:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #14213d;
  --ink-2: #4a5468;
  --ink-3: #7c8496;
  --line: #e4e1da;
  --accent: #e8900c;
  --accent-ink: #1a1200;
  --accent-soft: #fdf1dc;
  --good: #1f7a4d;
  --good-soft: #e3f3ea;
  --warn: #9a5b00;
  --warn-soft: #fff1d6;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 16px rgba(20, 33, 61, .05);
  --radius: 14px;
  --nav-h: 64px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1424;
    --surface: #161e33;
    --surface-2: #1b2440;
    --ink: #eef1f7;
    --ink-2: #b7bfd0;
    --ink-3: #8790a5;
    --line: #283252;
    --accent: #fca311;
    --accent-soft: #33280f;
    --good: #5cc98f;
    --good-soft: #12301f;
    --warn: #f3b555;
    --warn-soft: #34270d;
    --bad: #ff8a80;
    --bad-soft: #3a1714;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.boot { padding: 40px; text-align: center; color: var(--ink-3); }
[hidden] { display: none !important; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 232px; padding: 20px 14px;
  background: var(--ink); color: #fff; display: flex; flex-direction: column; gap: 4px;
}
@media (prefers-color-scheme: dark) { .sidebar { background: #0a0f1c; border-right: 1px solid var(--line); } }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; padding: 4px 10px 18px; }
.brand img { width: 32px; height: 32px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: rgba(255,255,255,.75); font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: rgba(252,163,17,.16); color: #fca311; }
.nav-link svg { width: 20px; height: 20px; flex: none; }
.sidebar .spacer { flex: 1; }
.sidebar .who { font-size: .85rem; color: rgba(255,255,255,.6); padding: 8px 12px; }
.main { margin-left: 232px; padding: 28px 32px 48px; max-width: 1240px; }

@media (max-width: 860px) {
  .sidebar {
    inset: auto 0 0 0; width: auto; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding: 6px 6px env(safe-area-inset-bottom); flex-direction: row; justify-content: space-around; gap: 0; z-index: 20;
  }
  .brand, .sidebar .spacer, .sidebar .who { display: none; }
  .nav-link { flex-direction: column; gap: 2px; font-size: .7rem; padding: 6px 4px; flex: 1; justify-content: center; text-align: center; }
  .main { margin-left: 0; padding: 16px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.35rem; }
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); text-decoration: none; font-size: .9rem; margin-bottom: 8px; }

/* ── Cards, tiles ───────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-decoration: none; display: block; }
.tile .label { font-size: .8rem; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tile .value { font-size: 1.9rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .hint { font-size: .8rem; color: var(--ink-3); }
.tile.alert { border-color: var(--bad); background: var(--bad-soft); }
.tile.alert .value { color: var(--bad); }
.tile.highlight .value { color: var(--accent); }
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr 1fr; } .tile .value { font-size: 1.5rem; } }

/* ── Buttons and forms ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .875rem; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { margin-bottom: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 14px; }
.error-msg { color: var(--bad); font-size: .9rem; margin: 8px 0 0; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.badge.new_lead { background: #e7eefc; color: #2b4c9b; border-color: #c9d8f6; }
.badge.survey_done { background: var(--accent-soft); color: var(--warn); border-color: transparent; }
.badge.building { background: #efe7fb; color: #5b3a99; border-color: transparent; }
.badge.review { background: #e2f4f6; color: #1d6b77; border-color: transparent; }
.badge.live { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.retainer { background: var(--ink); color: #fff; border-color: transparent; }
@media (prefers-color-scheme: dark) {
  .badge.new_lead { background: #1c2b52; color: #a9c1f5; border-color: transparent; }
  .badge.building { background: #2b2148; color: #c9b4f3; }
  .badge.review { background: #12343a; color: #8fd5e0; }
  .badge.retainer { background: var(--accent); color: var(--accent-ink); }
}

/* ── Client list ────────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input { flex: 1 1 240px; }
.toolbar select { flex: 0 1 200px; }
.list { list-style: none; margin: 0; padding: 0; }
.list-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--line); text-decoration: none;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .name { font-weight: 600; }
.list-row .meta { color: var(--ink-3); font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.flush { padding: 0; overflow: hidden; }
.empty { padding: 28px; text-align: center; color: var(--ink-3); }

/* ── Pipeline board ─────────────────────────────────────────────────────── */
.st-new_lead    { --st: #4f7be0; }
.st-survey_done { --st: #e8900c; }
.st-building    { --st: #8a63d2; }
.st-review      { --st: #1f9bb0; }
.st-live        { --st: #2f9e64; }
.st-retainer    { --st: #14213d; }
@media (prefers-color-scheme: dark) { .st-retainer { --st: #fca311; } }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--st); flex: none; }
.n { margin-left: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .75rem; font-weight: 700; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }

.main.wide { max-width: none; }
.board { display: grid; grid-template-columns: repeat(6, minmax(168px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.column { background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid var(--st); border-radius: 12px; display: flex; flex-direction: column; min-height: 320px; }
.column.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -4px; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; font-weight: 700; font-size: .875rem; }
.column-body { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col-empty { border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px 10px; text-align: center; font-size: .8rem; color: var(--ink-3); }
.board-hint { margin-top: 10px; }

.deal { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); cursor: grab; transition: box-shadow .15s, transform .15s; }
.deal:hover { box-shadow: 0 2px 4px rgba(20,33,61,.08), 0 8px 24px rgba(20,33,61,.08); }
.deal.dragging { opacity: .45; transform: rotate(1deg); }
.deal-main { display: flex; gap: 9px; align-items: center; padding: 11px 10px 8px; text-decoration: none; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: #fff; background: var(--st); }
.st-retainer .avatar { color: #fff; }
@media (prefers-color-scheme: dark) { .st-retainer .avatar { color: #1a1200; } }
.deal-text { display: flex; flex-direction: column; min-width: 0; }
.deal-name { font-weight: 650; font-size: .925rem; line-height: 1.25; }
.deal-sub { font-size: .78rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 6px 6px 10px; border-top: 1px solid var(--line); }
.deal-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chip { font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.deal-age { font-size: .72rem; color: var(--ink-3); }
.deal-moves { display: flex; gap: 2px; flex: none; }
.move { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.move:hover:not(:disabled) { background: var(--st); color: #fff; border-color: var(--st); }
.move:disabled { opacity: .3; cursor: default; }

/* Phone: tabs for each stage instead of a sideways board */
.stage-tabs, .stage-list { display: none; }
@media (max-width: 860px) {
  .board, .board-hint { display: none; }
  .stage-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 6px; scrollbar-width: none; }
  .stage-tabs::-webkit-scrollbar { display: none; }
  .stage-tab { display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 40px; padding: 0 8px 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; }
  .stage-tab .n { margin-left: 2px; background: var(--surface-2); }
  .stage-tab[aria-selected="true"] { background: var(--st); border-color: var(--st); color: #fff; }
  .stage-tab[aria-selected="true"] .dot { background: #fff; }
  .stage-tab[aria-selected="true"] .n { background: rgba(255,255,255,.22); border-color: transparent; color: #fff; }
  .stage-list { display: flex; flex-direction: column; gap: 10px; }
  .stage-list .deal { cursor: default; }
  .move { width: 40px; height: 36px; }
}

/* ── Client page ────────────────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-3); font-size: .875rem; }
.kv dd { margin: 0; word-break: break-word; }
.qa { margin: 0; padding: 0; list-style: none; }
.qa li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.qa li:last-child { border-bottom: 0; }
.qa .q { font-size: .85rem; color: var(--ink-3); font-weight: 600; }
.qa .a { white-space: pre-wrap; word-break: break-word; }
.note { padding: 12px 0; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; }
.note-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--ink-3); margin-bottom: 4px; }
.note-body { white-space: pre-wrap; word-break: break-word; }
.placeholder { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 14px; color: var(--ink-3); font-size: .9rem; }
/* Stage progress tracker on the client page */
.stepper { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); }
.step { position: relative; }
.step::before { content: ""; position: absolute; z-index: 0; top: 17px; left: -50%; right: 50%; height: 3px; background: var(--line); }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--accent); }
.step button { position: relative; z-index: 1; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 0 2px; font: inherit; color: inherit; cursor: pointer; }
.step-dot { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9rem; background: var(--surface); border: 2px solid var(--line); color: var(--ink-3); transition: transform .15s; }
.step button:hover .step-dot { transform: scale(1.08); }
.step.done .step-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step.current .step-dot { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 0 0 5px var(--accent-soft); }
@media (prefers-color-scheme: dark) { .step.current .step-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } }
.step-label { font-size: .8rem; font-weight: 600; color: var(--ink-3); text-align: center; line-height: 1.2; }
.step.current .step-label { color: var(--ink); }
.stage-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.stage-since { margin-left: auto; }
@media (max-width: 520px) {
  .step-dot { width: 30px; height: 30px; font-size: .8rem; }
  .step::before { top: 14px; }
  .step-label { font-size: .68rem; }
  .stage-actions .btn.primary { width: 100%; }
  .stage-since { margin-left: 0; width: 100%; }
}
.timeline { list-style: none; padding: 0; margin: 0; font-size: .875rem; }
.timeline li { padding: 4px 0; color: var(--ink-2); }

/* ── Auth screens ───────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 420px; padding: 28px; }
.auth .brand { color: var(--ink); padding: 0 0 18px; }
.qr { display: block; margin: 12px auto; width: 200px; height: 200px; border-radius: 8px; background: #fff; padding: 6px; }
.secret { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; text-align: center; letter-spacing: .05em; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 12px; border-radius: 10px; margin: 12px 0; }
input.code-input { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-family: ui-monospace, Menlo, monospace; }

.copy-box { display: flex; gap: 8px; }
.copy-box input { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; }
table.simple { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.simple th, table.simple td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.simple th { color: var(--ink-3); font-weight: 600; }
.table-wrap { overflow-x: auto; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px);
}
@media (prefers-color-scheme: dark) { #toast { background: var(--accent); color: var(--accent-ink); } }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 861px) { #toast { bottom: 28px; } }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 22px; width: min(520px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(10, 15, 28, .5); }

/* ── Website brief ──────────────────────────────────────────────────────── */
.brief, .site-panel { margin-top: 16px; }
.brief-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.brief-top p { margin: 4px 0 0; }
.ready { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.ready-num { font-size: 1.9rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ready-label { font-size: .75rem; color: var(--ink-3); font-weight: 600; }
.ready-good .ready-num { color: var(--good); }
.ready-warn .ready-num { color: var(--warn); }
.ready-bad .ready-num { color: var(--bad); }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin-top: 14px; }
.meter span { display: block; height: 100%; border-radius: 999px; transition: width .4s; }
.meter-good { background: var(--good); }
.meter-warn { background: var(--accent); }
.meter-bad { background: var(--bad); }
.meter-caption { margin: 6px 0 0; }
.still-needed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.need-chip { font: inherit; font-size: .8rem; font-weight: 600; min-height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer; background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); }
.need-chip:hover { background: var(--accent); color: var(--accent-ink); border-style: solid; }
.all-set { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--good-soft); color: var(--good); font-weight: 600; font-size: .9rem; }
.brief-sections { margin-top: 16px; border-top: 1px solid var(--line); }
.brief-sec { border-bottom: 1px solid var(--line); }
.brief-sec:last-child { border-bottom: 0; }
.brief-sec summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 4px; cursor: pointer; min-height: 52px; }
.brief-sec summary::-webkit-details-marker { display: none; }
.brief-sec summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); margin: -4px 4px 0 2px; transition: transform .2s; }
.brief-sec[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.sec-status { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.sec-status.good { background: var(--good); }
.sec-status.warn { background: var(--accent); }
.sec-title { font-weight: 650; flex: 1; }
.sec-flag { font-size: .72rem; font-weight: 700; color: var(--warn); background: var(--warn-soft); padding: 2px 8px; border-radius: 999px; }
.sec-count { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.sec-body { padding: 0 4px 18px 24px; }
.sec-why { margin: 0 0 12px; }
.brief-kv { margin-bottom: 14px; grid-template-columns: minmax(140px, 32%) 1fr; row-gap: 10px; }
.brief-kv dt { padding-top: 1px; }
.needed { font-size: .78rem; font-weight: 700; color: var(--warn); background: var(--warn-soft); padding: 1px 8px; border-radius: 6px; }
.pre { white-space: pre-wrap; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip-good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.swatch-row { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line); }
.brief-form { max-width: 720px; }
.brief-form .hint { font-size: .8rem; color: var(--ink-3); margin: -2px 0 6px; }
.req { font-size: .68rem; font-weight: 700; color: var(--warn); background: var(--warn-soft); padding: 1px 6px; border-radius: 5px; margin-left: 4px; vertical-align: 1px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 14px; }
fieldset.field legend { font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.toggle-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.toggle { margin: 0; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.toggle input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.toggle input:checked + span::before { content: "✓"; margin-right: 6px; }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-color-scheme: dark) { .toggle input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } }
.colour-input { display: flex; gap: 8px; }
.colour-input input[type=color] { width: 52px; flex: none; padding: 4px; cursor: pointer; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: 10px 0; border-top: 1px solid var(--line); margin-top: 6px; }
.row-end { display: inline-flex; align-items: center; gap: 8px; }
.mini-ready { font-size: .75rem; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
@media (max-width: 860px) {
  .sticky-actions { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
}
@media (max-width: 520px) {
  .brief-kv { grid-template-columns: 1fr; row-gap: 2px; }
  .brief-kv dd { margin-bottom: 10px; }
  .sec-body { padding-left: 4px; }
  .ready-num { font-size: 1.5rem; }
  .mini-ready { display: none; }
}

/* ── Stage 2: site health ───────────────────────────────────────────────── */
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; flex: none; }
.status-dot.up { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.status-dot.warn { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.status-dot.down { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .status-dot.down { animation: none; } }
.pill { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.pill-up { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill-down { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.site-head { align-items: flex-start; flex-wrap: wrap; }
.sub-h { font-size: .9rem; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.count-badge { background: var(--bad); color: #fff; font-size: .7rem; border-radius: 999px; padding: 1px 7px; }

.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.stat-label { font-size: .75rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.6rem; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-of { font-size: .85rem; color: var(--ink-3); font-weight: 600; margin-left: 2px; }
.stat-sub { font-size: .78rem; color: var(--ink-3); }
.score-good { color: var(--good); }
.score-warn { color: var(--warn); }
.score-bad { color: var(--bad); }
.spark { width: 100%; height: 56px; margin-top: 6px; display: block; }
.spark-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-dot { fill: var(--ink); }
.spark-good { stroke: var(--good); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.spark-poor { stroke: var(--bad); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }
@media (prefers-color-scheme: dark) { .spark-line { stroke: var(--accent); } .spark-dot { fill: var(--accent); } }
@media (max-width: 700px) { .stat-row { grid-template-columns: 1fr 1fr; } .stat-speed { grid-column: 1 / -1; } }
.site-grid { margin-top: 4px; }

.issue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.issue > a, .issue > div { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; background: var(--surface-2); border: 1px solid var(--line); border-left-width: 4px; }
.issue.sev-critical > a, .issue.sev-critical > div { border-left-color: var(--bad); background: var(--bad-soft); }
.issue.sev-warning > a, .issue.sev-warning > div { border-left-color: var(--accent); }
.issue .btn { margin-left: auto; flex: none; }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--ink-3); }
.sev-critical .sev-dot { background: var(--bad); }
.sev-warning .sev-dot { background: var(--accent); }
.issue-text { min-width: 0; display: flex; flex-direction: column; }
.issue-sub { display: block; font-size: .8rem; color: var(--ink-3); }
.all-good { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--good-soft); color: var(--good); font-weight: 600; font-size: .9rem; }
.fixed-list { margin-top: 10px; }
.fixed-list summary { cursor: pointer; }
.fixed-list ul { margin: 6px 0 0; padding-left: 18px; }
.renew-list { list-style: none; margin: 0; padding: 0; }
.renew-list a { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: .9rem; }
.renew-list li:last-child a { border-bottom: 0; }
.renew-when { color: var(--ink-3); }
.renew-when.soon, .renew-soon { color: var(--bad); font-weight: 700; }
.renew-kv { margin-bottom: 10px; }
.renew-form { margin-top: 10px; }

.backup-list { list-style: none; margin: 12px 0 0; padding: 0; }
.backup-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.backup-main { min-width: 0; }
.switch { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--ink); cursor: pointer; }
.switch input { width: 20px; min-height: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }

.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin-bottom: 6px; }
.howto summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.issue > div { flex-wrap: wrap; }
.issue .issue-text { flex: 1 1 180px; }
@media (max-width: 520px) { .issue .btn { margin-left: 18px; } }

/* ── Client files ───────────────────────────────────────────────────────── */
.files-panel { margin-top: 16px; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 22px 16px; border: 2px dashed var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; margin: 0; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dz-main { font-weight: 700; color: var(--ink); font-size: .95rem; }
.dz-sub { font-size: .8rem; color: var(--ink-3); font-weight: 500; }
.upload-opts { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.upload-opts .field { margin-bottom: 0; }
@media (max-width: 520px) { .upload-opts { grid-template-columns: 1fr; } }
.upload-progress { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.upload-progress li { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 10px; align-items: center; font-size: .85rem; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-bar { height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.up-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-progress li.ok .up-state { color: var(--good); font-weight: 600; }
.upload-progress li.bad .up-state { color: var(--bad); font-weight: 600; }
.file-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.file-tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.file-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px; border-bottom: 1px solid var(--line); overflow: hidden; }
.file-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.file-icon { font-weight: 800; font-size: .85rem; letter-spacing: .04em; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.file-meta { padding: 8px 10px 4px; display: flex; flex-direction: column; min-width: 0; }
.file-name { font-size: .82rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-note { font-style: italic; }
.file-actions { display: flex; justify-content: space-between; padding: 0 4px 4px; margin-top: auto; }
.btn.danger { background: transparent; }
@media (max-width: 520px) { .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Make Prompt ────────────────────────────────────────────────────────── */
dialog.prompt-dialog { width: min(880px, calc(100% - 24px)); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; gap: 12px; padding: 20px; }
dialog.prompt-dialog:not([open]) { display: none; }
.prompt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.prompt-head code { font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.prompt-status { font-size: .875rem; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.prompt-status.ready-good { background: var(--good-soft); border-color: transparent; }
.prompt-status.ready-warn { background: var(--warn-soft); border-color: transparent; }
.prompt-status.ready-bad { background: var(--bad-soft); border-color: transparent; }
.prompt-box { flex: 1; min-height: 46vh; font-family: ui-monospace, Menlo, monospace; font-size: .8rem; line-height: 1.5; white-space: pre-wrap; resize: vertical; }
.prompt-actions { align-items: center; }

/* ── Billing and reports ────────────────────────────────────────────────── */
.billing-panel { margin-top: 16px; }
.billing-panel .card-head h2 { display: inline; margin-right: 8px; }
.pay-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.pay-paid { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pay-due { background: #e7eefc; color: #2b4c9b; border-color: transparent; }
.pay-overdue, .pay-failed { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pay-not_set_up { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
@media (prefers-color-scheme: dark) { .pay-due { background: #1c2b52; color: #a9c1f5; } }
.gc-box { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.gc-step { display: flex; gap: 12px; align-items: flex-start; }
.gc-step > div { min-width: 0; flex: 1; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
@media (prefers-color-scheme: dark) { .step-num { background: var(--accent); color: var(--accent-ink); } }
.pay-table td { vertical-align: middle; }
.pay-actions { text-align: right; white-space: nowrap; }
.pay-list { list-style: none; margin: 0; padding: 0; }
.pay-list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.pay-list li:last-child a { border-bottom: 0; }
.inline-code { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav h1 { min-width: 0; }
.report-sheet { background: #fff; color: #14213d; border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; max-width: 820px; box-shadow: var(--shadow); }
.report-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 3px solid #e8900c; padding-bottom: 16px; margin-bottom: 20px; }
.report-head h2 { font-size: 1.6rem; margin: 2px 0; }
.report-head .muted { color: #5d6678; }
.report-kicker { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #c07400; }
.report-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.report-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.rstat { background: #f6f4ef; border-radius: 12px; padding: 14px; }
.rstat-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #5d6678; }
.rstat-value { font-size: 1.7rem; font-weight: 800; margin: 2px 0; }
.rstat-sub { font-size: .78rem; color: #5d6678; }
.report-sec { margin-bottom: 18px; }
.report-sec h3 { font-size: 1rem; margin-bottom: 6px; }
.report-sec ul { margin: 0; padding-left: 20px; }
.report-sec li { margin-bottom: 4px; }
.report-sec .muted { color: #5d6678; }
.report-foot { border-top: 1px solid #e4e1da; padding-top: 12px; font-size: .8rem; color: #5d6678; }
@media (max-width: 700px) { .report-stats { grid-template-columns: 1fr 1fr; } .report-sheet { padding: 18px; } .report-head { flex-direction: column; } }
@media print {
  .sidebar, .no-print, #toast { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  body, html { background: #fff !important; }
  .report-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .rstat { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 560px) {
  .pay-table thead { display: none; }
  .pay-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.simple.pay-table td { border: 0; padding: 0; white-space: nowrap; }
  table.simple.pay-table td:nth-child(2) { text-align: right; font-weight: 700; }
  table.simple.pay-table td:nth-child(3) { grid-column: 1 / -1; }
  table.simple.pay-table td:nth-child(4) { grid-column: 1 / -1; text-align: left; }
  table.simple.pay-table td.pay-actions:empty { display: none; }
}

/* ── Pipeline to-do board ───────────────────────────────────────────────── */
.lane-chase    { --lc: #c86f00; --lt: #fff4e3; --lb: #f6d7a8; }
.lane-build    { --lc: #6a4fc4; --lt: #f1edfd; --lb: #d6ccf6; }
.lane-building { --lc: #2463c7; --lt: #eaf1fd; --lb: #c3d6f6; }
.lane-waiting  { --lc: #1b7f8c; --lt: #e6f5f6; --lb: #b8e0e4; }
.lane-problems { --lc: #c0312b; --lt: #fdeceb; --lb: #f3c4c1; }
.lane-money    { --lc: #b3366f; --lt: #fcebf3; --lb: #f0c2d7; }
@media (prefers-color-scheme: dark) {
  .lane-chase    { --lc: #f6b257; --lt: #2e2210; --lb: #5a4019; }
  .lane-build    { --lc: #b9a6f4; --lt: #221c3a; --lb: #43386f; }
  .lane-building { --lc: #8db6f5; --lt: #16233b; --lb: #2b4572; }
  .lane-waiting  { --lc: #7fd2dc; --lt: #11292c; --lb: #245358; }
  .lane-problems { --lc: #ff9a92; --lt: #34171a; --lb: #6a2a2b; }
  .lane-money    { --lc: #f39cc4; --lt: #321726; --lb: #66304b; }
}
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface); }
.view-switch button { font: inherit; font-size: .85rem; font-weight: 600; border: 0; background: none; color: var(--ink-3); padding: 6px 12px; border-radius: 7px; cursor: pointer; min-height: 34px; }
.view-switch button.on { background: var(--ink); color: #fff; }
@media (prefers-color-scheme: dark) { .view-switch button.on { background: var(--accent); color: var(--accent-ink); } }
.lane-jump { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.lane-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; text-decoration: none; font-size: .85rem; font-weight: 600; background: var(--lt); color: var(--lc); border: 1px solid var(--lb); }
.lane-pill b { background: var(--lc); color: var(--lt); border-radius: 999px; padding: 0 7px; font-size: .75rem; }
.todo-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.lane { background: var(--lt); border: 1px solid var(--lb); border-top: 4px solid var(--lc); border-radius: 14px; overflow: hidden; scroll-margin-top: 16px; }
.lane-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px; }
.lane-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--lc); color: var(--lt); flex: none; }
.lane-title { font-weight: 700; display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.lane-hint { font-size: .75rem; font-weight: 500; color: var(--ink-3); }
.lane-count { font-weight: 800; font-size: 1.1rem; color: var(--lc); font-variant-numeric: tabular-nums; }
.lane-body { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.todo-card { background: var(--surface); border: 1px solid var(--lb); border-left: 4px solid var(--lc); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); }
.todo-card.urgent { border-color: var(--lc); }
.todo-name { font-weight: 700; text-decoration: none; display: block; line-height: 1.3; }
.todo-name:hover { text-decoration: underline; }
.todo-reason { font-size: .82rem; color: var(--ink-2); margin: 3px 0 8px; display: flex; align-items: center; gap: 6px; }
.urgent-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lc); flex: none; box-shadow: 0 0 0 3px var(--lb); }
.todo-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.todo-go { background: var(--lc); border-color: var(--lc); color: #fff; }
.todo-go:hover { background: var(--lc); filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { .todo-go { color: #111; } }
.all-clear { text-align: center; padding: 40px 20px; }
@media (max-width: 860px) {
  .todo-board { grid-template-columns: 1fr; }
  .page-head .view-switch { order: -1; }
}
.lane-empty { display: flex; align-items: center; gap: 8px; padding: 14px 12px; border: 1.5px dashed var(--lb); border-radius: 10px; color: var(--lc); font-size: .85rem; font-weight: 600; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.lane-pill.empty { opacity: .65; }
.lane-pill.empty b { background: transparent; color: var(--lc); border: 1px solid var(--lb); }
.todo-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1500px) { .todo-board { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 1100px) and (min-width: 861px) { .todo-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .todo-board { grid-template-columns: 1fr; } }

/* ── Clients page ───────────────────────────────────────────────────────── */
.client-tools { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.search-box { flex: 1 1 280px; position: relative; display: flex; align-items: center; margin: 0; }
.search-box svg { position: absolute; left: 12px; color: var(--ink-3); pointer-events: none; }
.search-box input { padding-left: 40px; background: var(--surface); }
.client-tools select { flex: 0 0 auto; width: auto; min-width: 170px; background: var(--surface); }
.stage-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.stage-filter button { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: .85rem; font-weight: 600; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.stage-filter button b { font-size: .75rem; color: var(--ink-3); }
.stage-filter button:hover { border-color: var(--ink-3); }
.stage-filter button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.stage-filter button[aria-pressed="true"] b { color: rgba(255,255,255,.7); }
.stage-filter button.st-new_lead[aria-pressed="true"], .stage-filter button[class^="st-"][aria-pressed="true"] { background: var(--st); border-color: var(--st); }
.stage-filter button[aria-pressed="true"] .dot { background: #fff; }
@media (prefers-color-scheme: dark) { .stage-filter button[data-stage=""][aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } }

.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.client-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 12px; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 12px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.client-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; border-radius: 14px 0 0 14px; background: var(--st); }
.client-card:hover { border-color: var(--st); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(20,33,61,.06), 0 10px 24px rgba(20,33,61,.08); }
@media (prefers-reduced-motion: reduce) { .client-card, .client-card:hover { transition: none; transform: none; } }
.cc-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.client-card .avatar { width: 42px; height: 42px; border-radius: 12px; font-size: .9rem; }
.cc-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cc-name { font-weight: 700; text-decoration: none; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-name:hover { text-decoration: underline; }
.cc-sub { font-size: .82rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-facts { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.fact { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.fact .status-dot { margin: 0; width: 7px; height: 7px; }
.fact.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.fact.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.fact.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.fact.muted { color: var(--ink-3); font-weight: 500; background: transparent; border-style: dashed; }
.mini-bar { width: 40px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; display: inline-block; }
.mini-bar span { display: block; height: 100%; background: var(--st, var(--accent)); border-radius: 999px; }
.cc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.cc-when { font-size: .78rem; color: var(--ink-3); }
.cc-actions { display: flex; gap: 6px; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); text-decoration: none; }
.icon-btn:hover { background: var(--st); border-color: var(--st); color: #fff; }
.empty-clients { grid-column: 1 / -1; text-align: center; padding: 40px 20px; }
.empty-clients .btn { margin-top: 8px; }
@media (max-width: 520px) {
  .client-grid { grid-template-columns: 1fr; gap: 10px; }
  .client-tools select { flex: 1 1 100%; }
  .stage-filter { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 4px; scrollbar-width: none; }
  .stage-filter::-webkit-scrollbar { display: none; }
  .stage-filter button { flex: none; }
}
.cc-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-top { align-items: flex-start; }
.cc-top .badge { margin-top: 2px; }
.fact.muted { border-color: var(--line); }

/* ── Package and build fee ──────────────────────────────────────────────── */
.build-status { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 6px; }
.invoice-form { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) auto; gap: 10px; align-items: end; width: 100%; }
.invoice-form .field { margin: 0; }
@media (max-width: 560px) { .invoice-form { grid-template-columns: 1fr; } }
.gate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line); }
.gate-item { font-size: .85rem; font-weight: 700; color: var(--bad); }
.gate-item.ok { color: var(--good); }
.gate .small { flex-basis: 100%; }
.todo-warn { font-size: .78rem; font-weight: 600; color: var(--bad); background: var(--bad-soft); border-radius: 6px; padding: 3px 8px; margin: -4px 0 8px; display: inline-block; }
