/* assets/css/public_dashboard.css */
/* Public Landing Dashboard — EOC Assessment System */
/* Extends global.css tokens — do not redefine :root variables here */

/* ─── Page Layout: Full-width dashboard hero ─────────────────────────────── */
.landing-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    align-items: stretch;
    gap: 0;
    position: relative;
}

/* Dashboard panel spans full width */
.dashboard-panel { grid-area: unset; }


/* ─── Dashboard Panel (left) ─────────────────────────────────────────────── */
.dashboard-panel {
    padding: 28px 24px 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100vh;
    overflow-y: auto;
    position: relative;
    z-index: 2;
}

@media (max-width: 1100px) {
    .dashboard-panel {
        padding: 20px 16px 16px 16px;
        min-height: auto;
    }
}

/* ─── Off-canvas Login Drawer ────────────────────────────────────────────── */

/* Floating login button (FAB) */
.login-fab {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #0A1931;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'Sarabun', 'Inter', sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(10,25,49,0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    letter-spacing: 0.01em;
}
.login-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(10,25,49,0.45);
    background: #152d57;
}
.login-fab:active {
    transform: translateY(0);
}

/* Backdrop */
.login-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(10, 25, 49, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    cursor: pointer;
}

/* Drawer panel */
.login-drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(440px, 100vw);
    height: 100dvh;
    z-index: 400;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: -8px 0 48px rgba(10,25,49,0.22);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Drawer header bar */
.login-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(10,25,49,0.07);
    background: rgba(255,255,255,0.8);
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Close button */
.login-drawer-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10,25,49,0.06);
    border: none;
    border-radius: 10px;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.login-drawer-close:hover {
    background: rgba(10,25,49,0.12);
    color: #0A1931;
}

