  :root {
    --ink: #121212;
    --ink-2: #3a3a3a;
    --muted: #6e6c68;
    --faint: #a3a09a;
    --line: #e7e4de;
    --line-2: #d6d2ca;
    --bg: #f6f5f2;
    --paper: #ffffff;
    --accent: #2140e8;        /* placeholder: swap for Identity brand token */
    --accent-soft: #eef1ff;
    --ok: #157a4a;
    --ok-soft: #e7f5ee;
    --warn: #9a5b00;
    --warn-soft: #fff4e0;
    --bad: #b42318;
    --bad-soft: #fdecea;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
    --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; }
  body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
  button, input { font: inherit; color: inherit; }
  a { color: inherit; }
  .num { font-variant-numeric: tabular-nums; }
  .muted { color: var(--muted); }
  .mono { font-family: var(--mono); font-size: 12.5px; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* ---------- Brand mark ---------- */
  .logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink, inherit); }
  .logo-mark { height: 22px; width: auto; display: block; }
  .logo-app { font-size: 13px; color: var(--muted); padding-left: 8px; border-left: 1px solid var(--line-2); }

  /* ---------- Buttons ---------- */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--paper); cursor: pointer; font-weight: 550; white-space: nowrap; text-decoration: none; }
  .btn:hover { border-color: var(--ink-2); }
  .btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
  .btn-primary:hover { background: #000; }
  .btn-primary:disabled, .btn:disabled { background: #e9e7e2; border-color: #e9e7e2; color: var(--faint); cursor: not-allowed; }
  .btn-ghost { border-color: transparent; background: transparent; }
  .btn-ghost:hover { background: #efede8; border-color: transparent; }
  .btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
  .link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent); font-weight: 550; }
  .link-btn:hover { text-decoration: underline; }

  /* ---------- Pills ---------- */
  .pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
  .pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .pill-ok { color: var(--ok); background: var(--ok-soft); }
  .pill-draft { color: var(--warn); background: var(--warn-soft); }
  .pill-open { color: var(--muted); background: #efede8; }
  .pill-bad { color: var(--bad); background: var(--bad-soft); }
  .tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 4px; padding: 1px 6px; vertical-align: 2px; }
  .rule { font-size: 12px; color: var(--muted); background: #f1efea; border-radius: 4px; padding: 2px 7px; white-space: nowrap; }

  /* ---------- Sign-in ---------- */
  .signin { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
  .signin-card { width: 400px; max-width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 40px 36px 32px; box-shadow: var(--shadow); }
  .signin-card h1 { font-size: 22px; letter-spacing: -.02em; margin: 28px 0 6px; }
  .signin-card p { margin: 0 0 24px; color: var(--muted); }
  .gbtn { width: 100%; height: 44px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 600; }
  .gbtn:hover { background: #fafafa; border-color: #bdb9b0; }
  .domain-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 12px 14px; background: var(--bg); border-radius: 8px; font-size: 13px; color: var(--ink-2); }
  .domain-note b { white-space: nowrap; }
  .alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; }
  .alert-bad { background: var(--bad-soft); color: #7a1a12; }
  .alert-bad svg { flex: none; margin-top: 1px; }
  .signin-foot { margin-top: 28px; font-size: 12px; color: var(--faint); text-align: center; }

  /* Mock Google chooser */
  .gchooser { width: 420px; max-width: calc(100vw - 32px); background: #fff; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.25); overflow: hidden; }
  .gchooser-head { padding: 28px 28px 16px; text-align: center; border-bottom: 1px solid #eee; }
  .gchooser-head h2 { font-size: 20px; font-weight: 500; margin: 14px 0 4px; }
  .gchooser-head p { margin: 0; color: #5f6368; font-size: 14px; }
  .gacct { width: 100%; display: flex; gap: 14px; align-items: center; padding: 12px 28px; border: 0; border-bottom: 1px solid #eee; background: #fff; cursor: pointer; text-align: left; }
  .gacct:hover { background: #f6f8fc; }
  .gavatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 14px; flex: none; }
  .gacct small { display: block; color: #5f6368; font-size: 12.5px; }
  .gother { padding: 14px 28px 22px; }
  .gother form { display: flex; gap: 8px; margin-top: 8px; }
  .gother input { flex: 1; height: 38px; border: 1px solid #dadce0; border-radius: 6px; padding: 0 12px; }
  .gmock { font-size: 11px; color: #9aa0a6; text-align: center; padding: 0 0 14px; }

  /* ---------- App shell ---------- */
  .topbar { position: sticky; top: 0; z-index: 20; height: 60px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
  .topbar-in { max-width: 1320px; margin: 0 auto; height: 100%; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; }
  .user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
  img.avatar { object-fit: cover; }
  .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
  .page { max-width: 1320px; margin: 0 auto; padding: 32px 28px 140px; }
  .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
  .page-head h1 { font-size: 26px; letter-spacing: -.025em; margin: 0; }
  .crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 10px; }
  .crumb:hover { color: var(--ink); }

  /* ---------- Stats ---------- */
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
  .stat { background: var(--paper); padding: 16px 20px; }
  .stat-label { font-size: 12px; color: var(--muted); font-weight: 550; }
  .stat-value { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
  .stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

  /* ---------- Search ---------- */
  .search { position: relative; width: 340px; }
  .search input { width: 100%; height: 40px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); padding: 0 12px 0 38px; }
  .search input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
  .search svg { position: absolute; left: 12px; top: 12px; color: var(--muted); }
  .search kbd { position: absolute; right: 10px; top: 10px; font-family: var(--font); font-size: 11px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; background: var(--bg); }

  /* ---------- Tables ---------- */
  .card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
  table { width: 100%; border-collapse: collapse; }
  th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 20px; border-bottom: 1px solid var(--line); white-space: nowrap; }
  td { padding: 14px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  tr:last-child td { border-bottom: 0; }
  .r { text-align: right; }
  .clients tbody tr { cursor: pointer; }
  .clients tbody tr:hover td { background: #faf9f7; }
  .clients tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .client-name { font-weight: 600; font-size: 14.5px; }
  .chev { color: var(--faint); }
  .clients tbody tr:hover .chev { color: var(--ink); }
  .bar { height: 6px; border-radius: 3px; background: #ece9e3; overflow: hidden; display: flex; min-width: 120px; }
  .bar span { display: block; height: 100%; }
  .bar .b-inv { background: var(--ink); }
  .bar .b-draft { background: #d9a441; }
  .bar .b-approved { background: var(--accent); }
  .empty { padding: 48px 20px; text-align: center; color: var(--muted); }

  /* ---------- Client detail ---------- */
  .client-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 20px; }
  .client-head h1 { font-size: 28px; letter-spacing: -.025em; margin: 0 0 10px; }
  .meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--ink-2); }
  .meta > span { display: inline-flex; align-items: center; gap: 6px; }
  .meta .k { color: var(--muted); }
  .xero-id { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px 2px 8px; }
  .xero-id button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 4px; border-radius: 4px; }
  .xero-id button:hover { background: #e9e7e2; color: var(--ink); }
  .xero-missing { display: inline-flex; align-items: center; gap: 6px; color: var(--bad); font-weight: 600; }
  .sow-link { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); text-decoration: none; font-weight: 550; }
  .sow-link:hover { border-color: var(--ink); }

  .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 8px 0 24px; }
  .tab { position: relative; padding: 10px 14px 12px; border: 0; background: none; font-weight: 600; color: var(--muted); cursor: pointer; }
  .tab[aria-selected="true"] { color: var(--ink); }
  .tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px; }

  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
  @media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }

  .section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 0 0 10px; }
  .section-head h2 { font-size: 16px; margin: 0; letter-spacing: -.01em; }
  .section-head p { margin: 0; font-size: 13px; color: var(--muted); }
  .section + .section { margin-top: 32px; }

  .ms th:first-child, .ms td:first-child { width: 44px; padding-right: 0; }
  .ms .grp td { background: #faf9f7; padding-top: 10px; padding-bottom: 10px; }
  .grp-name { font-weight: 650; }
  .grp-total { color: var(--muted); font-size: 13px; }
  .ms .line td { padding-top: 11px; padding-bottom: 11px; }
  .ms .line.is-sel td { background: var(--accent-soft); }
  .ms .line.is-done .lbl { color: var(--muted); }
  .lbl { display: flex; align-items: center; gap: 8px; }
  .lock { color: var(--faint); flex: none; }
  .inv-ref { font-size: 12px; color: var(--muted); }
  .why { font-size: 12px; color: var(--faint); }
  input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--ink); cursor: pointer; margin: 0; }
  input[type="checkbox"]:disabled { cursor: not-allowed; }

  /* Ad hoc */
  .adhoc-row { display: grid; grid-template-columns: 1fr 160px 36px; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: start; }
  .field { display: flex; flex-direction: column; gap: 4px; }
  .field input { height: 38px; border: 1px solid var(--line-2); border-radius: 7px; padding: 0 10px; background: #fff; width: 100%; }
  .field input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
  .field.err input { border-color: var(--bad); }
  .field .hint { font-size: 11.5px; color: var(--bad); min-height: 0; }
  .money { position: relative; }
  .money span { position: absolute; left: 10px; top: 10px; color: var(--muted); }
  .money input { padding-left: 22px; text-align: right; }
  .adhoc-foot { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); background: #faf9f7; border-radius: 0 0 var(--radius) var(--radius); }
  .adhoc-empty { padding: 18px 16px; color: var(--muted); font-size: 13px; }
  .icon-btn { width: 36px; height: 38px; border: 0; background: none; border-radius: 6px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
  .icon-btn:hover { background: #efede8; color: var(--bad); }

  /* Asana side panel */
  .side { position: sticky; top: 84px; }
  .side .card { padding: 18px; }
  .side h3 { font-size: 14px; margin: 0; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
  .phase { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 99px; }
  .side p { font-size: 13px; color: var(--muted); margin: 10px 0 14px; }
  .ghost-task { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px dashed var(--line); opacity: .55; font-size: 13px; }
  .ghost-task .dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--faint); flex: none; }
  .ghost-task .dot.done { background: var(--faint); }
  .ghost-task em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--faint); }

  /* Sticky invoice bar */
  .invbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--ink); color: #fff; transform: translateY(100%); transition: transform .2s ease; }
  .invbar.show { transform: translateY(0); }
  .invbar-in { max-width: 1320px; margin: 0 auto; padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .invbar .sum { font-size: 14px; }
  .invbar .sum b { font-size: 18px; letter-spacing: -.01em; }
  .invbar .sum small { display: block; color: #a9a7a2; font-size: 12px; }
  .invbar .btn { background: #fff; color: var(--ink); border-color: #fff; }
  .invbar .btn:disabled { background: #3a3a3a; border-color: #3a3a3a; color: #8a8883; }
  .invbar .btn-ghost { background: transparent; color: #d7d5d0; border-color: transparent; }
  .invbar .btn-ghost:hover { background: #2a2a2a; }
  .invbar .blocker { color: #ffb4ab; font-size: 13px; }

  /* ---------- Modal ---------- */
  .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(18,18,18,.45); display: grid; place-items: center; padding: 24px; overflow-y: auto; }
  .modal { width: 760px; max-width: 100%; background: var(--paper); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
  .modal-head { padding: 22px 28px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
  .modal-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
  .modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
  .modal-body { padding: 20px 28px; }
  .modal-foot { padding: 16px 28px 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--line); }
  .guard { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); max-width: 400px; }
  .guard svg { flex: none; color: var(--warn); margin-top: 1px; }

  .invoice { border: 1px solid var(--line); border-radius: 10px; padding: 24px; position: relative; overflow: hidden; }
  .watermark { position: absolute; right: 18px; top: 16px; font-weight: 800; font-size: 12px; letter-spacing: .12em; color: var(--warn); border: 1.5px solid var(--warn); border-radius: 4px; padding: 3px 8px; }
  .inv-meta { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; margin-bottom: 20px; font-size: 13px; }
  .inv-meta .k { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
  .invoice table th { padding: 8px 0; }
  .invoice table td { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .invoice table th + th, .invoice table td + td { padding-left: 16px; }
  .totals { margin-left: auto; width: 260px; margin-top: 12px; font-size: 13px; }
  .totals div { display: flex; justify-content: space-between; padding: 4px 0; }
  .totals .grand { border-top: 1px solid var(--ink); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 15px; }
  .src { font-size: 11px; font-weight: 600; color: var(--muted); background: #f1efea; border-radius: 3px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }

  .success { padding: 44px 36px 32px; text-align: center; }
  .success .tick { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 18px; }
  .success h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
  .success p { margin: 0 auto; color: var(--muted); max-width: 440px; }
  .success dl { display: grid; grid-template-columns: auto auto; gap: 6px 20px; justify-content: center; text-align: left; margin: 22px auto; font-size: 13px; }
  .success dt { color: var(--muted); }
  .success dd { margin: 0; font-weight: 600; }
  .success .actions { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
  .spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  .toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 80; box-shadow: var(--shadow); }
  .proto-note { position: fixed; right: 12px; bottom: 12px; z-index: 5; font-size: 11px; color: var(--faint); }

  /* =========== Phase 1 build additions =========== */
  .pill-sent { color: var(--ok); background: var(--ok-soft); }
  .pill-approved { color: var(--accent); background: var(--accent-soft); }
  .pill-paid { color: var(--accent); background: var(--accent-soft); }
  .pill-pending { color: var(--bad); background: var(--bad-soft); }
  .pill-void { color: var(--muted); background: #efede8; text-decoration: line-through; }
  .pill-void::before { display: none; }
  .tag-example { color: var(--warn); border-color: #e6c48a; }

  a.tab { text-decoration: none; display: inline-block; }
  .tab .count { font-weight: 600; color: var(--faint); margin-left: 4px; }

  /* Loading skeletons */
  .skel { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, #eeece7 0%, #f6f5f2 50%, #eeece7 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
  .skel.lg { height: 22px; width: 60%; }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .loading-card { padding: 20px; display: grid; gap: 14px; }

  /* Banners */
  .banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; }
  .banner svg { flex: none; margin-top: 1px; }
  .banner-bad { background: var(--bad-soft); color: #7a1a12; }
  .banner-warn { background: var(--warn-soft); color: #6b3f00; }
  .banner-info { background: var(--accent-soft); color: #1b2b8a; }
  .banner .actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

  /* Segmented control (Ex GST / Inc GST) */
  .seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; background: var(--bg); }
  .seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
  .seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
  .gst-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
  .gst-row .muted { font-size: 12.5px; }

  /* Invoice list */
  .inv-table td { vertical-align: top; }
  .inv-lines { margin: 4px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
  .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .err-text { font-size: 12px; color: var(--bad); margin-top: 4px; max-width: 280px; }
  .mock-btn { border-style: dashed; }

  /* Header actions */
  .head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
  .sync-note { font-size: 12px; color: var(--muted); }

  /* Modal states */
  .state-box { padding: 40px 36px 28px; text-align: center; }
  .state-box .tick { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; }
  .state-box .tick.bad { background: var(--bad-soft); color: var(--bad); }
  .state-box h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
  .state-box p { margin: 0 auto 6px; color: var(--muted); max-width: 470px; }
  .state-box .actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
  .spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--ink); }
  .contact-list { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; }
  .contact-list button { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; }
  .contact-list button:hover { background: #faf9f7; }
  .contact-list button:last-child { border-bottom: 0; }
  .contact-list small { display: block; }

  /* Mock controls (only when Xero/Google are mocked) */
  .mockctl-toggle { position: fixed; left: 12px; bottom: 12px; z-index: 40; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px dashed var(--line-2); background: var(--paper); font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
  .mockctl-toggle.armed { color: var(--bad); border-color: var(--bad); }
  .mockctl { position: fixed; left: 12px; bottom: 52px; z-index: 40; width: 300px; background: var(--paper); border: 1px dashed var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 14px 16px; font-size: 13px; }
  .mockctl h4 { margin: 0 0 4px; font-size: 13px; }
  .mockctl p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
  .mockctl label { display: block; font-weight: 600; font-size: 12px; margin: 10px 0 4px; }
  .mockctl select, .mockctl input { width: 100%; height: 32px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 8px; background: #fff; }
  .mockctl .row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
  body.has-invbar .mockctl-toggle { bottom: 84px; }
  body.has-invbar .mockctl { bottom: 124px; }

  /* Real Xero connection panel (XERO_MODE=xero only) */
  .xero-panel { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font-size: 14px; }
  .xero-panel > svg { flex: none; }
  .xero-panel > div:not(.actions) { flex: 1; }
  .xero-panel .actions { display: flex; gap: 8px; flex: none; }
  .xp-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
  .xp-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
  .xp-live { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
  .xp-bad { background: var(--bad-soft); border-color: transparent; color: #7a1a12; }

  /* ---------- CSD (Customer Service Desk, from the Xero "CSD" tracking category) ---------- */
  .topnav { display: flex; gap: 4px; margin-left: 28px; margin-right: auto; }
  .topnav a { padding: 6px 12px; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: 13.5px; }
  .topnav a:hover { color: var(--ink); background: var(--bg); }
  .topnav a[aria-current="page"] { color: var(--ink); background: var(--bg); }
  .csd-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
  .csd-row.err { border-color: var(--bad); background: var(--bad-soft); }
  .csd-row label { font-weight: 650; font-size: 13px; }
  .csd-row .src-note { font-size: 12px; color: var(--muted); margin-top: 3px; }
  .csd-row select, .csd-select { height: 36px; min-width: 220px; border: 1px solid var(--line-2); border-radius: 7px; padding: 0 10px; background: #fff; font: inherit; }
  .csd-row .hint { font-size: 12px; color: var(--bad); margin-top: 4px; }
  .csd-confirm { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin-top: 8px; }
  .csd-flag { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: var(--warn); }
  .csd-flag.bad { color: var(--bad); }
  .csd-none { color: var(--faint); }
  .csd-history { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12.5px; }
  .csd-history li { padding: 6px 0; border-top: 1px solid var(--line); }
  .report-filters { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; margin-bottom: 16px; }
  .report-filters label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
  .report-filters input[type="month"] { height: 36px; border: 1px solid var(--line-2); border-radius: 7px; padding: 0 8px; background: #fff; font: inherit; }
  .report-filters .checks { display: flex; gap: 14px; flex-wrap: wrap; height: 36px; align-items: center; font-size: 13px; }
  .report-table td.r, .report-table th.r { white-space: nowrap; }
  .report-table tfoot td { font-weight: 700; border-top: 2px solid var(--line-2); }
  .report-table td.zero { color: var(--faint); }
  .csd-options { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
  .csd-options span { border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; background: var(--paper); }

  /* "Already invoiced?" check: invoices made directly in Xero that look like a SOW line */
  .xm { margin-top: 8px; border: 1px solid #f0d9ae; background: var(--warn-soft); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
  .xm-head { display: flex; gap: 6px; align-items: center; font-weight: 600; color: var(--warn); }
  .xm-item { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #f0d9ae; }
  .xm-item:first-of-type { border-top: 0; padding-top: 0; }
  .xm-item .pill { transform: scale(.9); transform-origin: left center; }
  .xm-desc { color: var(--ink-2); margin-top: 2px; white-space: pre-line; }
  .xm-amt { font-size: 12px; color: var(--warn); margin-top: 3px; }
  .xm-actions { display: flex; gap: 6px; margin-top: 6px; }
  .banner.sow-notes { background: var(--paper, #fff); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
  .xm-target { font: inherit; font-size: 12px; padding: 3px 6px; border: 1px solid var(--line-2); border-radius: 6px; max-width: 190px; background: #fff; }

/* SOW GST basis dropdown in the client header */
.gst-select { font: inherit; font-size: 13px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line, #d0d5dd); background: var(--paper); color: inherit; }

/* Add client from SOW */
.sow-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px; border: 1.5px dashed var(--line-2, #cfcac0); border-radius: 12px; cursor: pointer; text-align: center; background: #fff; }
.sow-drop:hover, .sow-drop.over, .sow-drop:focus-within { border-color: var(--ink); background: #faf9f7; }
.sow-drop svg { width: 26px; height: 26px; }
.sow-drop .muted { font-size: 12.5px; }
.sow-reading { display: flex; gap: 14px; align-items: center; padding: 22px 4px; }
.sow-review { max-height: calc(100vh - 220px); overflow-y: auto; }
.sow-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 4px; }
.sow-grid label, .sow-review .field > label { font-size: 12.5px; color: var(--muted); }
.sow-review textarea { font: inherit; font-size: 13.5px; border: 1px solid var(--line-2, #d0d5dd); border-radius: 7px; padding: 8px 10px; width: 100%; resize: vertical; }
.sow-h { font-size: 14px; margin: 22px 0 8px; }
.sow-del { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.sow-del-head, .sow-pay { display: flex; gap: 8px; align-items: center; }
.sow-del-head .sw-dn { flex: 1; font-weight: 600; }
.sow-del input { height: 32px; border: 1px solid var(--line-2, #d0d5dd); border-radius: 7px; padding: 0 8px; font: inherit; font-size: 13.5px; }
.sow-fee { display: flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.sow-fee input, .sow-pay input[type=number] { width: 110px; text-align: right; }
.sow-pay { margin: 6px 0 0 18px; }
.sow-pay .sw-ps { flex: 1; }
.sow-pay label { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.sow-rule { font-size: 12px; margin: 6px 0 0 18px; }
.sow-del .link-btn { margin: 8px 0 0 18px; font-size: 12.5px; display: inline-flex; gap: 4px; align-items: center; }
.sow-ct-pick { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 13.5px; }
@media (max-width: 720px) { .sow-grid { grid-template-columns: 1fr 1fr; } .sow-del-head { flex-wrap: wrap; } }

/* Paid / unpaid line under a milestone's status */
.pay-line { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pay { font-weight: 600; }
.pay-ok { color: var(--ok); }
.pay-due { color: var(--warn); }
.pay-bad { color: var(--bad); }

/* Bonuses */
.cards-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .cards-2 { grid-template-columns: 1fr; } }
.bonus-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius, 12px); padding: 18px 20px; display: grid; gap: 12px; min-width: 0; align-content: start; }
.bonus-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bonus-head h3 { margin: 0; font-size: 17px; }
.btag { display: inline-flex; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #f0eee8; color: var(--muted); font-weight: 600; white-space: nowrap; }
.btag.pending { background: var(--warn-soft); color: #6b3f00; }
.btag.bad { background: var(--bad-soft); color: var(--bad); }
.bonus-kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 13.5px; }
.bonus-kv dt { color: var(--muted); }
.bonus-kv dd { margin: 0; text-align: right; }
.bonus-kv .t { font-weight: 650; color: var(--ink); border-top: 1px solid var(--line); padding-top: 6px; }
.bonus-bar { height: 8px; border-radius: 99px; background: #eeece6; overflow: hidden; display: flex; }
.bonus-bar .b-paid { background: var(--ok); }
.bonus-bar .b-wait { background: var(--warn); opacity: .55; }
.bonus-awards { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.paid-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.paid-toggle input { width: 16px; height: 16px; accent-color: var(--ok); }
.bonus-detail summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.bonus-detail h4 { font-size: 13px; margin: 14px 0 6px; }
.bonus-detail .scroll { margin-top: 8px; }
.scroll { overflow-x: auto; }
tr.is-excluded td { color: var(--faint); text-decoration: line-through; }
tr.is-excluded td:last-child { text-decoration: none; }
.bonus-email { padding: 16px 18px; display: grid; gap: 10px; margin-bottom: 10px; }
.bonus-email-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.bonus-email-body { margin: 0; white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; background: #faf9f7; border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 320px; overflow: auto; }
.bonus-people input[type=email] { width: 260px; }
.bonus-people input { height: 32px; border: 1px solid var(--line-2, #d0d5dd); border-radius: 7px; padding: 0 8px; font: inherit; font-size: 13px; }
.bonus-people input.bp-open { width: 120px; text-align: right; }
.proto-note a, .proto-note .link-btn { color: var(--muted); }
.toast-action { margin-left: 10px; background: none; border: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }
.inv-ref .link-btn { font-size: inherit; }

/* Asana board */
.asana-pick { display:block; width:100%; text-align:left; padding:8px 10px; margin-top:6px; border:1px solid var(--line); border-radius:8px; background:transparent; color:inherit; cursor:pointer; font:inherit; font-size:13px; }
.asana-pick:hover { border-color:var(--line-2); }
.asana-name { display:inline-flex; gap:4px; align-items:center; font-weight:600; font-size:13px; margin:2px 0 8px; color:inherit; }
.ghost-task .dot.half { background:linear-gradient(90deg, var(--faint) 50%, transparent 50%); }
.asana-recent-h { margin:12px 0 4px; font-size:12px; font-weight:600; }
.asana-recent { font-size:12px; padding:2px 0; }
.asana-board + .asana-board { margin-top:14px; padding-top:12px; border-top:1px solid var(--line); }
.st-line { display:flex; flex-wrap:wrap; align-items:center; gap:4px 6px; font-size:12.5px; color:var(--muted); }
.st-line .pill { margin-right:2px; }
.inv-link { color:inherit; text-decoration:underline; text-underline-offset:2px; }
.st-flag { margin-top:4px; font-size:12.5px; font-weight:600; color:var(--bad); }
