/* Fonts: the exact files the PDF embeds (served from @fontsource) */
@font-face { font-family: 'Instrument Sans'; font-weight: 400; font-display: swap;
  src: url(/fonts/sans/instrument-sans-latin-400-normal.woff2) format('woff2'), url(/fonts/sans/instrument-sans-latin-400-normal.woff) format('woff'); }
@font-face { font-family: 'Instrument Sans'; font-weight: 500; font-display: swap;
  src: url(/fonts/sans/instrument-sans-latin-500-normal.woff2) format('woff2'), url(/fonts/sans/instrument-sans-latin-500-normal.woff) format('woff'); }
@font-face { font-family: 'Instrument Sans'; font-weight: 600; font-display: swap;
  src: url(/fonts/sans/instrument-sans-latin-600-normal.woff2) format('woff2'), url(/fonts/sans/instrument-sans-latin-600-normal.woff) format('woff'); }
@font-face { font-family: 'Instrument Serif'; font-weight: 400; font-display: swap;
  src: url(/fonts/serif/instrument-serif-latin-400-normal.woff2) format('woff2'), url(/fonts/serif/instrument-serif-latin-400-normal.woff) format('woff'); }

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --sunken: #efede8;
  --ink: #1a1a19;
  --muted: #77756f;
  --faint: #a8a59d;
  --line: #e4e2dc;
  --line-strong: #d3d0c8;
  --accent: #1f5c45;
  --accent-soft: #e3ece7;
  --danger: #b3261e;

  --sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --surface: #1b1b19;
    --sunken: #222220;
    --ink: #edece7;
    --muted: #9b988f;
    --faint: #6d6b65;
    --line: #2b2a27;
    --line-strong: #3a3935;
    --accent: #7cc3a2;
    --accent-soft: #1e2f27;
    --danger: #f08b82;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
}

a { color: inherit; }
h1, h2 { margin: 0; font-weight: 400; }
h1 { font-family: var(--serif); font-size: 44px; line-height: 1.05; letter-spacing: -0.01em; }
h2 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.link { color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 500; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 0 32px; height: 60px;
  display: flex; align-items: center; gap: 40px;
}
.wordmark { font-family: var(--serif); font-size: 24px; text-decoration: none; letter-spacing: -0.01em; }

main { max-width: 1320px; margin: 0 auto; padding: 48px 32px 96px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid transparent;
  font: 500 14px var(--sans); text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--bg)); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--muted); }
.btn-text { background: none; color: var(--muted); padding: 0 8px; }
.btn-text:hover { color: var(--ink); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.danger { color: var(--danger) !important; }
.btn:focus-visible, .segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); min-width: 0; }
input, select, textarea {
  font: 400 14px var(--sans); color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  width: 100%; min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; line-height: 1.45; }
select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2377756f' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
input[type=number] { font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; margin-top: 14px; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }

/* ---------- page heads ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 32px; }

/* ---------- invoices list ---------- */
.summary {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}
.summary > div { padding: 18px 20px 20px 0; }
.summary > div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.summary .k { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.summary .v { font-family: var(--serif); font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.summary .s { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.search { max-width: 280px; height: 36px; }
.segmented { display: inline-flex; background: var(--sunken); border-radius: var(--radius); padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: none; font: 500 13px var(--sans); color: var(--muted);
  padding: 5px 12px; border-radius: 4px; cursor: pointer;
}
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table th.num { text-align: right; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background-color .1s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.table .strong { font-weight: 500; }
.table .row-actions { text-align: right; width: 1%; padding-top: 8px; padding-bottom: 8px; }
.row-actions .btn { opacity: 0; }
.table tbody tr:hover .row-actions .btn, .row-actions .btn:focus-visible { opacity: 1; }
@media (hover: none) { .row-actions .btn { opacity: 1; } }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--faint); box-sizing: border-box; }
.status.sent { color: var(--ink); }
.status.sent::before { border-color: var(--ink); }
.status.paid { color: var(--accent); }
.status.paid::before { background: var(--accent); border-color: var(--accent); }
.status.overdue { color: var(--danger); }
.status.overdue::before { background: var(--danger); border-color: var(--danger); }

.empty { padding: 64px 24px; text-align: center; }
.empty p + p { margin-top: 4px; }
.empty .btn { margin-top: 18px; }

/* ---------- editor ---------- */
.editor-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 10px; }
.back:hover { color: var(--ink); }
.actions { display: flex; gap: 8px; align-items: center; }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: 48px; align-items: start; }
.editor-form { container-type: inline-size; }

.block { padding: 24px 0; border-top: 1px solid var(--line); }
.block:first-child { padding-top: 0; border-top: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; min-height: 32px; }
.picker { width: auto; height: 32px; padding-top: 0; padding-bottom: 0; font-size: 13px; }

.from-summary {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; font-size: 13px; color: var(--muted); line-height: 1.55;
}
.from-summary strong { color: var(--ink); font-weight: 500; font-size: 14px; display: block; }
.from-summary.missing { border-style: dashed; background: none; }

.items-head, .item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 110px 110px 28px;
  gap: 8px; align-items: center;
}
.items-head { font-size: 12px; font-weight: 500; color: var(--muted); padding-bottom: 8px; }
.item + .item { margin-top: 8px; }
.item .amount { font-weight: 500; padding-right: 2px; }
.remove {
  border: 0; background: none; color: var(--faint); font-size: 18px; line-height: 1;
  width: 28px; height: 28px; border-radius: var(--radius); cursor: pointer;
}
.remove:hover { color: var(--danger); background: var(--sunken); }
#btn-add-item { margin: 10px 0 0 -8px; color: var(--accent); }

.adjustments {
  display: grid; grid-template-columns: 110px 140px 1fr; gap: 14px; align-items: end;
  margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--line);
}
.mini-totals { margin: 0; display: grid; grid-template-columns: auto auto; justify-content: end; column-gap: 24px; row-gap: 2px; font-size: 13px; }
.mini-totals dt { color: var(--muted); text-align: right; }
.mini-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.mini-totals .grand { font-weight: 600; color: var(--ink); font-size: 14px; }

