/* =================================================================
   Missing Info Tracker — Redesigned
   Extends existing charcoal/amber design system with service-centric
   components: service chips, subscription cards, deadline rails.
   ================================================================= */

:root {
    /* Core palette (kept from existing system) */
    --slate-950: #0f1117;
    --slate-900: #1a1d27;
    --slate-800: #252833;
    --slate-700: #353848;
    --slate-600: #4b4f63;
    --slate-500: #6b7089;
    --slate-400: #9298b0;
    --slate-300: #b8bdd0;
    --slate-200: #dcdfe8;
    --slate-100: #eef0f5;
    --slate-50:  #f6f7fa;

    --amber-500: #e8930c;
    --amber-400: #f5a623;
    --amber-300: #fbc56d;
    --amber-100: #fef3d9;
    --amber-50:  #fef9ec;

    --green-500: #22a55d;
    --green-400: #34c77b;
    --green-100: #e1f5ec;
    --red-500:   #dc3545;
    --red-400:   #e4505e;
    --red-100:   #fde8ea;
    --blue-500:  #2563eb;
    --blue-400:  #4a7cf0;
    --blue-100:  #e0e9fc;
    --orange-500:#e67e22;
    --orange-100:#fef0e1;
    --purple-500:#7c3aed;
    --purple-100:#ede9fe;
    --teal-500: #0d9488;
    --teal-100: #ccfbf1;
    --pink-500: #db2777;
    --pink-100: #fce7f3;

    --white: #ffffff;

    /* Semantic tokens */
    --sidebar-bg: var(--slate-900);
    --sidebar-text: var(--slate-300);
    --sidebar-active: var(--amber-400);
    --body-bg: var(--slate-50);
    --card-bg: var(--white);
    --card-border: var(--slate-200);
    --text-primary: var(--slate-900);
    --text-secondary: var(--slate-500);
    --text-muted: var(--slate-400);
    --accent: var(--amber-500);
    --accent-light: var(--amber-100);
    --link: var(--blue-500);
    --danger: var(--red-500);
    --success: var(--green-500);

    /* Service colours — one per service so the eye can scan */
    --svc-accounts: #2563eb;    /* blue */
    --svc-accounts-light: #e0e9fc;
    --svc-vat: #e67e22;         /* orange */
    --svc-vat-light: #fef0e1;
    --svc-paye: #7c3aed;        /* purple */
    --svc-paye-light: #ede9fe;
    --svc-sa: #0d9488;          /* teal */
    --svc-sa-light: #ccfbf1;
    --svc-mtd: #db2777;         /* pink */
    --svc-mtd-light: #fce7f3;

    /* Sizing */
    --sidebar-width: 248px;
    --topbar-height: 60px;
    --radius: 8px;
    --radius-sm: 5px;

    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--body-bg);
    line-height: 1.55;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---- App Shell ---- */
.app-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-header {
    padding: 18px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--slate-800);
}
.logo-mark {
    width: 34px; height: 34px;
    background: var(--amber-400);
    color: var(--slate-950);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    flex-shrink: 0;
}
.logo-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
    letter-spacing: -0.01em;
}
.sidebar-nav {
    flex: 1;
    padding: 12px 10px 20px;
}
.nav-group { margin-bottom: 14px; }
.nav-group-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 12px 6px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    border-radius: 6px;
    margin-bottom: 2px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--slate-800); color: var(--white); text-decoration: none; }
.nav-link.active { background: var(--slate-800); color: var(--sidebar-active); font-weight: 500; }
.nav-link svg { flex-shrink: 0; }
.nav-link-count {
    margin-left: auto;
    font-size: 11px;
    background: var(--slate-800);
    color: var(--slate-300);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 500;
}
.nav-link.active .nav-link-count { background: var(--amber-400); color: var(--slate-950); }
.nav-link-dot {
    width: 6px; height: 6px; border-radius: 50%;
    flex-shrink: 0;
}
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--slate-800);
    display: flex; align-items: center; gap: 10px;
}
.user-avatar {
    width: 34px; height: 34px;
    background: var(--slate-700);
    color: var(--white);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { color: var(--white); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--slate-400); font-size: 11.5px; text-transform: capitalize; }

