/* ── Hanham Agency Management — "Chart House" ─────────────────
   Design language: editorial ledger + maritime chart paper + Bloomberg density.
   Fonts: Fraunces (display serif), Geist (body sans), Geist Mono (tabular numeric).
   Loaded via <link> in base.html.
──────────────────────────────────────────────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Sidebar — deeper, warmer charcoal than pure black */
    --sidebar-bg: #13131a;
    --sidebar-hover: #1e1e25;
    --sidebar-active: #2a2a33;
    --sidebar-text: #a8a8b3;
    --sidebar-muted: #5a5a66;
    --sidebar-label: #6e6e7a;

    /* Paper surfaces — warm off-white evokes chart paper, not clinical white */
    --main-bg: #fafaf8;
    --card-bg: #ffffff;
    --card-bg-subtle: #f5f4ef;
    --border: #e6e3db;
    --border-light: #efede7;
    --border-strong: #d6d2c7;

    /* Ink — rich charcoal with warmth, not pure black */
    --text-primary: #1a1a1e;
    --text-secondary: #5c5c66;
    --text-muted: #8e8e99;

    /* Primary accent — retained salmon, slightly deepened for print feel */
    --accent: #d4765a;
    --accent-hover: #c06048;
    --accent-light: #fbe8df;
    --accent-tint: rgba(212, 118, 90, 0.08);

    /* Secondary accent — deep teal, evokes deep water, used for data/trust */
    --teal: #0f4c5c;
    --teal-hover: #0a3a47;
    --teal-light: #e3edef;
    --teal-tint: rgba(15, 76, 92, 0.08);

    /* Semantic statuses — muted, ledger-appropriate (brick / caramel / forest / indigo) */
    --success: #2d6a4f;
    --success-bg: #e8f0ea;
    --warning: #c77d14;
    --warning-bg: #faf0e0;
    --danger: #c44536;
    --danger-bg: #f9e8e5;
    --info: #3d5a80;
    --info-bg: #e6ecf3;

    /* Geometry — 4px baseline grid, tighter radii than stock SaaS */
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    /* Shadows — subtle, print-like */
    --shadow-sm: 0 1px 2px rgba(26, 26, 30, 0.04);
    --shadow: 0 1px 3px rgba(26, 26, 30, 0.06), 0 1px 2px rgba(26, 26, 30, 0.04);
    --shadow-lg: 0 4px 16px rgba(26, 26, 30, 0.08);
    --shadow-overlay: 0 20px 48px rgba(26, 26, 30, 0.18), 0 4px 12px rgba(26, 26, 30, 0.08);

    /* Motion */
    --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
    --font-body: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', 'JetBrains Mono', monospace;
}

/* ── Dark Mode ──────────────────────────────────── */

[data-theme="dark"] {
    --main-bg: #0e0e12;
    --card-bg: #18181d;
    --card-bg-subtle: #1f1f25;
    --border: #28282f;
    --border-light: #202026;
    --border-strong: #353540;
    --text-primary: #e8e6df;
    --text-secondary: #a8a8b3;
    --text-muted: #6e6e7a;
    --accent-light: rgba(212, 118, 90, 0.16);
    --accent-tint: rgba(212, 118, 90, 0.10);
    --teal-light: rgba(69, 142, 162, 0.16);
    --teal-tint: rgba(69, 142, 162, 0.10);
    --teal: #458ea2;
    --success-bg: rgba(45, 106, 79, 0.18);
    --warning-bg: rgba(199, 125, 20, 0.16);
    --danger-bg: rgba(196, 69, 54, 0.16);
    --info-bg: rgba(61, 90, 128, 0.18);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.36), 0 1px 2px rgba(0, 0, 0, 0.22);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.48);
    --shadow-overlay: 0 20px 48px rgba(0, 0, 0, 0.65), 0 4px 12px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .page-header { background: rgba(14, 14, 18, 0.88); }