@container (max-width: 600px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .items-head { display: none; }
  .item { grid-template-columns: 1fr 1fr minmax(80px, auto) 28px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .item [data-f=description] { grid-column: 1 / -1; }
  .adjustments { grid-template-columns: 1fr 1fr; }
  .mini-totals { grid-column: 1 / -1; }
}

/* ---------- paper preview (mirrors pdf.js; sizes in PDF points, A4 = 595pt wide) ---------- */
.preview-col { position: sticky; top: 92px; container-type: inline-size; }
.paper {
  --pt: calc(100cqw / 595);
  --p-ink: #1a1a19; --p-muted: #77756f; --p-line: #e4e2dc; --p-accent: #1f5c45;
  background: #fff; color: var(--p-ink);
  aspect-ratio: 595 / 842;
  padding: calc(48 * var(--pt)) calc(56 * var(--pt)) 0;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 12px 32px -8px rgba(40,35,20,.18);
  font-size: calc(9 * var(--pt)); line-height: 1.35;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.paper .serif { font-family: var(--serif); font-weight: 400; }
.p-label { font-size: calc(7 * var(--pt)); font-weight: 600; letter-spacing: calc(.9 * var(--pt)); text-transform: uppercase; color: var(--p-muted); }
.p-muted { color: var(--p-muted); }
.p-head { display: flex; justify-content: space-between; gap: calc(16 * var(--pt)); padding-bottom: calc(30 * var(--pt)); border-bottom: calc(.75 * var(--pt)) solid var(--p-line); }
.p-head > div:first-child { max-width: 60%; }
.p-from { font-size: calc(26 * var(--pt)); line-height: 1.15; }
.p-title { font-size: calc(34 * var(--pt)); line-height: 1.1; color: var(--p-accent); text-align: right; margin-top: calc(-4 * var(--pt)); }
.p-no { text-align: right; font-size: calc(9.5 * var(--pt)); }
.p-paid { text-align: right; margin-top: calc(5 * var(--pt)); color: var(--p-accent); font-size: calc(7.5 * var(--pt)); }
.p-meta { display: grid; grid-template-columns: 42% 18% 18% 22%; padding: calc(18 * var(--pt)) 0 calc(34 * var(--pt)); }
.p-meta .p-label { margin-bottom: calc(5 * var(--pt)); }
.p-meta .v { font-weight: 500; font-size: calc(10.5 * var(--pt)); }
.p-meta .bill { padding-right: calc(16 * var(--pt)); }
.p-meta .due { font-size: calc(22 * var(--pt)); line-height: 1; text-align: right; margin-top: calc(-3 * var(--pt)); }
.p-meta > div:last-child .p-label { text-align: right; }
.p-items { width: 100%; border-collapse: collapse; font-size: calc(9.5 * var(--pt)); }
.p-items th { padding-bottom: calc(5 * var(--pt)); border-bottom: calc(.75 * var(--pt)) solid var(--p-ink); text-align: right; }
.p-items td { padding: calc(9 * var(--pt)) 0 calc(9 * var(--pt)) calc(8 * var(--pt)); border-bottom: calc(.75 * var(--pt)) solid var(--p-line); text-align: right; vertical-align: top; }
.p-items th:first-child, .p-items td:first-child { text-align: left; padding-left: 0; width: 52%; white-space: pre-wrap; word-break: break-word; }
.p-items td:last-child { font-weight: 500; }
.p-totals { margin: calc(16 * var(--pt)) 0 0 auto; width: 42%; font-size: calc(9.5 * var(--pt)); }
.p-totals > div { display: flex; justify-content: space-between; height: calc(18 * var(--pt)); }
.p-totals > div span:first-child { color: var(--p-muted); }
.p-totals > div span:last-child { font-weight: 500; }
.p-totals .p-grand { height: auto; border-top: calc(.75 * var(--pt)) solid var(--p-ink); margin-top: calc(2 * var(--pt)); padding-top: calc(10 * var(--pt)); align-items: baseline; }
.p-totals .p-grand span:first-child { color: var(--p-ink); font-weight: 500; font-size: calc(10.5 * var(--pt)); }
.p-totals .p-grand span:last-child { font-family: var(--serif); font-weight: 400; font-size: calc(24 * var(--pt)); }
.p-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: calc(32 * var(--pt)); margin-top: calc(24 * var(--pt)); padding-top: calc(18 * var(--pt)); border-top: calc(.75 * var(--pt)) solid var(--p-line); }
.p-blocks.single { grid-template-columns: 60%; }
.p-blocks .p-label { margin-bottom: calc(5 * var(--pt)); }
.p-blocks p { white-space: pre-wrap; line-height: 1.5; }
.p-footer { margin-top: auto; display: flex; justify-content: space-between; border-top: calc(.75 * var(--pt)) solid var(--p-line); padding: calc(10 * var(--pt)) 0 calc(34 * var(--pt)); color: var(--p-muted); font-size: calc(8 * var(--pt)); }
.pre { white-space: pre-line; }

/* ---------- online payment ---------- */
.tag { font-size: 11.5px; font-weight: 500; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 8px; }
.pay-link { display: flex; gap: 8px; }
.pay-link input { color: var(--muted); font-size: 13px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.hint code { font-size: 12px; background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
.paid-note { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; }
.paid-note a { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.stack .check { margin-top: 12px; }
.p-pay { margin-top: calc(24 * var(--pt)); padding-top: calc(18 * var(--pt)); border-top: calc(.75 * var(--pt)) solid var(--p-line); }
.p-pay .p-label { margin-bottom: calc(5 * var(--pt)); }
.p-pay a { color: var(--p-accent); font-weight: 500; text-decoration: underline; word-break: break-all; }

/* ---------- public pay page ---------- */
.pay-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.pay-card {
  width: min(480px, 100%); padding: 40px 36px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px -12px rgba(40,35,20,.15);
}
.pay-card h1 { margin: 6px 0 16px; }
.pay-card .pay-amount { font-size: 52px; margin-bottom: 24px; font-variant-numeric: tabular-nums; }
.pay-form { display: flex; flex-direction: column; gap: 16px; }
.pay-element { min-height: 120px; }
.pay-loading { display: grid; place-items: center; height: 120px; color: var(--muted); font-size: 13px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.pay-error { color: var(--danger); font-size: 13px; margin: 0; }
.pay-btn:disabled { opacity: .55; cursor: not-allowed; }
.pay-from { font-weight: 500; color: var(--muted); }
.pay-meta { margin: 0 0 28px; border-top: 1px solid var(--line); }
.pay-meta div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.pay-meta dt { color: var(--muted); }
.pay-meta dd { margin: 0; font-weight: 500; }
.pay-btn { width: 100%; height: 44px; font-size: 15px; }
.pay-note { margin-top: 12px; font-size: 13px; text-align: center; color: var(--muted); }
.pay-status { padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); font-weight: 500; text-align: center; }
.pay-pdf { display: block; text-align: center; margin-top: 18px; }
.pay-foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); text-align: center; }

/* ---------- login ---------- */
.logout { margin: 0; }
.auth-body { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 400px); place-content: center; padding: 24px 16px; }
.auth-card {
  display: flex; flex-direction: column; gap: 16px;
  padding: 36px 32px 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px -12px rgba(40,35,20,.15);
}
.auth-mark { font-size: 22px; margin-bottom: 18px; }
.auth-card h1 { font-size: 40px; }
.auth-sub { margin-top: -10px; margin-bottom: 4px; font-size: 13.5px; }
.auth-btn { height: 42px; margin-top: 6px; font-size: 15px; }
.auth-btn:disabled { opacity: .5; cursor: not-allowed; }
.auth-error { margin: 0; padding: 10px 12px; border-radius: var(--radius); font-size: 13px;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.auth-error code { font-size: 12px; }

/* ---------- bills, client page, reports ---------- */
.page-sub { color: var(--muted); margin-top: 8px; max-width: 60ch; }
.summary-4 { grid-template-columns: repeat(4, 1fr); }
.summary-5 { grid-template-columns: repeat(5, 1fr); }
.summary-5 .v, .summary-4 .v { font-size: 30px; }
.section-head.first { margin-top: 8px; }

.log-form {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 16px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.log-form[hidden] { display: none; }
.log-form > .field { width: 160px; }
.log-form > .field:nth-child(2) { width: 120px; }
.log-form > .field.grow { flex: 1 1 220px; width: auto; }
.log-form > .field[hidden] { display: none; }
.note-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.tag-link { font-size: 12.5px; font-weight: 500; text-decoration: none; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px 9px; }
.tag-link.is-paid { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.tag-link:hover { border-color: var(--muted); }

.types-form { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; max-width: 640px; }
.types-head, .type-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 160px 28px; gap: 10px; align-items: center; }
.types-head { font-size: 12px; font-weight: 500; color: var(--muted); padding-bottom: 8px; }
.type-row + .type-row { margin-top: 8px; }
.type-row input[type=radio] { width: 16px; height: 16px; justify-self: center; accent-color: var(--accent); }
.types-actions { display: flex; align-items: end; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.types-actions .btn-text { color: var(--accent); margin-left: -8px; }
.types-actions .btn-secondary { margin-left: auto; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline select { width: auto; }

.pm-list { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.pm { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.pm-main { display: flex; flex-direction: column; margin-right: auto; }
.pm-main .muted { font-size: 12.5px; }

.charge-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); flex-wrap: wrap; }

.report-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 24px; }
.report-filters .field { min-width: 150px; }
.report-filters .custom-range { display: none; }
.report-filters .custom-range.shown { display: flex; }
.report-filters .segmented { height: 38px; align-items: center; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 24px 0 12px; }
.chart-card { margin: 0; padding: 18px 18px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.chart-card figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.chart-card h2 { font-size: 14px; font-weight: 600; }
.chart-card figcaption .muted { font-size: 13px; }
.chart { position: relative; overflow: hidden; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .grid.base { stroke: var(--line-strong); }
.chart .tick { fill: var(--muted); font: 400 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.on { fill: color-mix(in srgb, var(--ink) 5%, transparent); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 2;
  display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: 6px;
  background: var(--ink); color: var(--bg); font-size: 12px; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.chart-tip span { opacity: .75; }
.chart-tip strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.period-table { margin-bottom: 8px; }
.period-table summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; padding: 6px 0 12px; }
.report-split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; }
.inline-bar { height: 4px; margin-top: 6px; border-radius: 2px; background: var(--sunken); max-width: 240px; }
.inline-bar span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
#by-client-rows tr[data-client] { cursor: pointer; }

/* ---------- pages editor ---------- */
.settings.page-editor { max-width: 1120px; }
.page-editor .settings-row { grid-template-columns: 200px minmax(0, 1fr); }
.publish-check { margin-top: 0; font-size: 14px; color: var(--ink); }
.rows-editor { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.re-head, .re-row { display: grid; grid-template-columns: var(--tpl, repeat(var(--cols), minmax(0, 1fr))) 28px; gap: 8px; align-items: center; }
.re-head { font-size: 12px; font-weight: 500; color: var(--muted); }
.re-add { align-self: flex-start; color: var(--accent); margin-left: -8px; }
@media (max-width: 720px) {
  .re-head { display: none; }
  .re-row { grid-template-columns: minmax(0, 1fr) 28px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .re-row input { grid-column: 1; }
  .re-row .remove { grid-column: 2; grid-row: 1; }
}

/* ---------- scheduling (admin) ---------- */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin: -24px 0 32px; padding: 12px 16px; border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  color: var(--danger); font-weight: 500; font-size: 13.5px;
}
.sched-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 20px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.sched-card strong { font-weight: 600; }
.sched-card .hint { margin-top: 2px; }
.sched-card.ok { border-left: 3px solid var(--accent); }
.sched-card.warn { border-left: 3px solid var(--danger); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 40px 0 12px; }
.section-head h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; }
.table .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.table tbody tr.static { cursor: default; }
.feed-test { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.feed-test .hint { margin: 0; }
.field.disabled { opacity: .45; }
#view-scheduling .settings { max-width: none; }

/* ---------- public booking page ---------- */
.book-body { min-height: 100vh; background: var(--surface); }
.book { display: grid; grid-template-columns: 400px minmax(0, 1fr); height: 100vh; height: 100dvh; max-width: none; margin: 0; padding: 0; }
.book-info, .book-main { overflow-y: auto; overscroll-behavior: contain; }

.book-info { padding: 28px 28px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.book-owner { display: flex; align-items: center; gap: 12px; font-weight: 500; font-size: 15px; }
.book-owner img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--sunken); }
.book-info h1 { font-size: 34px; line-height: 1.1; margin-top: 28px; }
.book-desc { color: var(--muted); font-size: 15px; line-height: 1.5; margin-top: 12px; }
.book-facts { list-style: none; margin: 22px 0 0; padding: 0 0 22px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--line); }
.book-facts li { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.book-facts svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.book-tz select {
  border: 0; padding: 0 22px 0 0; height: auto; width: auto; max-width: 100%;
  background-color: transparent; background-position: right 2px center; font-size: 15px; color: var(--ink);
  box-shadow: none !important;
}
.book-current { margin-top: 18px; padding: 10px 12px; border-radius: var(--radius); background: var(--sunken); font-size: 13.5px; }
.book-current span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }

/* mini month calendar */
.mini-cal { margin-top: 24px; }
.mc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mc-head h2 { font-size: 15px; font-weight: 600; }
.mc-head h2 span { font-weight: 600; }
.mc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 4px; }
.mc-week span { text-align: center; font-size: 12.5px; color: var(--muted); padding: 6px 0; }
.mc-day {
  justify-self: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: none; cursor: pointer;
  font: 400 14.5px var(--sans); color: var(--muted); font-variant-numeric: tabular-nums;
}
.mc-day.has { color: var(--ink); font-weight: 600; }
.mc-day:not(:disabled):hover { background: var(--sunken); }
.mc-day:disabled { color: var(--faint); opacity: .55; cursor: default; }
.mc-day.anchor { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 600; }
.mc-day.today { background: var(--accent); color: var(--surface); font-weight: 600; }
.mc-day.today:hover { background: var(--accent); }

.round-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 0; flex-shrink: 0;
  background: var(--sunken); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer;
}
.round-btn:disabled { opacity: .35; cursor: default; }
.round-btn:not(:disabled):hover { background: var(--line-strong); }
.pill-btn { height: 36px; padding: 0 14px; border-radius: 8px; border: 0; background: var(--sunken); font: 500 14px var(--sans); color: var(--ink); cursor: pointer; }
.pill-btn:hover { background: var(--line-strong); }
.link-btn { border: 0; background: none; padding: 0; font: 500 14px var(--sans); color: var(--accent); cursor: pointer; }

/* week view */
.book-main { padding: 24px 40px 40px; min-width: 0; }
.wk-toolbar { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 36px; }
.wk-range { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.wk-range span { font-weight: 400; color: var(--muted); margin-left: 4px; }
.wk-nav { display: flex; align-items: center; gap: 8px; }
.wk-options { margin-left: auto; display: flex; gap: 8px; }
.wk-options select { width: auto; height: 34px; border: 0; background-color: transparent; font-weight: 500; font-size: 14px; padding-left: 8px; }
.wk-options select:hover { background-color: var(--sunken); }

.wk-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 16px; }
.wk-day { display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; margin-bottom: 24px; font-size: 16px; }
.wk-dow { color: var(--ink); }
.wk-num { font-weight: 500; font-variant-numeric: tabular-nums; }
.is-today .wk-day { color: var(--accent); }
.is-today .wk-dow { color: var(--accent); }
.is-today .wk-num { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); }
.wk-slots { display: flex; flex-direction: column; gap: 10px; }
.wk-none { text-align: center; color: var(--muted); font-size: 13.5px; padding-top: 10px; }
.wk-hint { margin-top: 32px; text-align: center; }
.time {
  height: 44px; width: 100%; border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line-strong));
  background: var(--surface); color: var(--accent);
  font: 500 15px var(--sans); cursor: pointer; font-variant-numeric: tabular-nums;
  transition: background-color .12s, color .12s, border-color .12s;
}
.time:hover, .time:focus-visible, .time:active, .time.selected {
  background: var(--accent); border-color: var(--accent); color: var(--surface);
}
.time:focus-visible, .mc-day:focus-visible, .round-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.book-loading, .book-empty { display: grid; place-items: center; align-content: center; gap: 8px; min-height: 360px; color: var(--muted); text-align: center; }
.book-empty .btn { margin-top: 8px; }
.book-error { margin: 0 0 16px; padding: 10px 12px; border-radius: var(--radius); font-size: 13.5px;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); }