/* ---- Main content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}
.top-bar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--card-border);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 12px;
}
.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    flex: 1;
}
.breadcrumbs {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--text-primary); }
.breadcrumbs .sep { margin: 0 6px; color: var(--slate-300); }

.page-content {
    padding: 24px;
    max-width: 100%;
}
.page-header {
    margin-bottom: 20px;
    display: flex; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}
.page-header .lede {
    color: var(--text-secondary);
    font-size: 13.5px;
    max-width: 720px;
}

/* ---- Cards ---- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
}
.card-header:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-header .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* ---- Stats row ---- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px;
    border-left: 4px solid var(--slate-300);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}
a.stat-card:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(15, 17, 23, 0.06); text-decoration: none; }
.stat-card .stat-label {
    font-size: 11.5px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px;
}
.stat-card .stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--text-primary); }
.stat-card .stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-card.accent { border-left-color: var(--accent); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: var(--blue-500); }
.stat-card.warning { border-left-color: var(--orange-500); }
.stat-card.svc-accounts { border-left-color: var(--svc-accounts); }
.stat-card.svc-vat { border-left-color: var(--svc-vat); }
.stat-card.svc-paye { border-left-color: var(--svc-paye); }
.stat-card.svc-sa { border-left-color: var(--svc-sa); }
.stat-card.svc-mtd { border-left-color: var(--svc-mtd); }

/* ---- Tables ---- */
.data-table { width: 100%; font-size: 13.5px; }
.data-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--card-border);
    background: var(--slate-50);
}
.data-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--slate-50); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .mono { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: #d17f07; }
.btn-secondary { background: var(--white); color: var(--text-primary); border-color: var(--card-border); }
.btn-secondary:hover { background: var(--slate-50); border-color: var(--slate-300); }
.btn-outline {
    background: var(--white);
    color: var(--text-secondary);
    border: 1px dashed var(--slate-400);
    font-weight: 500;
}
.btn-outline:hover { background: var(--slate-50); border-style: solid; color: var(--text-primary); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #1b8a4c; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c82333; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--slate-100); color: var(--text-primary); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn-svc {
    background: var(--slate-100);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}
.btn-svc:hover { background: var(--slate-200); }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.badge-pending   { background: var(--orange-100); color: var(--orange-500); }
.badge-resolved  { background: var(--green-100); color: var(--success); }
.badge-responded { background: var(--blue-100); color: var(--blue-500); }
.badge-active    { background: var(--green-100); color: var(--success); }
.badge-on_hold   { background: var(--orange-100); color: var(--orange-500); }
.badge-complete  { background: var(--blue-100); color: var(--blue-500); }
.badge-open      { background: var(--amber-100); color: var(--amber-500); }
.badge-overdue   { background: var(--red-500); color: var(--white); }
.badge-urgent    { background: var(--red-100); color: var(--red-500); }
.badge-muted     { background: var(--slate-100); color: var(--slate-500); }
.badge-neutral   { background: var(--slate-100); color: var(--slate-600); }
.badge-workflow  { background: var(--green-100); color: var(--green-600); text-transform: none; font-weight: 600; }

/* ---- Service chips (THE key new component) ---- */
.svc-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.5;
}
.svc-chip-lg {
    padding: 5px 12px;
    font-size: 12.5px;
    gap: 6px;
}
.svc-chip-accounts { background: var(--svc-accounts-light); color: var(--svc-accounts); }
.svc-chip-vat      { background: var(--svc-vat-light); color: var(--svc-vat); }
.svc-chip-paye     { background: var(--svc-paye-light); color: var(--svc-paye); }
.svc-chip-sa       { background: var(--svc-sa-light); color: var(--svc-sa); }
.svc-chip-mtd      { background: var(--svc-mtd-light); color: var(--svc-mtd); }
.svc-chip .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
}
.svc-letter {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 5px;
    font-size: 11px; font-weight: 700;
    margin-right: 2px;
}
.svc-letter-accounts { background: var(--svc-accounts-light); color: var(--svc-accounts); }
.svc-letter-vat      { background: var(--svc-vat-light); color: var(--svc-vat); }
.svc-letter-paye     { background: var(--svc-paye-light); color: var(--svc-paye); }
.svc-letter-sa       { background: var(--svc-sa-light); color: var(--svc-sa); }
.svc-letter-mtd      { background: var(--svc-mtd-light); color: var(--svc-mtd); }
.svc-letter-off      { background: var(--slate-100); color: var(--slate-300); }
.svc-letters { display: inline-flex; gap: 2px; flex-wrap: wrap; }

/* ---- Deadline pill ---- */
.dl-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 500;
    line-height: 1.5;
}
.dl-pill .days { font-size: 11px; opacity: 0.8; }
.dl-ok       { background: var(--green-100); color: var(--success); }
.dl-soon     { background: var(--amber-100); color: var(--amber-500); }
.dl-urgent   { background: var(--orange-100); color: var(--orange-500); }
.dl-overdue  { background: var(--red-100); color: var(--red-500); font-weight: 600; }
.dl-done     { background: var(--slate-100); color: var(--slate-500); }

/* ---- Filters bar ---- */
.filters-bar {
    background: var(--white);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
}
.filters-bar form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

/* ---- Forms ---- */
.form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.form-group { flex: 1; min-width: 180px; }
.form-group.narrow { flex: 0 0 140px; }
.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}
.form-input, .form-select, textarea.form-input {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 13.5px;
    background: var(--white);
    color: var(--text-primary);
    transition: border-color 0.12s, box-shadow 0.12s;
}
.form-input:focus, .form-select:focus, textarea.form-input:focus {
    outline: none;
    border-color: var(--amber-400);
    box-shadow: 0 0 0 3px var(--amber-100);
}
textarea.form-input { resize: vertical; min-height: 70px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--card-border);
}