[data-theme="dark"] .data-table thead { background: var(--card-bg-subtle); }
[data-theme="dark"] .data-table th:hover { background: #252530; }
[data-theme="dark"] .data-table tr:hover td { background: #22222a; }
[data-theme="dark"] .kanban-column { background: var(--card-bg-subtle); }
[data-theme="dark"] .kanban-count { background: #2a2a33; color: var(--text-secondary); }
[data-theme="dark"] .badge-muted { background: #2a2a33; }
[data-theme="dark"] .btn:hover { background: #2a2a33; border-color: #3a3a45; }
[data-theme="dark"] .search-input,
[data-theme="dark"] .filter-select { background: var(--card-bg); color: var(--text-primary); }
[data-theme="dark"] .empty-state-icon { background: #2a2a33; }
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #1a1a1f 25%, #2a2a33 50%, #1a1a1f 75%);
    background-size: 200% 100%;
}

/* ── Theme Toggle ──────────────────────────────── */

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--sidebar-muted);
    font-size: 12px;
    border: none;
    background: none;
    width: 100%;
    transition: color var(--transition);
}

.theme-toggle:hover {
    color: #fff;
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sun-icon { display: none; }
.moon-icon { display: block; }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

body {
    font-family: var(--font-body);
    background: var(--main-bg);
    min-height: 100vh;
    display: flex;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'ss01', 'ss02', 'cv11';
    text-rendering: optimizeLegibility;
}

/* Display type — editorial serif for page titles, brand, h1/h2/h3 */
h1, h2, h3, .font-display {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    letter-spacing: -0.01em;
}

/* Tabular numerics everywhere numbers live in a data context */
.font-mono,
.mono,
.data-table,
.data-table td,
.data-table th,
.kpi-value,
.kanban-card-premium,
.timeline-item-date {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' on, 'lnum' on;
}

/* ── Sidebar ────────────────────────────────────── */

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid #2a2a33;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-icon svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.brand-name {
    color: #fff;
    font-weight: 500;
    font-size: 17px;
    font-family: var(--font-display);
    letter-spacing: -0.015em;
}

.brand-sub {
    color: var(--sidebar-muted);
    font-size: 12px;
}

.nav-links {
    padding: 12px 8px;
    flex: 1;
}

.nav-separator {
    height: 1px;
    background: #2a2a33;
    margin: 8px 12px;
}

.nav-group-label {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sidebar-label);
    padding: 14px 14px 6px;
    margin-top: 6px;
}

.nav-group-label:first-child {
    margin-top: 0;
    padding-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 400;
    transition: all var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item:hover .nav-svg { opacity: 1; }

.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.nav-item.active .nav-svg { opacity: 1; }

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-svg {
    width: 18px;
    height: 18px;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #2a2a33;
}

.sync-status {
    color: var(--sidebar-muted);
    font-size: 11px;
}

/* ── Main Content ───────────────────────────────── */

.content {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
    max-width: calc(100vw - 240px);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: rgba(248, 249, 251, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-optical-sizing: auto;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-body {
    padding: 24px 32px;
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Animations ─────────────────────────────────── */

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

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

@keyframes subtlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Cards & KPIs ───────────────────────────────── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.04s; }
.kpi-card:nth-child(2) { animation-delay: 0.08s; }
.kpi-card:nth-child(3) { animation-delay: 0.12s; }
.kpi-card:nth-child(4) { animation-delay: 0.16s; }
.kpi-card:nth-child(5) { animation-delay: 0.20s; }
.kpi-card:nth-child(6) { animation-delay: 0.24s; }

.kpi-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon svg {
    width: 18px;
    height: 18px;
}

.kpi-icon.accent { background: var(--accent-light); color: var(--accent); }
.kpi-icon.success { background: var(--success-bg); color: var(--success); }
.kpi-icon.warning { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.danger { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.info { background: var(--info-bg); color: var(--info); }
.kpi-icon.muted { background: var(--border-light); color: var(--text-muted); }

.kpi-label {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.kpi-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
    font-optical-sizing: auto;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' on, 'lnum' on;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.kpi-sparkline {
    margin-top: 12px;
    height: 32px;
}

/* Legacy left-border variants (still used by endorsements etc.) */
.kpi-card.accent { border-left: 4px solid var(--accent); }
.kpi-card.success { border-left: 4px solid var(--success); }
.kpi-card.warning { border-left: 4px solid var(--warning); }
.kpi-card.danger { border-left: 4px solid var(--danger); }
.kpi-card.info { border-left: 4px solid var(--info); }

/* ── Charts ─────────────────────────────────────── */

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.chart-container {
    position: relative;
    height: 260px;
}

/* ── Tables ─────────────────────────────────────── */

.data-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 24px;
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.data-card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--card-bg-subtle);
    border-bottom: 1px solid var(--border-strong);
}

.data-table th {
    padding: 9px 16px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color var(--transition), background var(--transition);
}

.data-table th:hover {
    color: var(--text-primary);
    background: var(--border-light);
}

.data-table th[data-sort-dir="asc"]::after { content: ' \2191'; color: var(--accent); }
.data-table th[data-sort-dir="desc"]::after { content: ' \2193'; color: var(--accent); }

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-primary);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tr:hover td {
    background: var(--card-bg-subtle);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* ── Client Table — Sticky Column & Letter Nav ──── */

.data-table .col-sticky {
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
}

.data-table thead .col-sticky { background: var(--card-bg-subtle); }
.data-table tbody tr:hover .col-sticky { background: var(--card-bg-subtle); }

.data-table .col-mono { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.data-table .col-sm { font-size: 12px; }
.data-table .col-right { text-align: right; }
.data-table .col-notes { max-width: 200px; }

.letter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
}

.letter-btn {
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: background var(--transition), color var(--transition);
}

.letter-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.letter-btn.letter-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.letter-disabled {
    padding: 4px 10px;
    font-size: 13px;
    color: var(--text-muted);
    opacity: 0.4;
}

/* ── Status Badges ──────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.badge-active, .badge-bound { background: var(--success-bg); color: var(--success); }
.badge-active::before, .badge-bound::before { background: var(--success); }
.badge-pending, .badge-quoted { background: var(--info-bg); color: var(--info); }
.badge-pending::before, .badge-quoted::before { background: var(--info); }
.badge-warning, .badge-binder { background: var(--warning-bg); color: var(--warning); }
.badge-warning::before, .badge-binder::before { background: var(--warning); }
.badge-danger, .badge-expired, .badge-lost { background: var(--danger-bg); color: var(--danger); }
.badge-danger::before, .badge-lost::before { background: var(--danger); }
.badge-expired::before { background: var(--danger); }
.badge-muted { background: var(--card-bg-subtle); color: var(--text-muted); }
.badge-muted::before { display: none; }
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-accent::before { background: var(--accent); }

.badge-danger.pulse { animation: subtlePulse 2s ease-in-out infinite; }

/* ── Kanban ──────────────────────────────────────── */

.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
}

.kanban-column {
    min-width: 260px;
    max-width: 300px;
    flex: 1;
    background: var(--card-bg-subtle);
    border-radius: var(--radius);
    padding: 10px;
    border: 1px solid var(--border);
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 4px 10px;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}

.kanban-header h4 {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    font-optical-sizing: auto;
}

.kanban-header-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.kanban-count {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.kanban-col-sum {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.kanban-cards { min-height: 60px; }
.kanban-card {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 6px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-left: 3px solid var(--success);  /* fresh-green default age halo */
    cursor: grab;
    transition: box-shadow var(--transition), transform var(--transition);
}
.kanban-card:active { cursor: grabbing; }
.kanban-ghost { opacity: 0.4; }
.kanban-drag { box-shadow: var(--shadow-lg); transform: rotate(2deg); }
.kanban-card-error { border-color: var(--danger) !important; animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.kanban-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.kanban-card-name {
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 2px;
    color: var(--text-primary);
    line-height: 1.3;
}

.kanban-card-detail {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-bottom: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-light);
}

.kanban-card-premium {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 12.5px;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.kanban-card-days {
    font-size: 10.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ── Renewal Timeline ───────────────────────────── */

.timeline-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.timeline-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.timeline-section.urgent { border-top: 3px solid var(--danger); }
.timeline-section.soon { border-top: 3px solid var(--warning); }
.timeline-section.upcoming { border-top: 3px solid var(--success); }

.timeline-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-item-info {
    flex: 1;
}

.timeline-item-name {
    font-weight: 500;
    font-size: 13px;
}

.timeline-item-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline-item-date {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 12px;
}

/* ── Search & Filter ────────────────────────────── */

.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--card-bg);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 118, 90, 0.1);
}

.filter-select {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--card-bg);
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition);
}

.filter-select:focus {
    border-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all var(--transition);
    text-decoration: none;
}

.btn:hover { background: var(--card-bg-subtle); border-color: var(--border-strong); }
.btn:active { transform: scale(0.97); }
.btn-accent { background: var(--accent); color: #fff; border-color: transparent; }
.btn-accent:hover { background: var(--accent-hover); box-shadow: 0 2px 4px rgba(212, 118, 90, 0.3); }

/* ── Activity Feed ──────────────────────────────── */

.activity-feed {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.activity-item {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: background var(--transition);
}

.activity-item:hover {
    background: var(--card-bg-subtle);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-dot.change { background: var(--info); }
.activity-dot.create { background: var(--success); }
.activity-dot.delete { background: var(--danger); }

.activity-text {
    flex: 1;
}

.activity-text strong {
    font-weight: 600;
}

.activity-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Client Cards ───────────────────────────────── */

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.client-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: box-shadow var(--transition), transform var(--transition);
}

.client-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.client-card-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.client-card-name a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition);
}

.client-card-name a:hover {
    color: var(--accent);
}

.client-card-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.client-card-label {
    color: var(--text-secondary);
}

.client-card-value {
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-card-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
}

/* ── Empty State ────────────────────────────────── */

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

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background: var(--border-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* ── Utility ────────────────────────────────────── */

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.font-mono { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px 0;
}

.btn-page { min-width: 36px; }

.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* ── Responsive ─────────────────────────────────── */

@media (max-width: 1280px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .hamburger-btn { display: flex; align-items: center; }
    .sidebar { position: fixed; z-index: 100; width: 240px; transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
    .sidebar.sidebar-open { transform: translateX(0); }
    .content { margin-left: 0; max-width: 100vw; overflow-x: hidden; }
    .chart-row { grid-template-columns: 1fr; }
    .timeline-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .page-body { padding: 20px 16px; }
}

@media (max-width: 768px) {
    .data-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 700px; }
    .data-table td, .data-table th { padding: 8px 12px; font-size: 12px; }
    .search-bar { flex-direction: column; gap: 8px; }
    .search-bar .search-input { width: 100% !important; }
    .header-actions { flex-wrap: wrap; }
    .chart-container { height: 200px; }
}

@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .kanban-board { flex-direction: column; }
    .kanban-column { max-width: none; min-width: auto; }
}

/* ── Section Cards ────────────────────────────── */
.section-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}
.section-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* ── Modal Dialog ──────────────────────────────── */
.modal { border: none; border-radius: var(--radius-md); padding: 0; box-shadow: var(--shadow-lg); max-width: 480px; width: 90%; }
.modal::backdrop { background: rgba(0,0,0,0.5); }
.modal-content { padding: 24px; }
.modal-content h3 { margin-bottom: 16px; font-size: 18px; color: var(--text-primary); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text-secondary); }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: var(--bg); color: var(--text-primary); }
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,118,90,0.15); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: 0.9; }