/* details / done */
.book-pane { max-width: 460px; padding-top: 8px; }
.book-main .back { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; color: var(--muted); margin-bottom: 24px; }
.book-main .back:hover { color: var(--ink); }
.book-step { font-size: 22px; font-weight: 600; margin-bottom: 16px; }
.book-chosen { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 8px; background: var(--sunken); margin-bottom: 24px; }
.book-chosen strong { font-weight: 600; }
.book-chosen span { color: var(--muted); }
.book-form { display: flex; flex-direction: column; gap: 16px; }
.guest-row { display: grid; grid-template-columns: minmax(0, 1fr) 28px; gap: 8px; align-items: center; margin-bottom: 8px; }
.add-guest { align-self: flex-start; color: var(--accent); margin-left: -8px; }
.book-submit { height: 44px; font-size: 15px; align-self: flex-start; padding: 0 22px; }
.book-submit:disabled { opacity: .55; cursor: not-allowed; }
.book-done { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.book-done .book-chosen { align-self: stretch; margin: 4px 0; }
.book-done h2 { font-family: var(--serif); font-weight: 400; font-size: 40px; }
.book-check { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--surface); font-size: 20px; }

@media (max-width: 1100px) {
  .book { grid-template-columns: 340px minmax(0, 1fr); }
  .book-main { padding: 24px; }
  .wk-grid { gap: 10px; }
}
@media (max-width: 860px) {
  .book { grid-template-columns: minmax(0, 1fr); height: auto; }
  .book-info, .book-main { overflow: visible; }
  .book-info { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px 16px; }
  .book-info h1 { font-size: 30px; margin-top: 20px; }
  .mini-cal { max-width: 360px; }
  .book-main { padding: 20px 16px 40px; }
  .wk-toolbar { gap: 12px; margin-bottom: 20px; }
  .wk-range { font-size: 20px; width: 100%; }
  .wk-options { margin-left: auto; }
  .wk-grid { grid-template-columns: 1fr; gap: 0; }
  .wk-col { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
  .wk-day { flex-direction: column; justify-content: flex-start; align-items: flex-start; height: auto; margin: 0; gap: 2px; }
  .is-today .wk-num { width: 32px; height: 32px; }
  .wk-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .wk-none { text-align: left; padding-top: 4px; }
  .book-loading, .book-empty { min-height: 200px; }
}

/* manage page */
.pay-card .pay-h { font-size: 40px; margin: 4px 0 20px; }
.manage-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.manage-actions form { margin: 0; }
.muted-status { background: var(--sunken) !important; color: var(--muted) !important; }

/* ---------- settings ---------- */
.settings { max-width: 880px; }
.settings-row { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; padding: 28px 0; border-top: 1px solid var(--line); }
.settings-row:first-child { border-top-color: var(--ink); }
.settings-intro p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.settings-actions { display: flex; justify-content: flex-end; padding-top: 24px; border-top: 1px solid var(--line); }

/* ---------- dialog ---------- */
.dialog {
  border: 1px solid var(--line); border-radius: 10px; padding: 0;
  background: var(--surface); color: var(--ink);
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 24px 64px -12px rgba(0,0,0,.3);
}
.dialog::backdrop { background: rgba(20, 18, 12, .35); }
.dialog form { padding: 24px; }
.dialog h2 { font-family: var(--serif); font-size: 28px; font-weight: 400; margin-bottom: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

.confirm-dialog { width: min(460px, calc(100vw - 32px)); }
.confirm-dialog h2 { margin-bottom: 12px; }
.confirm-body p { margin: 0 0 8px; line-height: 1.5; }
.confirm-dialog .check { margin-top: 10px; color: var(--ink); font-size: 14px; }
.confirm-dialog .check input:disabled + span { color: var(--faint); }
.confirm-dialog .hint { margin-top: 6px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 100; animation: toast-in .18s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---------- responsive ---------- */
.mobile-only { display: none; }
@media (max-width: 1080px) {
  .editor-grid { grid-template-columns: 1fr; }
  .preview-col { position: static; max-width: 620px; }
}
@media (max-width: 1080px) {
  .summary-5 { grid-template-columns: repeat(3, 1fr); }
  .log-form > .field { width: calc(50% - 5px); }
  .log-form > .field.grow { flex-basis: 100%; }
  .chart-grid, .report-split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .summary-4, .summary-5 { grid-template-columns: 1fr 1fr; }
  .summary-4 > div + div, .summary-5 > div + div { border-left: 0; padding-left: 0; }
  .types-head, .type-row { grid-template-columns: 40px minmax(0, 1fr) 100px 28px; }
  .banner { margin-top: -8px; }
  .auth-card { padding: 28px 20px 24px; }
  .pay-card { padding: 28px 20px 20px; }
  .pay-card .pay-amount { font-size: 44px; }
  main { padding: 28px 16px 64px; }
  .topbar-inner { padding: 0 16px; gap: 16px; }
  .mobile-only { display: inline-flex; }
  h1 { font-size: 36px; }
  .summary { grid-template-columns: 1fr; }
  .summary > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .settings-row { grid-template-columns: 1fr; gap: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .search { max-width: none; }
  .editor-head .actions { width: 100%; }
  .editor-head .actions .btn-primary { margin-left: auto; }
}

/* ================= projects (admin) ================= */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project-card {
  display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; transition: border-color .15s, transform .15s;
}
.project-card:hover { border-color: var(--faint); }
.project-card.inactive { opacity: .7; }
.project-card-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.project-card h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.15; }
.bar { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .3s; }
.small { font-size: 13px; margin: 0; }
.next-tasks { list-style: none; margin: 2px 0 0; padding: 0; font-size: 13.5px; }
.next-tasks li { padding: 5px 0; border-top: 1px solid var(--line); }
.next-tasks li::before { content: '○'; color: var(--faint); margin-right: 8px; }

.project-title-wrap { flex: 1; min-width: 0; }
.title-input {
  width: 100%; border: 1px solid transparent; background: none; padding: 2px 6px; margin-left: -7px;
  font-family: var(--serif); font-size: 44px; line-height: 1.1; letter-spacing: -0.01em;
}
.title-input:hover { border-color: var(--line-strong); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.switch b { font-weight: 500; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background-color .15s; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.project-progress { display: flex; align-items: center; gap: 14px; margin: -12px 0 20px; font-size: 13.5px; color: var(--muted); }
.project-progress .bar { flex: 1; max-width: 420px; height: 8px; }
.project-desc { max-width: 760px; }

.task-add { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 8px; margin-bottom: 10px; max-width: 760px; }
.task-list { list-style: none; margin: 0; padding: 0; max-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.task-list:empty { display: none; }
.task-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr) 150px auto 28px; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.task-list li:last-child { border-bottom: 0; }
.task-list li.empty-row { display: block; padding: 14px; }
.task-list.done li { grid-template-columns: 28px minmax(0, 1fr) auto 28px; }
.task-check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.task-title { border-color: transparent; background: none; padding: 6px 8px; }
.task-title:hover { border-color: var(--line); }
.is-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.task-due { padding: 5px 8px; font-size: 13px; }
.task-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.task-move { display: inline-flex; gap: 2px; }
.task-move button { width: 26px; height: 26px; border: 0; border-radius: 4px; background: none; color: var(--faint); cursor: pointer; }
.task-move button:hover { background: var(--sunken); color: var(--ink); }
#tasks-done-wrap .section-head { margin-top: 32px; }
@media (max-width: 720px) {
  .title-input { font-size: 32px; }
  .task-add { grid-template-columns: minmax(0, 1fr) auto; }
  .task-add [name=dueDate] { grid-column: 1; }
  .task-list li { grid-template-columns: 28px minmax(0, 1fr) 28px; }
  .task-list li .task-due, .task-list li .task-move { grid-column: 2; }
  .task-list li .remove { grid-column: 3; grid-row: 1; }
}

/* ================= client portal ================= */
.pt-body { background: var(--bg); }
.pt { min-height: 100vh; }
.pt-top {
  max-width: 1080px; margin: 0 auto; padding: 0 32px; height: 72px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line);
}
.pt-brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 22px; }
.pt-brand span { font-family: var(--sans); font-size: 13px; color: var(--muted); }
.pt-user { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.pt-user form { margin: 0; }
.pt-main { max-width: 1080px; margin: 0 auto; padding: 48px 32px 96px; }
.pt-main.narrow { max-width: 460px; padding-top: 72px; }
.pt-auth { padding: 36px 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px -12px rgba(40,35,20,.15); }
.pt-auth h1 { font-size: 40px; margin-bottom: 8px; }
.pt-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.pt-submit { height: 42px; font-size: 15px; margin-top: 4px; }
.pt-alt { margin-top: 20px; font-size: 13.5px; color: var(--muted); }
.pt-notice { margin: 16px 0 0; padding: 10px 12px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); font-size: 13.5px; }
.pt-auth .auth-error { margin-top: 16px; }

.pt-hello { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.pt-owed { font-size: 15px; color: var(--muted); }
.pt-owed strong { font-family: var(--serif); font-weight: 400; font-size: 28px; color: var(--ink); }
.pt-section { margin-top: 40px; }
.pt-empty { padding: 4px 0; }
.pt-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pt-project {
  display: flex; flex-direction: column; gap: 10px; padding: 22px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s;
}
.pt-project:hover { border-color: var(--faint); }
.pt-project h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.15; }
.pt-project-client { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.pt-project-meta { margin: 0; font-size: 13.5px; color: var(--muted); }
.pt-progress { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.pt-progress span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.pt-next { list-style: none; margin: 4px 0 0; padding: 0; font-size: 14px; }
.pt-next li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.pt-next li span { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.pt-next li span.late, .pt-task-sub.late { color: var(--danger); }
.pt-project-open { margin-top: auto; padding-top: 6px; font-size: 13.5px; font-weight: 500; color: var(--accent); }
.pt-actions { white-space: nowrap; }
.pt-actions .btn { opacity: 1; }

.pt-project-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin: 4px 0 16px; }
.pt-project-stat { display: flex; flex-direction: column; align-items: flex-end; }
.pt-project-stat strong { font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1; }
.pt-project-stat span { font-size: 13.5px; color: var(--muted); }
.pt-desc { max-width: 70ch; margin-top: 24px; font-size: 16px; line-height: 1.6; color: var(--muted); }
.pt-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; margin-top: 16px; }
.pt-columns .section-head { margin-top: 32px; }
.pt-tasks, .pt-timeline { list-style: none; margin: 0; padding: 0; }
.pt-tasks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.pt-check { width: 18px; height: 18px; margin-top: 2px; border: 1.5px solid var(--line-strong); border-radius: 50%; }
.pt-task-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.pt-timeline { position: relative; }
.pt-timeline::before { content: ''; position: absolute; left: 8px; top: 18px; bottom: 18px; width: 2px; background: var(--line); }
.pt-timeline li { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; padding: 12px 0; font-size: 15px; color: var(--muted); }
.pt-dot { position: relative; z-index: 1; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--bg); }
.pt-dot::after { content: ''; position: absolute; left: 5px; top: 3px; width: 5px; height: 9px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pt-updated { margin-top: 48px; font-size: 13px; color: var(--faint); }

@media (max-width: 760px) {
  .pt-top, .pt-main { padding-left: 16px; padding-right: 16px; }
  .pt-user > span { display: none; }
  .pt-columns { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pt-auth { padding: 28px 20px; }
}
#view-project .section-head { max-width: 760px; }

.pt-preview { position: sticky; top: 0; z-index: 10; padding: 9px 16px; text-align: center; background: var(--accent); color: #fff; font-size: 13.5px; }
.pt-preview a { color: inherit; font-weight: 600; margin-left: 8px; text-underline-offset: 3px; }
.pt-email-chip { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 14px 0 0; padding: 10px 12px; border-radius: var(--radius); background: var(--sunken); font-size: 14px; }
.pt-email-chip span { font-weight: 500; overflow-wrap: anywhere; }
.pt-email-chip .link { font-size: 13px; }
.pt-alt-form { margin-top: 18px; }
.pt-alt-form .link-btn { font-size: 13.5px; }

/* ---------- project comments (admin) ---------- */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--accent); color: var(--surface); font-size: 11px; font-weight: 600; vertical-align: 1px; }
.new-comments { align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 9px; }
.thread { list-style: none; margin: 0 0 14px; padding: 0; max-width: 760px; display: flex; flex-direction: column; gap: 10px; }
.thread li { padding: 14px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.thread li.from-owner { background: var(--sunken); border-color: transparent; }
.thread li.from-client { border-left: 3px solid var(--accent); }
.thread li p { margin: 6px 0 0; line-height: 1.55; white-space: normal; overflow-wrap: anywhere; }
.thread .thread-empty { background: none; border: 1px dashed var(--line-strong); }
.comment-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.comment-head .btn { margin-left: auto; height: 24px; }
.comment-form { max-width: 760px; display: flex; flex-direction: column; gap: 10px; }
.comment-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.comment-actions .check { margin-top: 0; }

/* ---------- portal: meetings + comments ---------- */
.pt-meet-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.pt-meet-grid.single { grid-template-columns: minmax(0, 560px); }
.pt-book { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.pt-book h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 26px; }
.pt-book p { margin: 0 0 6px; line-height: 1.5; }
.pt-meetings { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.pt-meetings li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.pt-meetings li:last-child { border-bottom: 0; }
.pt-meet-date { display: flex; flex-direction: column; }
.pt-meet-date span, .pt-meetings .muted { font-size: 13px; color: var(--muted); }
.pt-comments { margin-top: 40px; max-width: 760px; }
.pt-thread { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pt-thread li { padding: 14px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.pt-thread li.from-owner { background: var(--accent-soft); border-color: transparent; }
.pt-thread p { margin: 6px 0 0; line-height: 1.55; overflow-wrap: anywhere; }
.pt-comment-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.pt-comment-head span { color: var(--muted); }
.pt-comment-form { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.pt-comment-form .field { align-self: stretch; }
@media (max-width: 760px) {
  .pt-meet-grid { grid-template-columns: minmax(0, 1fr); }
  .pt-meetings li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

/* ---------- two-step login ---------- */
.tfa-status { margin: 0; font-weight: 500; }
.tfa-status.on { color: var(--accent); }
.tfa-warn { color: var(--danger); }
.tfa-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tfa-code { width: 150px; font-variant-numeric: tabular-nums; letter-spacing: .12em; }
.tfa-steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 18px; }
.tfa-steps li::marker { color: var(--muted); }
.tfa-qr { width: 180px; height: 180px; margin: 10px 0 6px; padding: 8px; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.tfa-qr svg { display: block; width: 100%; height: 100%; }
.tfa-secret { font-size: 13px; letter-spacing: .06em; user-select: all; }
.tfa-codes { padding: 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.tfa-codes p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.5; }
.tfa-codes ol { columns: 2; margin: 0 0 12px; padding-left: 22px; font-size: 14px; }
.tfa-codes code { font-size: 14px; letter-spacing: .06em; }
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- project hours ---------- */
.project-hours-summary { max-width: 980px; }
.project-log { max-width: 980px; }
.project-hours-table { max-width: 980px; margin-bottom: 8px; }
#by-project-rows tr[data-project] { cursor: pointer; }
.confirm-body .field { margin-top: 12px; }
#view-project .section-head, #view-project .task-list, #view-project .task-add,
#view-project .thread, #view-project .comment-form, #view-project .project-desc { max-width: 980px; }

/* ================= admin menu bar (grouped, Stripe-style panels) ================= */
.topbar-inner { gap: 28px; }
.mnav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.mnav-group { position: relative; }
.mnav-trigger, .mnav-link {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border: 0; border-radius: var(--radius); background: none; cursor: pointer;
  font: 500 14px var(--sans); color: var(--muted); text-decoration: none; white-space: nowrap;
  transition: color .12s, background-color .12s;
}
.mnav-trigger:hover, .mnav-link:hover, .mnav-group.open > .mnav-trigger { color: var(--ink); }
.mnav-trigger.is-active, .mnav-link.is-active { color: var(--ink); background: var(--sunken); }
.mnav-chev { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s; }
.mnav-group.open > .mnav-trigger .mnav-chev { transform: rotate(180deg); }
.mnav-trigger:focus-visible, .mnav-link:focus-visible, .mnav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mnav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: -2px; }

.mnav-panel {
  position: absolute; top: calc(100% + 10px); left: -16px; z-index: 40;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, auto); gap: 28px;
  padding: 22px 24px 18px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 24px 48px -16px rgba(30, 28, 20, .22), 0 2px 6px rgba(30, 28, 20, .05);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}
.mnav-panel::before { content: ''; position: absolute; left: 0; right: 0; top: -12px; height: 12px; } /* hover bridge */
.mnav-group.open > .mnav-panel { opacity: 1; visibility: visible; transform: none; transition: opacity .16s ease, transform .16s ease; }
.mnav-right .mnav-panel { left: auto; right: 0; }
.mnav-panel-sm { grid-auto-columns: minmax(260px, auto); padding: 10px; }
.mnav-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mnav-heading {
  margin: 0 0 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-weight: 500; color: var(--ink);
}
.mnav-item {
  display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; margin: 0 -10px; border-radius: 8px;
  text-decoration: none; text-align: left; border: 0; background: none; cursor: pointer; font: inherit; width: calc(100% + 20px);
}
.mnav-panel-sm .mnav-item { margin: 0; width: 100%; }
.mnav-item strong { font-size: 14.5px; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 2px; }
.mnav-item span:not(.nav-badge) { font-size: 13px; color: var(--muted); line-height: 1.4; }
.mnav-item:hover { background: var(--sunken); }
.mnav-item.is-active { background: var(--accent-soft); }
.mnav-logout { margin: 0; }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
/* backdrop-filter would trap the fixed-position phone menu inside the bar */
.topbar:has(.mnav.mobile-open) { backdrop-filter: none; background: var(--bg); }
.mnav-new { gap: 6px; padding: 0 14px; background: var(--ink) !important; color: var(--bg) !important; }
.mnav-new:hover, .mnav-group.open > .mnav-new { background: color-mix(in srgb, var(--ink) 85%, var(--bg)) !important; }
.mnav-new .mnav-chev { stroke: currentColor; }
.mnav-avatar {
  width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 50% !important;
  background: var(--ink) !important; color: var(--bg) !important; font-size: 12.5px; font-weight: 600; letter-spacing: .03em;
}
.mnav-avatar .mnav-chev { display: none; }
.mnav-burger { display: none; width: 36px; height: 36px; border: 0; background: none; cursor: pointer; padding: 0; position: relative; }
.mnav-burger span { position: absolute; left: 9px; right: 9px; height: 1.6px; border-radius: 1px; background: var(--ink); transition: transform .2s, top .2s; }
.mnav-burger span:first-child { top: 13px; }
.mnav-burger span:last-child { top: 21px; }
.mnav-burger[aria-expanded="true"] span:first-child { top: 17px; transform: rotate(45deg); }
.mnav-burger[aria-expanded="true"] span:last-child { top: 17px; transform: rotate(-45deg); }

/* Phones / narrow: the menu becomes a sheet listing every section */
@media (max-width: 860px) {
  .topbar-inner { gap: 12px; }
  .mnav-burger { display: block; }
  .mnav { display: none; }
  .mnav.mobile-open {
    display: flex; flex-direction: column; align-items: stretch; gap: 18px;
    position: fixed; top: 60px; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 20px 16px 40px; overflow-y: auto; background: var(--bg);
  }
  .mnav.mobile-open .mnav-trigger { pointer-events: none; padding: 0; height: auto; color: var(--ink); font-size: 12.5px; }
  .mnav.mobile-open .mnav-trigger .mnav-chev { display: none; }
  .mnav.mobile-open .mnav-panel {
    position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none;
    grid-auto-flow: row; grid-auto-columns: auto; gap: 14px; margin-top: 8px; padding: 14px 16px;
  }
  .mnav.mobile-open .mnav-link { padding: 14px 16px; height: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--accent); font-weight: 600; font-size: 14.5px; }
  .mnav-group[data-group="account"] .mnav-panel, .mnav-group[data-group="new"] .mnav-panel { right: -8px; }
  .mnav-new { padding: 0 12px; }
}

/* ---------- profile photo ---------- */
.photo-row { display: flex; align-items: center; gap: 18px; }
.photo-preview {
  width: 72px; height: 72px; flex-shrink: 0; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--ink); color: var(--bg);
  font: 600 20px var(--sans); letter-spacing: .03em;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-actions .tfa-row { margin-top: 0; }
.photo-actions .hint { margin-top: 6px; font-weight: 400; }
.photo-upload { cursor: pointer; }
.photo-upload.disabled { opacity: .5; pointer-events: none; }
.mnav-avatar.has-photo { padding: 0; overflow: hidden; background: var(--sunken) !important; }
.mnav-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.pt-brand { align-items: center; }
.pt-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }

/* ---------- admin home (dashboard) ---------- */
.dash-head { margin-bottom: 28px; }
.dash-head h1 { text-wrap: balance; }
.summary > .dash-tile { padding: 18px 20px 20px 0; text-decoration: none; color: inherit; transition: background .15s; }
.summary > .dash-tile + .dash-tile { padding-left: 20px; border-left: 1px solid var(--line); }
.summary > .dash-tile:hover .k { color: var(--accent); }
.summary .v.is-danger, .num.is-danger { color: var(--danger); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.dash-col { display: grid; gap: 24px; min-width: 0; }
.dash-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px 8px; min-width: 0; }
.dash-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.dash-card-head h2 { font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: 0; margin: 0; display: flex; align-items: center; gap: 8px; }
.dash-card-head .link { font-size: 13px; white-space: nowrap; }
.dash-pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.dash-pill.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; }
.dash-list li:first-child { border-top: 0; }
.dash-list a { color: var(--ink); text-decoration: none; }
.dash-list a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.dash-main { flex: 1; min-width: 0; }
.dash-main .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.dash-main .clamp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-list li.unread .dash-main > a { font-weight: 600; }
.dash-when { width: 82px; flex: none; display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); }
.dash-when strong { color: var(--ink); font-weight: 600; font-size: 13px; }
.dash-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--line-strong); }
.dash-dot.late { background: var(--danger); }
.dash-list li.unread .dash-dot { background: var(--accent); }
.dash-dot.read { background: transparent; }
.dash-due { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.dash-due.late { color: var(--danger); font-weight: 500; }
.dash-empty { color: var(--muted); font-size: 13.5px; margin: 6px 0 14px; }
.dash-progress { height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; margin: 6px 0 8px; }
.dash-progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.dash-check { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 11px; color: var(--surface); }
.dash-list li.done .dash-check { background: var(--accent); border-color: var(--accent); }
.dash-list li.done .dash-main { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
@media (max-width: 960px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1080px) {
  .summary-4 > .dash-tile + .dash-tile { border-left: 0; padding-left: 0; }
  .summary-4 > .dash-tile:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
  .summary-4 > .dash-tile:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .dash-card { padding: 16px 16px 6px; }
  .dash-when { width: 70px; }
}

/* ---------- admin inbox ---------- */
#view-inbox .page-head { flex-wrap: wrap; }
.inbox { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-height: 520px; overflow: hidden; }
.inbox-list { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--line); overflow-y: auto; max-height: 72vh; }
.inbox-row { padding: 14px 18px 14px 26px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; outline: none; }
.inbox-row:hover { background: var(--sunken); }
.inbox-row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.inbox-row.selected { background: var(--accent-soft); }
.inbox-row.unread::before { content: ''; position: absolute; left: 11px; top: 21px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.inbox-row-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.inbox-row-top strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-row.unread .inbox-row-top strong { font-weight: 650; }
.inbox-row-top span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.inbox-row-sub { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.inbox-tag { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); flex: none; }
.inbox-tag.comment { background: var(--sunken); color: var(--muted); }
.inbox-row-preview { font-size: 13px; color: var(--muted); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inbox-empty { padding: 28px 20px; color: var(--muted); font-size: 14px; }
.inbox-detail { padding: 28px 32px; min-width: 0; }
.inbox-placeholder { height: 100%; min-height: 300px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.inbox-placeholder p { margin: 0; }
.inbox-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.inbox-detail-head h2 { font-size: 28px; margin: 0 0 4px; }
.inbox-detail-head p { margin: 0; }
.inbox-detail-head .small { white-space: nowrap; }
.inbox-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.inbox-chips span { font-size: 13px; color: var(--muted); background: var(--sunken); padding: 5px 10px; border-radius: 999px; }
.inbox-chips strong { color: var(--ink); font-weight: 500; }
.inbox-body { margin: 20px 0 24px; font-size: 15px; line-height: 1.65; max-width: 68ch; overflow-wrap: anywhere; }
.inbox-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 50vh; }
  .inbox-detail { padding: 22px 18px; }
  .inbox-placeholder { min-height: 140px; }
  .inbox-detail-head { flex-direction: column; gap: 6px; }
  .inbox-detail-head h2 { font-size: 24px; }
}

/* ---------- done check (public proposal / contract pages) ---------- */
.ct-check { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.dash-card:empty, #dash-money:empty { display: none; }
@media (max-width: 720px) {
  .summary-4 > .dash-tile + .dash-tile, .summary-4 > .dash-tile:nth-child(even) { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- Cmd+K search ---------- */
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s;
}
.search-btn:hover { color: var(--ink); border-color: var(--muted); }
.search-btn svg, .cmdk-input svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; flex: none; }
kbd { font: 500 11px/1 var(--sans); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--sunken); color: var(--muted); }
.cmdk {
  border: 1px solid var(--line); border-radius: 12px; padding: 0; margin: 12vh auto auto;
  width: min(640px, calc(100vw - 24px)); background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 80px -16px rgba(0,0,0,.4); overflow: hidden;
}
.cmdk[open] { display: flex; flex-direction: column; max-height: min(560px, 76vh); }
.cmdk::backdrop { background: rgba(20, 18, 12, .35); }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-input input { flex: 1; border: 0; background: none; height: 54px; padding: 0; font-size: 16px; color: var(--ink); box-shadow: none; outline: none; }
.cmdk-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.cmdk-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.cmdk-item { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.cmdk-item.active { background: var(--accent-soft); }
.cmdk-title { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.cmdk-item mark { background: none; color: var(--accent); font-weight: 600; }
.cmdk-empty { padding: 28px 10px; text-align: center; color: var(--muted); }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.cmdk-foot kbd { margin-right: 3px; }
@media (max-width: 860px) {
  .search-btn { width: 34px; padding: 0; justify-content: center; }
  .search-btn-label, .search-btn kbd { display: none; }
  .cmdk { margin-top: 12px; }
  .cmdk-foot { display: none; }
}

/* ---------- proposal & contract editors ---------- */
.doc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); }
.doc-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.doc-fieldset:disabled { opacity: .7; }
.md-hint { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.prop-items { display: grid; gap: 10px; }
.prop-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--surface); }
.prop-item.is-optional { border-style: dashed; border-color: var(--line-strong); }
.prop-item-main { display: grid; grid-template-columns: minmax(0, 1fr) 110px 64px 100px 96px 28px; gap: 8px; align-items: center; }
.prop-item-main select { height: 36px; font-size: 13px; }
.prop-item.is-rate [data-f=quantity] { visibility: hidden; }
.prop-item.is-rate { background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); }
.prop-item-main .amount { text-align: right; font-weight: 500; }
.prop-item-extra { display: flex; align-items: flex-start; gap: 12px; margin-top: 8px; }
.prop-item-extra textarea { flex: 1; min-height: 34px; resize: none; overflow: hidden; font-size: 13px; }
.prop-item-extra .check { margin-top: 8px; white-space: nowrap; }
.add-line { margin: 10px 0 0 -8px; color: var(--accent); }
@container (max-width: 600px) {
  .prop-item-main { grid-template-columns: 1fr 64px 1fr minmax(80px, auto) 28px; }
  .prop-item.is-rate [data-f=quantity] { display: none; }
  .prop-item.is-rate .prop-item-main { grid-template-columns: 1fr 1fr minmax(80px, auto) 28px; }
  .prop-item-main [data-f=description] { grid-column: 1 / -1; }
  .prop-item-extra { flex-direction: column; gap: 4px; }
}
.doc-side { position: sticky; top: 92px; display: grid; gap: 16px; min-width: 0; }
.doc-side > div:empty { display: none; }
#contract-side { display: grid; gap: 16px; }
.doc-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.doc-card h3 { font-family: var(--sans); font-size: 13px; font-weight: 600; margin: 0 0 10px; }
.doc-card .hint { margin: 0; }
.doc-link { display: flex; gap: 8px; }
.doc-link input { flex: 1; min-width: 0; height: 30px; font-size: 12.5px; color: var(--muted); }
.doc-timeline { list-style: none; margin: 0; padding: 0; }
.doc-timeline li { display: flex; gap: 12px; position: relative; padding-bottom: 14px; font-size: 13px; }
.doc-timeline li:last-child { padding-bottom: 0; }
.doc-timeline li:not(:last-child)::after { content: ''; position: absolute; left: 4px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.doc-timeline .dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface); flex: none; }
.doc-timeline li.done .dot { background: var(--accent); border-color: var(--accent); }
.doc-timeline strong { font-weight: 500; display: block; }
.doc-timeline li:not(.done) strong { color: var(--muted); font-weight: 400; }
.doc-timeline .muted { font-size: 12.5px; }
.doc-timeline .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.doc-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.doc-links li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-links li > span:first-child { color: var(--muted); width: 110px; }
.doc-hash { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; margin-top: 12px !important; }
.doc-attached { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.doc-attached.empty { border-style: dashed; background: none; }
.doc-attached .hint { margin: 4px 0 0; }
.doc-attached strong { font-weight: 500; margin-right: 6px; }
.contract-text-head { margin: 20px 0 8px; }
.contract-text-head h2 { font-size: 15px; }
#contract-missing { margin: 16px 0 0; }
.doc-text { width: 100%; min-height: 480px; font: 13.5px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; padding: 14px 16px; }
.doc-preview {
  background: #fff; color: #1a1a19; border-radius: 4px; padding: 32px 30px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 12px 32px -8px rgba(40,35,20,.18);
  max-height: calc(100vh - 260px); overflow-y: auto; font-size: 13px;
}
.doc-preview h1 { font-size: 26px; margin: 6px 0 16px; color: #1a1a19; }
.doc-preview .dc-rich { --ink: #1a1a19; --muted: #77756f; --line: #e4e2dc; color: #1a1a19; font-size: 13px; }
.doc-preview .dc-eyebrow { color: #1f5c45; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.template-card {
  display: flex; flex-direction: column; gap: 8px; text-align: left; min-height: 160px; padding: 18px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  text-decoration: none; font: inherit; cursor: pointer; transition: border-color .15s, transform .15s;
}
.template-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.template-card strong { font-family: var(--serif); font-size: 22px; font-weight: 400; }
.template-card .muted { font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.template-meta { margin-top: auto; font-size: 12px; color: var(--faint); }
.template-new { border-style: dashed; background: none; justify-content: center; align-items: center; text-align: center; }
.template-new strong { font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--accent); }
@media (max-width: 1100px) {
  .doc-grid { grid-template-columns: minmax(0, 1fr); }
  .doc-side { position: static; }
  .doc-preview { max-height: none; }
}

/* ---------- analytics ---------- */
.an-live { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; color: var(--accent); font-weight: 500; }
.an-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: an-pulse 2s ease-in-out infinite; }
@keyframes an-pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .an-live-dot { animation: none; } }
.an-delta { font-weight: 600; font-size: 12px; margin-right: 4px; }
.an-delta.up { color: var(--accent); }
.an-delta.down { color: var(--danger); }
.an-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.an-chart-card { margin-bottom: 20px; }
.an-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.an-card-head h2 { font-family: var(--sans); font-size: 14px; font-weight: 600; margin: 0; }
.an-chart { position: relative; min-height: 240px; }
.an-chart svg { display: block; overflow: visible; }
.an-grid-line { stroke: var(--line); stroke-width: 1; }
.an-grid-line.base { stroke: var(--line-strong); }
.an-axis { fill: var(--muted); font-size: 11px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.an-bar-mark { fill: var(--accent); opacity: .88; transition: opacity .1s; }
.an-bar-mark.active { opacity: 1; }
.an-hit { fill: transparent; cursor: default; }
.an-hover-band rect { fill: var(--sunken); }
.an-tip {
  position: absolute; pointer-events: none; z-index: 2; display: grid; gap: 2px; min-width: 140px;
  padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.25); font-size: 12.5px; color: var(--muted);
}
.an-tip strong { color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.an-tip b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.an-empty { min-height: 240px; display: grid; place-content: center; text-align: center; max-width: 440px; margin: 0 auto; }
.an-empty p { margin: 0 0 4px; }
.an-table { max-height: 340px; overflow-y: auto; }
.an-table .table td { padding: 8px 12px; }
.an-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.an-span-2 { grid-column: span 2; }
.an-cols { display: flex; gap: 0; font-size: 12px; color: var(--muted); }
.an-cols span { width: 72px; text-align: right; }
.an-list { list-style: none; margin: 0; padding: 0; }
.an-list li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 72px 72px; align-items: center; padding: 7px 8px; font-size: 13.5px; border-radius: 6px; }
.an-list li + li { margin-top: 2px; }
.an-bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); border-radius: 6px; z-index: 0; }
.an-list li > :not(.an-bar) { position: relative; z-index: 1; }
.an-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.an-label .link { text-decoration: none; }
.an-label .link:hover { text-decoration: underline; }
@media (max-width: 860px) {
  #view-analytics .page-head { flex-direction: column; align-items: flex-start; }
  #an-range { max-width: 100%; overflow-x: auto; }
  .an-grid { grid-template-columns: minmax(0, 1fr); }
  .an-span-2 { grid-column: auto; }
  .an-card { padding: 14px; }
}