/* Drawer body / inner card area */
.login-drawer-body {
    flex: 1;
    padding: 28px 28px 40px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

@media (max-width: 480px) {
    .login-drawer-body { padding: 20px 18px 32px; }
    .login-fab span { display: none; }
    .login-fab { padding: 10px 14px; border-radius: 50%; }
}


/* ─── Dashboard Header ───────────────────────────────────────────────────── */
.dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.dash-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.dash-subtitle {
    font-size: 0.72rem;
    color: #475569;
    margin-top: 2px;
    font-weight: 500;
}

.fy-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(10, 25, 49, 0.06);
    border: 1px solid rgba(10, 25, 49, 0.12);
    font-size: 0.68rem;
    font-weight: 700;
    color: #0A1931;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── Stat Cards Row ─────────────────────────────────────────────────────── */
.stat-cards-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

@media (max-width: 600px) {
    .stat-cards-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transform: translate3d(0, 0, 0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.stat-card-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-card-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.stat-card-count {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.stat-card-pct {
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
}

/* Color accent borders */
.stat-card.red-card   { border-top: 3px solid #E04848; }
.stat-card.orange-card { border-top: 3px solid #EB8C28; }
.stat-card.yellow-card { border-top: 3px solid #F0D02C; }
.stat-card.green-card  { border-top: 3px solid #34B06D; }

/* ─── Filter Row ─────────────────────────────────────────────────────────── */
.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dash-select {
    flex: 1;
    min-width: 180px;
    max-width: 400px;
    height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(10, 25, 49, 0.14);
    background: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
    font-family: var(--font-sans);
    color: #0f172a;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.dash-select:focus {
    outline: none;
    border-color: #0A1931;
    box-shadow: 0 0 0 3px rgba(10, 25, 49, 0.08);
}

/* ─── Stage Indicator Pill ───────────────────────────────────────────────── */
.stage-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.stage-pill.stage-draft       { background: rgba(148,163,184,0.15); color: #64748b; border: 1px solid rgba(148,163,184,0.3); }
.stage-pill.stage-submitted   { background: rgba(59,130,246,0.1);  color: #2563eb; border: 1px solid rgba(59,130,246,0.25); }
.stage-pill.stage-evaluating  { background: rgba(245,158,11,0.1);  color: #b45309; border: 1px solid rgba(245,158,11,0.25); }
.stage-pill.stage-evaluated   { background: rgba(52,176,109,0.1);  color: #15803d; border: 1px solid rgba(52,176,109,0.25); }
.stage-pill.stage-contested   { background: rgba(239,68,68,0.1);   color: #dc2626; border: 1px solid rgba(239,68,68,0.25); }
.stage-pill.stage-re_evaluated { background: rgba(124,77,204,0.1); color: #6d28d9; border: 1px solid rgba(124,77,204,0.25); }
.stage-pill.stage-final       { background: rgba(52,176,109,0.18); color: #15803d; border: 1px solid rgba(52,176,109,0.4); font-weight: 700; }

/* ─── Category Section ───────────────────────────────────────────────────── */
.category-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-row {
    background: rgba(255,255,255,0.6);
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    min-height: 48px;
}

.category-row:hover {
    background: rgba(255,255,255,0.85);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* Flags categories with a low national pass rate so they're scannable at a
   glance without reading all 10 rows. Categories keep their fixed official
   numbering — nothing is reordered, only flagged. Left-border accent mirrors
   the .toast-alert-* convention in global.css. */
.category-row--attention {
    border-left: 3px solid #E04848;
    padding-left: 10px;
    background: rgba(224, 72, 72, 0.045);
}
.category-row--attention:hover {
    background: rgba(224, 72, 72, 0.08);
}

.cat-pass-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    margin-left: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.cat-pass-label--low {
    color: #B91C1C;
    font-weight: 700;
}
.cat-pass-label--low i {
    stroke-width: 2.5px;
}

.category-name {
    font-size: 0.68rem;
    font-weight: 700;
    color: #334155;
    min-width: 96px;
    max-width: 136px;
    line-height: 1.3;
    flex-shrink: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

.category-cells {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    flex: 1;
    align-items: center;
}

.cat-stage-col {
    flex-shrink: 0;
    margin-left: auto;
}

/* ─── Matrix Cells (public dashboard variant — smaller) ──────────────────── */
.pub-matrix-cell {
    width: 36px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 9.5px;
    font-weight: 700;
    cursor: default;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    position: relative;
}

.pub-matrix-cell:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(0,0,0,0.14);
    z-index: 5;
}

.pub-matrix-cell.empty {
    background: rgba(15,23,42,0.03);
    border: 1px dashed rgba(15,23,42,0.12);
    color: rgba(15,23,42,0.2);
    cursor: default;
}

.pub-matrix-cell.empty:hover {
    transform: none;
    box-shadow: none;
}

/* National aggregate bar within category */
.cat-bar-wrap {
    display: flex;
    gap: 2px;
    height: 14px;
    border-radius: 8px;
    overflow: hidden;
    flex: 1;
    min-width: 80px;
}

.cat-bar-seg {
    border-radius: 0;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Chart Section ──────────────────────────────────────────────────────── */
.chart-donut-wrap {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.donut-container {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

#pub-donut-chart {
    width: 120px !important;
    height: 120px !important;
}

.donut-center-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.donut-count {
    font-size: 1.3rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    letter-spacing: -0.03em;
}

.donut-sub {
    font-size: 0.62rem;
    font-weight: 600;
    color: #475569;
    text-align: center;
    line-height: 1.2;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
    flex: 1;
}

.legend-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0f172a;
    min-width: 32px;
    text-align: right;
}

/* ─── Progress bar ───────────────────────────────────────────────────────── */
.progress-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: #475569;
}

.progress-pct {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0A1931;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(15,23,42,0.06);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #34B06D 0%, #00F2FE 100%);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* ─── Respondent info header (single respondent view) ────────────────────── */
.resp-info-bar {
    background: rgba(10,25,49,0.04);
    border: 1px solid rgba(10,25,49,0.10);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.resp-info-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0f172a;
}

.resp-info-type {
    font-size: 0.68rem;
    color: #64748b;
    font-weight: 500;
}

/* ─── Skeleton Loading ───────────────────────────────────────────────────── */
.dash-skeleton {
    background: linear-gradient(90deg,
        rgba(0,0,0,0.04) 25%,
        rgba(0,0,0,0.09) 37%,
        rgba(0,0,0,0.04) 63%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 10px;
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ─── Dashboard panel scroll ─────────────────────────────────────────────── */
.dashboard-panel::-webkit-scrollbar { width: 5px; }
.dashboard-panel::-webkit-scrollbar-track { background: transparent; }
.dashboard-panel::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 3px; }

/* ─── Entrance animation helpers ────────────────────────────────────────── */
/* NOTE: .dash-animate-in is a selector hook only — GSAP controls opacity/transform inline.
   Do NOT set opacity:0 here or clearProps will restore it after animation ends. */
.dash-animate-in {
    /* intentionally empty — GSAP owns the initial state */
}

/* ─── National vs Respondent toggle badge ────────────────────────────────── */
.view-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.25);
    color: #0369a1;
}

/* ─── "Live" status dot ──────────────────────────────────────────────────── */
.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34B06D;
    animation: live-pulse 2s ease-in-out infinite;
    display: inline-block;
    flex-shrink: 0;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.85); }
}

/* ─── Tooltip ─────────────────────────────────────────────────────────────── */
.pub-matrix-cell[title] { cursor: help; }

/* ─── Stage Guide (collapsible info card) ─────────────────────────────────── */
.stage-guide {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(10, 25, 49, 0.08);
    border-radius: 16px;
    overflow: hidden;
    transition: box-shadow 0.25s ease;
}

.stage-guide[open] {
    box-shadow: 0 4px 20px rgba(10, 25, 49, 0.06);
}

.stage-guide-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    color: #334155;
    user-select: none;
    list-style: none; /* hide default marker */
    transition: background 0.2s ease;
}

.stage-guide-toggle::-webkit-details-marker { display: none; }
.stage-guide-toggle::marker { display: none; content: ''; }

.stage-guide-toggle:hover {
    background: rgba(10, 25, 49, 0.03);
}

/* Chevron rotation when open */
.stage-guide[open] .stage-guide-chevron {
    transform: rotate(180deg);
}

.stage-guide-body {
    padding: 0 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: stage-guide-reveal 0.3s ease;
}

@keyframes stage-guide-reveal {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stage-guide-intro {
    font-size: 0.68rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(10, 25, 49, 0.06);
}

.stage-guide-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stage-guide-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(10, 25, 49, 0.02);
    border: 1px solid rgba(10, 25, 49, 0.04);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.stage-guide-item:hover {
    background: rgba(10, 25, 49, 0.04);
    border-color: rgba(10, 25, 49, 0.08);
}

.stage-guide-item .stage-pill {
    flex-shrink: 0;
    margin-top: 1px;
    white-space: nowrap;
}

.stage-guide-desc {
    font-size: 0.65rem;
    color: #475569;
    line-height: 1.55;
    margin: 0;
}

/* ─── Stage Guide: Visual flow diagram ────────────────────────────────────── */
.stage-flow-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: rgba(10, 25, 49, 0.025);
    border-radius: 10px;
    border: 1px dashed rgba(10, 25, 49, 0.1);
}

.stage-flow-step {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 600;
    background: rgba(10, 25, 49, 0.06);
    color: #334155;
    white-space: nowrap;
}

.stage-flow-final {
    background: rgba(52, 176, 109, 0.12);
    color: #166534;
    border: 1px solid rgba(52, 176, 109, 0.25);
}

/* ─── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .dash-skeleton {
        animation: none;
        background: rgba(0, 0, 0, 0.06);
    }
    .live-dot { animation: none; }
    .stat-card,
    .pub-matrix-cell,
    .stage-guide,
    .stage-guide-item,
    .dash-select,
    .progress-bar-fill {
        transition: none;
    }
    .stat-card:hover { transform: none; }
    .pub-matrix-cell:hover { transform: none; }
    .stage-guide-body { animation: none; }
    /* GSAP entrance/stagger calls in public_dashboard.js check this same
       media query before animating — see initPublicDashboard(). */
}

/* ─── Decision Tree Diagram ─────────────────────────────────────────────── */
.decision-tree-wrap {
    margin-top: 12px;
    background: rgba(10,25,49,0.03);
    border: 1px solid rgba(10,25,49,0.07);
    border-radius: 14px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.decision-tree-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #0A1931;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.6;
    margin-bottom: 2px;
}
.dt-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.dt-row-main { justify-content: center; }
.dt-row-branches {
    justify-content: center;
    gap: 12px;
    align-items: flex-start;
}
.dt-node {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 600;
    font-family: 'Sarabun', 'Inter', sans-serif;
    border: 1.5px solid transparent;
    min-width: 54px;
    text-align: center;
    flex-direction: column;
    white-space: nowrap;
}
.dt-node small {
    font-size: 0.5rem;
    opacity: 0.6;
    font-weight: 400;
    font-family: 'Inter', monospace;
    letter-spacing: 0.01em;
}
.dt-node-num {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(10,25,49,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 800;
    color: #0A1931;
}
.dt-node-draft     { background:#f1f5f9; border-color:#cbd5e1; color:#475569; }
.dt-node-submitted { background:#eff6ff; border-color:#93c5fd; color:#1d4ed8; }
.dt-node-evaluating{ background:#fef9c3; border-color:#fde047; color:#a16207; }
.dt-node-evaluated { background:#fff7ed; border-color:#fdba74; color:#c2410c; }
.dt-node-final     { background:#f0fdf4; border-color:#86efac; color:#15803d; }
.dt-node-contested { background:#fef2f2; border-color:#fca5a5; color:#b91c1c; }
.dt-node-reeval    { background:#f5f3ff; border-color:#c4b5fd; color:#6d28d9; }
.dt-arrow {
    font-size: 1rem;
    color: #94a3b8;
    flex-shrink: 0;
    line-height: 1;
}
.dt-arrow-down {
    align-self: center;
    font-size: 1rem;
}
.dt-decision-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #0A1931;
    opacity: 0.55;
    padding: 4px 0;
    letter-spacing: 0.02em;
    position: relative;
}
.dt-decision-label::before,
.dt-decision-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(10,25,49,0.12);
}
.dt-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.dt-branch-divider {
    font-size: 0.55rem;
    font-weight: 800;
    color: #94a3b8;
    align-self: flex-start;
    margin-top: 18px;
    padding: 2px 4px;
    background: rgba(10,25,49,0.05);
    border-radius: 4px;
}
.dt-branch-end-tag {
    font-size: 0.55rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.01em;
}
.dt-tag-green {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #86efac;
}
.dt-tag-lock {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #c4b5fd;
}

/* ─── Mobile tweaks ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .dash-title { font-size: 0.95rem; }
    .stat-card-count { font-size: 1.3rem; }
    .category-name { min-width: 64px; max-width: 72px; font-size: 0.62rem; }
    .pub-matrix-cell { width: 28px; height: 24px; font-size: 8px; }
    .chart-donut-wrap { flex-direction: column; align-items: flex-start; }

    .stage-guide-item {
        flex-direction: column;
        gap: 4px;
    }
    .dt-row-main { flex-wrap: nowrap; overflow-x: auto; }
    .dt-node { min-width: 44px; padding: 4px 6px; }
    .dt-row-branches { gap: 6px; }
}

/* ─── Vertical Decision Tree (vdt-*) ────────────────────────────────────── */
.vdt-wrap {
    margin-top: 14px;
    background: #fafbfc;
    border: 1px solid rgba(10,25,49,0.08);
    border-radius: 18px;
    padding: 18px 14px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.vdt-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #0A1931;
    letter-spacing: 0.01em;
    margin-bottom: 14px;
    font-family: 'Sarabun','Inter',sans-serif;
    text-align: center;
}

/* Step cards */
.vdt-step {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 14px;
    padding: 10px 14px;
    width: 100%;
    max-width: 260px;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(10,25,49,0.07);
    font-family: 'Sarabun','Inter',sans-serif;
}
.vdt-step-sm {
    max-width: 200px;
    padding: 8px 12px;
}

/* Step number badge (circle top-center) */
.vdt-badge {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 800;
    color: #fff;
    background: rgba(10,25,49,0.35);
    border: 1.5px solid #fff;
    z-index: 2;
}
.vdt-step-big-num {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    opacity: 0.18;
    flex-shrink: 0;
    font-family: 'Inter',sans-serif;
}
.vdt-step-body {
    flex: 1;
}
.vdt-step-name {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
}
.vdt-step-code {
    font-size: 0.55rem;
    font-weight: 400;
    opacity: 0.55;
    font-family: 'Inter',monospace;
    margin-top: 1px;
}
.vdt-step-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}
.vdt-step-icon-sm {
    font-size: 1rem;
    flex-shrink: 0;
}

/* Step color themes */
.vdt-step-draft     { background:#f1f5f9; border-color:#cbd5e1; color:#475569; }
.vdt-step-draft .vdt-step-big-num { color: #475569; }
.vdt-step-submitted { background:#dbeafe; border-color:#93c5fd; color:#1e3a8a; }
.vdt-step-submitted .vdt-step-big-num { color: #1e3a8a; }
.vdt-step-evaluating{ background:#fef9c3; border-color:#fde047; color:#713f12; }
.vdt-step-evaluating .vdt-step-big-num { color: #713f12; }
.vdt-step-evaluated { background:#fed7aa; border-color:#fb923c; color:#7c2d12; }
.vdt-step-evaluated .vdt-step-big-num { color: #7c2d12; }
.vdt-step-final     { background:#bbf7d0; border-color:#4ade80; color:#14532d; }
.vdt-step-final .vdt-step-big-num { color: #14532d; }
.vdt-step-contested { background:#fecaca; border-color:#f87171; color:#7f1d1d; }
.vdt-step-contested .vdt-step-big-num { color: #7f1d1d; }
.vdt-step-reeval    { background:#e9d5ff; border-color:#c084fc; color:#581c87; }
.vdt-step-reeval .vdt-step-big-num { color: #581c87; }

/* Connectors */
.vdt-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    width: 100%;
}
.vdt-arrow-down {
    font-size: 1rem;
    color: #94a3b8;
    line-height: 1;
}

/* Fork / decision label */
.vdt-fork-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #0A1931;
    text-align: center;
    margin: 10px 0 4px;
    padding: 5px 12px;
    background: rgba(10,25,49,0.05);
    border-radius: 20px;
    font-family: 'Sarabun','Inter',sans-serif;
    border: 1px dashed rgba(10,25,49,0.15);
}

/* Branches container */
.vdt-branches {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    margin-top: 4px;
}
.vdt-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    flex: 1;
    max-width: 180px;
}

/* Branch connector line (colored top border indicator) */
.vdt-branch-line {
    width: 3px;
    height: 16px;
    border-radius: 4px;
    margin-bottom: 4px;
}
.vdt-branch-line-green { background: #4ade80; }
.vdt-branch-line-red   { background: #f87171; }

/* End tags */
.vdt-end-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 12px;
    font-size: 0.62rem;
    font-weight: 700;
    font-family: 'Sarabun','Inter',sans-serif;
    width: 100%;
    max-width: 200px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.vdt-end-tag > span { font-size: 1rem; flex-shrink: 0; }
.vdt-end-label { font-size: 0.65rem; font-weight: 700; }
.vdt-end-code  { font-size: 0.5rem; opacity: 0.6; font-family: monospace; margin-top: 1px; }
.vdt-end-green  { background: #dcfce7; border: 1.5px solid #86efac; color: #14532d; }
.vdt-end-purple { background: #f3e8ff; border: 1.5px solid #c084fc; color: #581c87; }

@media (max-width: 600px) {
    .vdt-wrap { padding: 14px 10px 16px; }
    .vdt-step { max-width: 100%; padding: 8px 12px; }
    .vdt-step-sm { max-width: 100%; padding: 6px 8px; gap: 6px; }
    .vdt-step-big-num { font-size: 1.3rem; }
    .vdt-step-name { font-size: 0.68rem; }
    .vdt-step-code { font-size: 0.5rem; }
    .vdt-step-icon { font-size: 1.1rem; }
    .vdt-step-icon-sm { font-size: 0.85rem; }
    .vdt-branches { gap: 6px; }
    .vdt-branch { max-width: 145px; }
    .vdt-end-tag { padding: 5px 6px; gap: 4px; border-radius: 10px; }
    .vdt-end-tag > span { font-size: 0.85rem; }
    .vdt-end-label { font-size: 0.58rem; }
    .vdt-end-code { font-size: 0.45rem; }
}