/* ── Inline Editing ────────────────────────────── */
.editable { cursor: pointer; padding: 2px 6px; border-radius: 3px; transition: background 0.15s; }
.editable:hover { background: var(--accent-subtle, rgba(212,118,90,0.08)); }
.editable-input { padding: 4px 8px; border: 1px solid var(--accent); border-radius: 3px; font: inherit; font-size: inherit; width: 100%; background: var(--bg); color: var(--text-primary); }
.save-indicator { display: inline-block; color: var(--green, #22c55e); font-size: 11px; margin-left: 4px; opacity: 0; transition: opacity 0.3s; }
.save-indicator.show { opacity: 1; }

/* ── Delete Button ────────────────────────────── */
.btn-delete { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px; color: var(--text-muted); opacity: 0.4; transition: opacity 0.15s, color 0.15s; }
.btn-delete:hover { opacity: 1; color: var(--danger, #ef4444); }
tr:hover .btn-delete, .kanban-card:hover .btn-delete { opacity: 0.7; }

/* ── Sidebar User ────────────────────────────── */
.sidebar-user { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; margin-top: 8px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.sidebar-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout { color: var(--text-muted); opacity: 0.6; transition: opacity 0.15s; }
.sidebar-logout:hover { opacity: 1; color: var(--danger, #ef4444); }

/* ── Nav Badges ───────────────────────────────── */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 10px; font-weight: 700; line-height: 1; margin-left: 6px; }
.nav-badge.danger { background: var(--danger); color: #fff; }
.nav-badge.accent { background: var(--accent); color: #fff; }
.nav-badge.info { background: var(--info); color: #fff; }

/* ── Toast Notifications ──────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1100; display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--card-bg); border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 13px; color: var(--text-primary); max-width: 360px; transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.toast.toast-show { transform: translateX(0); }
.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }
.toast-icon { flex-shrink: 0; display: flex; }
.toast-msg { flex: 1; line-height: 1.4; }

/* ── Danger Button ───────────────────────────── */
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

/* ── Bulk Action Bar ────────────────────────── */
.bulk-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px 24px; display: flex; align-items: center; gap: 16px; z-index: 100; font-size: 14px; }
.bulk-bar .btn-sm { padding: 6px 14px; font-size: 12px; }

/* ── Autocomplete Dropdown ───────────────────── */
.autocomplete-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 200; max-height: 320px; overflow-y: auto; display: none; }
.autocomplete-dropdown.active { display: block; }
.ac-item { display: block; padding: 10px 14px; text-decoration: none; color: var(--text-primary); border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background 0.15s; }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.ac-active { background: var(--accent); color: #fff; }
.ac-item:hover .ac-meta, .ac-item.ac-active .ac-meta { color: rgba(255,255,255,0.8); }
.ac-name { font-weight: 500; font-size: 14px; }
.ac-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ac-empty { padding: 12px 14px; color: var(--text-muted); font-size: 13px; text-align: center; }

/* ── Button Loading & Disabled States ─────────── */
.btn:disabled, .btn.btn-loading { opacity: 0.55; pointer-events: none; cursor: not-allowed; }
.btn.btn-loading::after { content: ''; width: 12px; height: 12px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.6s linear infinite; margin-left: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton loaders ─────────────────────────── */
.skeleton-text { height: 14px; width: 80%; margin-bottom: 10px; border-radius: 4px; }
.skeleton-kpi { height: 32px; width: 50%; border-radius: 4px; }
.skeleton-row { height: 44px; width: 100%; margin-bottom: 6px; border-radius: 6px; }

/* ── Tab Navigation ───────────────────────────── */
.tab-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 10px 20px; font-size: 13px; font-weight: 500; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: color var(--transition), border-color var(--transition); }
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeInUp 0.2s ease; }

/* ── Email Timeline ───────────────────────────── */
.email-list { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.email-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background var(--transition); }
.email-item:last-child { border-bottom: none; }
.email-item:hover { background: var(--hover, rgba(0,0,0,0.02)); }
.email-direction { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.email-direction.sent { background: var(--accent-light, #fdf0ec); color: var(--accent); }
.email-direction.received { background: var(--info-bg); color: var(--info); }
.email-content { flex: 1; min-width: 0; }
.email-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.email-subject { font-size: 13px; font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.email-snippet { font-size: 12px; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-from { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.email-body { display: none; margin-top: 12px; padding: 12px; background: var(--main-bg); border-radius: var(--radius-sm); font-size: 13px; line-height: 1.6; max-height: 400px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.email-item.expanded .email-body { display: block; animation: fadeInUp 0.15s ease; }
.email-item.expanded .email-snippet { display: none; }

/* ── Document Viewer ──────────────────────────── */
.doc-list { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.doc-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background var(--transition); }
.doc-item:last-child { border-bottom: none; }
.doc-item:hover { background: var(--hover, rgba(0,0,0,0.02)); }
.doc-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.doc-icon.pdf { background: #fef2f2; color: #dc2626; }
.doc-icon.image { background: #eff6ff; color: #2563eb; }
.doc-icon.other { background: #f3f4f6; color: #6b7280; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* PDF viewer modal */
.pdf-viewer-modal { position: fixed; inset: 0; z-index: 200; background: var(--card-bg); display: none; flex-direction: column; }
.pdf-viewer-modal.active { display: flex; }
.pdf-viewer-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.pdf-viewer-header span { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-viewer-header button { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
.pdf-viewer-header button:hover { color: var(--text-primary); }

/* Image lightbox */
.lightbox { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; }
.lightbox.active { display: flex; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); }
.lightbox-content { position: relative; z-index: 1; max-width: 90vw; max-height: 90vh; }
.lightbox-content img { max-width: 90vw; max-height: 85vh; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.lightbox-close { position: absolute; top: -36px; right: 0; background: none; border: none; color: #fff; font-size: 28px; cursor: pointer; }

/* ── Hamburger Menu ───────────────────────────── */
.hamburger-btn { display: none; background: none; border: none; padding: 6px; border-radius: 6px; color: var(--text-secondary); cursor: pointer; margin-right: 8px; }
.hamburger-btn:hover { background: var(--hover, rgba(0,0,0,0.04)); }
.sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.4); }
.sidebar-overlay.active { display: block; }

/* ── Focus Visible ────────────────────────────── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .nav-item:focus-visible { box-shadow: 0 0 0 3px rgba(212,118,90,0.2); }

/* ── Empty State ──────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state-icon { margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ── Command Palette (Cmd+K) ────────────────── */
.cmd-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding-top: 20vh; }
.cmd-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.cmd-dialog { position: relative; width: 560px; max-width: 92vw; background: var(--card-bg, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 14px; box-shadow: 0 16px 70px rgba(0,0,0,0.2); overflow: hidden; animation: cmdSlideIn 0.15s ease-out; }
@keyframes cmdSlideIn { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.cmd-search-row { display: flex; align-items: center; padding: 12px 16px; gap: 10px; border-bottom: 1px solid var(--border-light, #f3f4f6); }
.cmd-search-icon { color: var(--text-muted, #9ca3af); flex-shrink: 0; }
.cmd-input { flex: 1; border: none; background: none; font-size: 15px; font-family: inherit; color: var(--text-primary); outline: none; }
.cmd-input::placeholder { color: var(--text-muted, #9ca3af); }
.cmd-kbd { font-size: 11px; font-family: var(--font-mono); font-weight: 500; padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); background: var(--card-bg-subtle); flex-shrink: 0; letter-spacing: -0.01em; }
.cmd-results { max-height: 360px; overflow-y: auto; }
.cmd-results:empty { display: none; }
.cmd-group { padding: 6px 0; }
.cmd-group-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 6px 16px 4px; }
.cmd-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; cursor: pointer; text-decoration: none; color: var(--text-primary); transition: background 0.08s; }
.cmd-item:hover, .cmd-item.cmd-active { background: var(--hover, rgba(0,0,0,0.04)); }
.cmd-item-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; }
.cmd-item-icon.client { background: var(--info-bg, #eff6ff); color: var(--info, #3b82f6); }
.cmd-item-icon.page { background: var(--accent-light, #fef3f0); color: var(--accent, #d4765a); }
.cmd-item-text { flex: 1; min-width: 0; }
.cmd-item-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-item-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-empty { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.cmd-hint { padding: 8px 16px; border-top: 1px solid var(--border-light, #f3f4f6); display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--text-muted); }
.cmd-hint kbd { font-family: var(--font-mono); font-size: 10px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 3px; background: var(--card-bg-subtle); color: var(--text-muted); }

/* ── Today's Focus ───────────────────────────── */
.focus-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.focus-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-light, #f3f4f6); }
.focus-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 0; color: var(--text-primary); }
.focus-count { font-size: 12px; color: var(--text-muted); }
.focus-list { display: flex; flex-direction: column; }
.focus-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; text-decoration: none; color: var(--text-primary); border-left: 3px solid transparent; transition: background 0.1s; }
.focus-item:hover { background: var(--hover, rgba(0,0,0,0.02)); }
.focus-item + .focus-item { border-top: 1px solid var(--border-light, #f3f4f6); }
.focus-item.focus-urgent { border-left-color: var(--danger, #ef4444); }
.focus-item.focus-soon { border-left-color: var(--warning, #f59e0b); }
.focus-item.focus-info { border-left-color: var(--info, #3b82f6); }
.focus-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.focus-urgent .focus-dot { background: var(--danger); }
.focus-soon .focus-dot { background: var(--warning); }
.focus-info .focus-dot { background: var(--info); }
.focus-text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.focus-name { font-weight: 600; font-size: 13px; white-space: nowrap; }
.focus-action { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.focus-detail { font-size: 12px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.focus-arrow { color: var(--text-muted); flex-shrink: 0; opacity: 0; transition: opacity 0.15s; }
.focus-item:hover .focus-arrow { opacity: 1; }
@media (max-width: 768px) {
    .focus-text { flex-direction: column; gap: 2px; }
    .focus-detail { display: none; }
}

/* ── Kanban Stale Deal Indicators ────────────── */
.kanban-card.stale-warn { border-left-color: var(--warning); }
.kanban-card.stale-danger { border-left-color: var(--danger); }
.kanban-card-stale { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-light); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.stale-warn .kanban-card-stale { color: var(--warning); }
.stale-danger .kanban-card-stale { color: var(--danger); }

/* ── Client Detail Two-Column Layout ─────────── */
.client-layout { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.client-sidebar { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 12px; }
.client-main { min-width: 0; }
.sidebar-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.sidebar-actions { display: flex; gap: 8px; }
.sidebar-field { padding: 8px 0; border-bottom: 1px solid var(--border-light, #f3f4f6); }
.sidebar-field:last-child { border-bottom: none; }
.sidebar-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 3px; }
.sidebar-value { font-size: 14px; font-weight: 500; color: var(--text-primary); word-break: break-all; }
@media (max-width: 1024px) {
    .client-layout { grid-template-columns: 1fr; }
    .client-sidebar { position: static; }
}

/* ── App Check Button ────────────────────────── */
.btn-app-check { display: flex; align-items: center; gap: 4px; width: 100%; margin-top: 8px; padding: 5px 8px; font-size: 11px; font-weight: 500; color: var(--accent); background: var(--accent-light, rgba(212,118,90,0.08)); border: 1px solid rgba(212,118,90,0.2); border-radius: 6px; cursor: pointer; transition: background 0.15s, border-color 0.15s; font-family: inherit; }
.btn-app-check:hover { background: rgba(212,118,90,0.15); border-color: var(--accent); }

/* ═══════════════════════════════════════════════════
   Feature 1: Inline Edit Save Flash
   ═══════════════════════════════════════════════════ */
@keyframes saveFlash {
    0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
    50% { box-shadow: 0 0 0 4px rgba(34,197,94,0.15); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.editable.save-ok { animation: saveFlash 0.6s ease-out; background: rgba(34,197,94,0.12) !important; }
.editable .save-check { display: inline-block; margin-left: 4px; color: var(--success); font-size: 12px; opacity: 0; transition: opacity 0.2s; }
.editable.save-ok .save-check { opacity: 1; }

/* ═══════════════════════════════════════════════════
   Feature 2: Notification Center
   ═══════════════════════════════════════════════════ */
.notif-btn { position: relative; background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); color: var(--text-secondary); transition: background 0.15s, color 0.15s; }
.notif-btn:hover { background: rgba(0,0,0,0.05); color: var(--text-primary); }
[data-theme="dark"] .notif-btn:hover { background: rgba(255,255,255,0.08); }
.notif-btn svg { display: block; }
.notif-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--main-bg); display: none; }
.notif-dot.active { display: block; }

.notif-panel { position: fixed; top: 0; right: -400px; width: 380px; max-width: 100vw; height: 100vh; background: var(--card-bg); border-left: 1px solid var(--border); box-shadow: -4px 0 24px rgba(0,0,0,0.1); z-index: 150; display: flex; flex-direction: column; transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.notif-panel.open { right: 0; }
.notif-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.notif-panel-header h3 { font-size: 16px; font-weight: 600; margin: 0; }
.notif-close { background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-muted); border-radius: 4px; }
.notif-close:hover { color: var(--text-primary); background: rgba(0,0,0,0.05); }
.notif-list { flex: 1; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border-light); transition: background 0.1s; }
.notif-item:hover { background: rgba(0,0,0,0.02); }
[data-theme="dark"] .notif-item:hover { background: rgba(255,255,255,0.03); }
.notif-item-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.notif-item-dot.change { background: var(--info); }
.notif-item-dot.create { background: var(--success); }
.notif-item-dot.delete { background: var(--danger); }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.notif-item-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-item-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.notif-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.notif-backdrop { position: fixed; inset: 0; z-index: 140; background: rgba(0,0,0,0.3); display: none; }
.notif-backdrop.open { display: block; }

/* ═══════════════════════════════════════════════════
   Feature 3: Collapsible Sidebar (Cmd+B)
   ═══════════════════════════════════════════════════ */
.sidebar { transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; }
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .nav-item span:not(.nav-icon):not(.nav-badge),
.sidebar.collapsed .theme-label,
.sidebar.collapsed .sync-status,
.sidebar.collapsed .sidebar-user-name { opacity: 0; width: 0; overflow: hidden; white-space: nowrap; transition: opacity 0.15s, width 0.15s; }
.sidebar.collapsed .sidebar-brand { padding: 20px 10px; gap: 0; justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
.sidebar.collapsed .nav-item.active::before { left: 0; }
.sidebar.collapsed .nav-links { padding: 12px 4px; }
.sidebar.collapsed .nav-separator { margin: 8px 4px; }
.sidebar.collapsed .sidebar-footer { padding: 12px 8px; }
.sidebar.collapsed .theme-toggle { justify-content: center; padding: 8px; }
.sidebar.collapsed .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 14px; height: 14px; font-size: 8px; padding: 0 3px; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed + .sidebar-overlay + .content,
.sidebar.collapsed ~ .content { margin-left: 56px; }
.sidebar .brand-name, .sidebar .brand-sub, .sidebar .nav-item span:not(.nav-icon):not(.nav-badge),
.sidebar .theme-label, .sidebar .sync-status, .sidebar .sidebar-user-name { transition: opacity 0.2s 0.05s, width 0.2s; }

/* Sidebar collapse button */
.sidebar-collapse-btn { display: none; position: absolute; top: 50%; right: -12px; transform: translateY(-50%); width: 24px; height: 24px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 50%; cursor: pointer; z-index: 101; align-items: center; justify-content: center; color: var(--text-muted); box-shadow: var(--shadow-sm); transition: color 0.15s, background 0.15s; }
.sidebar-collapse-btn:hover { color: var(--text-primary); background: var(--card-bg); }
.sidebar-collapse-btn svg { transition: transform 0.25s; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
@media (min-width: 1025px) {
    .sidebar-collapse-btn { display: flex; }
}

/* ═══════════════════════════════════════════════════
   Feature 4: Mobile Bottom Tab Bar
   ═══════════════════════════════════════════════════ */
.mobile-tabs { display: none; }
@media (max-width: 768px) {
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: var(--card-bg);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
        padding: 4px 0;
        padding-bottom: env(safe-area-inset-bottom, 4px);
    }
    .mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 8px 4px 6px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 500;
        transition: color 0.15s;
        border: none;
        background: none;
        cursor: pointer;
    }
    .mobile-tab:hover, .mobile-tab.active { color: var(--accent); }
    .mobile-tab svg { width: 20px; height: 20px; }
    .page-body { padding-bottom: 80px; }
    #toast-container { bottom: 80px; }
    .bulk-bar { bottom: 80px; }
}

/* ═══════════════════════════════════════════════════
   Feature 5: Renewal Progress Steps
   ═══════════════════════════════════════════════════ */
.renewal-steps { display: flex; align-items: center; gap: 0; }
.renewal-step { display: flex; align-items: center; gap: 0; }
.renewal-step-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border); background: var(--card-bg); flex-shrink: 0; transition: background 0.2s, border-color 0.2s; }
.renewal-step.done .renewal-step-dot { background: var(--success); border-color: var(--success); }
.renewal-step.current .renewal-step-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,118,90,0.2); }
.renewal-step-line { width: 16px; height: 2px; background: var(--border); flex-shrink: 0; }
.renewal-step.done + .renewal-step .renewal-step-line,
.renewal-step.done .renewal-step-line { background: var(--success); }
.renewal-step-label { display: none; }
.renewal-steps[title] { cursor: help; }

/* ═══════════════════════════════════════════════════
   Feature 6: Column Visibility Toggle
   ═══════════════════════════════════════════════════ */
.col-toggle-wrap { position: relative; display: inline-block; }
.col-toggle-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; font-size: 12px; font-weight: 500; color: var(--text-secondary); background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; transition: border-color 0.15s, color 0.15s; }
.col-toggle-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.col-toggle-menu { display: none; position: absolute; top: calc(100% + 4px); right: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 60; min-width: 180px; padding: 6px 0; }
.col-toggle-menu.open { display: block; animation: fadeInUp 0.12s ease-out; }
.col-toggle-item { display: flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 12px; color: var(--text-primary); cursor: pointer; transition: background 0.1s; user-select: none; }
.col-toggle-item:hover { background: rgba(0,0,0,0.03); }
[data-theme="dark"] .col-toggle-item:hover { background: rgba(255,255,255,0.04); }
.col-toggle-item input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

/* ═══════════════════════════════════════════════════
   Feature 7: KPI Sparkline Mini-Charts
   ═══════════════════════════════════════════════════ */
.kpi-sparkline { margin-top: 10px; height: 28px; position: relative; }
.kpi-sparkline canvas { width: 100% !important; height: 100% !important; }


/* ═══════════════════════════════════════════════════
   Chart House — component library (macro support)
   ═══════════════════════════════════════════════════ */

/* Keyboard key cap — uses Geist Mono, looks like a physical key */
.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    letter-spacing: -0.01em;
    line-height: 1;
}
.kbd + .kbd { margin-left: 3px; }

/* Inline pill — smaller, denser than .badge, no uppercase */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 11.5px;
    font-weight: 500;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    white-space: nowrap;
    letter-spacing: -0.005em;
}
.pill-ok      { background: var(--success-bg); color: var(--success); border-color: rgba(45, 106, 79, 0.18); }
.pill-warn    { background: var(--warning-bg); color: var(--warning); border-color: rgba(199, 125, 20, 0.22); }
.pill-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: rgba(196, 69, 54, 0.22); }
.pill-info    { background: var(--info-bg);    color: var(--info);    border-color: rgba(61, 90, 128, 0.22); }
.pill-teal    { background: var(--teal-light); color: var(--teal);    border-color: rgba(15, 76, 92, 0.22); }
.pill-muted   { background: var(--card-bg-subtle); color: var(--text-muted); border-color: var(--border); }

/* Data row — labeled values for sidebars / detail cards */
.data-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.data-row:last-child { border-bottom: none; }
.data-row-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    flex-shrink: 0;
}
.data-row-value { color: var(--text-primary); text-align: right; word-break: break-word; }

/* Empty state (expanded) */
.empty-state-title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 12px 0 4px;
    letter-spacing: -0.01em;
}
.empty-state-body {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 36ch;
    margin: 0 auto;
}

/* Generic progress-steps tracker — used by endorsement workflow, etc. */
.progress-steps {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 4px 0;
}
.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.progress-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-strong);
    border: 2px solid var(--card-bg);
    box-shadow: 0 0 0 1px var(--border-strong);
    transition: background var(--transition);
}
.progress-done .progress-step-dot    { background: var(--success); box-shadow: 0 0 0 1px var(--success); }
.progress-current .progress-step-dot { background: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-tint); }
.progress-step-label {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.progress-current .progress-step-label { color: var(--text-primary); }
.progress-done .progress-step-label { color: var(--text-secondary); }
.progress-step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 4px;
    min-width: 20px;
}
.progress-step-line.done { background: var(--success); }

/* Age halos — for pipeline cards & renewal rows */
.age-fresh { border-left: 3px solid var(--success); }
.age-warn  { border-left: 3px solid var(--warning); }
.age-stale { border-left: 3px solid var(--danger); }

/* Chart House decorative — subtle chart-paper grid on main bg (optional) */
.main-bg-grid {
    background-image:
        linear-gradient(rgba(26, 26, 30, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 26, 30, 0.025) 1px, transparent 1px);
    background-size: 24px 24px;
}


/* ═══════════════════════════════════════════════════
   Overview — Today's Work Board
   Three columns: Needs me / Waiting client / Waiting carrier
   ═══════════════════════════════════════════════════ */
.work-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.work-col {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}
.work-needs-me        { border-top: 3px solid var(--danger); }
.work-waiting-client  { border-top: 3px solid var(--warning); }
.work-waiting-carrier { border-top: 3px solid var(--teal); }

.work-col-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border-light);
}
.work-col-head h3 {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.work-count {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.work-list { list-style: none; padding: 4px 0; margin: 0; flex: 1; }
.work-item + .work-item { border-top: 1px solid var(--border-light); }
.work-link {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    transition: background var(--transition-fast);
}
.work-link:hover { background: var(--card-bg-subtle); }
.work-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--card-bg-subtle); }
.work-item-danger .work-link { box-shadow: inset 2px 0 0 var(--danger); }
.work-item-warn .work-link   { box-shadow: inset 2px 0 0 var(--warning); }
.work-item-teal .work-link,
.work-item-info .work-link   { box-shadow: inset 2px 0 0 var(--teal); }

.work-item-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 3px;
}
.work-item-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.work-item-meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 11.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.work-item-carrier {
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
    color: var(--text-secondary);
}
.work-item-detail { color: var(--text-muted); }

.work-empty {
    padding: 32px 16px;
    font-family: var(--font-display);
    font-style: italic;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

@media (max-width: 1100px) {
    .work-board { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════
   KPI Strip — one-line ledger summary (replaces KPI card grid)
   ═══════════════════════════════════════════════════ */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}
.kpi-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: var(--card-bg);
    text-decoration: none;
    color: inherit;
    transition: background var(--transition-fast);
    min-height: 76px;
}
.kpi-cell:hover { background: var(--card-bg-subtle); }
.kpi-cell-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.kpi-cell-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' on, 'lnum' on;
}
.kpi-cell-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.kpi-cell-hot .kpi-cell-value { color: var(--accent); }

@media (max-width: 1200px) {
    .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ═══════════════════════════════════════════════════
   Drafts — split-view inbox with J/K keyboard nav
   ═══════════════════════════════════════════════════ */
.draft-shortcuts {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-left: 12px;
}

.draft-split {
    display: grid;
    grid-template-columns: minmax(320px, 400px) 1fr;
    gap: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    height: calc(100vh - 160px);
    min-height: 480px;
}

/* Left: list rail */
.draft-list {
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--card-bg-subtle);
    padding: 4px 0;
}
.draft-row {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: background var(--transition-fast);
    position: relative;
}
.draft-row:hover { background: var(--card-bg); }
.draft-row:focus-visible { outline: none; background: var(--card-bg); }
.draft-row.selected {
    background: var(--card-bg);
    box-shadow: inset 3px 0 0 var(--accent);
}
.draft-row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 3px;
}
.draft-row-to {
    font-weight: 500;
    font-size: 13.5px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.draft-row-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.draft-row-subject {
    font-size: 12.5px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 6px;
}
.draft-row-meta { display: flex; flex-wrap: wrap; gap: 4px; }

/* Right: preview */
.draft-preview {
    overflow-y: auto;
    position: relative;
    padding: 0;
}
.draft-view { display: none; padding: 32px 40px; max-width: 820px; }
.draft-view.active { display: block; animation: fadeInUp 0.18s cubic-bezier(0.4, 0, 0.2, 1); }

.draft-view-head {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.draft-view-subject {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-bottom: 16px;
    font-optical-sizing: auto;
}
.draft-view-field {
    display: flex;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 4px;
    font-size: 13px;
}
.draft-view-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    width: 40px;
    flex-shrink: 0;
}
.draft-view-value { color: var(--text-secondary); }
.draft-view-chips {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.draft-view-body {
    padding: 8px 0 24px;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.65;
}
.draft-view-snippet {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
    margin: 0;
    padding: 16px 20px;
    background: var(--card-bg-subtle);
    border-left: 3px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.draft-view-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
    font-style: italic;
}

.draft-view-actions {
    display: flex;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
    .draft-split { grid-template-columns: 1fr; height: auto; }
    .draft-list { max-height: 360px; border-right: none; border-bottom: 1px solid var(--border); }
    .draft-view { padding: 24px 20px; }
}


/* ═══════════════════════════════════════════════════
   Renewals — 12-week horizon grid
   Each column is a calendar week; each chip is a policy.
   ═══════════════════════════════════════════════════ */
.renewal-horizon {
    margin-bottom: 32px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.renewal-horizon-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 14px 18px 12px;
    border-bottom: 1px solid var(--border-light);
}
.renewal-horizon-head h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.renewal-horizon-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-display);
}

.renewal-horizon-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(80px, 1fr));
    gap: 1px;
    background: var(--border-light);
    overflow-x: auto;
}

.horizon-week {
    background: var(--card-bg);
    padding: 10px 8px 8px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.horizon-week-current {
    background: var(--accent-tint);
    box-shadow: inset 0 3px 0 var(--accent);
}

.horizon-week-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 10.5px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border);
}
.horizon-week-label {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}
.horizon-week-current .horizon-week-label { color: var(--accent); font-weight: 600; }
.horizon-week-count {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.horizon-week-chips {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}
.horizon-chip {
    display: block;
    padding: 3px 6px;
    font-size: 11px;
    line-height: 1.3;
    border-radius: 3px;
    text-decoration: none;
    color: var(--text-primary);
    border-left: 3px solid transparent;
    background: var(--card-bg-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.horizon-chip:hover { background: var(--card-bg); }
.horizon-chip-danger { border-left-color: var(--danger); }
.horizon-chip-warn   { border-left-color: var(--warning); }
.horizon-chip-teal   { border-left-color: var(--teal); }
.horizon-chip-name { font-weight: 500; }

.horizon-week-foot {
    padding-top: 6px;
    border-top: 1px dashed var(--border);
    font-size: 10.5px;
    color: var(--text-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
    .renewal-horizon-grid {
        grid-auto-flow: column;
        grid-template-columns: repeat(12, minmax(110px, 1fr));
    }
}


/* ═══════════════════════════════════════════════════
   Endorsement 4-step tracker — inline in table cell
   Requested → Submitted → Approved → Delivered
   ═══════════════════════════════════════════════════ */
.endo-steps {
    display: inline-flex;
    align-items: center;
    gap: 0;
    min-width: 140px;
}
.endo-step {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-strong);
    position: relative;
    z-index: 1;
}
.endo-step-dot {
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--card-bg);
}
.endo-done        { background: var(--success); }
.endo-done .endo-step-dot { display: none; }
.endo-current     { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.endo-current .endo-step-dot { background: var(--accent); inset: 0; }
.endo-step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    min-width: 24px;
    max-width: 40px;
}
.endo-step-line.done { background: var(--success); }

/* Shrink a bit in dense rows */
.data-table .endo-steps { min-width: 130px; }


/* ═══════════════════════════════════════════════════
   Policies — book stats strip above the table
   ═══════════════════════════════════════════════════ */
.policies-stats {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(160px, 1fr) minmax(400px, 3fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.policies-stat, .policies-carriers {
    background: var(--card-bg);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 76px;
}
.policies-carriers { padding-bottom: 12px; }
.policies-stat-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.policies-stat-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.policies-stat-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.policies-carrier-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.policies-carrier-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 10px;
    background: var(--card-bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}
.policies-carrier-count {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    padding: 0 6px;
    background: var(--card-bg);
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
}
.policies-carrier-more { color: var(--text-muted); font-style: italic; }

@media (max-width: 900px) {
    .policies-stats { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════
   Client Detail — sticky summary band
   Facts at a glance: name + status + policies + premium + next renewal + endorsements
   ═══════════════════════════════════════════════════ */
.client-summary {
    display: grid;
    grid-template-columns: minmax(280px, 1.2fr) minmax(480px, 2fr);
    gap: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.client-summary-lead {
    padding: 18px 22px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    background: var(--card-bg-subtle);
}
.client-summary-name {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-optical-sizing: auto;
    margin: 0;
}
.client-summary-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.client-summary-contact {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: -0.01em;
}

.client-summary-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--border);
}
.client-summary-stat {
    background: var(--card-bg);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 78px;
}
.client-summary-stat-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.client-summary-stat-value {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.client-summary-stat-value-sm {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}
.client-summary-stat-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1000px) {
    .client-summary { grid-template-columns: 1fr; }
    .client-summary-lead { border-right: none; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) {
    .client-summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ═══════════════════════════════════════════════════
   Keyboard Shortcuts help overlay (press ?)
   ═══════════════════════════════════════════════════ */
.shortcuts-dialog {
    position: relative;
    width: 680px;
    max-width: 92vw;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-overlay);
    animation: cmdSlideIn 0.15s ease-out;
}
.shortcuts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.shortcuts-head h2 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-optical-sizing: auto;
}
.shortcuts-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
    line-height: 1;
}
.shortcuts-close:hover { background: var(--card-bg-subtle); color: var(--text-primary); }

.shortcuts-body {
    padding: 20px 24px 28px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.shortcuts-group h3 {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border);
}
.shortcuts-group dl {
    display: grid;
    grid-template-columns: minmax(90px, auto) 1fr;
    gap: 6px 14px;
    align-items: baseline;
}
.shortcuts-group dt {
    text-align: right;
    white-space: nowrap;
}
.shortcuts-group dd {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

@media (max-width: 700px) {
    .shortcuts-body { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════
   Chart House — motion polish
   Subtle staggered reveals on page load.
   Respects prefers-reduced-motion.
   ═══════════════════════════════════════════════════ */
@keyframes chStagger {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.work-item,
.horizon-chip,
.draft-row,
.kpi-cell,
.policies-carrier-chip {
    animation: chStagger 0.22s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.work-item:nth-child(1) { animation-delay: 20ms; }
.work-item:nth-child(2) { animation-delay: 40ms; }
.work-item:nth-child(3) { animation-delay: 60ms; }
.work-item:nth-child(4) { animation-delay: 80ms; }
.work-item:nth-child(5) { animation-delay: 100ms; }
.work-item:nth-child(n+6) { animation-delay: 120ms; }

.horizon-chip:nth-child(1) { animation-delay: 10ms; }
.horizon-chip:nth-child(2) { animation-delay: 30ms; }
.horizon-chip:nth-child(3) { animation-delay: 50ms; }
.horizon-chip:nth-child(n+4) { animation-delay: 70ms; }

.kpi-cell:nth-child(1) { animation-delay: 0ms; }
.kpi-cell:nth-child(2) { animation-delay: 40ms; }
.kpi-cell:nth-child(3) { animation-delay: 80ms; }
.kpi-cell:nth-child(4) { animation-delay: 120ms; }
.kpi-cell:nth-child(5) { animation-delay: 160ms; }
.kpi-cell:nth-child(6) { animation-delay: 200ms; }

@media (prefers-reduced-motion: reduce) {
    .work-item, .horizon-chip, .draft-row, .kpi-cell, .policies-carrier-chip {
        animation: none;
    }
    .draft-view.active { animation: none; }
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* ═══════════════════════════════════════════════════
   Accessibility — focus-visible everywhere
   Ensures keyboard users can see every focused control.
   ═══════════════════════════════════════════════════ */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}
.btn:focus-visible,
.btn-accent:focus-visible,
a.nav-item:focus-visible,
.kpi-cell:focus-visible,
.work-link:focus-visible,
.draft-row:focus-visible,
.tab-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
/* Don't double-outline inputs that already have a focus ring */
.form-input:focus,
.search-input:focus,
.cmd-input:focus {
    outline: none;
}


/* ═══════════════════════════════════════════════════
   Print views — Renewals + Policies as clean ledger
   Used for occasional PDF exports the user might print.
   ═══════════════════════════════════════════════════ */
@media print {
    @page { size: letter landscape; margin: 0.5in; }

    body {
        background: #fff !important;
        color: #000 !important;
        display: block !important;
    }
    .sidebar, .sidebar-overlay, .page-header, .hamburger-btn,
    .notif-btn, .theme-toggle, .sidebar-footer, .btn, .btn-delete,
    .col-toggle-wrap, .search-bar, .bulk-bar, .pagination,
    #toast-container, .cmd-overlay, #shortcuts-overlay,
    .modal, dialog {
        display: none !important;
    }
    .content { margin-left: 0 !important; max-width: 100% !important; }
    .page-body { padding: 0 !important; }

    /* Printable ledger tables */
    .data-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    .data-table th, .data-table td {
        padding: 6px 10px !important;
        font-size: 10pt !important;
        color: #000 !important;
        border-bottom: 1px solid #ddd !important;
    }
    .data-table thead { background: #f4f4f4 !important; }
    .kanban-board, .work-board, .renewal-horizon, .draft-split {
        display: none !important;
    }

    /* Print header — identify the agency */
    .page-body::before {
        content: "Hanham Insurance Agency";
        display: block;
        font-family: 'Fraunces', Georgia, serif;
        font-size: 14pt;
        font-weight: 500;
        margin-bottom: 12px;
        padding-bottom: 8px;
        border-bottom: 2px solid #000;
    }

    /* Stats strips + summary bands — simplified print */
    .kpi-strip, .policies-stats, .client-summary {
        border: 1px solid #ccc !important;
        background: #fff !important;
        page-break-inside: avoid;
        margin-bottom: 16px;
    }
    .kpi-cell, .policies-stat, .client-summary-stat, .client-summary-lead {
        background: #fff !important;
        border-right: 1px solid #ddd !important;
    }
    .kpi-cell-value, .policies-stat-value, .client-summary-stat-value {
        color: #000 !important;
    }

    /* Pills become text on print */
    .pill, .badge { background: transparent !important; border: 1px solid #888 !important; color: #000 !important; }

    a { color: #000 !important; text-decoration: none !important; }
}