/* ---- Service subscription picker (main innovation in add-client) ---- */
.svc-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.svc-picker-option {
    position: relative;
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--white);
}
.svc-picker-option:hover { border-color: var(--slate-400); }
.svc-picker-option input { position: absolute; opacity: 0; pointer-events: none; }
.svc-picker-option .head {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.svc-picker-option .name { font-weight: 600; font-size: 13.5px; }
.svc-picker-option .cycle { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.svc-picker-option .check {
    margin-left: auto;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--slate-300);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.svc-picker-option .check svg { opacity: 0; width: 12px; height: 12px; }
.svc-picker-option.selected {
    background: var(--amber-50);
    border-color: var(--amber-400);
}
.svc-picker-option.selected .check {
    background: var(--amber-500);
    border-color: var(--amber-500);
    color: var(--white);
}
.svc-picker-option.selected .check svg { opacity: 1; }

.svc-detail-panel {
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
    background: var(--slate-50);
}
.svc-detail-panel.accounts { border-left: 3px solid var(--svc-accounts); }
.svc-detail-panel.vat      { border-left: 3px solid var(--svc-vat); }
.svc-detail-panel.paye     { border-left: 3px solid var(--svc-paye); }
.svc-detail-panel.sa       { border-left: 3px solid var(--svc-sa); }
.svc-detail-panel.mtd      { border-left: 3px solid var(--svc-mtd); }
.svc-detail-panel h4 {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px;
}

/* ---- Service tabs on client detail ---- */
.svc-tabs {
    display: flex;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 16px;
    overflow-x: auto;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 0 6px;
}
.svc-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2.5px solid transparent;
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.12s, border-color 0.12s;
}
.svc-tab:hover { color: var(--text-primary); text-decoration: none; }
.svc-tab.active { color: var(--text-primary); }
.svc-tab.active.svc-accounts { border-bottom-color: var(--svc-accounts); }
.svc-tab.active.svc-vat      { border-bottom-color: var(--svc-vat); }
.svc-tab.active.svc-paye     { border-bottom-color: var(--svc-paye); }
.svc-tab.active.svc-sa       { border-bottom-color: var(--svc-sa); }
.svc-tab.active.svc-mtd      { border-bottom-color: var(--svc-mtd); }
.svc-tab.active.overview     { border-bottom-color: var(--slate-700); }
.svc-tab .count {
    background: var(--slate-100);
    color: var(--text-secondary);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.svc-tab.active .count { background: var(--amber-100); color: var(--amber-500); }
.svc-tab .count.warn { background: var(--red-100); color: var(--red-500); }

/* ---- Subscription cards (client detail, one per service) ---- */
.sub-card {
    background: var(--white);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--slate-400);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 14px;
}
.sub-card.accounts { border-left-color: var(--svc-accounts); }
.sub-card.vat      { border-left-color: var(--svc-vat); }
.sub-card.paye     { border-left-color: var(--svc-paye); }
.sub-card.sa       { border-left-color: var(--svc-sa); }
.sub-card.mtd      { border-left-color: var(--svc-mtd); }
.sub-card-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin-bottom: 10px;
}
.sub-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub-card-title h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.sub-card-head-text { flex: 1; min-width: 200px; }
.sub-card-period-ref { margin: 4px 0 0; }
.sub-card-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    margin: 12px 0 4px;
    padding: 12px 14px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 10px;
}
.sub-card-toolbar-cluster {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: min(100%, 220px);
    flex: 1 1 200px;
    padding: 8px 10px;
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: 8px;
}
@media (max-width: 700px) {
    .sub-card-toolbar-cluster {
        min-width: 100%;
        flex: 1 1 100%;
    }
}
.sub-card-toolbar-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}
.sub-card-toolbar-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.sub-card-toolbar-form {
    display: inline;
    margin: 0;
}
.accounts-inline-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 14px 0 6px;
    padding: 10px 14px;
    background: linear-gradient(180deg, var(--slate-50), var(--white));
    border: 1px solid var(--card-border);
    border-radius: 8px;
}
.accounts-inline-meta-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.accounts-inline-edit { color: var(--text-muted); margin-left: auto; }
.accounts-inline-edit:hover { color: var(--accent); }
.period-rail-label {
    margin: 12px 0 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.card-header-tight { padding-bottom: 8px; margin-bottom: 8px; }
.card-header-title { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.card-header-sub { margin: 4px 0 0; }
.card-missing-items { margin-top: 8px; }
.sub-card-meta {
    font-size: 12.5px;
    color: var(--text-secondary);
    display: flex; gap: 14px; flex-wrap: wrap;
    margin-top: 3px;
}
.sub-card-meta span strong { color: var(--text-primary); font-weight: 600; }

/* ---- Ready to Work On card (shown at top of Accounts dashboard) ---- */
.ready-banner {
    background: var(--green-500);
    color: var(--white);
    padding: 12px 18px;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.005em;
}
.ready-banner .count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
}
.ready-card {
    background: var(--white);
    border: 1px solid var(--green-400);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}
.ready-card table { width: 100%; }

/* Inline status dropdown (shown in table cells) */
.status-select {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px 24px 4px 11px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    cursor: pointer;
    min-width: 150px;
}
.status-select:focus { outline: 2px solid var(--amber-300); outline-offset: 1px; }
.status-prepared    { background-color: var(--green-100); color: var(--green-500); border-color: var(--green-400); }
.status-pending     { background-color: var(--amber-100); color: var(--amber-500); border-color: var(--amber-300); }
.status-approval    { background-color: var(--blue-100); color: var(--blue-500); border-color: var(--blue-400); }
.status-not-started { background-color: var(--slate-100); color: var(--slate-600); border-color: var(--slate-300); }
.status-filed       { background-color: var(--slate-100); color: var(--slate-500); border-color: var(--slate-300); }
.status-empty       { background-color: var(--white); color: var(--text-muted); border-color: var(--card-border); font-weight: 500; }

/* Short-note pill (inline editable-looking) */
.short-note-cell {
    font-size: 12.5px;
    color: var(--text-primary);
    font-style: italic;
    max-width: 180px;
    display: inline-block;
    padding: 2px 8px;
    background: var(--amber-50);
    border-radius: 4px;
    border: 1px dashed var(--amber-300);
}
.short-note-cell.empty {
    color: var(--text-muted);
    background: transparent;
    border: 1px dashed var(--slate-200);
    font-style: normal;
}

/* ---- Year management bar — shows current year & lets you switch / close ---- */
.year-bar {
    display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--slate-400);
    border-radius: var(--radius);
    margin-bottom: 14px;
}
.year-bar.accounts { border-left-color: var(--svc-accounts); }
.year-bar.vat      { border-left-color: var(--svc-vat); }
.year-bar.paye     { border-left-color: var(--svc-paye); }
.year-bar.sa       { border-left-color: var(--svc-sa); }
.year-bar.mtd      { border-left-color: var(--svc-mtd); }
.year-bar-current {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 200px;
    padding-right: 14px;
    border-right: 1px dashed var(--card-border);
}
.year-bar-current .label {
    font-size: 10.5px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.year-bar-current .year {
    font-size: 15px; font-weight: 600; color: var(--text-primary);
}
.year-bar-current .period {
    font-size: 12px; color: var(--text-secondary);
}
.year-bar-switcher {
    display: flex; align-items: center; gap: 8px;
    font-size: 12.5px;
}
.year-bar-switcher label { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.year-bar-switcher select {
    padding: 5px 10px; font-size: 12.5px;
    border: 1px solid var(--card-border); border-radius: 5px;
    background: var(--white); min-width: 200px;
}
.year-bar-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* Deadline edit table */
.deadline-table th, .deadline-table td { vertical-align: top; }
.deadline-table .stat-deadline { font-weight: 600; color: var(--text-primary); }
.deadline-table .int-deadline { color: var(--amber-500); font-weight: 600; }
.deadline-table .ext-deadline { color: var(--green-500); font-weight: 600; }

/* Rollover workflow steps */
.workflow-steps {
    display: flex; gap: 0;
    margin-bottom: 20px;
    position: relative;
}
.workflow-step {
    flex: 1;
    padding: 14px 16px;
    background: var(--slate-100);
    border: 1px solid var(--card-border);
    border-right: none;
    position: relative;
}
.workflow-step:last-child { border-right: 1px solid var(--card-border); border-radius: 0 var(--radius) var(--radius) 0; }
.workflow-step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.workflow-step::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -11px;
    transform: translateY(-50%) rotate(45deg);
    width: 20px; height: 20px;
    background: inherit;
    border-top: 1px solid var(--card-border);
    border-right: 1px solid var(--card-border);
    z-index: 2;
}
.workflow-step:last-child::after { display: none; }
.workflow-step.active { background: var(--amber-50); border-color: var(--amber-300); }
.workflow-step.active::after { background: var(--amber-50); border-color: var(--amber-300); }
.workflow-step.done { background: var(--green-100); border-color: var(--green-400); }
.workflow-step.done::after { background: var(--green-100); border-color: var(--green-400); }
.workflow-step .step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--slate-500); color: var(--white);
    font-size: 11px; font-weight: 700;
    margin-right: 6px;
}
.workflow-step.active .step-num { background: var(--amber-500); }
.workflow-step.done .step-num { background: var(--green-500); }
.workflow-step h4 { font-size: 13px; font-weight: 600; display: inline; }
.workflow-step p { font-size: 11.5px; color: var(--text-secondary); margin-top: 4px; }

/* ---- Period rail — multiple periods can be open simultaneously ---- */
.period-rail {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin: 10px 0 14px;
    padding: 6px 2px 8px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}
.period-rail .period-item {
    flex: 0 0 auto;
    min-width: 148px;
    max-width: 220px;
    scroll-snap-align: start;
}
.period-item {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--slate-50);
    position: relative;
    transition: transform 0.12s ease, box-shadow 0.15s ease;
}
a.period-item, button.period-item {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    text-align: left;
    width: 100%;
    font-family: inherit;
    font-size: inherit;
}
a.period-item:hover, button.period-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 17, 23, 0.08);
    text-decoration: none;
}
.period-item .period-label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    display: flex; align-items: center; gap: 4px;
}
.period-item .period-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 3px;
}
.period-item .period-due {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.period-item.filed {
    background: #eaf6ee;
    border-color: var(--green-400);
}
.period-item.filed .period-label { color: var(--green-500); }
.period-item.filed::before { content: '✓ '; color: var(--green-500); font-weight: 700; }
.period-item.open {
    background: var(--amber-50);
    border-color: var(--amber-300);
}
.period-item.open .period-label { color: var(--amber-500); }
.period-item.overdue {
    background: var(--red-100);
    border-color: var(--red-400);
}
.period-item.overdue .period-label { color: var(--red-500); }
.period-item.viewing {
    border-color: var(--slate-800);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06), inset 0 0 0 1px var(--slate-800);
    background: linear-gradient(180deg, #fffbeb 0%, var(--amber-50) 100%);
}
.period-item.viewing .period-label {
    padding-right: 64px;
}
.period-item.viewing::after {
    content: 'Viewing';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--slate-800);
    color: var(--white);
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    z-index: 1;
}
.period-item.new {
    background: transparent;
    border: 1.5px dashed var(--slate-300);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 62px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12.5px;
    letter-spacing: 0.02em;
}
.period-item.new:hover {
    background: var(--amber-50);
    border-color: var(--amber-400);
    border-style: solid;
    color: var(--amber-500);
}
.period-item.future {
    opacity: 0.65;
}

/* ---- Progress bar ---- */
.progress {
    width: 100%;
    height: 6px;
    background: var(--slate-100);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.2s; }
.progress-fill.success { background: var(--success); }
.progress-fill.danger { background: var(--danger); }
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-text { font-size: 12px; color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- Empty states ---- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}
.empty-state h3 { font-size: 15px; margin-bottom: 8px; color: var(--text-primary); }
.empty-state p { font-size: 13px; margin-bottom: 14px; }

/* ---- Helpers ---- */
.text-small { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-mono { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 14px; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* ---- Login page ---- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-950) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 36px 34px;
    width: 100%; max-width: 400px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.2);
}
.login-card .logo-mark { margin: 0 auto 14px; width: 48px; height: 48px; font-size: 16px; }
.login-card h1 { text-align: center; font-size: 22px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.01em; }
.login-card .lede { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 26px; }
.login-card .btn { width: 100%; padding: 10px; }

/* ---- Calendar / timeline for deadlines ---- */
.timeline-month {
    background: var(--white);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 14px;
}
.timeline-month-head {
    display: flex; align-items: baseline; justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 10px;
}
.timeline-month-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.timeline-month-head .count { font-size: 12px; color: var(--text-muted); }
.timeline-item {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 12px 14px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px dashed var(--slate-100);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item .date {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
    padding-top: 2px;
}
.timeline-item .date .weekday { display: block; font-size: 10.5px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.timeline-main {
    min-width: 0;
}
.timeline-chip {
    margin-bottom: 8px;
}
.timeline-chip .svc-chip {
    vertical-align: middle;
}
.timeline-main a {
    text-decoration: none;
    color: var(--link);
}
.timeline-main a:hover {
    text-decoration: underline;
}
.timeline-main > a strong {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}
.timeline-due {
    padding-top: 4px;
    white-space: nowrap;
}
@media (max-width: 520px) {
    .timeline-item {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "date due"
            "main main";
    }
    .timeline-item .date { grid-area: date; }
    .timeline-item .timeline-due { grid-area: due; justify-self: end; }
    .timeline-item .timeline-main { grid-area: main; }
}

/* ---- Flow map (index page) ---- */
.flow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 14px;
}
.flow-card {
    background: var(--white);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex; flex-direction: column;
}
.flow-card .num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: 6px;
    background: var(--amber-100);
    color: var(--amber-500);
    font-weight: 700; font-size: 13px;
    margin-bottom: 10px;
}
.flow-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.flow-card p { color: var(--text-secondary); font-size: 13px; margin-bottom: 10px; flex: 1; }
.flow-card a.btn { align-self: flex-start; }

/* ---- Tag cloud for small meta ---- */
.meta-row {
    display: flex; gap: 16px; flex-wrap: wrap;
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--text-secondary);
}
.meta-row strong { color: var(--text-primary); font-weight: 600; }

/* ---- Responsive ---- */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
    .stats-row { grid-template-columns: 1fr; }
    .page-content { padding: 14px; }
    .top-bar { padding: 0 14px; }
}
.hamburger {
    display: none; background: none; border: none; padding: 6px;
    margin-right: 4px; cursor: pointer;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text-primary); margin: 4px 0; border-radius: 2px; }
@media (max-width: 960px) {
    .hamburger { display: block; }
}

/* ---- Items table (missing info list) ---- */
.items-table .client-remark {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 3px;
}
.items-table .item-files {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11.5px;
    color: var(--blue-500);
}

/* ---- Callout ---- */
.callout {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--amber-50);
    border: 1px solid var(--amber-300);
    font-size: 13px;
    margin-bottom: 14px;
}
.callout.info { background: var(--blue-100); border-color: var(--blue-400); }
.callout.success { background: var(--green-100); border-color: var(--green-400); }
.callout.danger { background: var(--red-100); border-color: var(--red-400); }
.callout strong { display: block; margin-bottom: 3px; }

/* ---- Key-value grid (client info display) ---- */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px 20px;
}
.kv {
    border-bottom: 1px dashed var(--slate-100);
    padding-bottom: 8px;
}
.kv-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.kv-value { font-size: 13.5px; color: var(--text-primary); margin-top: 2px; font-weight: 500; }
.kv-value.muted { color: var(--text-muted); font-weight: 400; font-style: italic; }

/* ---- Import missing items (design mockup alignment) ---- */
.import-page {
    max-width: 1180px;
    margin: 0 auto;
}
.import-hero {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 20px 22px;
    border-radius: var(--radius);
    border: 1px solid var(--slate-200);
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 45%, #f0fdf4 100%);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
}
.import-hero-icon {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, #0f172a, #1e293b);
    color: #4ade80;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(15, 23, 42, 0.25);
}
.import-hero-icon svg {
    opacity: 0.95;
}
.import-hero-text {
    flex: 1;
    min-width: 0;
}
.import-hero-title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}
.import-hero-lede {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-secondary);
}
@media (max-width: 640px) {
    .import-hero {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }
    .import-hero-icon {
        width: 48px;
        height: 48px;
    }
    .import-hero-title {
        font-size: 1.25rem;
    }
}
.import-hero-em {
    color: #15803d;
    font-weight: 700;
}
.import-page-header-sub {
    margin-bottom: 20px;
}
.import-page-header-sub .lede {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}
.import-paste-master-label {
    font-size: 15px !important;
    margin-bottom: 14px !important;
}
.import-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
/* Retro terminal paste buffers */
.import-page .import-terminal {
    border-radius: 10px;
    overflow: hidden;
    margin-top: 4px;
    box-shadow:
        0 0 0 1px rgba(74, 222, 128, 0.15),
        0 12px 40px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.import-page .import-terminal-chrome {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
    border-bottom: 1px solid #0f172a;
    font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
    font-size: 11px;
}
.import-page .import-terminal-lights {
    display: inline-flex;
    gap: 5px;
}
.import-page .import-terminal-lights i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: block;
    box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.35);
}
.import-page .import-terminal-lights i:nth-child(1) {
    background: #ff5f56;
}
.import-page .import-terminal-lights i:nth-child(2) {
    background: #ffbd2e;
}
.import-page .import-terminal-lights i:nth-child(3) {
    background: #27c93f;
}
.import-page .import-terminal-title {
    flex: 1;
    color: #94a3b8;
    letter-spacing: 0.06em;
    text-transform: lowercase;
}
.import-page .import-terminal-meta {
    color: #4ade80;
    opacity: 0.85;
    font-weight: 600;
}
.import-page .import-terminal-screen {
    position: relative;
    background: #070b07;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.12) 2px,
        rgba(0, 0, 0, 0.12) 3px
    );
}
.import-page .import-terminal-screen::after {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(57, 255, 20, 0.03) 0%,
        transparent 40%,
        transparent 100%
    );
    z-index: 1;
}
.import-page .import-terminal-textarea.import-paste-textarea {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    min-height: 120px;
    margin: 0;
    padding: 14px 16px;
    border: none;
    border-radius: 0;
    resize: vertical;
    font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #4ade80;
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.25);
    background: transparent;
    caret-color: #86efac;
}
.import-page .import-terminal-textarea.import-paste-textarea::placeholder {
    color: rgba(74, 222, 128, 0.35);
    text-shadow: none;
}
.import-page .import-terminal-textarea.import-paste-textarea:focus {
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.45);
}
.import-page .import-terminal-textarea.import-paste-textarea::selection {
    background: rgba(74, 222, 128, 0.28);
    color: #ecfdf5;
}
.import-page .page-header {
    margin-bottom: 20px;
}
.import-page .page-header .lede {
    margin-top: 4px;
}
.import-page .import-grid-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 800px) {
    .import-page .import-grid-top {
        grid-template-columns: 1fr;
    }
}
.import-page .import-input-card {
    padding-top: 12px;
    margin-bottom: 20px;
}
.import-page .import-tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 0 -2px;
    padding: 0 2px;
    border-bottom: 1px solid var(--slate-100);
}
.import-page .import-tab {
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    border-radius: 0;
    line-height: 1.3;
}
.import-page .import-tab:hover {
    color: var(--text-secondary);
}
.import-page .import-tab.active {
    color: var(--blue-500);
    border-bottom-color: var(--blue-500);
}
.import-page .import-tab-panel {
    padding-top: 16px;
}
.import-page .import-tab-panel[hidden] {
    display: none !important;
}
.import-page .import-dropzone {
    border: 2px dashed var(--slate-200);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center;
    background: var(--slate-50);
    color: var(--text-secondary);
    transition: border-color 0.15s, background 0.15s;
}
.import-page .import-dropzone:hover {
    border-color: var(--amber-500);
    background: var(--amber-50);
}
.import-page .import-dropzone strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 600;
}
.import-page .import-preview-card {
    border-left: 4px solid var(--green-500);
    margin-bottom: 20px;
}
.import-page .import-preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--slate-100);
}
.import-page .import-preview-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--green-500);
}
.import-page .import-stat-inline {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.import-page .import-stat-inline strong {
    color: var(--text-primary);
}
.import-page .import-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.import-page .import-mini-table th {
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    padding: 8px 10px;
    border-bottom: 1px solid var(--slate-100);
}
.import-page .import-mini-table td {
    padding: 10px;
    border-bottom: 1px solid var(--slate-100);
    vertical-align: middle;
}
.import-page .import-mini-table tbody tr:last-child td {
    border-bottom: none;
}
.import-type-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
}
.import-type-badge-bank {
    background: var(--amber-100);
    color: var(--amber-500);
}
.import-type-badge-invoice {
    background: var(--blue-100);
    color: var(--blue-500);
}
.import-type-badge-query,
.import-type-badge-note {
    background: var(--slate-100);
    color: var(--slate-600);
}
.import-type-badge-err {
    background: var(--slate-100);
    color: var(--text-muted);
}
.import-page .import-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
    margin-bottom: 24px;
}
.import-page .import-btn-row .form-hint {
    margin: 0;
}
.import-page .import-input-card textarea.form-input {
    min-height: 160px;
}

/* Import preview: spreadsheet-style bank grid */
.import-page .import-preview-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
    padding: 0 8px 4px;
}
.import-page .import-bank-preview-grid {
    min-width: 880px;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    overflow: hidden;
}
.import-page .import-bank-preview-grid th,
.import-page .import-bank-preview-grid td {
    border-right: 1px solid var(--slate-100);
    border-bottom: 1px solid var(--slate-100);
}
.import-page .import-bank-preview-grid th:last-child,
.import-page .import-bank-preview-grid td:last-child {
    border-right: none;
}
.import-page .import-bank-preview-grid thead th.import-th-statement {
    text-align: center;
    background: var(--slate-50);
    border-bottom: none;
    padding-bottom: 4px;
}
.import-page .import-bank-preview-grid thead tr:last-child th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: var(--slate-50);
    padding-top: 6px;
    padding-bottom: 8px;
}
.import-page .import-bank-preview-grid tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.85);
}
.import-page .import-bank-preview-grid .import-th-line {
    width: 44px;
}
.import-page .import-bank-preview-grid .import-th-type {
    width: 88px;
}
.import-page .import-bank-preview-grid .import-th-status {
    width: 72px;
}
.import-page .import-bank-preview-grid .import-to-cell {
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.import-page .import-bank-preview-grid tbody td:nth-child(6),
.import-page .import-bank-preview-grid tbody td:nth-child(8) {
    font-variant-numeric: tabular-nums;
}
.import-page .import-bank-preview-grid .import-td-period-free {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    font-variant-numeric: normal;
}
.import-page .import-bank-preview-grid .import-preview-cell-err {
    color: var(--red-600);
    font-size: 12px;
    line-height: 1.4;
}
.import-page .import-preview-ok {
    color: var(--green-500);
    font-weight: 600;
}
.import-page .import-preview-bad {
    color: var(--red-500);
    font-weight: 600;
}
.import-page kbd {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--slate-200);
    background: var(--slate-50);
}
.import-page .import-paste-blocks-card .form-label:first-child {
    font-weight: 600;
}
.import-page .import-paste-blocks {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 900px) {
    .import-page .import-paste-blocks {
        grid-template-columns: 1fr 1fr;
    }
}
.import-page .import-paste-block {
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.import-page .import-paste-block:hover {
    border-color: var(--slate-300);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}
.import-page .import-paste-block-title {
    margin-bottom: 4px;
    font-size: 14px;
}
.import-page .import-paste-block-hint {
    margin: 0 0 8px;
    font-size: 12px;
}
.import-page .import-paste-textarea:not(.import-terminal-textarea) {
    min-height: 100px;
    font-size: 12px;
}
.import-page .import-preview-section {
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--slate-100);
}
.import-page .import-preview-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.import-page .import-preview-section-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}
.import-page .import-paste-editor-label,
.import-page .import-paste-grid-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 10px 0 6px;
}
.import-page .import-paste-grid-label {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.import-page .import-paste-grid-label::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: linear-gradient(135deg, var(--accent, #e8911c), #f59e0b);
}
.import-page .import-paste-editor-label {
    margin-top: 0;
}
.import-page .import-tsv-preview-wrap {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}
.import-page .import-tsv-preview-placeholder {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
}
.import-page .import-tsv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.import-page .import-tsv-table td {
    border: 1px solid var(--slate-200);
    padding: 5px 10px;
    vertical-align: top;
    min-width: 56px;
    max-width: 28rem;
    word-break: break-word;
    background: #fff;
}
.import-page .import-tsv-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}
.import-page .import-tsv-table--single td {
    max-width: none;
}
.import-page .import-tsv-cell-plain {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}
.import-page .import-tsv-preview-footnote {
    margin: 8px 10px 10px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}
/* Supplier-invoices block: echo “Preview before import” section styling */
.import-page .import-tsv-table--supplier .import-tsv-row--supplier-name td {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.12), rgba(251, 191, 36, 0.1));
    border-left: 4px solid var(--green-500);
    padding: 12px 14px !important;
    font-size: 14px;
    line-height: 1.4;
    max-width: none !important;
}
.import-page .import-tsv-supplier-line-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--green-600);
    margin-right: 6px;
}
.import-page .import-tsv-supplier-line-value {
    color: var(--text-primary);
    font-weight: 700;
}
.import-page .import-tsv-table--supplier .import-tsv-row--supplier-statement td {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    background: var(--slate-50);
    padding: 8px 10px !important;
    border-bottom: 1px solid var(--slate-200) !important;
}
.import-page .import-tsv-table--supplier .import-tsv-row--column-head td,
.import-page .import-tsv-th {
    background: var(--slate-100) !important;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}
.import-page .import-tsv-table--supplier .import-tsv-row--free-line .import-tsv-cell-plain {
    font-family: ui-monospace, monospace;
    font-size: 12px;
}
.import-page .import-query-preview-grid,
.import-page .import-invoice-preview-grid {
    min-width: 760px;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    overflow: hidden;
}
.import-page .import-notes-preview-grid {
    min-width: 480px;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    overflow: hidden;
}
.import-page .import-query-preview-grid .import-th-money,
.import-page .import-invoice-preview-grid .import-th-money {
    text-align: right;
}
.import-page .import-td-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.import-page .import-query-preview-grid tbody tr:nth-child(even) td,
.import-page .import-invoice-preview-grid:not(.import-invoice-preview-grid--grouped) tbody tr:nth-child(even) td,
.import-page .import-notes-preview-grid tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.85);
}
.import-page .import-invoice-preview-grid--grouped .import-preview-supplier-banner td {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.1), rgba(251, 191, 36, 0.08)) !important;
    border-left: 4px solid var(--green-500) !important;
    padding: 12px 14px !important;
    font-size: 14px;
}
.import-page .import-preview-supplier-banner-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--green-600);
    margin-right: 8px;
}
.import-page .import-preview-supplier-banner-value {
    color: var(--text-primary);
}
.import-page .import-invoice-preview-grid--grouped tbody tr.import-preview-row-error td {
    background: #fff5f5 !important;
}
.import-page .import-invoice-preview-grid--grouped tbody tr:not(.import-preview-supplier-banner):not(.import-preview-row-error) td {
    background: #fff;
}
.import-page .import-preview-supplier-cell-cont {
    text-align: center;
    color: var(--text-muted);
    font-weight: 600;
}

/* Client detail — urgent accounts (compact strip under header) */
.card-urgent-accounts {
    padding: 12px 14px;
    border-color: rgba(245, 158, 11, 0.45);
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.95) 0%, var(--card-bg) 55%);
    box-shadow: inset 0 1px 0 rgba(251, 191, 36, 0.35);
    margin-bottom: 12px;
}
.urgent-accounts-inner {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 12px 18px;
    align-items: center;
}
.urgent-accounts-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.25);
    color: var(--amber-600);
}
.urgent-accounts-kicker {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--amber-700);
}
.urgent-accounts-lede {
    margin: 2px 0 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-secondary);
    max-width: 52ch;
}
.urgent-accounts-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
}
.urgent-accounts-check input { width: 16px; height: 16px; accent-color: var(--amber-500); }
.urgent-accounts-date {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.urgent-date-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.urgent-date-input {
    max-width: 168px;
    padding: 6px 10px;
    font-size: 13px;
}
.urgent-accounts-save .btn {
    min-width: 72px;
}
@media (max-width: 900px) {
    .urgent-accounts-inner {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .urgent-accounts-icon {
        display: none;
    }
    .urgent-accounts-save .btn {
        width: 100%;
    }
}

/* ---- Enquiries module ---- */
.chip {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    vertical-align: middle;
}
.chip-post { background: var(--red-100); color: #991b1b; }
.chip-email { background: var(--blue-100); color: #1e40af; }
.chip-wa { background: #dcfce7; color: #166534; }
.chip-admin { background: var(--amber-100); color: #92400e; }

.tabs-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.tabs-bar .tab {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}
.tabs-bar .tab.active {
    background: var(--slate-900);
    color: var(--white);
    border-color: var(--slate-900);
}
.tabs-bar .tab-count {
    opacity: 0.75;
    margin-left: 4px;
    font-size: 12px;
}

.enquiry-view-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.enquiry-view-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}
.enquiry-view-toggle {
    display: inline-flex;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
}
.enquiry-view-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-secondary);
    border-right: 1px solid var(--card-border);
}
.enquiry-view-btn:last-child { border-right: none; }
.enquiry-view-btn.active {
    background: var(--slate-900);
    color: var(--white);
}

.enquiry-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--slate-100);
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    font-size: 13px;
    gap: 8px;
}
.enquiry-group-header.overdue {
    background: var(--red-100);
    color: #991b1b;
}
.enquiry-group-count {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 12px;
}
.enquiry-staff-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--blue-100);
    color: #1e40af;
    font-size: 12px;
    font-weight: 700;
    margin-right: 6px;
}

.enquiry-date-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: 200px;
}
@media (max-width: 700px) {
    .enquiry-date-layout { grid-template-columns: 1fr; }
}
.enquiry-date-index {
    border-right: 1px solid var(--card-border);
    background: var(--slate-50);
    overflow-y: auto;
    max-height: 480px;
}
.enquiry-date-index a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    border-bottom: 1px solid var(--slate-100);
}
.enquiry-date-index a:hover { background: var(--card-bg); }
.enquiry-date-index a.active { background: var(--blue-100); font-weight: 600; }
.enquiry-date-index a.overdue { color: var(--red-500); }
.enquiry-date-n {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--card-bg);
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--card-border);
}

.enquiry-detail-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}
@media (max-width: 1000px) {
    .enquiry-detail-grid { grid-template-columns: 1fr; }
}

.enquiry-status-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.enquiry-status-steps span {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--text-muted);
}
.enquiry-status-steps span.current {
    background: var(--blue-100);
    color: #1e40af;
    font-weight: 600;
}
.enquiry-status-steps span.done {
    background: var(--green-100);
    color: #166534;
}

.enquiry-timeline { padding: 14px; }
.enquiry-event {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--slate-100);
}
.enquiry-event:last-child { border-bottom: none; }
.enquiry-event-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.enquiry-event-icon.scan { background: var(--red-100); }
.enquiry-event-icon.note { background: var(--slate-100); }
.enquiry-event-icon.msg { background: var(--blue-100); }
.enquiry-event-icon.done { background: var(--green-100); }
.enquiry-message-quote {
    margin: 8px 0 0;
    padding: 10px 12px;
    background: var(--slate-50);
    border-left: 3px solid var(--blue-500);
    font-size: 13px;
}
.enquiry-checklist {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
}
.enquiry-checklist li { padding: 6px 0; font-size: 13px; }
.enquiry-checklist label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }

.enquiry-upload-zone {
    border: 2px dashed var(--card-border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}
.enquiry-upload-zone.drag { border-color: var(--blue-500); background: var(--blue-100); }

.enquiry-table td { font-size: 13px; }

/* ---- Chasing: year-end month picker ---- */
.chasing-ye-picker {
    margin-bottom: 16px;
    padding: 14px 16px;
}
.chasing-ye-picker__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.chasing-ye-picker__title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}
.chasing-ye-picker__year-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}
.chasing-month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
}
.chasing-month-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    padding: 10px 8px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    background: var(--white);
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.chasing-month-box:hover {
    border-color: var(--blue-500);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
    text-decoration: none;
}
.chasing-month-box.is-active {
    border-color: var(--blue-500);
    background: var(--blue-100);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.chasing-month-box.is-empty {
    opacity: 0.55;
}
.chasing-month-box.is-empty .chasing-month-box__count {
    color: var(--text-muted);
}
.chasing-month-box__name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}
.chasing-month-box__year {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.chasing-month-box__count {
    font-size: 18px;
    font-weight: 700;
    margin-top: 4px;
    color: var(--blue-500);
}
.chasing-month-box.is-active .chasing-month-box__count {
    color: var(--slate-900);
}
.chasing-ye-picker__hint {
    margin: 12px 0 0;
}
.chasing-urgent-details {
    border: 2px solid #f87171;
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.chasing-urgent-details__summary {
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef2f2;
    font-size: 14px;
}
.chasing-urgent-details__summary::-webkit-details-marker { display: none; }
.chasing-data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--slate-100);
}