/* ---------- public proposal & contract pages ---------- */
.dc-body { background: var(--bg); }
.dc { max-width: 860px; margin: 0 auto; padding: 24px 24px 64px; }
.dc-top { display: flex; align-items: center; justify-content: space-between; padding-bottom: 20px; }
.dc-top .pt-brand { align-items: center; }
.dc-paper {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 56px 64px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 18px 48px -24px rgba(0,0,0,.22);
}
.dc-gone { text-align: center; padding: 72px 32px; }
.dc-gone h1 { font-size: 34px; margin-bottom: 10px; }
.dc-head { padding-bottom: 28px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.dc-eyebrow { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.dc-head h1 { font-size: clamp(36px, 6vw, 56px); line-height: 1.02; letter-spacing: -0.015em; margin: 0 0 14px; text-wrap: balance; }
.dc-head > p { margin: 0; }
.dc-meta { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 20px 0 0; }
.dc-meta dt { font-size: 12px; color: var(--muted); }
.dc-meta dd { margin: 2px 0 0; font-weight: 500; }
.dc-rich { font-size: 15.5px; line-height: 1.7; color: var(--ink); overflow-wrap: anywhere; }
.dc-rich > :first-child { margin-top: 0; }
.dc-rich h1, .dc-rich h2 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 1.6em 0 .5em; }
.dc-rich h1 { font-size: 30px; }
.dc-rich h2 { font-size: 24px; }
.dc-rich h3 { font-size: 15.5px; font-weight: 600; margin: 1.4em 0 .4em; }
.dc-rich p { margin: 0 0 1em; }
.dc-rich ul, .dc-rich ol { margin: 0 0 1em; padding-left: 1.3em; }
.dc-rich li { margin: .25em 0; }
.dc-rich li::marker { color: var(--muted); }
.dc-rich strong { font-weight: 600; }
.dc-rich hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.dc-section { margin-top: 44px; }
.dc-section > h2, .dc-signatures > h2, .dc-accept > h2 { font-size: 28px; margin: 0 0 16px; }
.dc-items { width: 100%; border-collapse: collapse; font-size: 15px; }
.dc-items td { padding: 16px 0; border-top: 1px solid var(--line); vertical-align: top; }
.dc-items td + td { padding-left: 16px; white-space: nowrap; }
.dc-items tr:last-child td { border-bottom: 1px solid var(--line); }
.dc-items .num { text-align: right; font-variant-numeric: tabular-nums; }
.dc-items tr.excluded td { color: var(--muted); }
.dc-items tr.excluded td:last-child { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.dc-item-title { font-weight: 500; }
.dc-item-details { margin-top: 4px; font-size: 13.5px; color: var(--muted); line-height: 1.55; white-space: normal; }
.dc-opt { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.dc-opt input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.dc-tag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent); vertical-align: 2px; }
.dc-totals { margin: 20px 0 0 auto; max-width: 360px; display: grid; gap: 6px; font-variant-numeric: tabular-nums; }
.dc-totals div { display: flex; justify-content: space-between; gap: 24px; color: var(--muted); }
.dc-totals dd { margin: 0; color: var(--ink); }
.dc-totals .grand { padding-top: 10px; border-top: 1px solid var(--line-strong); color: var(--ink); font-weight: 600; font-size: 17px; }
.dc-totals .deposit { padding: 10px 12px; margin-top: 6px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.dc-totals .deposit dd { color: var(--accent); }
.dc-contract { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 32px; padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: 10px; }
.dc-contract > div { display: grid; gap: 2px; }
.dc-contract.signed { border-color: var(--accent); background: var(--accent-soft); }
.dc-accept { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--line); display: grid; gap: 16px; max-width: 520px; }
.dc-accept .check { margin: 0; align-items: flex-start; font-size: 14px; color: var(--ink); }
.dc-accept .check input { margin-top: 3px; }
.dc-cta { height: 46px; padding: 0 24px; font-size: 15px; justify-self: start; }
.dc-cta:disabled { opacity: .45; cursor: not-allowed; }
.dc-accept .hint { margin: -6px 0 0; }
.dc-done { margin-top: 40px; padding: 28px; border-radius: 12px; background: var(--accent-soft); text-align: center; }
.dc-done p { margin: 0 0 10px; }
.dc-done p:last-child { margin-bottom: 0; }
.dc-done .ct-check { background: var(--surface); margin: 0 auto 14px; }
.dc-banner { margin: 32px 0 0; padding: 16px 18px; border-radius: 10px; background: var(--sunken); text-align: center; }
.dc-decline { margin-top: 28px; font-size: 14px; }
.dc-decline summary { cursor: pointer; color: var(--muted); }
.dc-decline summary:hover { color: var(--ink); }
.dc-decline form { display: grid; gap: 12px; margin-top: 14px; max-width: 520px; }
.dc-decline .btn { justify-self: start; }
.dc-signatures { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.dc-sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.dc-sig { display: grid; gap: 4px; }
.dc-sig-label { font-size: 12.5px; color: var(--muted); }
.dc-sig-name { min-height: 52px; padding-bottom: 6px; border-bottom: 1px solid var(--line-strong); font-family: var(--serif); font-style: italic; font-size: 34px; line-height: 1.4; }
.dc-sig-meta { font-size: 12.5px; color: var(--muted); }
.dc-sig.signed .dc-sig-meta { color: var(--accent); }
.dc-sign-form { margin-top: 32px; display: grid; gap: 14px; max-width: 520px; }
.dc-sign-form .check { margin: 0; align-items: flex-start; font-size: 14px; color: var(--ink); }
.dc-sign-form .check input { margin-top: 3px; }
.dc-sig-preview { min-height: 50px; font-family: var(--serif); font-style: italic; font-size: 34px; line-height: 1.4; border-bottom: 1px dashed var(--line-strong); color: var(--accent); }
.dc-sig-preview:empty::before { content: 'Your signature'; color: var(--faint); font-size: 22px; }
.dc-foot { padding-top: 24px; text-align: center; font-size: 13px; color: var(--muted); }
@media (max-width: 720px) {
  .dc { padding: 12px 12px 48px; }
  .dc-paper { padding: 28px 20px; border-radius: 12px; }
  .dc-head { padding-bottom: 20px; margin-bottom: 24px; }
  .dc-rich { font-size: 15px; }
  .dc-items td + td:not(:last-child) { display: none; }
  .dc-sig-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .dc-contract { flex-direction: column; align-items: flex-start; }
}

/* ---------- portal: proposals & agreements ---------- */
.pt-docs { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.pt-docs li + li { border-top: 1px solid var(--line); }
.pt-docs a { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px 18px; text-decoration: none; }
.pt-docs a:hover { background: var(--sunken); }
.pt-doc-kind { font-size: 12px; color: var(--muted); }
.pt-doc-main { display: grid; min-width: 0; }
.pt-doc-main strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-doc-main .muted { font-size: 13px; }
.pt-doc-status { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pt-doc-status.todo { color: var(--accent); font-weight: 600; }
@media (max-width: 600px) {
  .pt-docs a { grid-template-columns: minmax(0, 1fr) auto; }
  .pt-doc-kind { display: none; }
}

/* ---------- Markdown editor ---------- */
.md-editor { border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); overflow: hidden; container-type: inline-size; }
.md-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.md-toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--line); background: var(--sunken); flex-wrap: wrap; }
.md-toolbar button {
  height: 28px; min-width: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--muted);
  font: 600 12.5px/1 var(--sans); cursor: pointer; display: inline-grid; place-items: center;
}
.md-toolbar button:hover { background: var(--surface); color: var(--ink); }
.md-toolbar button:disabled { opacity: .4; }
.md-toolbar b { font-weight: 700; font-size: 14px; }
.md-toolbar i { font-family: var(--serif); font-size: 16px; font-weight: 400; }
.md-toolbar svg { width: 15px; height: 15px; fill: currentColor; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.md-toolbar svg path { fill: none; }
.md-toolbar svg text { font: 600 4.5px var(--sans); stroke: none; }
.md-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 4px; }
.md-spacer { flex: 1; }
.md-modes { display: inline-flex; gap: 2px; padding: 2px; border-radius: 7px; background: var(--line); }
.md-modes button { height: 24px; font-weight: 500; font-size: 12px; }
.md-modes button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.md-panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: 340px; min-height: 180px; resize: vertical; overflow: hidden; }
.md-editor .md-input {
  width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none !important; resize: none; outline: none;
  padding: 14px 16px; font: 13.5px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface);
}
.md-preview { height: 100%; overflow-y: auto; padding: 14px 20px; border-left: 1px solid var(--line); background: var(--bg); font-size: 14.5px; }
.md-empty { color: var(--faint); }
.md-editor[data-mode="write"] .md-panes { grid-template-columns: minmax(0, 1fr); }
.md-editor[data-mode="write"] .md-preview { display: none; }
.md-editor[data-mode="preview"] .md-panes { grid-template-columns: minmax(0, 1fr); }
.md-editor[data-mode="preview"] .md-input { display: none; }
.md-editor[data-mode="preview"] .md-preview { border-left: 0; }
.md-editor.no-preview .md-panes { display: block; height: auto; resize: none; overflow: visible; }
.md-editor.no-preview .md-input { height: auto; min-height: 520px; resize: vertical; }
@container (max-width: 560px) {
  .md-editor[data-mode="split"] .md-panes { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr 1fr; height: 520px; }
  .md-editor[data-mode="split"] .md-preview { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- proposal rates + attached agreement ---------- */
.dc-per { color: var(--muted); font-size: 13px; margin-left: 1px; }
.dc-subhead { font-family: var(--sans); font-size: 15px; font-weight: 600; margin: 36px 0 2px; }
.dc-subnote { margin: 0 0 8px; }
.dc-rates td:nth-child(2) { font-size: 13px; }
.doc-attached-actions { display: flex; gap: 6px; flex: none; }

.md-editor.tall .md-panes { height: 620px; }
.md-preview.dc-rich h1.md-doc-title { font-size: 30px; margin: 4px 0 18px; }
.md-preview .dc-eyebrow { margin-bottom: 6px; }
#view-contract .editor-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); }
@media (max-width: 1100px) { #view-contract .editor-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- private notes ---------- */
.notes-panel { display: grid; gap: 14px; max-width: 860px; }
.notes-page { max-width: none; }
.note-new .md-editor .md-input { min-height: 72px; }
.note-new .md-editor.no-preview .md-input { min-height: 72px; resize: vertical; }
.note-new-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.note-new-actions .check { margin: 0; }
.note-new-actions .hint { margin: 0 0 0 auto; }
.note-new-actions .picker { max-width: 240px; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.note { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px 10px; }
.note.pinned { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: inset 3px 0 0 var(--accent); }
.note-body.dc-rich { font-size: 14.5px; line-height: 1.6; }
.note-body.dc-rich h1, .note-body.dc-rich h2 { font-size: 20px; margin: .6em 0 .3em; }
.note-body.dc-rich > :last-child { margin-bottom: 0; }
.note-meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12.5px; flex-wrap: wrap; min-height: 30px; }
.note-actions { margin-left: auto; display: flex; gap: 2px; opacity: .55; transition: opacity .15s; }
.note:hover .note-actions, .note:focus-within .note-actions { opacity: 1; }
.note-pin-badge { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 999px; }
.note-target { font-weight: 500; text-decoration: none; color: var(--ink); }
a.note-target:hover { color: var(--accent); }
.note-empty { padding: 18px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--muted); font-size: 13.5px; }
.note-edit .md-editor .md-input { min-height: 120px; }
.confirm-quote { padding: 10px 14px; border-left: 3px solid var(--line-strong); background: var(--sunken); border-radius: 4px; font-size: 13.5px; max-height: 200px; overflow: auto; }
@media (hover: none) { .note-actions { opacity: 1; } }

/* ---------- short links ---------- */
.link-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 16px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.slug-input { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.slug-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.slug-prefix { display: flex; align-items: center; padding: 0 1px 0 10px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.slug-input input { border: 0; box-shadow: none !important; padding-left: 0; min-width: 0; }
.link-list { display: grid; gap: 10px; }
.link-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.link-card.open { border-color: var(--line-strong); }
.link-card.off .link-short strong { color: var(--muted); text-decoration: line-through; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 20px; align-items: center; padding: 14px 18px; cursor: pointer; }
.link-row:hover { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.link-short { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.link-short .muted { font-size: 13px; }
.link-dest { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.link-stats { display: flex; align-items: center; gap: 14px; font-size: 13.5px; white-space: nowrap; }
.link-stats .sub { font-size: 12px; color: var(--muted); }
.spark rect { fill: var(--accent); }
.spark rect.zero { fill: var(--line-strong); }
.link-detail { border-top: 1px solid var(--line); padding: 18px; background: var(--bg); }
.link-detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto; gap: 28px; align-items: start; }
.link-edit { display: grid; gap: 12px; }
.link-edit .check { margin: 0; }
.link-edit .hint { margin: 0; }
.link-edit-actions { display: flex; align-items: center; gap: 8px; }
.link-edit-actions .spacer { flex: 1; }
.link-breakdown h4 { font-size: 13px; font-weight: 600; margin: 0 0 10px; }
.link-break-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.link-break-cols h5 { margin: 0 0 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.link-break { list-style: none; margin: 0; padding: 0; font-size: 13px; display: grid; gap: 4px; }
.link-break li { display: flex; justify-content: space-between; gap: 8px; }
.link-break li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-qr { display: grid; justify-items: center; gap: 6px; }
.link-qr img { background: #fff; border-radius: 8px; padding: 6px; border: 1px solid var(--line); }
@media (max-width: 1000px) {
  .link-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .link-form .grow { grid-column: 1 / -1; }
  .link-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .link-qr { justify-items: start; }
}
@media (max-width: 640px) {
  .link-form { grid-template-columns: minmax(0, 1fr); }
  .link-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .link-stats .spark { display: none; }
  .link-actions { display: none; }
  .link-break-cols { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- social previews ---------- */
.social-site { max-width: 640px; margin-bottom: 24px; }
.social-slots { display: grid; gap: 18px; }
.sp-slot { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 28px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.sp-fields { display: grid; gap: 12px; align-content: start; }
.sp-fields .hint { margin: -6px 0 0; }
.sp-head { display: flex; align-items: baseline; gap: 10px; }
.sp-head h2 { font-size: 22px; margin: 0; }
.sp-head code { font-size: 12px; color: var(--muted); }
.sp-image { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sp-image img { width: 120px; height: 63px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.sp-image .hint { margin: 0 !important; }
.sp-foot { margin-top: 4px; }
.sp-previews { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sp { margin: 0; min-width: 0; }
.sp figcaption { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: .02em; }
.sp-card { overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; }
.sp-card img, .sp-noimg { display: block; width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--sunken); }
.sp-noimg { display: grid; place-items: center; color: var(--faint); font-size: 12px; }
.sp-text { padding: 8px 12px 10px; display: grid; gap: 2px; }
.sp-text strong { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-text span { font-size: 12px; color: var(--muted); }
.sp-li .sp-card { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.sp-x .sp-card { position: relative; border: 1px solid var(--line); border-radius: 16px; }
.sp-x-title { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-x-host { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; }
.sp-im .sp-card { border-radius: 18px; background: #e9e9eb; color: #000; max-width: 280px; }
.sp-im .sp-text span { color: #6e6e73; }
.sp-sl .sp-card { display: flex; gap: 10px; padding: 2px 0; }
.sp-sl-bar { width: 4px; border-radius: 4px; background: var(--line-strong); flex: none; }
.sp-sl .sp-card > div:last-child { display: grid; gap: 3px; min-width: 0; font-size: 13px; }
.sp-sl-site { font-size: 12px; font-weight: 600; }
.sp-sl strong { color: #1d9bd1; font-weight: 600; }
.sp-sl p { margin: 0; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-sl img { max-width: 260px; border-radius: 6px; margin-top: 4px; }
@media (prefers-color-scheme: dark) { .sp-im .sp-card { background: #262628; color: #fff; } .sp-im .sp-text span { color: #98989f; } }
@media (max-width: 1000px) {
  .sp-slot { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .sp-slot { padding: 16px; }
  .sp-previews { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- payouts ---------- */
.payout-fees { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 8px; }
.payout-dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 0 0 8px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.payout-dl dt { color: var(--muted); }
.payout-dl dd { margin: 0; text-align: right; }
.payout-dl .strong { color: var(--ink); font-weight: 600; padding-top: 4px; border-top: 1px solid var(--line); }
.payouts-table tbody tr.open { background: var(--sunken); }
.payout-detail-row { cursor: default !important; }
.payout-detail-row:hover { background: none !important; }
.payout-detail-row > td { padding: 0 !important; white-space: normal; background: var(--bg); }
.payout-txns { width: 100%; border-collapse: collapse; font-size: 13px; }
.payout-txns th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 16px 6px; }
.payout-txns td { padding: 7px 16px; border-top: 1px solid var(--line); }
.payout-txns .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.payout-txns tfoot td { border-top: 1px solid var(--line-strong); padding-bottom: 12px; }

/* ---------- sessions & logins ---------- */
.session-list { display: grid; gap: 10px; max-width: 760px; }
.session-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.session-card.current { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.session-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--sunken); color: var(--muted); flex: none; }
.session-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.session-main { flex: 1; min-width: 0; }
.session-main strong { font-weight: 500; margin-right: 8px; }
.session-main .sub { font-size: 12.5px; color: var(--muted); }
.history-table td { white-space: nowrap; }
.history-table td:nth-child(2) { white-space: normal; }
.h-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; background: var(--line-strong); vertical-align: 1px; }
.h-ok .h-dot { background: var(--accent); }
.h-bad .h-dot { background: var(--danger); }
.h-bad td:nth-child(2) { color: var(--danger); }
.h-warn .h-dot { background: #c28a1a; }
.history-table tbody tr { cursor: default; }
@media (max-width: 640px) {
  .session-card { flex-wrap: wrap; }
  .session-card .btn { width: 100%; }
  #view-sessions .page-head { flex-direction: column; align-items: flex-start; }
}

/* ================= blog (admin) ================= */
.blog-warn { margin-bottom: 16px; padding: 12px 14px; border-radius: var(--radius); font-size: 13.5px; background: var(--sunken); color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.blog-warn code { font-size: 12px; }
.blog-group { margin-bottom: 36px; }
.blog-group > h2 { margin-bottom: 12px; font-size: 13px; letter-spacing: .02em; }
.blog-none { font-size: 13.5px; }
.blog-list { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.blog-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); transition: background-color .1s; }
.blog-row:last-child { border-bottom: 0; }
.blog-row:hover { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.blog-thumb { width: 96px; aspect-ratio: 3 / 2; border-radius: 5px; overflow: hidden; background: var(--sunken); display: grid; place-items: center; font-size: 11px; color: var(--faint); }
.blog-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.blog-row-main strong { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.2; }
.blog-row-kicker { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.blog-row-dek { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blog-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12.5px; white-space: nowrap; }
.blog-writing::before { animation: blog-pulse 1.2s ease-in-out infinite; }
@keyframes blog-pulse { 50% { opacity: .25; } }
.blog-loading { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 10px; }
.blog-loading::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: blog-spin .8s linear infinite; flex-shrink: 0; }
@keyframes blog-spin { to { transform: rotate(360deg); } }

.blog-topics { margin-bottom: 36px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.blog-topics-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.blog-topics-head h2 { font-size: 15px; margin-bottom: 2px; }
.blog-topics-head p { font-size: 13px; }
.blog-topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.blog-topic { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 14px 42px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 1.45; transition: border-color .12s, background-color .12s; }
.blog-topic:hover { border-color: var(--line-strong); }
.blog-topic.picked { border-color: var(--accent); background: var(--accent-soft); }
.blog-topic input { position: absolute; left: 14px; top: 16px; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.blog-topic strong { font-family: var(--serif); font-weight: 400; font-size: 19px; line-height: 1.2; }
.blog-topic:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.blog-why { font-size: 12px; }
.blog-own { display: flex; gap: 8px; margin-top: 14px; }
.blog-own input { flex: 1; }
.blog-topics-foot { display: flex; justify-content: flex-end; margin-top: 16px; }

.blog-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.blog-form .blog-headline { font-family: var(--serif); font-size: 24px; height: auto; padding-top: 8px; padding-bottom: 8px; }
.blog-slug { display: flex; align-items: center; gap: 4px; }
.blog-slug span { color: var(--faint); font-weight: 400; }
.blog-slug input { flex: 1; }
.blog-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 76px; }
.blog-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.blog-card h2 { font-size: 13.5px; }
.blog-card p { font-size: 13px; }
.blog-card textarea { width: 100%; }
.blog-card .btn-sm { align-self: flex-start; }
.blog-cover { aspect-ratio: 3 / 2; border-radius: 6px; overflow: hidden; background: var(--sunken); }
.blog-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-cover.empty { display: grid; place-items: center; padding: 16px; text-align: center; font-size: 12.5px; color: var(--muted); border: 1px dashed var(--line-strong); }
.blog-cover-actions, .blog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.blog-schedule { display: flex; align-items: flex-end; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.blog-schedule .field { flex: 1; min-width: 0; margin: 0; }
.blog-schedule input { width: 100%; }
.blog-card.blog-is-scheduled { border-color: var(--accent); background: var(--accent-soft); }
.blog-is-scheduled .blog-schedule { border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.btn-link-danger { align-self: flex-start; background: none; border: 0; padding: 4px 0; font: inherit; font-size: 13px; color: var(--danger); cursor: pointer; }
.btn-link-danger:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 960px) {
  .blog-editor { grid-template-columns: minmax(0, 1fr); }
  .blog-side { position: static; }
}
@media (max-width: 640px) {
  .blog-row { grid-template-columns: 72px minmax(0, 1fr); }
  .blog-thumb { width: 72px; }
  .blog-row-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; }
  .blog-row-dek { white-space: normal; }
}

/* ================= newsletter (admin) ================= */
.blog-note { background: var(--accent-soft); }
.nl-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.nl-stats div { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.nl-stats div + div { border-left: 1px solid var(--line); }
.nl-stats strong { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1; }
.nl-stats span { font-size: 12.5px; color: var(--muted); }
.nl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); transition: background-color .1s; }
.nl-row:last-child { border-bottom: 0; }
.nl-row:hover { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.nl-subs-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.nl-subs-head h2 { margin: 0; }
.nl-add { display: flex; gap: 6px; }
.nl-add input { width: 220px; height: 30px; }
.nl-table tbody tr { cursor: default; }
.nl-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.nl-form-col, .nl-side-col { display: flex; flex-direction: column; gap: 16px; }
.nl-preview-col { position: sticky; top: 76px; }
.nl-preview { width: 100%; height: calc(100vh - 110px); min-height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #f3f1ec; }
.nl-posts { border: 0; padding: 0; margin: 0; }
.nl-posts legend { padding: 0; margin-bottom: 4px; }
/* Posts in an issue: an ordered list you can drag, nudge or trim */
.nl-chosen { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.nl-chosen li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: grab; }
.nl-chosen li:first-child { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.nl-chosen li.is-dragging { opacity: .45; }
.nl-chosen li.is-over { box-shadow: inset 0 2px 0 var(--accent); }
.nl-grip { color: var(--faint); font-size: 12px; letter-spacing: -2px; user-select: none; }
.nl-chosen-thumb { flex: none; width: 54px; height: 36px; border-radius: 5px; overflow: hidden; background: var(--sunken); }
.nl-chosen-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nl-chosen-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nl-chosen-main strong { color: var(--ink); font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nl-chosen-main .muted { font-size: 12px; }
.nl-chosen-btns { display: flex; gap: 2px; }
.nl-chosen-btns button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
.nl-chosen-btns button:hover:not(:disabled) { background: var(--sunken); color: var(--ink); }
.nl-chosen-btns button:disabled { opacity: .3; cursor: default; }
.nl-tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--sunken); color: var(--ink); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.nl-tag-lead { background: var(--accent-soft); color: var(--accent); }
.nl-tag-warn { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.nl-chosen-none { margin-top: 6px; font-size: 13px; }
.nl-add-post { margin-top: 8px; width: 100%; }
.art-dialog.nl-pick { width: min(820px, 94vw); height: fit-content; max-height: 90vh; }
.nl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.nl-card { display: flex; flex-direction: column; gap: 4px; padding: 0 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.nl-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.nl-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.nl-card:active { transform: scale(.98); }
.nl-card-img { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 2; margin-bottom: 4px; background: var(--sunken); color: var(--faint); font-size: 12px; }
.nl-card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nl-card-n { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgb(0 0 0 / .35); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 1px 4px rgb(0 0 0 / .3); }
.nl-card.is-on .nl-card-n { background: var(--accent); }
.nl-card-tags { display: flex; gap: 4px; min-height: 16px; padding: 0 10px; }
.nl-card strong { padding: 0 10px; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.nl-card .muted { padding: 0 10px; font-size: 12px; }
.nl-pick-body { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.nl-pick-body textarea { width: 100%; }
.nl-pick-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.nl-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.nl-redraft textarea { width: 100%; }
.nl-progress { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.nl-progress span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.nl-errors { font-size: 12.5px; color: var(--danger); }
.nl-errors ul { margin: 6px 0 0; padding-left: 18px; }
@media (max-width: 1000px) {
  .nl-editor { grid-template-columns: minmax(0, 1fr); }
  .nl-preview-col { position: static; }
  .nl-preview { height: 640px; }
  .nl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nl-stats div:nth-child(3) { border-left: 0; }
  .nl-stats div:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
.nl-schedule.is-scheduled { border-color: var(--accent); background: var(--accent-soft); }
.nl-schedule-row { display: flex; gap: 8px; }
.nl-schedule-row select { flex: 1; min-width: 0; }
.nl-schedule-alt { display: flex; flex-wrap: wrap; gap: 8px; }

/* ================= cover art chat (admin) ================= */
.art-dialog { width: min(1120px, 94vw); height: min(880px, 90vh); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); box-shadow: 0 30px 80px -30px rgb(0 0 0 / .5); }
.art-dialog[open] { display: flex; flex-direction: column; }
.art-dialog::backdrop { background: rgb(0 0 0 / .45); }
.art-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.art-head h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; }
.art-head p { font-size: 13px; margin-top: 2px; }
.art-close { width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.art-close:hover { background: var(--sunken); color: var(--ink); }
.art-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.art-empty { margin: auto; max-width: 420px; text-align: center; color: var(--muted); font-size: 14px; }
.art-msg { max-width: 100%; }
.art-msg > p { font-size: 14.5px; line-height: 1.5; }
.art-user { align-self: flex-end; max-width: 70%; padding: 10px 14px; border-radius: 14px 14px 4px 14px; background: var(--accent); color: #fff; }
.art-claude { align-self: flex-start; width: 100%; }
.art-claude > p { margin-bottom: 10px; }
.art-typing, .art-failed { width: auto; padding: 12px 14px; border-radius: 14px 14px 14px 4px; background: var(--surface); border: 1px solid var(--line); }
.art-failed { display: flex; align-items: center; gap: 12px; color: var(--danger); }
.art-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.art-option { margin: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.art-option img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; background: var(--sunken); }
.art-option figcaption { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 4px; font-size: 13px; }
.art-option figcaption span { color: var(--muted); line-height: 1.45; }
.art-option-actions { display: flex; gap: 6px; padding: 8px 12px 12px; }
.art-compose { border-top: 1px solid var(--line); padding: 12px 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.art-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.art-chips button { height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 500 12.5px var(--sans); cursor: pointer; }
.art-chips button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.art-input { display: flex; gap: 8px; align-items: flex-end; }
.art-input textarea { flex: 1; resize: none; }
.art-compose :disabled { opacity: .55; cursor: default; }

/* ================= readers & activity (admin) ================= */
.rd-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.rd-stats div { display: flex; flex-direction: column; }
.rd-stats strong { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.05; }
.rd-stats span { font-size: 12px; color: var(--muted); }
.rd-sources { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.rd-sources span { padding: 3px 9px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.rd-sources b { color: var(--ink); font-weight: 600; }
.rd-head { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; }
.rd-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.rd-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.rd-email { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.rd-tags { display: inline-flex; gap: 4px; }
.rd-tag { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.rd-tag.rd-done { background: var(--accent-soft); color: var(--accent); }
.nl-sub-row { cursor: pointer !important; }
.nl-activity { height: min(760px, 88vh); width: min(720px, 94vw); }
.nl-activity .rd-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 8px; }
.rd-timeline { list-style: none; margin: 0; padding: 0; }
.rd-timeline li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.rd-timeline time { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.rd-timeline div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.rd-timeline div .muted { flex-basis: 100%; font-size: 12.5px; }
