:root {
    --navy: #2d5c5a;
    --blue: #5b8fd4;
    --cyan: #0891b2;
    --green: #047857;
    --gold: #b7791f;
    --red: #b91c1c;
    --ink: #14213d;
    --muted: #64748b;
    --line: #dbe3ef;
    --surface: #ffffff;
    --soft: #f4f7fb;
}

* {
    letter-spacing: 0;
}

body {
    font-family: "Tahoma", "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--soft);
}

.btn {
    border-radius: 8px;
    font-weight: 700;
}

.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--navy), var(--cyan));
    box-shadow: 0 10px 24px rgba(18, 49, 95, .2);
}

.navbar-brand strong,
.admin-brand strong {
    display: block;
    font-size: 1rem;
    line-height: 1.1;
    color: var(--ink);
}

.navbar-brand small,
.admin-brand small {
    display: block;
    color: var(--muted);
    font-size: .76rem;
}

.public-navbar {
    background: rgba(255, 255, 255, .95);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.public-navbar .nav-link {
    color: #334155;
    font-weight: 700;
    font-size: .92rem;
}

.public-navbar .nav-link.active,
.public-navbar .nav-link:hover {
    color: var(--blue);
}

.public-hero {
    padding: 88px 0 56px;
    background:
        linear-gradient(110deg, rgba(255,255,255,.97) 0%, rgba(255,255,255,.88) 52%, rgba(232,244,255,.76) 100%),
        url("https://images.unsplash.com/photo-1576091160550-2173dba999ef?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.hero-kicker,
.eyebrow,
.section-heading span {
    display: inline-block;
    color: var(--cyan);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.public-hero h1,
.login-info h1 {
    font-size: clamp(2.2rem, 5vw, 4.4rem);
    font-weight: 900;
    line-height: 1.08;
    max-width: 820px;
}

.public-hero p,
.login-info p {
    color: #475569;
    font-size: 1.12rem;
    line-height: 1.8;
    max-width: 720px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.hero-panel {
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 24px 70px rgba(18, 49, 95, .14);
}

.hero-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    color: var(--muted);
}

.hero-panel-header strong {
    color: var(--ink);
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.hero-metrics div {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.hero-metrics strong {
    display: block;
    font-size: 1.45rem;
    color: var(--blue);
}

.hero-metrics span {
    color: var(--muted);
    font-size: .82rem;
}

.health-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 22px;
}

.health-grid span {
    height: 76px;
    border-radius: 8px;
    background: linear-gradient(180deg, #dff7ee, #bfe7ff);
    border: 1px solid rgba(8, 145, 178, .2);
}

.health-grid span:nth-child(2n) {
    background: linear-gradient(180deg, #dbeafe, #e9d5ff);
}

.section-band {
    padding: 64px 0;
    background: #eef4fb;
}

.section-band.white {
    background: #fff;
}

.section-heading {
    margin-bottom: 28px;
}

.section-heading h2 {
    font-weight: 900;
}

.portal-card,
.news-card,
.panel,
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

.portal-card {
    padding: 24px;
}

.portal-card h3,
.news-card h3 {
    font-size: 1.15rem;
    font-weight: 850;
    margin-top: 16px;
}

.portal-card p,
.news-card p {
    color: var(--muted);
}

.card-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e0f2fe;
    color: var(--cyan);
}

.status-pill {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 8px;
    color: #065f46;
    background: #d1fae5;
    font-weight: 800;
    font-size: .78rem;
}

.news-card {
    padding: 22px;
}

.news-date {
    color: var(--blue);
    font-weight: 900;
}

.public-footer {
    padding: 36px 0;
    background: #0f284d;
    color: #dbeafe;
}

.public-footer h2 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 850;
}

.login-body {
    min-height: 100vh;
    background:
        linear-gradient(120deg, rgba(15,40,77,.95), rgba(29,78,216,.82)),
        url("https://images.unsplash.com/photo-1584515933487-779824d29309?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 48px;
    align-items: center;
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 24px;
}

.login-info {
    color: #fff;
}

.login-info .admin-brand strong,
.login-info .admin-brand small {
    color: #fff;
}

.login-info p {
    color: #dbeafe;
}

.login-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.login-badges span {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 700;
}

.login-card {
    padding: 34px;
}

.login-card-header {
    margin-bottom: 24px;
}

.login-card-header span {
    color: var(--cyan);
    font-weight: 900;
}

.login-card-header h2 {
    font-size: 1.9rem;
    font-weight: 900;
}

.input-group-text {
    background: #f8fafc;
    border-color: var(--line);
}

.form-control {
    border-color: var(--line);
}

.login-hint {
    margin-top: 20px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
}

.access-denied-body {
    min-height: 100vh;
    background: #edf2f7;
}

.access-denied-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.access-denied-card {
    width: min(100%, 560px);
    text-align: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 40px 32px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

.access-denied-icon {
    width: 68px;
    height: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    border-radius: 8px;
    background: #fee2e2;
    color: var(--red);
    font-size: 2rem;
}

.access-denied-card h1 {
    font-size: 1.8rem;
    font-weight: 900;
}

.access-denied-card p {
    color: var(--muted);
    line-height: 1.8;
}

.admin-body {
    background: linear-gradient(180deg, #f7fafc 0%, #eef6f4 42%, #f7fafc 100%);
    color: #334155;
    font-family: "Prompt", "Sarabun", "Noto Sans Thai", Tahoma, system-ui, sans-serif;
    line-height: 1.65;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 280px;
    flex: 0 0 280px;
    background: #102a52;
    color: #e0ecff;
    padding: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    color: inherit;
    margin-bottom: 28px;
}

.admin-sidebar .admin-brand strong {
    color: #fff;
}

.admin-sidebar .admin-brand small {
    color: #bfdbfe;
}

.admin-menu {
    display: grid;
    gap: 6px;
}

.admin-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #dbeafe;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 8px;
    font-weight: 750;
}

.admin-menu a.active,
.admin-menu a:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.admin-main {
    min-width: 0;
    flex: 1;
}

.admin-topbar {
    min-height: 84px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 28px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-topbar h1 {
    font-size: 1.3rem;
    margin: 0;
    font-weight: 900;
}

.icon-btn,
.user-chip {
    border: 1px solid var(--line);
    background: #fff;
}

.user-chip {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.admin-content {
    padding: 28px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 5px solid var(--blue);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 14px 34px rgba(15,23,42,.06);
}

.stat-card span,
.stat-card small {
    display: block;
    color: var(--muted);
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    font-weight: 950;
    margin: 4px 0;
}

.accent-green { border-left-color: var(--green); }
.accent-gold { border-left-color: var(--gold); }
.accent-red { border-left-color: var(--red); }

.panel {
    padding: 22px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 1.15rem;
    font-weight: 900;
    margin: 0;
}

.system-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.system-list li {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}

.system-list span {
    color: var(--muted);
}

.admin-toast {
    position: fixed;
    right: 24px;
    top: 96px;
    z-index: 1080;
}

.admin-table th {
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 44px 20px;
    color: var(--muted);
}

.empty-state i {
    display: block;
    color: var(--cyan);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.empty-state h2 {
    color: var(--ink);
    font-size: 1.2rem;
    font-weight: 900;
}

.admin-step {
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .05);
}

.admin-step .card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}

.admin-sticky {
    position: sticky;
    top: 104px;
}

.info-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 14px;
}

.info-box span {
    display: block;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.info-box strong {
    display: block;
    margin-top: 4px;
}

.project-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    border-left: 3px solid var(--blue);
    padding-left: 12px;
}

.timeline-item p {
    margin: 3px 0;
    color: var(--muted);
}

.timeline-item small {
    color: var(--muted);
}

.project-print-body {
    background: #e5e7eb;
    color: #111827;
    font-family: "TH Sarabun New", "Sarabun", "Noto Sans Thai", Tahoma, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
}

.print-toolbar {
    width: min(100%, 210mm);
    margin: 20px auto 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.project-print-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 28px;
    padding: 18mm 18mm 20mm;
    background: #fff;
    border: 1px solid #d1d5db;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .12);
}

.project-print-header {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 18px;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 2px solid #111827;
    margin-bottom: 16px;
    text-align: center;
}

.project-print-header img {
    width: 74px;
    height: 74px;
    object-fit: contain;
}

.project-print-header h1 {
    margin: 0 0 4px;
    font-size: 1.55rem;
    font-weight: 900;
}

.project-print-header p {
    margin: 0;
    font-weight: 700;
}

.print-section {
    break-inside: avoid;
    margin-bottom: 12px;
}

.print-section h2 {
    font-size: 1rem;
    font-weight: 900;
    margin: 0 0 4px;
}

.print-section p {
    margin: 0 0 6px;
    text-align: justify;
}

.print-budget-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: .94rem;
}

.print-budget-table th,
.print-budget-table td {
    border: 1px solid #111827;
    padding: 5px 7px;
    vertical-align: top;
}

.print-budget-table th {
    background: #f3f4f6;
    font-weight: 900;
}

.print-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-top: 34px;
    break-inside: avoid;
}

.print-signatures p {
    margin: 0 0 12px;
    text-align: center;
}

@page {
    size: A4;
    margin: 12mm;
}

@media print {
    body,
    .project-print-body {
        background: #fff !important;
    }

    .no-print,
    .print-toolbar,
    .admin-sidebar,
    .admin-topbar,
    .public-navbar,
    .hf-navbar,
    .hf-topbar,
    .hf-footer,
    .btn {
        display: none !important;
    }

    .project-print-page {
        width: auto;
        min-height: auto;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .print-budget-table th {
        background: #fff !important;
    }
}

@media (max-width: 991.98px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .public-hero {
        padding-top: 52px;
    }

    .hero-metrics,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 24px;
    }

    .admin-content,
    .admin-topbar {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* Phase 5 — pastel workflow & lock badges */
.hf-wf-badge,
.hf-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.hf-wf-draft { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.hf-wf-submitted { background: #e8f3ff; color: #2d6a87; border-color: #c7e0f7; }
.hf-wf-review { background: #fff7d6; color: #8a5a12; border-color: #fde68a; }
.hf-wf-revision { background: #ffedd5; color: #9a3412; border-color: #fdba74; }
.hf-wf-approved { background: #dff7e8; color: #2f6f4e; border-color: #b8e8c9; }
.hf-wf-rejected { background: #ffe8e8; color: #b45353; border-color: #fbc4c4; }
.hf-wf-completed { background: #e6f6ff; color: #2d6a87; border-color: #c7e8f5; }
.hf-wf-archived { background: #f3f0ff; color: #5c4d8a; border-color: #ddd6fe; }

.hf-lock-open { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.hf-lock-warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.hf-lock-closed { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.hf-lock-subclosed { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.hf-lock-frozen { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.hf-lock-pending { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }

.hf-workflow-panel {
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.hf-wf-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.hf-wf-timeline-horizontal {
    flex-direction: row;
    align-items: stretch;
    gap: 0.5rem;
}

.hf-wf-timeline-step {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    padding: 0.35rem 0.5rem;
    border-radius: 10px;
    background: #f8fafc;
}

.hf-wf-timeline-horizontal .hf-wf-timeline-step {
    flex: 1 1 120px;
    min-width: 100px;
}

@media (max-width: 767.98px) {
    .hf-wf-timeline-horizontal {
        flex-direction: column;
    }
    .hf-wf-timeline-horizontal .hf-wf-timeline-step {
        flex: 1 1 auto;
        min-width: 0;
    }
}

.hf-wf-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
}

.hf-wf-done .hf-wf-dot { background: #5aaf9c; }
.hf-wf-current {
    background: rgba(184, 227, 218, 0.45);
    color: #2d5c5a;
    box-shadow: inset 0 0 0 1px rgba(124, 198, 182, 0.5);
}
.hf-wf-current .hf-wf-dot { background: #5aaf9c; }
.hf-wf-pending .hf-wf-dot { background: #e2e8f0; }
.hf-wf-blocked .hf-wf-dot { background: #f97316; }

.hf-workflow-toolbar .btn {
    border-radius: 999px;
}

/* Phase 5.1 — admin pastel shell, buttons, tables, timeline */
:root {
    --hf-pastel-1: #7cc6b6;
    --hf-pastel-2: #9fd8cb;
    --hf-sky-1: #a7d8ff;
    --hf-surface: #fdfefe;
    --hf-accent-warm: #ffd6a5;
    --hf-chart-green: #7cc6b6;
    --hf-chart-sky: #9ec8f5;
    --hf-chart-warm: #ffd6a5;
    --hf-chart-mint: #9fd8cb;
    --hf-chart-soft-red: #fca5a5;
}

.admin-sidebar {
    background: linear-gradient(180deg, #1a3d4a 0%, #0f2a33 55%, #1e3340 100%);
    border-right: 1px solid rgba(124, 198, 182, 0.2);
}

.admin-menu a.active,
.admin-menu a:hover {
    background: linear-gradient(90deg, rgba(124, 198, 182, 0.28), rgba(167, 216, 255, 0.15));
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.admin-menu-group-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(191, 219, 254, 0.55);
    padding: 10px 12px 4px;
}

.hf-card-enterprise {
    border-radius: 18px !important;
    border: 1px solid rgba(15, 23, 42, 0.06) !important;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06) !important;
    background: var(--hf-surface) !important;
}

.stat-card.hf-card-metric {
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card.hf-card-metric:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.hf-btn {
    border-radius: 999px;
    font-weight: 700;
    padding: 0.55rem 1.1rem;
    min-height: 44px;
    border: 1px solid transparent;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.hf-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}

.hf-btn.btn-sm {
    min-height: 38px;
    padding: 0.38rem 0.85rem;
    font-size: 0.82rem;
}

.hf-btn-primary {
    background: linear-gradient(135deg, var(--hf-pastel-1), #4a9d8f);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.12);
}

.hf-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border-color: #e2e8f0;
}

.hf-btn-success {
    background: linear-gradient(135deg, #86efac, #4ade80);
    color: #14532d;
    border-color: rgba(20, 83, 45, 0.12);
}

.hf-btn-warning {
    background: linear-gradient(135deg, #fde68a, var(--hf-accent-warm));
    color: #78350f;
    border-color: rgba(120, 53, 15, 0.12);
}

.hf-btn-danger {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #7f1d1d;
    border-color: rgba(127, 29, 29, 0.12);
}

.hf-alert {
    border-radius: 14px;
    border-width: 1px;
    border-style: solid;
}

.hf-alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.hf-alert-success {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #14532d;
}

.hf-alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.hf-alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.hf-table-scroll {
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    max-height: min(70vh, 720px);
    overflow: auto;
}

.admin-content .table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table.hf-table-pastel thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #f8fafc, #eef6f4);
    color: #475569;
    font-weight: 800;
    box-shadow: 0 1px 0 var(--line);
}

.table.hf-table-pastel tbody tr:nth-child(even) {
    background: rgba(159, 216, 203, 0.12);
}

.admin-content .form-label {
    font-weight: 650;
    color: #475569;
    margin-bottom: 0.35rem;
}

.admin-content .panel .row.g-3,
.admin-content .panel .row.g-2 {
    --bs-gutter-y: 0.75rem;
}

.hf-wf-timeline-vertical {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.hf-wf-timeline-vertical .hf-wf-timeline-step {
    border-radius: 14px;
    padding: 0.55rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    animation: hfWfFade 0.4s ease both;
}

.hf-wf-timeline-vertical .hf-wf-timeline-step:nth-child(1) {
    animation-delay: 0.02s;
}

.hf-wf-timeline-vertical .hf-wf-timeline-step:nth-child(2) {
    animation-delay: 0.06s;
}

.hf-wf-timeline-vertical .hf-wf-timeline-step:nth-child(3) {
    animation-delay: 0.1s;
}

@keyframes hfWfFade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hf-wf-dot {
    width: 12px;
    height: 12px;
}

@media (min-width: 992px) {
    .hf-collapse-lg.collapse:not(.show),
    .hf-collapse-lg.collapsing {
        display: block !important;
        height: auto !important;
        visibility: visible !important;
        transition: none !important;
    }
}

/* ========== Phase 5.1.2 — Admin enterprise shell (layout, cards, tables, forms, modals) ========== */

.hf-admin-content {
    width: 100%;
    max-width: min(1380px, 100%);
    margin: 0 auto;
    padding: clamp(16px, 2.2vw, 32px) clamp(14px, 2vw, 28px) 40px;
}

.admin-topbar {
    background: linear-gradient(180deg, #fdfefe 0%, #f7fafc 100%);
    border-bottom: 1px solid rgba(124, 198, 182, 0.22);
    box-shadow: 0 8px 28px rgba(30, 51, 64, 0.05);
}

.admin-topbar .eyebrow {
    color: #64748b;
    font-weight: 750;
}

.icon-btn,
.user-chip {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fdfefe;
    box-shadow: 0 4px 14px rgba(30, 41, 59, 0.05);
}

.user-chip:hover,
.icon-btn:hover {
    border-color: rgba(124, 198, 182, 0.55);
    background: rgba(184, 227, 218, 0.18);
}

/* Default admin panels: layered card (hf-card-enterprise still wins when both set) */
.admin-content .panel:not(.hf-card-enterprise) {
    border-radius: 20px;
    background: var(--hf-surface, #fdfefe);
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.055);
    padding: clamp(18px, 2vw, 24px);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.admin-content .panel:not(.hf-card-enterprise):hover {
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.07);
}

.hf-card-enterprise {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.hf-card-enterprise:hover {
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.08) !important;
}

/* Reusable page header */
.hf-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1.2rem 1.35rem;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(184, 227, 218, 0.28), rgba(253, 254, 254, 0.95));
    border: 1px solid rgba(124, 198, 182, 0.32);
    box-shadow: 0 10px 28px rgba(30, 51, 64, 0.06);
}

.hf-page-header--flat {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding-left: 0;
    padding-right: 0;
}

.hf-page-header__crumb {
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.hf-page-header__title {
    font-size: clamp(1.2rem, 2.4vw, 1.55rem);
    font-weight: 900;
    margin: 0.2rem 0 0;
    color: #1e3340;
    line-height: 1.25;
}

.hf-page-header__sub {
    margin: 0.4rem 0 0;
    max-width: 52rem;
    color: #64748b;
    font-size: 0.95rem;
}

.hf-page-header__actions {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Table shell: rounded wrapper + scroll; pair with .hf-table-pastel inside */
.hf-table-shell {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #fdfefe;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(30, 41, 59, 0.05);
}

.hf-table-shell .table-responsive,
.hf-table-shell .hf-table-scroll {
    margin: 0;
}

.hf-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 16px;
    background: rgba(253, 254, 254, 0.92);
    border: 1px solid rgba(124, 198, 182, 0.22);
}

.hf-table-toolbar .form-label {
    font-size: 0.8rem;
}

/* DataTables 2 — pastel paging */
.admin-content .dt-container .dt-paging .dt-paging-button {
    border-radius: 999px !important;
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
    background: #fdfefe !important;
    color: #334155 !important;
    margin: 0 2px;
    min-width: 2.35rem;
}

.admin-content .dt-container .dt-paging .dt-paging-button.current,
.admin-content .dt-container .dt-paging .dt-paging-button:hover:not(.disabled) {
    background: linear-gradient(135deg, rgba(124, 198, 182, 0.45), rgba(167, 216, 255, 0.35)) !important;
    border-color: rgba(124, 198, 182, 0.55) !important;
    color: #1e3340 !important;
}

.admin-content .dt-container .dt-paging .dt-paging-button.disabled {
    opacity: 0.45;
}

.admin-content .dt-container .dt-length,
.admin-content .dt-container .dt-search {
    margin-bottom: 0.75rem;
}

.admin-content .dt-container .dt-search .dt-input {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    min-height: 42px;
}

/* Forms — enterprise controls */
.admin-content .form-control,
.admin-content .form-select,
.admin-content textarea.form-control {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.38);
    min-height: 46px;
    padding: 0.55rem 0.85rem;
    background: #fdfefe;
    font-size: 0.95rem;
}

.admin-content textarea.form-control {
    min-height: auto;
}

.admin-content .form-control:focus,
.admin-content .form-select:focus,
.admin-content textarea.form-control:focus {
    border-color: rgba(124, 198, 182, 0.85);
    box-shadow: 0 0 0 0.2rem rgba(124, 198, 182, 0.22);
}

.admin-content .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(124, 198, 182, 0.22);
}

.admin-content .form-control.is-invalid,
.admin-content .form-select.is-invalid {
    border-color: rgba(248, 113, 113, 0.65);
}

.admin-content .invalid-feedback {
    font-weight: 600;
    color: #b45353;
}

/* Large admin form sections (Bootstrap cards) */
.admin-content .project-form .admin-step.card {
    border-radius: 20px;
    border: 1px solid rgba(124, 198, 182, 0.28);
    box-shadow: 0 14px 36px rgba(30, 41, 59, 0.06);
    overflow: hidden;
    background: #fdfefe;
}

.admin-content .project-form .admin-step.card .card-header {
    background: linear-gradient(90deg, rgba(184, 227, 218, 0.35), rgba(253, 254, 254, 0.95));
    border-bottom: 1px solid rgba(124, 198, 182, 0.22);
    font-weight: 800;
    color: #1e3340;
}

.admin-content .project-form .admin-step.card .card-body {
    padding: 1.25rem 1.35rem;
}

.admin-content .project-form.pb-hf-sticky-actions {
    padding-bottom: 5.5rem;
}

.hf-project-section-header strong {
    display: block;
    font-size: 1.05rem;
}

.hf-project-section-sub {
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    margin-top: 0.25rem;
}

.hf-project-section-card .card-header {
    padding-bottom: 0.85rem;
}

.hf-project-nested-card {
    background: rgba(253, 254, 254, 0.92);
}

.hf-budget-detail-row {
    background: rgba(253, 254, 254, 0.65);
    border-color: rgba(124, 198, 182, 0.35) !important;
}

.hf-project-quick-nav a {
    text-decoration: none;
    font-weight: 600;
    color: #2d6a87;
}

.hf-project-quick-nav a:hover {
    text-decoration: underline;
}

.hf-project-sticky-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0));
    background: linear-gradient(180deg, rgba(253, 254, 254, 0), rgba(241, 249, 246, 0.97) 28%, rgba(241, 249, 246, 0.99));
    border-top: 1px solid rgba(124, 198, 182, 0.35);
    box-shadow: 0 -10px 28px rgba(30, 41, 59, 0.08);
}

.hf-project-sticky-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 0.75rem !important;
}

@media (min-width: 992px) {
    .admin-content .project-form.pb-hf-sticky-actions {
        padding-bottom: 4.5rem;
    }

    .hf-project-sticky-actions {
        left: var(--hf-admin-sidebar-width, 260px);
    }
}

/* Dashboard metrics */
.stat-card.hf-card-metric.hf-metric-tile {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    border-left-width: 0;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.hf-metric-icon {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.hf-metric-icon--sky {
    background: rgba(167, 216, 255, 0.35);
    color: #2d6a87;
}

.hf-metric-icon--mint {
    background: rgba(184, 227, 218, 0.45);
    color: #2d5c5a;
}

.hf-metric-icon--warm {
    background: rgba(255, 214, 165, 0.45);
    color: #92400e;
}

.hf-metric-icon--rose {
    background: rgba(254, 202, 202, 0.45);
    color: #9f1239;
}

.hf-metric-copy {
    min-width: 0;
    flex: 1;
}

.hf-metric-copy span,
.hf-metric-copy small {
    display: block;
}

.hf-metric-copy strong {
    font-size: clamp(1.45rem, 3vw, 2rem);
}

/* Quick actions */
.hf-quick-actions {
    padding: 1rem 1.15rem;
}

.hf-quick-actions__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.hf-qa-tile {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    font-weight: 750;
    text-decoration: none;
    color: #1e3340;
    border: 1px solid rgba(124, 198, 182, 0.35);
    background: rgba(253, 254, 254, 0.95);
    box-shadow: 0 6px 16px rgba(30, 41, 59, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.hf-qa-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(30, 41, 59, 0.08);
    background: rgba(184, 227, 218, 0.22);
    color: #134e4a;
}

/* Workflow panel emphasis */
.hf-workflow-panel-card {
    position: relative;
}

.hf-workflow-panel-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(124, 198, 182, 0.2);
}

.hf-wf-timeline-horizontal .hf-wf-timeline-step.hf-wf-current {
    animation: hfWfStepGlow 2.4s ease-in-out infinite;
}

@keyframes hfWfStepGlow {
    0%,
    100% {
        box-shadow: inset 0 0 0 1px rgba(124, 198, 182, 0.45), 0 0 0 0 rgba(124, 198, 182, 0);
    }
    50% {
        box-shadow: inset 0 0 0 1px rgba(124, 198, 182, 0.65), 0 0 22px rgba(124, 198, 182, 0.28);
    }
}

/* Review comments — speech-style */
.hf-comment-bubble {
    position: relative;
    border-radius: 16px 16px 16px 6px;
    padding: 0.85rem 1rem;
    background: linear-gradient(180deg, #fdfefe, #f1fbfb);
    border: 1px solid rgba(124, 198, 182, 0.28);
    box-shadow: 0 8px 20px rgba(30, 41, 59, 0.05);
}

.hf-comment-bubble::before {
    content: "";
    position: absolute;
    left: 10px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: #f1fbfb;
    border-left: 1px solid rgba(124, 198, 182, 0.28);
    border-bottom: 1px solid rgba(124, 198, 182, 0.28);
    transform: rotate(45deg);
}

/* Timeline & info boxes */
.admin-content .timeline-item {
    border-left: 3px solid rgba(124, 198, 182, 0.85);
    padding-left: 14px;
}

.admin-content .info-box {
    border-radius: 14px;
    border: 1px solid rgba(124, 198, 182, 0.2);
    background: rgba(253, 254, 254, 0.95);
}

/* Empty states */
.empty-state {
    border-radius: 20px;
    border: 1px dashed rgba(124, 198, 182, 0.45);
    background: rgba(253, 254, 254, 0.75);
}

.empty-state i {
    color: #5aaf9c;
}

/* Toasts — calmer success */
.admin-toast.toast.text-bg-success {
    background: linear-gradient(135deg, #5aaf9c, #3d8f7f) !important;
    border: 0;
    box-shadow: 0 14px 36px rgba(30, 100, 90, 0.25);
}

/* Modals */
.admin-body .modal-content {
    border-radius: 20px;
    border: 1px solid rgba(124, 198, 182, 0.25);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    background: #fdfefe;
}

.admin-body .modal-header {
    border-bottom: 1px solid rgba(124, 198, 182, 0.22);
    background: linear-gradient(90deg, rgba(184, 227, 218, 0.3), rgba(253, 254, 254, 0.98));
}

.admin-body .modal-footer {
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.admin-content .alert {
    border-radius: 14px;
    border-width: 1px;
}

.admin-content .alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.admin-content .list-group-item {
    border-color: rgba(148, 163, 184, 0.22);
}

.admin-content .list-group-item:hover {
    background: rgba(184, 227, 218, 0.12);
}

@media (max-width: 575.98px) {
    .admin-body .modal-dialog:not(.modal-fullscreen) {
        margin: 0.5rem;
    }

    .admin-body .modal-dialog.modal-fullscreen-sm-down .modal-content {
        border-radius: 0;
    }
}

.dashboard-grid {
    gap: clamp(12px, 2vw, 18px);
}

@media (max-width: 991.98px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Phase 5.4.1 — admin exercise QR block */
.hf-admin-qr-card .hf-admin-qr-frame {
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

.hf-admin-qr-card .hf-admin-qr-frame img {
    max-height: 280px;
}
