/* PADMIN styles - extracted from PADMIN-index.html (Phase 1 refactor). Source order preserved. */

/* ===== Block A: design tokens, layout, base components ===== */
        :root {
            /* ============================================================
               Microsoft Fluent design tokens · v1
               Calm warm neutrals, tight radii, subtle elevation, dense type.
               PTS brand red kept as the accent (Fluent allows brand accent).
               ============================================================ */

            /* Type stacks — Fluent system fonts with graceful fallbacks */
            --font-sans: 'Segoe UI Variable Display', 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
            --font-display: var(--font-sans);
            --font-brand: 'Fraunces', Georgia, 'Times New Roman', serif;

            /* Surfaces — Fluent Mica-style warm neutrals */
            --bg: #F3F2F1;            /* Page background — Fluent neutralLighterAlt */
            --bg-card: #FFFFFF;
            --bg-subtle: #FAF9F8;     /* Fluent neutralLighter */
            --bg-alt: #F8F8F8;
            --surface: #FAF9F8;
            --border: #E1DFDD;        /* Fluent neutralLight */
            --border-strong: #C8C6C4; /* Fluent neutralQuaternary */

            /* Text — Fluent neutral foreground ramp */
            --text: #201F1E;
            --text-secondary: #484644;
            --text-muted: #605E5C;

            /* PTS Brand — used as accent (Fluent style) */
            --brand: #ED2347;
            --brand-dark: #C81A38;
            --brand-light: #FDEBEF;
            --accent: var(--brand);
            --accent-dark: var(--brand-dark);
            --accent-light: var(--brand-light);

            /* Semantic — Fluent palette */
            --success: #107C10;
            --success-light: #DFF6DD;
            --warning: #986F0B;
            --warning-light: #FFF4CE;
            --info: #0078D4;
            --info-light: #DEECF9;
            --danger: #A4262C;
            --danger-light: #FDE7E9;

            /* Legacy semantic aliases */
            --green: var(--success); --green-light: var(--success-light);
            --amber: var(--warning); --amber-light: var(--warning-light);
            --orange: var(--info);   --orange-light: var(--info-light);
            --red: var(--danger);    --red-light: var(--danger-light);

            /* Spacing scale (4-pt) */
            --space-1: 0.25rem;
            --space-2: 0.5rem;
            --space-3: 0.75rem;
            --space-4: 1rem;
            --space-5: 1.5rem;
            --space-6: 2rem;
            --space-7: 3rem;

            /* Type weights */
            --fw-regular: 400;
            --fw-medium: 500;
            --fw-semibold: 600;
            --fw-bold: 700;

            /* Radius — Fluent: 2 (subtle) / 4 (default) / 8 (cards) */
            --radius-sm: 2px;
            --radius: 4px;
            --radius-lg: 8px;
            --radius-pill: 999px;

            /* Elevation — Fluent depth tokens (subtle, layered) */
            --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
            --shadow:    0 1.6px 3.6px rgba(0, 0, 0, 0.08), 0 0.3px 0.9px rgba(0, 0, 0, 0.06);
            --shadow-lg: 0 6.4px 14.4px rgba(0, 0, 0, 0.10), 0 1.2px 3.6px rgba(0, 0, 0, 0.05);

            /* Tap target — kept at 44 to preserve existing button heights */
            --tap: 44px;
        }

        /* Fluent System Icons helper — sizes to em, inherits text colour.
           Use as: <svg class="fui-icon"><use href="#fui-name"/></svg>
           Variants: .fui-icon-sm (0.875em), .fui-icon-lg (1.25em). */
        .fui-icon {
            width: 1em;
            height: 1em;
            flex-shrink: 0;
            vertical-align: -0.15em;
            color: currentColor;
            fill: currentColor;
        }
        .fui-icon-sm { width: 0.875em; height: 0.875em; }
        .fui-icon-lg { width: 1.25em; height: 1.25em; }
        .fui-icon-xl { width: 1.5em; height: 1.5em; }

        /* Honor reduced motion */
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                transition-duration: 0.01ms !important;
                scroll-behavior: auto !important;
            }
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: var(--font-sans);
            background: var(--bg);
            color: var(--text);
            line-height: 1.5;
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* Layout */
        .app {
            display: grid;
            grid-template-columns: 240px 1fr;
            min-height: 100vh;
        }

        /* Sidebar */
        .sidebar {
            background: var(--bg-card);
            border-right: 1px solid var(--border);
            padding: 1.5rem 0;
            position: sticky;
            top: 0;
            height: 100vh;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }

        .nav { flex: 1; }

        .nav-footer {
            padding: 0.5rem 0.75rem 0.25rem;
            border-top: 1px solid var(--border);
            margin-top: 0.5rem;
        }

        .logo {
            padding: 0.5rem 1.25rem 1.25rem;
            border-bottom: 1px solid var(--border);
            margin-bottom: 1rem;
            text-align: center;
        }

        .logo h1 {
            font-family: var(--font-brand);
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--accent);
            letter-spacing: -0.02em;
        }

        .logo span {
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 400;
            display: block;
            margin-top: 0.15rem;
        }

        .global-search-wrap {
            position: relative;
            padding: 0 0.75rem;
            margin-bottom: 0.5rem;
        }
        .global-search {
            width: 100%;
            padding: 0.5rem 2rem 0.5rem 0.75rem;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            font-size: 0.85rem;
            background: var(--bg);
            color: var(--text);
            box-sizing: border-box;
        }
        .global-search:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 2px var(--accent-light);
        }
        .global-search-clear {
            position: absolute;
            right: 1rem;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            font-size: 1.2rem;
            color: var(--text-muted);
            cursor: pointer;
            padding: 0 0.25rem;
            line-height: 1;
        }
        .global-search-clear:hover {
            color: var(--text);
        }
        .global-search-results {
            position: absolute;
            left: 0;
            right: 0;
            top: 100%;
            margin-top: 0.25rem;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            max-height: 400px;
            overflow-y: auto;
            z-index: 1000;
        }
        .global-search-results:empty {
            display: none !important;
        }
        .search-result-section {
            padding: 0.5rem 0.75rem;
            font-size: 0.7rem;
            font-weight: 600;
            text-transform: uppercase;
            color: var(--text-muted);
            background: var(--bg-subtle);
            border-bottom: 1px solid var(--border);
        }
        .search-result-item {
            padding: 0.6rem 0.75rem;
            cursor: pointer;
            border-bottom: 1px solid var(--border);
            transition: background 0.15s;
        }
        .search-result-item:hover {
            background: var(--bg-subtle);
        }
        .search-result-item:last-child {
            border-bottom: none;
        }
        .search-result-name {
            font-weight: 500;
            font-size: 0.9rem;
        }
        .search-result-meta {
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-top: 0.15rem;
        }

        .nav { padding: 0.5rem 0.75rem; }

        .nav-item {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.625rem 0.75rem;
            border-radius: var(--radius);
            color: var(--text-secondary);
            text-decoration: none;
            font-size: 0.9rem;
            font-weight: var(--fw-medium);
            cursor: pointer;
            transition: background 0.15s, color 0.15s;
            margin-bottom: 0.25rem;
            /* Button-element resets so <button class="nav-item"> looks like the original div */
            width: 100%;
            background: transparent;
            border: none;
            text-align: left;
            font-family: inherit;
            position: relative;
        }

        .nav-item:hover {
            background: var(--bg-subtle);
            color: var(--text);
        }

        .nav-item:focus-visible {
            outline: 2px solid var(--brand);
            outline-offset: -2px;
        }

        /* Fluent active-nav pattern: subtle tinted background + leading
           accent bar on the left edge (mirrors Outlook/Teams sidebar). */
        .nav-item.active {
            background: var(--brand-light);
            color: var(--brand);
            font-weight: var(--fw-semibold);
        }
        .nav-item.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 6px;
            bottom: 6px;
            width: 3px;
            border-radius: 0 2px 2px 0;
            background: var(--brand);
        }

        .nav-item svg {
            width: 18px;
            height: 18px;
            opacity: 0.7;
            flex-shrink: 0;
        }

        .nav-section {
            font-size: 0.7rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-muted);
            padding: 1rem 0.75rem 0.4rem;
            cursor: pointer;
            user-select: none;
            display: flex;
            align-items: center;
            justify-content: space-between;
            transition: color 0.12s;
        }
        .nav-section:hover { color: var(--text); }
        .nav-section:first-child { padding-top: 0.25rem; }
        .nav-section::after {
            content: '▾';
            font-size: 0.65rem;
            opacity: 0.6;
            transition: transform 0.15s;
        }
        .nav-section.collapsed::after { transform: rotate(-90deg); }
        .nav-item.collapsed-hidden { display: none; }

        /* Generic filter bar (used by Classes, Students, Customers) */
        .class-filter-bar,
        .filter-bar {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            padding: 0.875rem 1rem;
            border-bottom: 1px solid var(--border);
            background: var(--bg-subtle);
            align-items: center;
        }
        .class-filter-input,
        .class-filter-select,
        .filter-input,
        .filter-select {
            padding: 0.45rem 0.65rem;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: var(--bg-card);
            color: var(--text);
            font-size: 0.85rem;
            font-family: inherit;
        }
        .class-filter-input,
        .filter-input { min-width: 220px; flex: 1; }
        .class-filter-select,
        .filter-select { min-width: 130px; }
        .class-filter-input:focus,
        .class-filter-select:focus,
        .filter-input:focus,
        .filter-select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
        .class-filter-btn,
        .filter-btn {
            padding: 0.45rem 0.85rem;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: var(--bg-card);
            color: var(--text);
            font-size: 0.85rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.15s;
            font-family: inherit;
        }
        .class-filter-btn:hover,
        .filter-btn:hover { background: var(--bg-subtle); }
        .class-filter-btn-primary,
        .filter-btn-primary {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent);
        }
        .class-filter-btn-primary:hover,
        .filter-btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

        /* KPI Drill-down */
        .kpi-calc-row.drillable {
            cursor: pointer;
            transition: background 0.12s;
            border-radius: 4px;
            padding-right: 0.5rem;
        }
        .kpi-calc-row.drillable:hover {
            background: var(--accent-light);
        }
        .kpi-calc-row.drillable .kpi-calc-label::after {
            content: ' ›';
            color: var(--accent);
            font-weight: 700;
            margin-left: 0.25rem;
        }

        .kpi-drill-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.45);
            z-index: 1000;
            align-items: flex-start;
            justify-content: center;
            padding: 5vh 1rem;
            overflow-y: auto;
        }
        .kpi-drill-backdrop.open { display: flex; }
        .kpi-drill-modal {
            background: var(--bg-card);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            width: 100%;
            max-width: 960px;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .kpi-drill-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            padding: 1.25rem 1.5rem 1rem;
            border-bottom: 1px solid var(--border);
        }
        .kpi-drill-eyebrow {
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-muted);
            font-weight: 600;
            margin-bottom: 0.15rem;
        }
        .kpi-drill-title {
            font-family: var(--font-display);
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--text);
            margin: 0;
        }
        .kpi-drill-close {
            background: transparent;
            border: 0;
            color: var(--text-muted);
            font-size: 1.6rem;
            cursor: pointer;
            line-height: 1;
            padding: 0 0.4rem;
        }
        .kpi-drill-close:hover { color: var(--text); }
        .kpi-drill-toolbar {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem 1.5rem;
            background: var(--bg-subtle);
            border-bottom: 1px solid var(--border);
        }
        .kpi-drill-toolbar .filter-input { flex: 1; }
        .kpi-drill-count {
            font-size: 0.85rem;
            color: var(--text-muted);
            white-space: nowrap;
        }
        .kpi-drill-body {
            overflow-y: auto;
            flex: 1;
            padding: 0;
        }
        .kpi-drill-table { width: 100%; }
        .kpi-drill-table thead th {
            position: sticky;
            top: 0;
            background: var(--bg-card);
            z-index: 1;
        }
        .kpi-drill-table tbody tr {
            cursor: pointer;
            transition: background 0.1s;
        }
        .kpi-drill-table tbody tr.no-detail { cursor: default; }
        .kpi-drill-table tbody tr:hover:not(.no-detail) { background: var(--accent-light); }

        /* Lead Kanban */
        .lead-kanban {
            display: grid;
            grid-template-columns: repeat(5, minmax(220px, 1fr));
            gap: 0.85rem;
            overflow-x: auto;
            padding-bottom: 0.5rem;
        }
        @media (max-width: 1100px) {
            .lead-kanban { grid-template-columns: repeat(5, 240px); }
        }
        .kanban-col {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            display: flex;
            flex-direction: column;
            min-height: 300px;
            max-height: calc(100vh - 280px);
        }
        .kanban-col-head {
            padding: 0.75rem 0.85rem;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            position: sticky;
            top: 0;
            background: var(--bg-card);
            border-radius: var(--radius-lg) var(--radius-lg) 0 0;
            z-index: 1;
        }
        .kanban-col-head .title {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 600;
            font-size: 0.9rem;
        }
        .kanban-col-head .dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            display: inline-block;
        }
        .kanban-col-head .count {
            font-size: 0.8rem;
            background: var(--bg-subtle);
            padding: 2px 8px;
            border-radius: 999px;
            color: var(--text-muted);
            font-weight: 600;
        }
        .kanban-col-body {
            padding: 0.6rem;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            overflow-y: auto;
            flex: 1;
        }
        .kanban-card {
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 0.6rem 0.7rem;
            background: var(--bg-card);
            cursor: pointer;
            transition: all 0.12s;
            box-shadow: var(--shadow-sm);
        }
        .kanban-card:hover {
            border-color: var(--accent);
            box-shadow: var(--shadow);
            transform: translateY(-1px);
        }
        .kanban-card .name {
            font-weight: 600;
            font-size: 0.9rem;
            color: var(--text);
            margin-bottom: 0.15rem;
        }
        .kanban-card .meta {
            font-size: 0.78rem;
            color: var(--text-muted);
            line-height: 1.4;
        }
        .kanban-card .meta strong { color: var(--text-secondary); font-weight: 500; }
        .kanban-card .age-pill {
            display: inline-block;
            margin-top: 0.4rem;
            font-size: 0.7rem;
            padding: 1px 7px;
            border-radius: 999px;
            background: var(--bg-subtle);
            color: var(--text-muted);
        }
        .kanban-card .age-pill.warn { background: var(--amber-light); color: var(--amber); }
        .kanban-card .age-pill.bad  { background: var(--red-light); color: var(--red); }
        .kanban-empty {
            text-align: center;
            color: var(--text-muted);
            font-size: 0.8rem;
            padding: 1rem 0.5rem;
            font-style: italic;
        }
        .kanban-col.col-new      .dot { background: #6366F1; }
        .kanban-col.col-booked   .dot { background: var(--amber); }
        .kanban-col.col-attended .dot { background: var(--orange); }
        .kanban-col.col-converted .dot { background: var(--green); }
        .kanban-col.col-lost     .dot { background: var(--red); }

        /* Cohort heatmap */
        .cohort-heatmap-wrap {
            overflow-x: auto;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: var(--bg-card);
        }
        .cohort-heatmap {
            border-collapse: collapse;
            font-size: 0.78rem;
            min-width: 100%;
        }
        .cohort-heatmap th,
        .cohort-heatmap td {
            padding: 0.4rem 0.55rem;
            text-align: center;
            border-bottom: 1px solid var(--border);
            white-space: nowrap;
        }
        .cohort-heatmap thead th {
            background: var(--bg-subtle);
            color: var(--text-muted);
            font-weight: 600;
            text-transform: uppercase;
            font-size: 0.7rem;
            letter-spacing: 0.04em;
            position: sticky;
            top: 0;
            z-index: 1;
        }
        .cohort-heatmap tbody th {
            background: var(--bg-subtle);
            text-align: left;
            font-weight: 600;
            color: var(--text);
            position: sticky;
            left: 0;
            z-index: 1;
        }
        .cohort-heatmap td.size-cell {
            background: var(--bg-card);
            color: var(--text-muted);
            font-weight: 500;
        }
        .cohort-heatmap td.cohort-cell {
            color: #fff;
            font-weight: 600;
        }
        .cohort-heatmap td.cohort-cell.empty {
            background: var(--bg-card);
            color: var(--text-muted);
            font-weight: 400;
        }
        .cohort-legend-pill {
            padding: 2px 8px;
            border-radius: 999px;
            font-weight: 600;
            font-size: 0.72rem;
        }

        /* Main Content */
        .main {
            padding: 2rem 2.5rem;
            max-width: 1400px;
        }

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 2rem;
        }

        .page-title {
            font-family: var(--font-display);
            font-size: 1.5rem;            /* Fluent uses tighter type scale than editorial */
            font-weight: var(--fw-semibold);
            letter-spacing: -0.01em;
            color: var(--text);
        }

        .page-subtitle {
            color: var(--text-secondary);
            font-size: 0.875rem;
            margin-top: 0.15rem;
            font-weight: var(--fw-regular);
        }

        .header-actions {
            display: flex;
            gap: 0.75rem;
        }
        
        .search-input-wrap {
            position: relative;
            display: inline-flex;
        }
        .search-input-wrap .search-input {
            padding-right: 2rem;
        }
        .search-clear-btn {
            position: absolute;
            right: 0.5rem;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            font-size: 1.2rem;
            color: var(--text-muted);
            cursor: pointer;
            padding: 0 0.25rem;
            line-height: 1;
        }
        .search-clear-btn:hover {
            color: var(--text);
        }

        /* Buttons — Fluent design language
           - Default = neutral surface, 1px subtle border, no shadow at rest
           - Hover  = warm-tinted background reveal, slightly stronger border
           - Primary = solid brand, no border, soft Fluent shadow
           - Focus  = 2px brand outline (accessibility)
        */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-2);
            min-height: var(--tap);
            padding: 0 var(--space-4);
            border-radius: var(--radius);
            font-family: inherit;
            font-size: 0.875rem;
            font-weight: var(--fw-semibold);
            cursor: pointer;
            transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.05s;
            border: 1px solid var(--border-strong);
            background: var(--bg-card);
            color: var(--text);
            white-space: nowrap;
            letter-spacing: 0;
        }

        .btn:hover {
            background: var(--bg-subtle);
            border-color: var(--text-muted);
        }
        .btn:active {
            background: var(--border);
            transform: translateY(0);
        }
        .btn:focus-visible {
            outline: 2px solid var(--brand);
            outline-offset: 2px;
        }
        .btn[disabled], .btn[aria-disabled="true"] {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .btn-primary {
            background: var(--brand);
            border-color: var(--brand);
            color: #fff;
            box-shadow: 0 1px 2px rgba(164, 38, 44, 0.18);
        }

        .btn-primary:hover {
            background: var(--brand-dark);
            border-color: var(--brand-dark);
            box-shadow: 0 2px 4px rgba(164, 38, 44, 0.24);
        }
        .btn-primary:active {
            background: var(--brand-dark);
            box-shadow: none;
        }

        .btn-danger {
            background: var(--danger);
            border-color: var(--danger);
            color: #fff;
        }

        /* Subtle text-only button (Fluent "subtle" variant) */
        .btn.btn-subtle {
            border-color: transparent;
            background: transparent;
        }
        .btn.btn-subtle:hover {
            background: var(--bg-subtle);
            border-color: transparent;
        }

        /* Selects and inputs — Fluent text fields
           Bottom-border accent on focus echoes Fluent's underline pattern. */
        .field {
            min-height: var(--tap);
            padding: 0 var(--space-3);
            border: 1px solid var(--border-strong);
            border-radius: var(--radius);
            background: var(--bg-card);
            color: var(--text);
            font-family: inherit;
            font-size: 0.875rem;
            transition: border-color 0.12s ease, box-shadow 0.12s ease;
        }
        .field:hover {
            border-color: var(--text-muted);
        }
        .field:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 1px var(--brand);
        }

        /* Native select indicator */
        select.field {
            appearance: none;
            background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
            background-repeat: no-repeat;
            background-position: right var(--space-3) center;
            padding-right: 2rem;
        }

        .pace-metric-btn {
            background: var(--bg-card);
            color: var(--text-muted);
            padding: 6px 12px;
            font-size: 0.85rem;
        }
        .pace-metric-btn.active {
            background: var(--accent);
            color: white;
        }
        .pace-metric-btn:hover:not(.active) {
            background: var(--surface);
        }

        .btn svg { width: 16px; height: 16px; }

        /* Cards — Fluent surface treatment.
           Subtle resting elevation; on hover the border deepens
           (Fluent "Reveal" pattern — no aggressive shadow lift). */
        .card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            padding: 1.25rem;
            box-shadow: var(--shadow-sm);
            transition: border-color 0.15s ease, box-shadow 0.15s ease;
        }
        .card:hover {
            border-color: var(--border-strong);
        }

        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }

        .card-title {
            font-family: var(--font-display);
            font-size: 1rem;
            font-weight: var(--fw-semibold);
            letter-spacing: -0.005em;
            color: var(--text);
        }

        /* KPI Grid */
        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 1rem;
            margin-bottom: 1.5rem;
        }

        @media (max-width: 1100px) {
            .kpi-grid { grid-template-columns: repeat(2, 1fr); }
        }

        /* Flip card container */
        .kpi-flip-container {
            perspective: 1000px;
            min-height: 160px;
            position: relative;
        }

        .kpi-flip-inner {
            position: relative;
            width: 100%;
            min-height: 160px;
            transition: transform 0.5s ease;
            transform-style: preserve-3d;
        }

        /* Click-only — hover trigger removed (was a functional bug:
           hover and .flipped both rotated, so click appeared to do nothing) */
        .kpi-flip-container.flipped .kpi-flip-inner {
            transform: rotateY(180deg);
        }

        .kpi-flip-front, .kpi-flip-back {
            position: absolute;
            inset: 0;
            backface-visibility: hidden;
            border-radius: var(--radius-lg);
        }

        .kpi-flip-back {
            transform: rotateY(180deg);
            background: var(--bg-card);
            border: 1px solid var(--border);
            padding: var(--space-4);
            overflow-y: auto;
        }

        /* "i" affordance — visible signifier replacing hidden hover trigger */
        .kpi-flip-toggle {
            position: absolute;
            top: var(--space-3);
            right: var(--space-3);
            width: 28px; height: 28px;
            min-height: auto;
            padding: 0;
            border-radius: 50%;
            background: transparent;
            border: 1px solid var(--border);
            color: var(--text-muted);
            font-size: 0.85rem;
            font-style: italic;
            font-family: var(--font-display);
            font-weight: var(--fw-bold);
            z-index: 2;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            line-height: 1;
        }
        .kpi-flip-toggle:hover { color: var(--brand); border-color: var(--brand); }
        .kpi-flip-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
        
        .kpi-flip-back h4 {
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.04em;
            margin: 0 0 0.75rem 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .kpi-calc-row {
            display: flex;
            justify-content: space-between;
            font-size: 0.8rem;
            padding: 0.35rem 0;
            border-bottom: 1px solid var(--border);
        }
        
        .kpi-calc-row:last-child {
            border-bottom: none;
            font-weight: 600;
        }
        
        .kpi-calc-label {
            color: var(--text-secondary);
        }
        
        .kpi-calc-value {
            color: var(--text);
            font-weight: 500;
        }
        
        .kpi-calc-formula {
            font-size: 0.7rem;
            color: var(--text-muted);
            background: var(--bg);
            padding: 0.5rem;
            border-radius: 4px;
            margin-top: 0.5rem;
            font-family: monospace;
        }
        
        .flip-hint {
            position: absolute;
            bottom: 0.5rem;
            right: 0.75rem;
            font-size: 0.65rem;
            color: var(--text-muted);
            opacity: 0.5;
        }

        .kpi-card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            padding: 1.25rem;
            position: relative;
            transition: all 0.2s;
            height: 100%;
            box-sizing: border-box;
        }

        .kpi-card::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            border-radius: var(--radius-lg) 0 0 var(--radius-lg);
        }

        .kpi-card.green::before { background: var(--green); }
        .kpi-card.amber::before { background: var(--amber); }
        .kpi-card.red::before { background: var(--red); }

        .kpi-top {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 0.75rem;
        }

        .kpi-label {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .kpi-badge {
            font-size: 0.65rem;
            font-weight: 600;
            padding: 0.2rem 0.5rem;
            border-radius: 4px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .kpi-badge.green { background: var(--green-light); color: var(--green); }
        .kpi-badge.amber { background: var(--amber-light); color: var(--amber); }
        .kpi-badge.red { background: var(--red-light); color: var(--red); }

        .kpi-value {
            font-family: var(--font-display);
            font-size: clamp(1.75rem, 1.25rem + 2vw, 2.5rem);
            font-weight: var(--fw-bold);
            letter-spacing: -0.03em;
            line-height: 1.05;
            margin-bottom: var(--space-2);
            overflow-wrap: anywhere;
        }

        .kpi-value.green { color: var(--success); }
        .kpi-value.amber { color: var(--warning); }
        .kpi-value.red   { color: var(--danger); }

        .kpi-footer {
            display: flex;
            justify-content: space-between;
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .kpi-target { font-weight: 500; }
        /* Content Grid */
        .content-grid {
            display: grid;
            grid-template-columns: 1fr 340px;
            gap: 1.5rem;
            margin-bottom: 1.5rem;
        }

        @media (max-width: 1000px) {
            .content-grid { grid-template-columns: 1fr; }
        }

        .chart-container {
            height: 260px;
            position: relative;
        }

        /* Alerts */
        .alert-list { display: flex; flex-direction: column; gap: 0.625rem; }

        .alert-item {
            display: flex;
            gap: 0.75rem;
            padding: 0.75rem;
            border-radius: var(--radius);
            background: var(--bg-subtle);
            border: 1px solid var(--border);
        }

        .alert-item.critical {
            background: var(--red-light);
            border-color: #F5D5D5;
        }

        .alert-item.warning {
            background: var(--amber-light);
            border-color: #F0E4C4;
        }

        .alert-icon { font-size: 1rem; line-height: 1.4; }

        .alert-content { flex: 1; }

        .alert-title {
            font-size: 0.85rem;
            font-weight: 600;
            margin-bottom: 0.1rem;
        }

        .alert-item.critical .alert-title { color: var(--red); }
        .alert-item.warning .alert-title { color: var(--amber); }

        .alert-desc {
            font-size: 0.8rem;
            color: var(--text-secondary);
        }

        /* Tables */
        .table-wrap { overflow-x: auto; }

        .data-table {
            width: 100%;
            border-collapse: separate;          /* lets us round corners on the wrapper */
            border-spacing: 0;
            font-size: 0.85rem;
            font-variant-numeric: tabular-nums; /* digits align in numeric columns */
        }

        .data-table th {
            text-align: left;
            padding: 0.55rem 0.85rem;
            font-size: 0.7rem;
            font-weight: var(--fw-semibold);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            background: var(--bg-subtle);
            border-bottom: 1px solid var(--border-strong);
            white-space: nowrap;
            position: sticky;
            top: 0;
            z-index: 1;
        }
        .data-table th:first-child { border-top-left-radius: var(--radius); }
        .data-table th:last-child  { border-top-right-radius: var(--radius); }

        .data-table td {
            padding: 0.55rem 0.85rem;
            border-bottom: 1px solid var(--border);
            vertical-align: middle;
            line-height: 1.35;
        }
        .data-table tbody tr:last-child td { border-bottom: none; }

        /* Subtle zebra — only on the actual data rows */
        .data-table tbody tr:nth-child(even) td { background: rgba(0,0,0,0.015); }

        /* Hover only signals click on rows that ARE clickable.
           Rows become clickable by carrying onclick or [data-clickable]. */
        .data-table tbody tr[onclick],
        .data-table tbody tr[data-clickable] {
            cursor: pointer;
        }
        .data-table tbody tr[onclick]:hover td,
        .data-table tbody tr[data-clickable]:hover td {
            background: var(--brand-light);
        }

        /* Right-align numeric columns when marked */
        .data-table th.num,
        .data-table td.num {
            text-align: right;
            font-variant-numeric: tabular-nums;
        }
        /* Center status/state columns when marked */
        .data-table th.center,
        .data-table td.center { text-align: center; }

        /* Sortable columns */
        .data-table th.sortable {
            cursor: pointer;
            user-select: none;
            transition: background 0.15s, color 0.15s;
        }
        .data-table th.sortable:hover { background: var(--bg-subtle); color: var(--text); }
        .data-table th.sortable:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
        .sort-icon {
            display: inline-block;
            width: 10px;
            margin-left: 4px;
            color: var(--text-muted);
        }
        .sort-icon::after {
            content: '↕';
            opacity: 0.6;
            font-size: 0.85em;
        }
        .sort-icon.asc::after  { content: '↑'; opacity: 1; color: var(--brand); }
        .sort-icon.desc::after { content: '↓'; opacity: 1; color: var(--brand); }

        .status-pill {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.2rem 0.6rem;
            border-radius: 20px;
            font-size: 0.75rem;
            font-weight: 500;
        }

        .status-pill.green  { background: var(--success-light); color: var(--success); }
        .status-pill.amber  { background: var(--warning-light); color: var(--warning); }
        .status-pill.red    { background: var(--danger-light);  color: var(--danger); }  /* now distinct from brand */
        .status-pill.orange { background: var(--info-light);    color: var(--info); }
        
        .help-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: transparent;
            color: var(--text-muted);
            border: 1px solid var(--border-strong);
            font-size: 10px;
            font-weight: var(--fw-semibold);
            cursor: pointer;
            margin-left: 4px;
            transition: color 0.15s, border-color 0.15s;
        }
        .help-icon:hover { color: var(--brand); border-color: var(--brand); }

        /* Info Tooltips */
        .info-tip {
            position: relative;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: transparent;
            color: var(--text-muted);
            border: 1px solid var(--border-strong);
            font-size: 10px;
            font-weight: var(--fw-semibold);
            cursor: help;
            margin-left: 4px;
            flex-shrink: 0;
            transition: color 0.15s, border-color 0.15s;
        }
        .info-tip:hover {
            color: var(--brand);
            border-color: var(--brand);
            background: transparent;
        }
        .info-tip .tip-content {
            display: none;
            position: absolute;
            bottom: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%);
            background: rgba(30, 41, 59, 0.95);
            color: white;
            padding: 10px 12px;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 400;
            line-height: 1.5;
            width: 280px;
            max-width: 90vw;
            text-align: left;
            z-index: 1000;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }
        .info-tip .tip-content::after {
            content: '';
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            border: 6px solid transparent;
            border-top-color: rgba(30, 41, 59, 0.95);
        }
        .info-tip:hover .tip-content {
            display: block;
        }
        .info-tip .tip-content strong {
            color: var(--amber);
            font-weight: 600;
        }
        .info-tip .tip-content code {
            background: rgba(255,255,255,0.15);
            padding: 1px 4px;
            border-radius: 3px;
            font-size: 11px;
        }

        .status-pill::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: currentColor;
        }

        /* Modal */
        .modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.4);
            backdrop-filter: blur(4px);
            z-index: 100;
            align-items: center;
            justify-content: center;
        }

        .modal-overlay.active { display: flex; }

        .modal {
            background: var(--bg-card);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            width: 100%;
            max-width: 560px;
            max-height: 90vh;
            overflow: hidden;
            margin: 1rem;
        }

        .modal-header {
            padding: 1.25rem 1.5rem;
            border-bottom: 1px solid var(--border);
        }

        .modal-header h2 {
            font-family: var(--font-display);
            font-size: 1.25rem;
            font-weight: 600;
        }

        .modal-body {
            padding: 1.5rem;
            overflow-y: auto;
            max-height: calc(90vh - 140px);
        }

        .modal-footer {
            padding: 1rem 1.5rem;
            border-top: 1px solid var(--border);
            display: flex;
            justify-content: flex-end;
            gap: 0.75rem;
        }

        /* Drop Zone */
        .drop-zone {
            border: 2px dashed var(--border-strong);
            border-radius: var(--radius-lg);
            padding: 2.5rem 2rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
            background: var(--bg-subtle);
        }

        .drop-zone:hover, .drop-zone.drag-over {
            border-color: var(--accent);
            background: var(--accent-light);
        }

        .drop-zone-icon {
            font-size: 2.5rem;
            margin-bottom: 0.75rem;
        }

        .drop-zone-title {
            font-weight: 600;
            margin-bottom: 0.25rem;
        }

        .drop-zone-text {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        .drop-zone input { display: none; }

        /* File Preview */
        .file-preview {
            margin-top: 1rem;
            padding: 1rem;
            background: var(--bg-subtle);
            border-radius: var(--radius);
            border: 1px solid var(--border);
        }

        .file-preview-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.75rem;
        }

        .file-preview-name {
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .file-preview-type {
            font-size: 0.75rem;
            padding: 0.2rem 0.5rem;
            background: var(--accent-light);
            color: var(--accent);
            border-radius: 4px;
            font-weight: 500;
        }

        .file-preview-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 0.75rem;
            font-size: 0.85rem;
        }

        .file-preview-stat {
            text-align: center;
            padding: 0.5rem;
            background: var(--bg-card);
            border-radius: var(--radius);
        }

        .file-preview-stat-value {
            font-weight: 600;
            font-size: 1.25rem;
        }

        .file-preview-stat-label {
            font-size: 0.7rem;
            color: var(--text-muted);
            text-transform: uppercase;
        }

        /* Toast */
        .toast {
            position: fixed;
            bottom: 1.5rem;
            right: 1.5rem;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 0.875rem 1.25rem;
            box-shadow: var(--shadow-lg);
            display: flex;
            align-items: center;
            gap: 0.75rem;
            font-size: 0.875rem;
            font-weight: 500;
            z-index: 200;
            transform: translateY(100px);
            opacity: 0;
            transition: all 0.3s;
        }

        .toast.show { transform: translateY(0); opacity: 1; }
        .toast.success { border-left: 4px solid var(--green); }
        .toast.error { border-left: 4px solid var(--red); }

        /* Page Views */
        .page { display: none; }
        .page.active { display: block; }

        /* Tabs */
        .tabs {
            display: flex;
            flex-wrap: wrap;
            gap: var(--space-1);
            padding: var(--space-1);
            background: var(--bg-subtle);
            border-radius: var(--radius);
            margin-bottom: var(--space-5);
        }

        .tab {
            min-height: var(--tap);
            padding: 0 var(--space-4);
            border-radius: 6px;
            font-size: 0.875rem;
            font-weight: var(--fw-medium);
            cursor: pointer;
            background: transparent;
            border: none;
            color: var(--text-secondary);
            transition: background 0.15s, color 0.15s;
        }

        .tab:hover { color: var(--text); background: rgba(0,0,0,0.03); }
        .tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
        .tab.active {
            background: var(--bg-card);
            color: var(--brand);
            box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
            font-weight: var(--fw-semibold);
        }

        /* Empty State */
        .empty-state {
            text-align: center;
            padding: 3rem 2rem;
            color: var(--text-muted);
        }

        .empty-state-icon {
            font-size: 3rem;
            margin-bottom: 1rem;
            opacity: 0.5;
        }

        .empty-state-title {
            font-weight: 600;
            color: var(--text-secondary);
            margin-bottom: 0.25rem;
        }

        /* Loading */
        .loading {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            padding: 2rem;
            color: var(--text-muted);
        }

        .spinner {
            width: 20px;
            height: 20px;
            border: 2px solid var(--border);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin { to { transform: rotate(360deg); } }

        /* Responsive — mobile drawer pattern */
        .mobile-nav-toggle {
            display: none;
            position: fixed;
            top: var(--space-3);
            left: var(--space-3);
            z-index: 60;
            width: var(--tap);
            height: var(--tap);
            border-radius: var(--radius);
            background: var(--bg-card);
            border: 1px solid var(--border);
            box-shadow: var(--shadow);
            cursor: pointer;
            align-items: center;
            justify-content: center;
            color: var(--text);
        }
        .mobile-nav-toggle:focus-visible {
            outline: 2px solid var(--brand);
            outline-offset: 2px;
        }
        .sidebar-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.4);
            z-index: 40;
        }
        .sidebar-backdrop.open { display: block; }

        @media (max-width: 900px) {
            .app { grid-template-columns: 1fr; }
            .sidebar {
                position: fixed;
                top: 0; bottom: 0; left: 0;
                width: 280px;
                z-index: 50;
                transform: translateX(-100%);
                transition: transform 0.25s ease;
                display: flex;
            }
            .sidebar.open { transform: translateX(0); }
            .mobile-nav-toggle { display: inline-flex; }
            .main {
                padding: calc(var(--tap) + var(--space-4)) var(--space-4) var(--space-4);
            }

            .page-header { flex-direction: column; align-items: stretch; gap: var(--space-3); }
            .header-actions { flex-wrap: wrap; }
            .kpi-grid { grid-template-columns: 1fr; }
            .kpi-flip-container { min-height: auto; }

            /* Filter bars become a horizontal scroller, not a wrapping mess */
            .filter-bar, .class-filter-bar {
                flex-wrap: nowrap;
                overflow-x: auto;
                scroll-snap-type: x mandatory;
            }
            .filter-bar > *, .class-filter-bar > * {
                scroll-snap-align: start;
                flex-shrink: 0;
            }
        }

        @media (max-width: 768px) {
            .main { padding: calc(var(--tap) + var(--space-3)) var(--space-3) var(--space-3); }
        }

        /* Coarse-pointer (touch) sweep — guarantees 44px tap targets */
        @media (pointer: coarse) {
            .nav-item { min-height: var(--tap); }
            .filter-btn, .class-filter-btn { min-height: var(--tap); }
            .field { font-size: 16px; } /* prevents iOS zoom-on-focus */
        }

        /* Import Page */
        .import-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
            gap: 1.5rem;
        }

        .import-section {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            padding: 1.25rem;
        }

        .import-section-title {
            font-family: var(--font-display);
            font-size: 1.1rem;
            font-weight: 600;
            margin-bottom: 0.25rem;
        }

        .import-section-desc {
            font-size: 0.8rem;
            color: var(--text-muted);
            margin-bottom: 1rem;
        }

        .import-card {
            background: var(--bg-subtle);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 1rem;
            margin-bottom: 0.75rem;
        }

        .import-card:last-child {
            margin-bottom: 0;
        }

        .import-card-header {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 0.5rem;
        }

        .import-card-icon {
            font-size: 1.25rem;
        }

        .import-card-title {
            font-weight: 600;
            font-size: 0.95rem;
        }

        .import-card-desc {
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .import-card-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.75rem;
            margin-bottom: 0.75rem;
        }

        .import-card-file {
            color: var(--text-muted);
            font-family: monospace;
        }

        .import-card-status {
            font-weight: 500;
        }

        .import-card-status.success {
            color: var(--green);
        }

        .import-card-status.error {
            color: var(--red);
        }

        .import-drop {
            border: 2px dashed var(--border);
            border-radius: var(--radius);
            padding: 1rem;
            text-align: center;
            font-size: 0.8rem;
            color: var(--text-muted);
            cursor: pointer;
            transition: all 0.15s;
            position: relative;
        }

        .import-drop:hover {
            border-color: var(--accent);
            background: rgba(237, 35, 71, 0.05);
        }

        .import-drop.drag-over {
            border-color: var(--accent);
            background: rgba(237, 35, 71, 0.1);
        }

        .import-drop.processing {
            opacity: 0.6;
            pointer-events: none;
        }

        .import-file-input {
            position: absolute;
            inset: 0;
            opacity: 0;
            cursor: pointer;
        }

        .import-log {
            max-height: 200px;
            overflow-y: auto;
            font-size: 0.85rem;
        }

        .import-log-empty {
            color: var(--text-muted);
            text-align: center;
            padding: 1rem;
        }

        .import-log-entry {
            display: flex;
            justify-content: space-between;
            padding: 0.5rem 0;
            border-bottom: 1px solid var(--border);
        }

        .import-log-entry:last-child {
            border-bottom: none;
        }

        .import-log-type {
            font-weight: 500;
        }

        .import-log-result {
            color: var(--text-muted);
        }

        .import-log-result.success {
            color: var(--green);
        }

        .import-log-result.error {
            color: var(--red);
        }

        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }

        .card-title {
            font-family: var(--font-display);
            font-weight: 600;
        }

        .universal-drop {
            border: 2px dashed var(--border);
            border-radius: var(--radius-lg);
            padding: 2rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.15s;
            position: relative;
        }

        .universal-drop:hover {
            border-color: var(--accent);
            background: rgba(237, 35, 71, 0.05);
        }

        .universal-drop.drag-over {
            border-color: var(--accent);
            background: rgba(237, 35, 71, 0.1);
        }

        .universal-drop .import-file-input {
            position: absolute;
            inset: 0;
            opacity: 0;
            cursor: pointer;
        }
        /* Analytics tabs */
        .analytics-tab-content { display: none; }
        .analytics-tab-content.active { display: block; }
        .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; text-align: center; }
        .stat-item { padding: 0.5rem; }
        .stat-value { font-size: 1.5rem; font-weight: 600; }
        .stat-label { font-size: 0.8rem; color: var(--text-light); }

        /* Export Hub */
        .export-date-row {
            display: flex;
            gap: 0.75rem;
            align-items: center;
            flex-wrap: wrap;
        }
        .export-date-label {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-size: 0.8rem;
            color: var(--text-secondary);
            font-weight: var(--fw-medium);
        }
        .export-date-input {
            min-height: 36px;
            padding: 0 var(--space-3);
            font-size: 0.875rem;
        }
        /* ============================================================
           REPORTS HUB · industry-standard reporting tool layout
           Toolbar (search + category chips) · pinned · recent · sections
           ============================================================ */
        .report-hub-toolbar {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            align-items: center;
            padding: 0.85rem 1rem;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 10px;
            box-shadow: var(--shadow-sm);
            margin-bottom: 1.25rem;
            position: sticky;
            top: 0;
            z-index: 5;
        }
        .report-hub-search {
            position: relative;
            flex: 1 1 240px;
            min-width: 220px;
            display: flex;
            align-items: center;
        }
        .report-hub-search-icon {
            position: absolute;
            left: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            font-size: 0.95rem;
            color: var(--text-muted);
            pointer-events: none;
            display: inline-flex;
            align-items: center;
        }
        .report-hub-search-icon .fui-icon { vertical-align: 0; }
        .report-hub-clear { display: inline-flex; align-items: center; justify-content: center; }
        .report-hub-search input[type="search"] {
            width: 100%;
            height: 38px;
            padding: 0 2.25rem 0 2.25rem;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--bg);
            font-size: 0.9rem;
            color: var(--text);
            transition: border-color 0.15s, box-shadow 0.15s;
        }
        .report-hub-search input[type="search"]:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 3px rgba(237, 35, 71, 0.15);
        }
        .report-hub-clear {
            position: absolute;
            right: 0.5rem;
            top: 50%;
            transform: translateY(-50%);
            background: var(--bg-subtle);
            border: none;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            font-size: 1rem;
            line-height: 1;
            color: var(--text-muted);
            cursor: pointer;
        }
        .report-hub-clear:hover { background: var(--border); color: var(--text); }
        .report-hub-filters {
            display: flex;
            flex-wrap: wrap;
            gap: 0.35rem;
        }
        .report-hub-chip {
            min-height: 32px;
            padding: 0 0.85rem;
            border: 1px solid var(--border);
            background: var(--bg);
            color: var(--text-secondary);
            border-radius: 16px;
            font-size: 0.82rem;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.15s, border-color 0.15s, color 0.15s;
        }
        .report-hub-chip:hover {
            background: var(--bg-subtle);
            border-color: var(--border-strong);
            color: var(--text);
        }
        .report-hub-chip.is-active {
            background: var(--brand);
            border-color: var(--brand);
            color: #fff;
        }
        .report-hub-count {
            margin-left: auto;
            font-size: 0.8rem;
            color: var(--text-muted);
            white-space: nowrap;
        }
        .report-hub-section {
            margin-bottom: 1.5rem;
        }
        .report-hub-section-header {
            display: flex;
            align-items: baseline;
            gap: 0.6rem;
            margin: 0 0 0.85rem 0;
            padding-bottom: 0.35rem;
            border-bottom: 1px solid var(--border);
        }
        .report-hub-section-icon {
            font-size: 1.05rem;
        }
        .report-hub-section-title {
            margin: 0;
            font-family: var(--font-display);
            font-size: 1rem;
            font-weight: var(--fw-semibold);
            letter-spacing: -0.005em;
            color: var(--text);
        }
        .report-hub-section-hint {
            font-size: 0.8rem;
            color: var(--text-muted);
        }
        .report-hub-pinned-list,
        .report-hub-recent-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 0.6rem;
        }
        .report-hub-tile {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
            padding: 0.7rem 0.85rem;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 8px;
            cursor: pointer;
            transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
            text-align: left;
            font: inherit;
            color: var(--text);
        }
        .report-hub-tile:hover {
            border-color: var(--brand);
            box-shadow: var(--shadow-sm);
        }
        .report-hub-tile:active { transform: translateY(1px); }
        .report-hub-tile-title {
            font-weight: 600;
            font-size: 0.92rem;
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }
        .report-hub-tile-meta {
            font-size: 0.75rem;
            color: var(--text-muted);
        }
        /* Card chrome inside the hub */
        .report-card {
            position: relative;
        }
        .report-card .card-title {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 0.5rem;
        }
        .report-card-meta {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            margin-left: auto;
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 400;
        }
        .report-card-pin {
            background: transparent;
            border: 1px solid transparent;
            cursor: pointer;
            padding: 2px 6px;
            border-radius: 6px;
            font-size: 0.95rem;
            line-height: 1;
            color: var(--text-muted);
            transition: background 0.15s, color 0.15s, border-color 0.15s;
        }
        .report-card-pin:hover { background: var(--bg-subtle); color: var(--text); }
        .report-card-pin.is-pinned { color: var(--warning); }
        .report-card-pin.is-pinned:hover { background: var(--warning-light); }
        .report-card-category {
            display: inline-block;
            padding: 1px 8px;
            border-radius: 10px;
            font-size: 0.7rem;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.03em;
            background: var(--bg-subtle);
            color: var(--text-secondary);
            border: 1px solid var(--border);
        }
        .report-hub-empty {
            text-align: center;
            padding: 3rem 1rem;
            color: var(--text);
            background: var(--bg-card);
            border: 1px dashed var(--border);
            border-radius: 12px;
        }
        @media (max-width: 720px) {
            .report-hub-toolbar { position: static; }
            .report-hub-count { display: none; }
        }

        .export-preset-row {
            display: flex;
            gap: 0.4rem;
            flex-wrap: wrap;
            margin-left: auto;
        }
        .export-preset-btn {
            min-height: 36px;
            padding: 0 var(--space-3);
            font-size: 0.8rem;
        }
        .export-preset-btn.active {
            background: var(--brand);
            color: #fff;
            border-color: var(--brand);
        }
        .export-range-summary {
            font-size: 0.85rem;
            color: var(--text-muted);
            font-weight: var(--fw-medium);
        }
        .export-date-help {
            font-size: 0.78rem;
            color: var(--text-muted);
            margin-top: 0.65rem;
            line-height: 1.4;
        }

        .snapshot-list {
            margin-top: 0.5rem;
            font-size: 0.85rem;
        }
        .snapshot-status-row {
            margin-bottom: 0.65rem;
        }
        .snapshot-status {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            font-size: 0.78rem;
            font-weight: var(--fw-medium);
            padding: 0.25rem 0.6rem;
            border-radius: var(--radius-pill);
            border: 1px solid var(--border);
            background: var(--bg-subtle);
            color: var(--text-secondary);
            line-height: 1.3;
        }
        .snapshot-status.ok {
            background: var(--success-light);
            color: var(--success);
            border-color: var(--success-light);
        }
        .snapshot-status.warn {
            background: var(--warning-light);
            color: var(--warning);
            border-color: var(--warning-light);
            max-width: 100%;
            white-space: normal;
        }
        .snapshot-status.pending {
            color: var(--text-muted);
        }

        /* ---------- Workflow hero cards ---------- */
        .wf-hero {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-left: 4px solid var(--brand);
            border-radius: var(--radius-lg);
            padding: 1.25rem 1.4rem;
            margin-bottom: 1.25rem;
            box-shadow: var(--shadow-sm);
        }
        .wf-hero[data-tone="amber"] { border-left-color: var(--warning); }
        .wf-hero[data-tone="green"] { border-left-color: var(--success); }
        .wf-hero[data-tone="red"]   { border-left-color: var(--danger); }

        .wf-hero-head {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 1rem;
            flex-wrap: wrap;
            margin-bottom: 0.75rem;
        }
        .wf-hero-title-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
        .wf-hero-title {
            font-family: var(--font-display);
            font-size: 1.25rem;
            font-weight: var(--fw-semibold);
            margin: 0;
        }
        .wf-hero-desc {
            font-size: 0.86rem;
            color: var(--text-secondary);
            margin: 0.35rem 0 0;
            line-height: 1.45;
        }
        .wf-hero-meta {
            display: flex;
            gap: 0.85rem;
            font-size: 0.78rem;
            color: var(--text-muted);
            margin-top: 0.5rem;
            flex-wrap: wrap;
        }

        .wf-status-pill {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            font-size: 0.7rem;
            font-weight: var(--fw-semibold);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            padding: 0.25rem 0.55rem;
            border-radius: var(--radius-pill);
        }
        .wf-status-pill.ready   { background: var(--bg-subtle); color: var(--text-secondary); }
        .wf-status-pill.queued  { background: var(--brand-light); color: var(--brand); }
        .wf-status-pill.running { background: var(--warning-light); color: var(--warning); }
        .wf-status-pill.done    { background: var(--success-light); color: var(--success); }
        .wf-status-pill.stale   { background: var(--danger-light); color: var(--danger); }

        .wf-bulk {
            border: 2px dashed var(--border-strong);
            border-radius: var(--radius-lg);
            padding: 1.25rem;
            text-align: center;
            background: var(--bg-subtle);
            position: relative;
            transition: border-color 0.15s, background 0.15s;
            cursor: pointer;
            margin-top: 0.75rem;
        }
        .wf-bulk:hover, .wf-bulk.drag-over {
            border-color: var(--brand);
            background: var(--brand-light);
        }
        .wf-bulk-title {
            font-weight: var(--fw-semibold);
            font-size: 1rem;
            margin-bottom: 0.2rem;
        }
        .wf-bulk-sub { font-size: 0.82rem; color: var(--text-muted); }

        .wf-queue {
            margin-top: 0.85rem;
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
        }
        .wf-queue-row {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.45rem 0.65rem;
            background: var(--bg-subtle);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            font-size: 0.83rem;
        }
        .wf-queue-row .name { flex: 1; min-width: 0; font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .wf-queue-row .meta { color: var(--text-muted); font-size: 0.75rem; }
        .wf-queue-row.queued    { border-color: var(--brand-light); }
        .wf-queue-row.importing { border-color: var(--warning); background: var(--warning-light); }
        .wf-queue-row.done      { border-color: var(--success-light); background: var(--success-light); }
        .wf-queue-row.error     { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }

        .wf-run-btn {
            width: 100%;
            margin-top: 1rem;
            min-height: 52px;
            font-size: 0.95rem;
            font-weight: var(--fw-semibold);
        }

        .wf-activity {
            margin-top: 1rem;
            background: #0f172a;
            color: #e2e8f0;
            border-radius: var(--radius);
            padding: 0.85rem 1rem;
            font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
            font-size: 0.82rem;
            line-height: 1.55;
            max-height: 280px;
            overflow-y: auto;
        }
        .wf-activity .ln       { display: flex; gap: 0.5rem; align-items: baseline; }
        .wf-activity .ln .ts   { color: #64748b; flex-shrink: 0; }
        .wf-activity .ln.info  { color: #cbd5e1; }
        .wf-activity .ln.ok    { color: #86efac; }
        .wf-activity .ln.warn  { color: #fcd34d; }
        .wf-activity .ln.err   { color: #fca5a5; }
        .wf-activity .ln.head  { color: #fff; font-weight: 600; margin-top: 0.4rem; }

        .wf-progress-bar {
            margin-top: 0.75rem;
            height: 8px;
            background: var(--border);
            border-radius: var(--radius-pill);
            overflow: hidden;
        }
        .wf-progress-bar > span {
            display: block;
            height: 100%;
            background: var(--brand);
            transition: width 0.25s ease;
        }

        .wf-disclosure {
            margin-top: 0.85rem;
            border-top: 1px solid var(--border);
            padding-top: 0.65rem;
        }
        .wf-disclosure-toggle {
            background: transparent;
            border: none;
            cursor: pointer;
            color: var(--text-secondary);
            font-size: 0.8rem;
            font-weight: var(--fw-medium);
            padding: 0;
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
        }
        .wf-disclosure-toggle:hover { color: var(--text); }
        .wf-disclosure-toggle::before {
            content: '▸';
            font-size: 0.7rem;
            transition: transform 0.15s;
        }
        .wf-disclosure[open] .wf-disclosure-toggle::before { transform: rotate(90deg); }
        .wf-step-list { margin-top: 0.65rem; display: none; }
        .wf-disclosure[open] .wf-step-list { display: block; }
        .wf-step {
            display: flex;
            align-items: center;
            gap: 0.55rem;
            padding: 0.45rem 0;
            border-bottom: 1px solid var(--border);
            font-size: 0.85rem;
        }
        .wf-step:last-child { border-bottom: none; }
        .wf-step.done { color: var(--text-muted); text-decoration: line-through; }
        .wf-step input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
        .wf-step .lbl { flex: 1; min-width: 0; }
        .wf-step .lbl .det { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }

        .wf-report {
            margin-top: 0.85rem;
            background: var(--success-light);
            border: 1px solid var(--success);
            border-radius: var(--radius);
            padding: 0.85rem 1rem;
        }
        .wf-report-title {
            font-weight: var(--fw-semibold);
            color: var(--success);
            margin-bottom: 0.45rem;
            font-size: 0.9rem;
        }
        .wf-report-body { font-size: 0.85rem; line-height: 1.55; color: var(--text); }
        .wf-report-body .stat { margin-right: 0.85rem; white-space: nowrap; }

        /* ---------- Attendance streak flash ---------- */
        @keyframes streakFlashRed {
            0%, 100% { background: var(--danger-light); }
            50%      { background: rgba(220, 38, 38, 0.22); }
        }
        .streak-flash-red td {
            animation: streakFlashRed 1.4s ease-in-out infinite !important;
            color: var(--text) !important;
        }
        .streak-flash-red td:first-child {
            border-left: 4px solid var(--danger) !important;
        }
        .streak-pill {
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
            padding: 2px 8px;
            border-radius: var(--radius-pill);
            font-weight: 700;
            font-size: 0.75rem;
            white-space: nowrap;
        }
        .streak-pill.amber {
            background: var(--warning-light);
            color: var(--warning);
        }
        .streak-pill.red {
            background: var(--danger);
            color: #fff;
            animation: streakFlashRed 1.4s ease-in-out infinite;
        }
        @media (prefers-reduced-motion: reduce) {
            .streak-flash-red td, .streak-pill.red { animation: none !important; }
            .streak-pill.red { background: var(--danger); }
        }

        /* ---------- Year Setup ---------- */
        .ys-step { margin-bottom: 1.25rem; padding: 1.25rem 1.4rem; }
        .ys-step-head {
            display: flex;
            gap: 0.85rem;
            align-items: flex-start;
            margin-bottom: 1rem;
        }
        .ys-step-num {
            width: 32px; height: 32px;
            min-width: 32px;
            border-radius: 50%;
            background: var(--brand);
            color: #fff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-family: var(--font-display);
            font-weight: var(--fw-bold);
            font-size: 1rem;
        }
        .ys-step-title {
            font-family: var(--font-display);
            font-size: 1.15rem;
            font-weight: var(--fw-semibold);
            margin: 0 0 0.15rem 0;
        }
        .ys-step-sub {
            margin: 0;
            font-size: 0.85rem;
            color: var(--text-secondary);
            line-height: 1.45;
        }

        .ys-input-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 0.85rem;
            margin-bottom: 1rem;
        }
        .ys-field {
            display: flex;
            flex-direction: column;
            gap: 0.3rem;
            font-size: 0.78rem;
            color: var(--text-secondary);
            font-weight: var(--fw-medium);
        }
        .ys-field em {
            font-style: normal;
            color: var(--text-muted);
            font-weight: var(--fw-regular);
        }
        .ys-field-wide { grid-column: 1 / -1; }
        .ys-field-label {
            font-size: 0.78rem;
            color: var(--text-secondary);
            font-weight: var(--fw-medium);
            display: block;
            margin-bottom: 0.3rem;
        }
        .ys-textarea {
            min-height: auto;
            padding: 0.65rem;
            font-family: inherit;
            font-size: 0.88rem;
            line-height: 1.5;
            resize: vertical;
        }

        .ys-content-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 1rem;
        }

        .ys-warnings {
            margin: 0.5rem 0;
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
        }
        .ys-warning {
            font-size: 0.82rem;
            padding: 0.55rem 0.75rem;
            border-radius: var(--radius);
            border-left: 3px solid var(--warning);
            background: var(--warning-light);
            color: var(--warning);
        }
        .ys-warning.bad {
            border-left-color: var(--danger);
            background: var(--danger-light);
            color: var(--danger);
        }
        .ys-warning.ok {
            border-left-color: var(--success);
            background: var(--success-light);
            color: var(--success);
        }

        .ys-term-summary {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 0.85rem;
            margin: 0.85rem 0 0.5rem;
        }
        .ys-term-card {
            padding: 0.85rem 1rem;
            border-radius: var(--radius);
            background: var(--bg-subtle);
            border: 1px solid var(--border);
        }
        .ys-term-card.t1 { border-left: 4px solid var(--brand); }
        .ys-term-card.t2 { border-left: 4px solid var(--warning); }
        .ys-term-card.t3 { border-left: 4px solid var(--success); }
        .ys-term-card.t4 { border-left: 4px solid var(--info); }

        /* Closure & re-opening dates panel */
        .ys-breaks-title {
            font-size: 0.78rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            font-weight: var(--fw-semibold);
            margin: 1rem 0 0.5rem;
        }
        .ys-breaks-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 0.65rem;
        }
        .ys-break-card {
            padding: 0.75rem 0.9rem;
            border: 1px solid var(--border);
            border-left: 3px solid var(--warning);
            border-radius: var(--radius);
            background: var(--bg-card);
        }
        .ys-break-name {
            font-family: var(--font-display);
            font-weight: var(--fw-semibold);
            font-size: 0.92rem;
            margin-bottom: 0.4rem;
            color: var(--text);
        }
        .ys-break-line {
            font-size: 0.82rem;
            color: var(--text-secondary);
            line-height: 1.45;
            margin-bottom: 0.15rem;
        }
        .ys-break-line:last-child { margin-bottom: 0; }
        .ys-break-edit {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            margin-top: 0.6rem;
            padding-top: 0.6rem;
            border-top: 1px dashed var(--border);
        }
        .ys-break-edit label {
            display: flex;
            flex-direction: column;
            gap: 0.2rem;
            font-size: 0.72rem;
            font-weight: var(--fw-medium);
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.02em;
        }
        .ys-break-edit input {
            font-size: 0.85rem;
            padding: 0.3rem 0.4rem;
            border: 1px solid var(--border-strong);
            border-radius: var(--radius-sm);
            background: var(--bg-card);
            color: var(--text);
        }
        .ys-break-edit input[type="number"] { width: 4rem; }
        .ys-break-edit input:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 2px var(--brand-light);
        }
        .ys-term-name {
            font-family: var(--font-display);
            font-weight: var(--fw-semibold);
            margin-bottom: 0.2rem;
        }
        .ys-term-dates { font-size: 0.85rem; color: var(--text-secondary); }
        .ys-term-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

        .ys-disclosure {
            margin-top: 0.65rem;
            border-top: 1px solid var(--border);
            padding-top: 0.65rem;
        }
        .ys-disclosure summary {
            cursor: pointer;
            font-size: 0.82rem;
            color: var(--brand);
            font-weight: var(--fw-medium);
            list-style: none;
        }
        .ys-disclosure summary::before {
            content: '▸ ';
            transition: transform 0.15s;
            display: inline-block;
        }
        .ys-disclosure[open] summary::before { content: '▾ '; }

        .ys-calendar-wrap { margin-top: 0.65rem; overflow-x: auto; }
        .ys-calendar {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.82rem;
        }
        .ys-calendar th, .ys-calendar td {
            padding: 0.4rem 0.65rem;
            border-bottom: 1px solid var(--border);
            text-align: left;
        }
        .ys-calendar th {
            background: var(--bg-subtle);
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            font-weight: var(--fw-semibold);
        }
        .ys-calendar tr.holiday td { background: var(--bg-subtle); color: var(--text-muted); font-style: italic; }
        .ys-calendar tr.bankhol td { background: var(--warning-light); }
        .ys-calendar td.wnum { font-weight: var(--fw-semibold); width: 60px; }
        .ys-calendar td.term { width: 80px; }

        /* Drag-to-move on holiday rows */
        .ys-calendar tr.holiday { cursor: grab; user-select: none; }
        .ys-calendar tr.holiday:active { cursor: grabbing; }
        .ys-calendar tr.holiday.ys-dragging td { opacity: 0.4; }
        .ys-calendar tr.ys-drop-target td {
            background: var(--brand-light) !important;
            color: var(--brand) !important;
            font-style: normal !important;
            box-shadow: inset 0 -2px 0 var(--brand);
        }
        .ys-drag-handle {
            display: inline-block;
            color: var(--text-muted);
            font-weight: var(--fw-bold);
            margin-right: 0.3rem;
            opacity: 0.6;
        }
        .ys-calendar tr.holiday:hover .ys-drag-handle { opacity: 1; color: var(--brand); }

        /* Editable per-week notes input — borderless until focused */
        .ys-notes-stack { display: flex; flex-direction: column; gap: 0.2rem; }
        .ys-week-note {
            width: 100%;
            font: inherit;
            font-size: 0.78rem;
            padding: 0.2rem 0.35rem;
            border: 1px solid transparent;
            border-radius: var(--radius-sm);
            background: transparent;
            color: var(--text);
            transition: border-color 0.12s, background 0.12s;
            min-width: 100px;
        }
        .ys-week-note::placeholder { color: var(--text-muted); opacity: 0.55; font-style: italic; }
        .ys-week-note:hover { border-color: var(--border); background: rgba(0,0,0,0.015); }
        .ys-week-note:focus {
            outline: none;
            border-color: var(--brand);
            background: var(--bg-card);
        }
        /* On holiday rows, the input sits below the holiday label so make it darker for legibility */
        .ys-calendar tr.holiday .ys-week-note { color: var(--text); font-style: normal; }

        .ys-drag-hint {
            font-weight: var(--fw-regular);
            font-size: 0.72rem;
            color: var(--text-muted);
            text-transform: none;
            letter-spacing: 0;
        }

        .ys-moved-tag {
            display: inline-block;
            font-size: 0.62rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            background: var(--brand-light);
            color: var(--brand);
            padding: 0.1rem 0.45rem;
            border-radius: var(--radius-pill);
            font-weight: var(--fw-semibold);
            margin-left: 0.4rem;
            vertical-align: middle;
        }
        .ys-reset-btn {
            background: transparent;
            border: none;
            color: var(--brand);
            font-size: 0.72rem;
            font-weight: var(--fw-medium);
            cursor: pointer;
            padding: 0;
            margin-left: 0.25rem;
        }
        .ys-reset-btn:hover { text-decoration: underline; }

        /* Summer School preview cards (matches the website card style) */
        .ys-summer-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 1rem;
            margin: 0.85rem 0;
        }
        .ys-summer-card {
            background: #FFFFFF;
            border-radius: 14px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
            overflow: hidden;
            display: flex;
            flex-direction: column;
            position: relative;
        }
        .ys-summer-card .head {
            background: #1A1A1A;
            color: #FFFFFF;
            padding: 1rem 1rem 1.1rem;
            text-align: center;
            position: relative;
        }
        .ys-summer-card .head::after {
            content: '';
            position: absolute;
            left: 0; right: 0;
            bottom: -2px;
            height: 3px;
            background: var(--brand);
        }
        .ys-summer-card .head h4 {
            margin: 0;
            font-family: 'Source Sans 3', Arial, sans-serif;
            font-weight: 800;
            font-size: 1.05rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }
        .ys-summer-card .body {
            padding: 1rem 1rem 0.85rem;
            text-align: center;
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 0.55rem;
        }
        .ys-summer-card .ageBadge {
            display: inline-block;
            background: var(--brand-light);
            color: var(--brand);
            font-weight: 700;
            font-size: 0.7rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            padding: 0.3rem 0.85rem;
            border-radius: var(--radius-pill);
            align-self: center;
        }
        .ys-summer-card .dates {
            font-weight: 700;
            font-size: 0.92rem;
            color: var(--text);
            line-height: 1.35;
        }
        .ys-summer-card .features {
            list-style: none;
            margin: 0.4rem 0 0;
            padding: 0.65rem 0 0;
            border-top: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            gap: 0.3rem;
            font-size: 0.88rem;
            color: var(--text-secondary);
        }
        .ys-summer-card .features li.hl {
            color: var(--brand);
            font-weight: 700;
        }
        .ys-summer-card .priceBlock {
            background: #FFFFFF;
            border-top: 1px solid var(--border);
            padding: 1rem 1rem 1.1rem;
            text-align: center;
        }
        .ys-summer-card .priceBig {
            font-family: 'Source Sans 3', Arial, sans-serif;
            font-weight: 800;
            font-size: 2.1rem;
            color: var(--brand);
            line-height: 1;
        }
        .ys-summer-card .priceSub {
            font-size: 0.7rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-top: 0.3rem;
            font-weight: 600;
        }
        .ys-summer-edit-row {
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 0.75rem 0.9rem;
            margin-bottom: 0.6rem;
            background: var(--bg-card);
        }
        .ys-summer-edit-row .row1 {
            display: grid;
            grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
            gap: 0.4rem;
            margin-bottom: 0.45rem;
        }
        .ys-summer-edit-row .row2 {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 0.4rem;
            align-items: center;
        }
        .ys-summer-edit-row .field { min-height: 32px; padding: 0 0.5rem; font-size: 0.82rem; }
        .ys-summer-edit-row label.lbl {
            font-size: 0.68rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            display: block;
            margin-bottom: 2px;
        }
        .ys-summer-edit-row .hl-radio {
            display: flex;
            align-items: center;
            gap: 0.3rem;
            font-size: 0.78rem;
            color: var(--text-secondary);
            justify-content: center;
        }

        /* PDF builder block */
        .ys-pdf-builder {
            margin-top: 1rem;
            padding: 1rem 1.1rem;
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            background: var(--bg-card);
        }
        .ys-pdf-builder-title {
            font-family: var(--font-display);
            font-weight: var(--fw-semibold);
            font-size: 1rem;
            margin-bottom: 0.2rem;
        }
        .ys-pdf-builder-sub {
            font-size: 0.82rem;
            color: var(--text-muted);
            margin: 0 0 0.65rem 0;
            line-height: 1.45;
        }
        .ys-pdf-checks {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 0.4rem 0.85rem;
            margin-bottom: 0.85rem;
        }
        .ys-pdf-checks label {
            display: inline-flex;
            align-items: center;
            gap: 0.45rem;
            font-size: 0.88rem;
            color: var(--text);
            cursor: pointer;
            padding: 0.4rem 0.55rem;
            border-radius: var(--radius);
            transition: background 0.12s;
        }
        .ys-pdf-checks label:hover { background: var(--bg-subtle); }
        .ys-pdf-checks input[type="checkbox"] {
            width: 16px; height: 16px;
            cursor: pointer;
            accent-color: var(--brand);
        }
        .ys-pdf-generate { min-width: 220px; }
        .ys-pdf-mode {
            display: flex;
            align-items: center;
            margin-bottom: 0.85rem;
            padding-top: 0.4rem;
            border-top: 1px dashed var(--border);
        }
        .ys-pdf-mode label {
            display: inline-flex;
            align-items: center;
            gap: 0.45rem;
            font-size: 0.88rem;
            color: var(--text);
            cursor: pointer;
            padding: 0.4rem 0.55rem;
            border-radius: var(--radius);
            transition: background 0.12s;
        }
        .ys-pdf-mode label:hover { background: var(--bg-subtle); }
        .ys-pdf-mode input[type="checkbox"] {
            width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand);
        }
        .ys-pdf-mode-hint { color: var(--text-muted); font-weight: var(--fw-regular); }

        /* Cloud-sync status badge (sits next to the year picker in the page header) */
        .ys-cloud-slot { display: inline-flex; align-items: center; }
        .ys-cloud-status {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            font-size: 0.75rem;
            font-weight: var(--fw-medium);
            padding: 0.25rem 0.6rem;
            border-radius: var(--radius-pill);
            border: 1px solid var(--border);
            background: var(--bg-subtle);
            color: var(--text-secondary);
            line-height: 1.3;
            white-space: nowrap;
            max-width: 360px;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .ys-cloud-status.ok {
            background: var(--success-light);
            color: var(--success);
            border-color: var(--success-light);
        }
        .ys-cloud-status.warn {
            background: var(--warning-light);
            color: var(--warning);
            border-color: var(--warning-light);
        }
        .ys-cloud-status.pending { color: var(--text-muted); }

        .ys-table-wrap { margin-top: 0.5rem; }
        .ys-fee-table input.field {
            min-height: 32px;
            padding: 0 0.5rem;
            font-size: 0.85rem;
        }
        .ys-fee-table td { padding: 0.4rem 0.5rem; }
        .ys-fee-row-pct.up   { color: var(--success); font-weight: var(--fw-semibold); }
        .ys-fee-row-pct.down { color: var(--danger);  font-weight: var(--fw-semibold); }

        /* Fee blocks accordion (Year Setup Step 3 + Fees page) */
        .ys-fee-block {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-left: 4px solid var(--brand);
            border-radius: var(--radius);
            padding: 0.85rem 1rem;
            margin-top: 0.85rem;
        }
        .ys-fee-block:nth-of-type(2) { border-left-color: var(--warning); }
        .ys-fee-block:nth-of-type(3) { border-left-color: var(--success); }
        .ys-fee-block-head {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 0.85rem;
            margin-bottom: 0.5rem;
            flex-wrap: wrap;
        }
        .ys-fee-block-name {
            font-family: var(--font-display);
            font-weight: var(--fw-semibold);
            font-size: 1.05rem;
            background: transparent;
            border: 1px solid transparent;
            padding: 0.25rem 0.4rem;
            border-radius: var(--radius-sm);
            min-width: 240px;
            color: var(--text);
        }
        .ys-fee-block-name:hover { border-color: var(--border); }
        .ys-fee-block-name:focus {
            outline: none;
            border-color: var(--brand);
            background: var(--bg);
        }
        .ys-fee-perclass-toggle {
            font-size: 0.78rem;
            color: var(--text-muted);
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            cursor: pointer;
        }
        .ys-fee-perclass-toggle input[type="checkbox"] {
            width: 14px; height: 14px;
            accent-color: var(--brand);
            cursor: pointer;
        }
        .ys-fee-block-desc {
            width: 100%;
            font: inherit;
            font-size: 0.85rem;
            padding: 0.45rem 0.6rem;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: var(--bg-subtle);
            color: var(--text);
            margin-bottom: 0.5rem;
            resize: vertical;
            min-height: 44px;
        }
        .ys-fee-block-desc:focus {
            outline: none;
            border-color: var(--brand);
            background: var(--bg-card);
        }

        .ys-shows-list { display: flex; flex-direction: column; gap: 0.4rem; }
        .ys-show-row {
            display: grid;
            grid-template-columns: 150px 1fr 1fr auto;
            gap: 0.5rem;
            align-items: center;
        }
        .ys-show-row .field { min-height: 36px; padding: 0 0.6rem; font-size: 0.85rem; }
        .ys-show-row .icon-rm {
            background: transparent;
            border: 1px solid var(--border);
            color: var(--danger);
            width: 32px; height: 32px;
            border-radius: var(--radius);
            cursor: pointer;
            font-size: 0.85rem;
        }
        .ys-show-row .icon-rm:hover { background: var(--danger-light); border-color: var(--danger); }

        .ys-output-card { background: linear-gradient(180deg, var(--bg-card) 0%, var(--brand-light) 200%); }
        .ys-output-actions {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin-bottom: 0.85rem;
        }
        .ys-preview {
            background: #0f172a;
            color: #e2e8f0;
            padding: 1rem;
            border-radius: var(--radius);
            font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
            font-size: 0.78rem;
            line-height: 1.55;
            white-space: pre-wrap;
            max-height: 480px;
            overflow-y: auto;
            margin-top: 0.65rem;
        }
        .snapshot-empty {
            text-align: center;
            color: var(--text-muted);
            padding: 1.25rem;
            font-style: italic;
        }
        .snapshot-row {
            display: grid;
            grid-template-columns: 130px 1fr auto;
            gap: 0.75rem;
            align-items: center;
            padding: 0.55rem 0.75rem;
            border-bottom: 1px solid var(--border);
        }
        .snapshot-row:last-child { border-bottom: none; }
        .snapshot-row:nth-child(even) { background: rgba(0,0,0,0.015); }
        .snapshot-date {
            font-weight: var(--fw-semibold);
            color: var(--text);
        }
        .snapshot-summary {
            color: var(--text-secondary);
            font-size: 0.82rem;
            line-height: 1.35;
        }
        .snapshot-summary span { margin-right: 0.85rem; white-space: nowrap; }
        .snapshot-row-actions {
            display: flex;
            gap: 0.35rem;
        }
        .snapshot-icon-btn {
            min-height: auto;
            width: 32px;
            height: 32px;
            padding: 0;
            font-size: 0.85rem;
        }
        .snapshot-actions {
            display: flex;
            gap: 0.5rem;
            margin-top: 1rem;
            flex-wrap: wrap;
            padding-top: 0.85rem;
            border-top: 1px solid var(--border);
        }
        .snapshot-clear-btn {
            margin-left: auto;
            color: var(--danger);
            border-color: var(--danger-light);
        }
        .snapshot-clear-btn:hover {
            background: var(--danger-light);
            border-color: var(--danger);
        }

        .export-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
            gap: 1rem;
        }
        .export-card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            padding: 1rem 1.1rem;
            display: flex;
            flex-direction: column;
            gap: 0.65rem;
            box-shadow: var(--shadow-sm);
        }
        .export-card-header {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .export-card-title {
            font-family: var(--font-display);
            font-size: 1.05rem;
            font-weight: var(--fw-semibold);
            margin: 0;
        }
        .export-card-tag {
            margin-left: auto;
            font-size: 0.65rem;
            font-weight: var(--fw-semibold);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            padding: 0.18rem 0.45rem;
            border-radius: 4px;
            background: var(--bg-subtle);
            color: var(--text-muted);
        }
        .export-card-tag.windowed { background: var(--brand-light); color: var(--brand); }
        .export-card-desc {
            font-size: 0.84rem;
            color: var(--text-secondary);
            line-height: 1.45;
            margin: 0;
        }
        .export-prompt-wrap {
            background: var(--bg-subtle);
            border: 1px dashed var(--border-strong);
            border-radius: var(--radius);
            padding: 0.5rem 0.65rem;
        }
        .export-prompt-label {
            font-size: 0.65rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            font-weight: var(--fw-semibold);
            margin-bottom: 0.3rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .export-prompt-text {
            font-size: 0.78rem;
            color: var(--text);
            line-height: 1.45;
            font-family: 'Source Sans 3', monospace;
            white-space: pre-wrap;
            word-break: break-word;
        }
        .export-card-actions {
            display: flex;
            gap: 0.4rem;
            margin-top: auto;
        }
        .export-card-actions .btn {
            flex: 1;
            min-height: 38px;
            padding: 0 var(--space-3);
            font-size: 0.82rem;
        }
        .export-mini-link {
            background: transparent;
            border: none;
            color: var(--brand);
            font-size: 0.7rem;
            font-weight: var(--fw-semibold);
            cursor: pointer;
            padding: 0;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }
        .export-mini-link:hover { text-decoration: underline; }

/* ===== Block B: exits chips ===== */
                .exits-chip {
                    background: var(--bg-card);
                    border: 1px solid var(--border);
                    color: var(--text);
                    padding: 0.35rem 0.75rem;
                    border-radius: 18px;
                    font-size: 0.82rem;
                    cursor: pointer;
                    transition: all 0.15s;
                }
                .exits-chip:hover { background: var(--surface); border-color: var(--border-strong); }
                .exits-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ===== Block C: CRM panel ===== */
        /* CRM Panel Styles */
        .crm-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            opacity: 0;
            visibility: hidden;
            transition: all 0.2s ease;
            z-index: 999;
        }
        .crm-overlay.open { opacity: 1; visibility: visible; }
        
        .crm-panel {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0.95);
            width: 900px;
            max-width: 95vw;
            /* Fixed height so the panel does not resize when switching tabs.
               Content scrolls inside .crm-content instead. */
            height: min(720px, 90vh);
            background: #fff;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
            border-radius: 16px;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            opacity: 0;
            visibility: hidden;
            transition: all 0.2s ease;
            overflow: hidden;
        }
        .crm-panel.open { 
            opacity: 1; 
            visibility: visible;
            transform: translate(-50%, -50%) scale(1);
        }
        
        .crm-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 1.5rem;
            border-bottom: 1px solid var(--border);
            background: #fff;
        }
        .crm-header-left {
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        .crm-avatar {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: linear-gradient(135deg, #ED2347, #C81A38);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 1rem;
        }
        .crm-header-info h2 { margin: 0; font-size: 1.35rem; font-weight: 600; }
        .crm-subtitle { color: var(--text-muted); font-size: 0.9rem; }
        .crm-header-actions {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .crm-btn {
            padding: 0.5rem 1rem;
            border: 1px solid var(--border);
            border-radius: 6px;
            background: #fff;
            cursor: pointer;
            font-size: 0.85rem;
            transition: all 0.15s ease;
        }
        .crm-btn:hover { background: var(--surface); border-color: var(--text-muted); }
        .crm-close {
            background: none;
            border: none;
            font-size: 1.75rem;
            cursor: pointer;
            color: var(--text-muted);
            line-height: 1;
            padding: 0 0.5rem;
        }
        .crm-close:hover { color: var(--text); }
        
        .crm-body {
            display: flex;
            flex: 1;
            overflow: hidden;
            min-height: 0;          /* allow flex child to shrink so .crm-content can scroll */
        }
        .crm-sidebar {
            width: 160px;
            background: var(--surface);
            border-right: 1px solid var(--border);
            padding: 1rem 0;
            flex-shrink: 0;
        }
        .crm-tab {
            display: block;
            width: 100%;
            padding: 0.75rem 1.25rem;
            border: none;
            background: none;
            text-align: left;
            cursor: pointer;
            font-size: 0.9rem;
            color: var(--text-muted);
            border-left: 3px solid transparent;
            transition: all 0.15s ease;
        }
        .crm-tab:hover { color: var(--text); background: rgba(0,0,0,0.03); }
        .crm-tab.active { 
            color: var(--accent); 
            font-weight: 600; 
            border-left-color: var(--accent);
            background: rgba(237, 35, 71, 0.05);
        }
        
        .crm-content {
            flex: 1;
            overflow-y: auto;
            padding: 1rem 1.25rem;          /* tightened from 1.5rem */
        }

        /* Metrics Row */
        .crm-metrics {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 0.65rem;                   /* tightened from 1rem */
            margin-bottom: 0.85rem;         /* tightened from 1.5rem */
        }
        .crm-metric {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 0.6rem 0.75rem;        /* tightened from 1rem */
            text-align: center;
        }
        .crm-metric.clickable {
            cursor: pointer;
            transition: all 0.15s ease;
        }
        .crm-metric.clickable:hover {
            border-color: var(--accent);
            background: var(--bg-subtle);
        }
        
        /* Student Picker Modal */
        .student-picker-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2000;
        }
        .student-picker-modal {
            background: var(--bg);
            border-radius: 12px;
            box-shadow: 0 20px 40px rgba(0,0,0,0.3);
            width: 90%;
            max-width: 400px;
            max-height: 80vh;
            overflow: hidden;
        }
        .student-picker-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 1.25rem;
            border-bottom: 1px solid var(--border);
        }
        .student-picker-header h3 {
            margin: 0;
            font-size: 1.1rem;
        }
        .student-picker-close {
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--text-muted);
            line-height: 1;
        }
        .student-picker-close:hover {
            color: var(--text);
        }
        .student-picker-list {
            max-height: 60vh;
            overflow-y: auto;
        }
        .student-picker-item {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem 1.25rem;
            cursor: pointer;
            border-bottom: 1px solid var(--border);
            transition: background 0.15s ease;
        }
        .student-picker-item:last-child {
            border-bottom: none;
        }
        .student-picker-item:hover {
            background: var(--bg-subtle);
        }
        .student-picker-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, #ED2347, #C81A38);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            font-size: 0.85rem;
            flex-shrink: 0;
        }
        .student-picker-info {
            flex: 1;
            min-width: 0;
        }
        .student-picker-name {
            font-weight: 600;
            margin-bottom: 0.15rem;
        }
        .student-picker-meta {
            font-size: 0.8rem;
            color: var(--text-muted);
        }
        .student-picker-arrow {
            color: var(--text-muted);
            font-size: 1.25rem;
        }
        
        .crm-metric.highlight {
            background: linear-gradient(135deg, #ED2347, #C81A38);
            border-color: transparent;
            color: #fff;
        }
        .crm-metric-label {
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            margin-bottom: 0.25rem;
        }
        .crm-metric.highlight .crm-metric-label { color: rgba(255,255,255,0.8); }
        .crm-metric-value {
            font-size: 1.15rem;             /* tightened from 1.5rem */
            font-weight: 700;
            line-height: 1.2;
        }

        /* Contact Card */
        .crm-contact-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 0.85rem 1rem;          /* tightened from 1.25rem */
            margin-bottom: 0.85rem;         /* tightened from 1.5rem */
        }
        .crm-contact-row {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 0.75rem;                   /* tightened from 1rem */
            margin-bottom: 0.65rem;         /* tightened from 1rem */
        }
        .crm-contact-row:last-child { margin-bottom: 0; }
        .crm-contact-field label {
            display: block;
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            margin-bottom: 0.2rem;          /* tightened from 0.35rem */
        }
        .crm-contact-field .value {
            font-size: 0.9rem;              /* tightened from 0.95rem */
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 0.4rem;
            line-height: 1.3;
        }
        .crm-contact-field .value a {
            color: var(--accent);
            text-decoration: none;
        }
        .crm-contact-field .value a:hover { text-decoration: underline; }
        .crm-icon-btn {
            width: 26px;                    /* tightened from 32px */
            height: 26px;
            border-radius: 5px;
            border: 1px solid var(--border);
            background: #fff;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
            transition: background 0.15s ease, border-color 0.15s ease;
        }
        .crm-icon-btn:hover { background: var(--surface); }
        .crm-icon-btn.primary { background: #10b981; border-color: #10b981; color: #fff; }
        .crm-icon-btn.primary:hover { background: #059669; }
        
        /* Section styling */
        .crm-section {
            margin-bottom: 0.85rem;         /* tightened from 1.5rem */
        }
        .crm-section:last-child { margin-bottom: 0; }
        .crm-section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.5rem;          /* tightened from 0.75rem */
        }
        .crm-section-title {
            font-size: 0.72rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            font-weight: 600;
            margin-bottom: 0.4rem;          /* default tight spacing */
        }
        /* Override inline `style="margin-bottom: 1rem"` set on the contact-card title */
        .crm-contact-card .crm-section-title { margin-bottom: 0.5rem !important; }

        .crm-field {
            display: flex;
            justify-content: space-between;
            padding: 0.35rem 0;             /* tightened from 0.6rem */
            border-bottom: 1px solid var(--border);
            font-size: 0.88rem;
            line-height: 1.3;
        }
        .crm-field:last-child { border-bottom: none; }
        .crm-field-label { color: var(--text-muted); font-size: 0.85rem; }
        .crm-field-value { font-weight: 500; text-align: right; max-width: 60%; }
        
        /* Timeline */
        .crm-timeline {
            position: relative;
            padding-left: 1.5rem;
        }
        .crm-timeline::before {
            content: '';
            position: absolute;
            left: 0.35rem;
            top: 0.5rem;
            bottom: 0.5rem;
            width: 2px;
            background: var(--border);
        }
        .crm-timeline-item {
            position: relative;
            padding-bottom: 1rem;
        }
        .crm-timeline-item::before {
            content: '';
            position: absolute;
            left: -1.15rem;
            top: 0.35rem;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: var(--accent);
            border: 2px solid #fff;
        }
        .crm-timeline-item.enrol::before { background: #10b981; }
        .crm-timeline-item.exit::before { background: #ef4444; }
        .crm-timeline-item.trial::before { background: #f59e0b; }
        .crm-timeline-item.lead::before { background: #6366f1; }
        .crm-timeline-date { font-size: 0.8rem; color: var(--text-muted); }
        .crm-timeline-event { font-weight: 500; }
        
        /* Related cards */
        .crm-linked-card {
            background: #fff;
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 1rem 1.25rem;
            margin-bottom: 0.75rem;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .crm-linked-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
        .crm-linked-name { font-weight: 600; margin-bottom: 0.25rem; }
        .crm-linked-meta { font-size: 0.85rem; color: var(--text-muted); }
        .crm-linked-arrow { color: var(--text-muted); font-size: 1.25rem; }
        
        .btn-jump-customer {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 1rem;
            background: var(--accent-light);
            color: var(--accent);
            border: 1px solid var(--accent);
            border-radius: var(--radius);
            font-size: 0.85rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.15s;
        }
        .btn-jump-customer:hover {
            background: var(--accent);
            color: white;
        }
        
        /* Notes */
        .crm-notes-input {
            width: 100%;
            padding: 0.75rem;
            border: 1px solid var(--border);
            border-radius: 8px;
            font-family: inherit;
            font-size: 0.9rem;
            resize: vertical;
        }
        .crm-notes-input:focus { outline: none; border-color: var(--accent); }
        
        .crm-notes-log {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 0.5rem;
            max-height: 280px;
            overflow-y: auto;
            font-size: 0.9rem;
        }
        .crm-note-entry {
            padding: 0.75rem;
            background: #fff;
            border-radius: 6px;
            margin-bottom: 0.5rem;
            border: 1px solid var(--border);
        }
        .crm-note-entry:last-child { margin-bottom: 0; }
        .crm-note-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.35rem;
        }
        .crm-note-date {
            font-size: 0.75rem;
            color: var(--text-muted);
        }
        .crm-note-delete {
            background: none;
            border: none;
            color: #dc2626;
            cursor: pointer;
            font-size: 0.8rem;
            padding: 0;
            opacity: 0.6;
        }
        .crm-note-delete:hover { opacity: 1; }
        .crm-note-text {
            color: var(--text);
            line-height: 1.5;
            white-space: pre-wrap;
        }
        
        /* Transactions table */
        .crm-transactions-table {
            width: 100%;
            font-size: 0.85rem;
        }
        .crm-transactions-table th {
            text-align: left;
            padding: 0.5rem;
            font-weight: 600;
            color: var(--text-muted);
            border-bottom: 2px solid var(--border);
            font-size: 0.75rem;
            text-transform: uppercase;
        }
        .crm-transactions-table td {
            padding: 0.5rem;
            border-bottom: 1px solid var(--border);
        }
        .crm-transactions-total {
            background: var(--surface);
            font-weight: 600;
        }
        
        /* Journey indicator for Related tab */
        .crm-journey {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 1rem;
            background: linear-gradient(90deg, #fef3c7 0%, #d1fae5 50%, #dbeafe 100%);
            border-radius: 8px;
            margin-bottom: 1rem;
            font-size: 0.85rem;
        }
        .crm-journey-step {
            display: flex;
            align-items: center;
            gap: 0.35rem;
        }
        .crm-journey-step.active { font-weight: 600; }
        .crm-journey-arrow { color: var(--text-muted); }
        
        /* Tab content */
        .crm-tab-content { display: none; }
        .crm-tab-content.active { display: block; }
        
        /* Smooth hover transition on data-table rows.
           Cursor + background-on-hover are handled in the main .data-table rule
           (only rows with onclick/[data-clickable] are pointer + tinted). */
        .data-table tbody tr td { transition: background 0.12s ease; }
        
        @media (max-width: 768px) {
            .crm-panel { width: 100%; max-width: 100%; max-height: 100%; border-radius: 0; }
            .crm-sidebar { width: 120px; }
            .crm-metrics { grid-template-columns: repeat(2, 1fr); }
            .crm-contact-row { grid-template-columns: 1fr; }
        }

/* ===== Block D: import/export ===== */
        .import-dropzone {
            border: 2px dashed var(--border);
            border-radius: 12px;
            padding: 3rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
        }
        .import-dropzone:hover, .import-dropzone.drag-over {
            border-color: var(--accent);
            background: rgba(237, 35, 71, 0.05);
        }
        .import-dropzone input {
            position: absolute;
            inset: 0;
            opacity: 0;
            cursor: pointer;
        }

        /* Compact dropzone used inside Workflow step rows */
        .wf-dropzone:hover, .wf-dropzone.drag-over {
            border-color: var(--accent) !important;
            background: var(--accent-light) !important;
            color: var(--text) !important;
        }

        /* Bulk drop zone at top of a workflow card */
        .wf-bulk-drop:hover, .wf-bulk-drop.drag-over {
            border-color: var(--accent);
            background: var(--accent-light);
        }
        .import-log { max-height: 200px; overflow-y: auto; }
        .import-log-empty { padding: 2rem; text-align: center; color: var(--text-muted); }
        .import-log-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.75rem 1rem;
            border-bottom: 1px solid var(--border);
            font-size: 0.9rem;
        }
        .import-log-item:last-child { border-bottom: none; }

/* ===== Login gate + signed-in badge ===== */
        .padmin-login-overlay {
            position: fixed;
            inset: 0;
            z-index: 100000;
            display: none;               /* toggled to flex by JS */
            align-items: center;
            justify-content: center;
            background: var(--bg);
            padding: var(--space-4);
        }
        .padmin-login-card {
            width: 100%;
            max-width: 380px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            padding: var(--space-6);
            display: flex;
            flex-direction: column;
            gap: var(--space-3);
        }
        .padmin-login-logo {
            display: block;
            width: 100%;
            max-width: 180px;
            height: auto;
            margin: 0 auto var(--space-2);
        }
        .padmin-login-brand {
            font-family: var(--font-brand);
            font-weight: var(--fw-bold);
            font-size: 1.35rem;
            color: var(--brand);
            text-align: center;
        }
        .padmin-login-sub {
            font-size: 0.85rem;
            color: var(--text-muted);
            text-align: center;
            margin-bottom: var(--space-3);
        }
        .padmin-login-field {
            display: flex;
            flex-direction: column;
            gap: 0.3rem;
            font-size: 0.8rem;
            font-weight: var(--fw-medium);
            color: var(--text-secondary);
        }
        .padmin-login-field input {
            font-size: 0.95rem;
            padding: 0.55rem 0.65rem;
            border: 1px solid var(--border-strong);
            border-radius: var(--radius);
            background: var(--bg-card);
            color: var(--text);
        }
        .padmin-login-field input:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 2px var(--brand-light);
        }
        .padmin-login-btn { margin-top: var(--space-2); width: 100%; justify-content: center; }
        .padmin-login-error {
            font-size: 0.82rem;
            color: var(--danger);
            min-height: 1.1em;
            text-align: center;
        }
        .padmin-user-badge {
            position: fixed;
            top: 0.6rem;
            right: 0.8rem;
            z-index: 9000;
            display: none;               /* toggled to flex by JS */
            align-items: center;
            gap: 0.5rem;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-pill);
            padding: 0.25rem 0.35rem 0.25rem 0.75rem;
            box-shadow: var(--shadow-sm);
            font-size: 0.78rem;
        }
        .padmin-user-email { color: var(--text-muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .padmin-signout-btn {
            border: 1px solid var(--border-strong);
            background: var(--bg-subtle);
            color: var(--text-secondary);
            border-radius: var(--radius-pill);
            padding: 0.2rem 0.6rem;
            font-size: 0.76rem;
            cursor: pointer;
        }
        .padmin-signout-btn:hover { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }