  /* =========================================================================
     Customer Portal — redesigned May 2026 to match the staff studio shell.
     Navy sidebar (deep lift on the customer-blue), warm cream canvas, Inter,
     white cards. Restyles the existing markup + JS-emitted classes in place
     so all data-loading + modals keep working unchanged.
     ========================================================================= */
  :root {
    --ink: #0e1410; --ink-2: #2a312c; --ink-3: #5c655e; --ink-4: #8a938c;
    --line: #e6e4de; --line-2: #efece6;
    --bg: #fafaf7; --card: #ffffff;
    --brand: #2563eb; --brand-2: #1e40af; --brand-3: #1e3a8a;
    --brand-soft: #eff4ff; --brand-soft-2: #dbeafe;
    --side-bg: #0f1d3f; --side-bg-2: #15295a;
    --side-text: rgba(255,255,255,0.78); --side-text-strong: #ffffff; --side-text-dim: rgba(255,255,255,0.48);
    --danger: #b3261e; --danger-soft: #fdf1ef;
    --warning: #b45309; --warning-soft: #fef6e7;
    --success: #166534; --success-soft: #ecfdf3;
    /* legacy aliases used by existing markup/JS */
    --navy: #0f1d3f; --navy-soft: #15295a; --cream: #fafaf7; --paper: #fbfaf5;
    --ink-faint: #8a938c; --green: #16a34a; --green-soft: #ecfdf3; --green-dark: #166534;
    --violet: #6b21a8; --violet-soft: #f3e8ff; --gold: #b45309;
    --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --shadow-sm: 0 1px 2px rgba(14,20,16,0.04), 0 1px 3px rgba(14,20,16,0.03);
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    font-family: var(--font); color: var(--ink); background: var(--bg);
    min-height: 100vh; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "ss01", "cv11";
  }
  a { color: var(--ink-2); text-decoration: none; }
  a:hover { color: var(--brand); }

  /* ===== App shell ===== */
  .app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

  /* ===== Sidebar ===== */
  .sidebar {
    background: var(--side-bg);
    background-image:
      radial-gradient(ellipse 70% 40% at 0% 0%, var(--side-bg-2), transparent 70%),
      radial-gradient(ellipse 60% 40% at 100% 100%, var(--brand-3), transparent 70%);
    color: var(--side-text);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    border-right: 1px solid rgba(0,0,0,0.4);
  }
  .sb-brand { padding: 22px 22px 16px; display: flex; align-items: center; gap: 12px; }
  .sb-brand-mark { width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
  .sb-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
  .sb-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
  .sb-brand-text .b1 { font-size: 14px; font-weight: 600; color: var(--side-text-strong); letter-spacing: -0.01em; display:flex; align-items:center; gap:8px; }
  .sb-brand-text .b2 { font-size: 10.5px; color: var(--side-text-dim); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 3px; }
  .preview-badge { font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: var(--gold); color: #fff; padding: 1px 6px; border-radius: 4px; }
  body:not(.preview-mode) .preview-badge { display: none; }

  .sb-school { margin: 4px 14px 8px; padding: 10px 12px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; display: flex; align-items: center; gap: 10px; }
  .sb-school-mark { width: 32px; height: 32px; border-radius: 7px; background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #0f172a; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
  .sb-school-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
  .sb-school-name { font-size: 12.5px; font-weight: 600; color: var(--side-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sb-school-meta { font-size: 10.5px; color: var(--side-text-dim); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }

  .sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }
  .sb-nav::-webkit-scrollbar { width: 6px; }
  .sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
  .sb-section { margin-top: 16px; padding: 0 10px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--side-text-dim); }
  .sb-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--side-text); cursor: pointer; border: 1px solid transparent; background: transparent; text-decoration: none; transition: background .12s, color .12s; }
  .sb-link:hover { background: rgba(255,255,255,0.04); color: var(--side-text-strong); }
  .sb-link.active { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.18); color: var(--side-text-strong); font-weight: 600; }
  .sb-link .ti { font-size: 16px; width: 18px; text-align: center; opacity: 0.85; }
  .sb-link.soon { opacity: 0.5; cursor: default; }
  .sb-link .sb-soon { margin-left: auto; font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; background: rgba(255,255,255,0.06); color: var(--side-text-dim); padding: 1px 6px; border-radius: 4px; }

  /* User pill (carries the existing usermenu IDs so JS works) */
  .sb-foot { margin: 8px 14px 16px; position: relative; }
  .usermenu { position: relative; }
  .usermenu-trigger { width: 100%; padding: 8px 12px 8px 8px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 999px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: background .12s; font-family: inherit; }
  .usermenu-trigger:hover { background: rgba(255,255,255,0.07); }
  .usermenu-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #93c5fd, #60a5fa); color: #0f1d3f; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; flex-shrink: 0; }
  .usermenu-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
  .usermenu-who .n { font-size: 12.5px; font-weight: 600; color: var(--side-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .usermenu-who .r { font-size: 10.5px; color: var(--side-text-dim); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }
  .usermenu-chev { color: var(--side-text-dim); font-size: 14px; flex-shrink: 0; }
  .usermenu-dropdown { position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 -6px 24px rgba(0,0,0,0.18); padding: 6px; display: none; z-index: 200; }
  .usermenu-dropdown.open { display: block; }
  .usermenu-head { padding: 8px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
  .usermenu-name { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0; }
  .usermenu-email { font-size: 11.5px; color: var(--ink-3); margin: 2px 0 0; }
  .usermenu-item { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; font-family: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; border-radius: 6px; }
  .usermenu-item:hover { background: var(--line-2); }
  .usermenu-danger { color: var(--danger); }

  /* ===== Main ===== */
  main { min-width: 0; }
  .stack { padding: 24px 32px 48px; max-width: 1200px; display: flex; flex-direction: column; gap: 14px; }

  /* Hero → school card */
  .hero { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px 26px; background-image: radial-gradient(ellipse 60% 80% at 0% 0%, var(--brand-soft) 0%, transparent 60%); }
  #hero-logo-wrap { display: flex; align-items: center; }
  .hero-logo { width: 84px; height: 84px; border-radius: 14px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
  .hero-logo.fallback { display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; color: var(--brand-2); background: linear-gradient(135deg, var(--brand-soft-2), var(--brand-soft)); }
  .hero-logo.skeleton { background: var(--line-2); color: transparent; }
  .greeting { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand-2); margin: 0 0 4px; }
  .hero h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; color: var(--ink); }
  .school-name { font-size: 14px; color: var(--ink-3); margin: 0 0 14px; }
  .hero-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 2px; }
  .hero-kpis .kpi { background: none; border: 0; padding: 0; }
  .hero-kpis .kpi .label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); margin: 0 0 3px; }
  .hero-kpis .kpi .value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin: 0; font-variant-numeric: tabular-nums; }
  .hero-kpis .kpi .sub { font-size: 11px; color: var(--ink-4); margin: 2px 0 0; }
  .hero-kpis .kpi .sub.kpi-extra { color: var(--brand-2); font-weight: 500; }
  @media (max-width: 720px) { .hero { grid-template-columns: 1fr; } .hero-kpis { grid-template-columns: 1fr; gap: 12px; } }

  /* Generic card */
  .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
  .card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
  .card-title { font-size: 14px; font-weight: 600; margin: 0; color: var(--ink); }
  .card-meta { font-size: 12px; color: var(--ink-4); }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  @media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

  /* Helpdesk banner */
  .helpdesk-banner { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; flex-direction: column; gap: 14px; }
  .hb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .hb-title { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
  .hb-sub { font-size: 11px; color: var(--ink-4); }
  .hb-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
  .hb-stat { display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--line-2); padding-right: 8px; }
  .hb-stat:last-child { border-right: 0; }
  .hb-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-4); margin: 0; }
  .hb-value { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; color: var(--ink); margin: 0; font-variant-numeric: tabular-nums; }
  .hb-value.warm { color: var(--warning); }
  .hb-foot { font-size: 10.5px; color: var(--ink-4); margin: 0; }
  @media (max-width: 760px) { .hb-row { grid-auto-flow: row; grid-template-columns: repeat(2,1fr); } .hb-stat { border-right: 0; } }

  /* Renewals banner */
  .renewals { background: var(--warning-soft); border: 1px solid color-mix(in oklab, var(--warning), white 70%); border-radius: var(--radius); padding: 14px 18px; }
  .renewals .text { font-size: 13.5px; color: var(--ink-2); }
  .renewals .text strong { color: var(--ink); }

  /* School details grid */
  .detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 28px; }
  .detail-grid .field .label, .field .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-4); margin: 0 0 4px; }
  .detail-grid .field .value, .field .value { font-size: 14px; color: var(--ink); margin: 0; line-height: 1.4; }
  .detail-grid .value .empty, .value .empty, .empty { color: var(--ink-4); font-style: italic; }
  @media (max-width: 600px) { .detail-grid { grid-template-columns: 1fr; } }

  /* Team sections */
  .team-section { margin-bottom: 14px; }
  .team-section:last-child { margin-bottom: 0; }
  .team-section h3 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-4); margin: 0 0 8px; }

  /* People rows */
  .person { display: flex; align-items: flex-start; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .person:last-child { border-bottom: 0; }
  .person-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-soft), var(--brand-soft-2)); color: var(--brand-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
  .person-body { flex: 1; min-width: 0; }
  .person-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
  .person-role { font-size: 12.5px; color: var(--ink-3); margin: 1px 0 0; }
  .person-extra { font-size: 12px; color: var(--ink-4); margin: 4px 0 0; }
  .person-extra a { color: var(--ink-3); }
  .person-extra a:hover { color: var(--brand); }

  /* Account-management visits (last + next), shown under the AM */
  .am-visits { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 6px; }
  .am-visit { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
  .am-visit-label { color: var(--ink-4); font-weight: 600; flex-shrink: 0; }
  .am-visit-val { color: var(--ink-2); text-align: right; }

  /* Pins / badges */
  .pin { display: inline-flex; align-items: center; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: var(--line-2); color: var(--ink-3); }
  .pin-green { background: var(--success-soft); color: var(--success); }
  .pin-violet { background: #f3e8ff; color: #6b21a8; }

  /* Account grid reuses .detail-grid */

  /* Invoices table */
  .invoices-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  .invoices-table thead th { text-align: left; padding: 6px 10px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); border-bottom: 1px solid var(--line); }
  .invoices-table thead th.num, .invoices-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
  .invoices-table tbody td { padding: 12px 10px; border-bottom: 1px solid var(--line-2); }
  .invoices-table tbody tr:last-child td { border-bottom: 0; }
  .invoices-table tbody tr:hover { background: var(--paper); cursor: pointer; }
  .invoices-table .inv-num { font-weight: 600; color: var(--ink); }
  .invoices-table .inv-due { color: var(--ink-3); }
  .invoices-table tr.is-overdue .inv-due { color: var(--danger); font-weight: 500; }
  .invoices-pill { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
  .invoices-pill.overdue { background: var(--danger-soft); color: var(--danger); }
  .invoices-pill.ok { background: var(--success-soft); color: var(--success); }

  /* Services */
  .svc-group { margin-bottom: 18px; }
  .svc-group:last-child { margin-bottom: 0; }
  .svc-group-title { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
  .svc-group-title::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
  .svc-card { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 14px 18px 14px 22px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: 8px; transition: border-color .12s, box-shadow .12s; }
  .svc-card:last-child { margin-bottom: 0; }
  .svc-card::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--svc-color, var(--ink-4)); }
  .svc-card:hover { border-color: #cfcdc5; box-shadow: var(--shadow-sm); }
  .svc-card[data-cat="core"]         { --svc-color: #1e40af; }
  .svc-card[data-cat="connectivity"] { --svc-color: #16a34a; }
  .svc-card[data-cat="voice"]        { --svc-color: #7c3aed; }
  .svc-card[data-cat="security"]     { --svc-color: #b91c1c; }
  .svc-card[data-cat="licensing"]    { --svc-color: #b45309; }
  .svc-card[data-cat="compliance"]   { --svc-color: #475569; }
  .svc-card[data-cat="hardware"]     { --svc-color: #0891b2; }
  .svc-name { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 8px; }
  .svc-chips { display: flex; flex-wrap: wrap; gap: 14px; }
  .chip { display: inline-flex; flex-direction: column; line-height: 1.2; }
  .chip-label { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); margin: 0; }
  .chip-value { font-size: 12.5px; color: var(--ink-2); font-weight: 500; margin: 2px 0 0; }
  .chip-amber .chip-value { color: var(--warning); font-weight: 600; }
  .svc-price-block { text-align: right; min-width: 90px; }
  .svc-price { font-size: 18px; font-weight: 600; color: var(--ink); margin: 0; font-variant-numeric: tabular-nums; letter-spacing: -0.015em; }
  .svc-price-sub { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-4); font-weight: 500; margin: 2px 0 0; }
  @media (max-width: 600px) { .svc-card { grid-template-columns: 1fr; } .svc-price-block { text-align: left; } }

  /* Coming soon */
  .placeholders-intro { font-size: 13px; color: var(--ink-3); margin: 0 0 14px; }
  .placeholder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
  .placeholder { position: relative; background: var(--paper); border: 1px dashed var(--line); border-radius: 10px; padding: 14px 16px; }
  .badge-cs { position: absolute; top: 12px; right: 12px; font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-2); background: var(--brand-soft); padding: 2px 6px; border-radius: 4px; }
  .placeholder-icon { font-size: 20px; }
  .placeholder-title { font-size: 13px; font-weight: 600; color: var(--ink); margin: 6px 0 4px; padding-right: 50px; }
  .placeholder-desc { font-size: 12px; color: var(--ink-3); margin: 0; line-height: 1.45; }

  /* Buttons */
  .btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; font-size: 13px; font-weight: 500; font-family: var(--font); border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
  .btn:hover { border-color: #cfcdc5; background: var(--paper); }
  .btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
  .btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
  .btn-secondary { background: #fff; }
  .btn-ghost { background: transparent; border-color: transparent; color: var(--ink-3); height: auto; padding: 4px 8px; }
  .btn-ghost:hover { color: var(--brand); background: var(--line-2); }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; }

  /* Modals */
  .modal-backdrop { position: fixed; inset: 0; background: rgba(15,29,63,0.4); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
  .modal-backdrop.open { display: flex; }
  .modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; box-shadow: 0 24px 50px -20px rgba(14,20,16,0.25); }
  .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); }
  .modal-title { font-size: 16px; font-weight: 600; margin: 0; }
  .modal-close { background: none; border: 0; font-size: 22px; color: var(--ink-4); cursor: pointer; line-height: 1; }
  .modal-close:hover { color: var(--ink); }
  .modal-body { padding: 18px 22px; }
  .modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
  .modal-foot-right { display: flex; gap: 10px; }
  .form-row { margin-bottom: 14px; }
  .form-row label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
  .form-row input[type=text], .form-row input[type=email], .form-row input[type=tel], .form-row input[type=password], .form-row textarea { width: 100%; padding: 9px 12px; font-size: 14px; font-family: var(--font); border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
  .form-row textarea { resize: vertical; min-height: 70px; }
  .form-row input:focus, .form-row textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
  .form-row .check { display: flex; align-items: center; gap: 8px; }
  .form-row .check input { width: 18px; height: 18px; cursor: pointer; }
  .form-row .help { font-size: 11.5px; color: var(--ink-4); margin-top: 4px; }
  .form-err { display: none; background: var(--danger-soft); color: var(--danger); font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
  .form-err.show { display: block; }
  .form-warn { background: var(--warning-soft); color: var(--warning); font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }

  /* Toast */
  .toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(12px); background: var(--side-bg); color: #fff; font-size: 13.5px; padding: 12px 20px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 300; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  .toast.error { background: var(--danger); }

  /* Preview-mode: hide edit affordances */
  body.preview-mode #edit-school-btn,
  body.preview-mode #add-contact-btn,
  body.preview-mode [data-edit-contact],
  body.preview-mode #change-password-btn { display: none !important; }

  /* Mobile: collapse sidebar */
  @media (max-width: 760px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .stack { padding: 20px 16px 40px; }
  }
  @media print { .sidebar, .btn, .modal-backdrop { display: none !important; } }

  /* ===== Multi-page additions (May 2026) ===== */
  /* Full-width content — no max-width cap. */
  .stack { max-width: none; }

  /* Home stat tiles (figures only — full detail lives on its own page) */
  .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 4px 8px; }
  .stat-cell { display: flex; flex-direction: column; gap: 3px; padding: 8px 14px 8px 0; border-right: 1px solid var(--line-2); }
  .stat-cell:last-child { border-right: 0; }
  .stat-lbl { font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-4); margin: 0; }
  .stat-val { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; color: var(--ink); margin: 0; font-variant-numeric: tabular-nums; }
  .stat-val.warn { color: var(--warning); }
  .stat-val.small { font-size: 17px; }
  .stat-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); }
  .stat-foot strong { color: var(--ink); font-weight: 600; }
  @media (max-width: 760px) { .stat-cell { border-right: 0; } }

  /* Renewals card list */
  .renew-list { display: flex; flex-direction: column; }
  .renew-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .renew-row:last-child { border-bottom: 0; }
  .renew-swatch { width: 3px; height: 28px; border-radius: 2px; background: var(--svc-color, var(--brand)); flex-shrink: 0; }
  .renew-body { flex: 1; min-width: 0; }
  .renew-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
  .renew-meta { font-size: 12px; color: var(--ink-4); margin-top: 2px; }
  .renew-meta.soon { color: var(--warning); font-weight: 500; }
  .renew-amount { font-size: 14px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

  /* Panel footer link */
  .panel-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 12.5px; font-weight: 500; color: var(--brand-2); }
  .panel-link:hover { color: var(--brand); text-decoration: underline; }

  /* Page heading on subpages */
  .page-head { margin-bottom: 4px; }
  .page-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; color: var(--ink); }
  .page-head p { font-size: 14px; color: var(--ink-3); margin: 0; }

  /* Card head action button (e.g. Add person / Edit) */
  .card-actions { display: flex; align-items: center; gap: 8px; }
  .btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
  .btn-danger:hover { filter: brightness(0.94); }

  /* Invoice detail modal body */
  .invoice-detail .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px 20px; margin-bottom: 18px; }
  .invoice-detail .row .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-4); margin: 0 0 3px; }
  .invoice-detail .row .value { font-size: 14px; color: var(--ink); margin: 0; }
  .invoice-detail table.lines { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
  .invoice-detail table.lines th { text-align: left; padding: 6px 8px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-4); border-bottom: 1px solid var(--line); }
  .invoice-detail table.lines th.num, .invoice-detail table.lines td.num { text-align: right; font-variant-numeric: tabular-nums; }
  .invoice-detail table.lines td { padding: 8px; border-bottom: 1px solid var(--line-2); }
  .invoice-detail .totals { margin-left: auto; max-width: 320px; }
  .invoice-detail .totals .line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; color: var(--ink-2); }
  .invoice-detail .totals .line.grand { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; font-weight: 600; color: var(--ink); }
  .invoice-detail .totals .line.due { border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 9px; font-weight: 700; color: var(--ink); font-size: 15px; }
