/* Sham Marbles — app styles.
   Apple-style grouped look: white cards on a soft grey page, the system font, and the logo brown (#6C2700)
   as the single accent, used for primary actions, links and the selected menu item.
   Corner radius rule: panels and cards 18px, inputs 10px, buttons, chips and segmented controls fully round
   (charts keep 4px bar ends). Big numbers use the rounded system font where available. */

:root {
  color-scheme: light;
  --page: #F2F2F7;
  --surface: #FFFFFF;
  --surface-2: #F2F2F7;
  --fill: rgba(118, 118, 128, .12);       /* buttons, search, segmented track */
  --fill-hover: rgba(118, 118, 128, .2);
  --seg-on: #FFFFFF;
  --ink: #1D1D1F;
  --ink-2: #3A3A3C;
  --ink-3: #6E6E73;            /* 5.1:1 on white, 4.5:1 on the page grey */
  --muted: #737378;            /* 4.7:1 on white */
  --line: #E5E5EA;
  --line-strong: #C7C7CC;
  --accent: #6C2700;           /* logo brown, 11.4:1 on white */
  --accent-hover: #551F00;
  --accent-ink: #FFFFFF;
  --accent-soft: #F5ECE6;
  --mark: #A4552E;             /* chart bars */
  --good-text: #1F7A36;        /* 5.4:1 on white */
  --st-open: #8E8E93;          /* Apple gray, orange, green, red; always shown with a text label */
  --st-follow: #FF9500;
  --st-closed: #34C759;
  --st-lost: #FF3B30;
  --slab-ink: #4A1E06;         /* text on the marble (sign-in screen) */
  --slab-ink-2: #6E4A36;
  --panel-wash: rgba(255, 255, 254, 0);
  --bar: rgba(249, 249, 251, .78);        /* frosted top and tab bars on phones */
  --scrim: rgba(0, 0, 0, .32);
  --shadow-seg: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .04);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .06);
  --r-panel: 18px;
  --r-ctl: 10px;
  --r-pill: 999px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", var(--font);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #000000;
    --surface: #1C1C1E;
    --surface-2: #2C2C2E;
    --fill: rgba(118, 118, 128, .24);
    --fill-hover: rgba(118, 118, 128, .34);
    --seg-on: #636366;
    --ink: #F5F5F7;
    --ink-2: #D1D1D6;
    --ink-3: #98989D;            /* 5.9:1 on cards */
    --muted: #8E8E93;            /* 5.2:1 on cards */
    --line: #38383A;
    --line-strong: #48484A;
    --accent: #D9956A;           /* 6.8:1 on cards */
    --accent-hover: #E6A882;
    --accent-ink: #2A1206;
    --accent-soft: #3A281C;
    --mark: #C8794C;
    --good-text: #30D158;
    --st-open: #8E8E93;
    --st-follow: #FF9F0A;
    --st-closed: #30D158;
    --st-lost: #FF453A;
    --slab-ink: #F2E4D6;
    --slab-ink-2: #C2AE9F;
    --panel-wash: rgba(20, 20, 19, .72);
    --bar: rgba(22, 22, 24, .78);
    --scrim: rgba(0, 0, 0, .58);
    --shadow-seg: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-pop: 0 24px 60px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.has-drawer { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
/* Icons: Phosphor (bold weight), drawn with fill */
svg.ic { width: 18px; height: 18px; flex: none; fill: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.sub { display: block; color: var(--ink-3); font-size: 13px; }
.none { color: var(--muted); }
.boot { min-height: 100dvh; display: grid; place-items: center; color: var(--ink-3); }

/* ---------- brand ---------- */
.brand { display: block; text-decoration: none; line-height: 0; }
.brand picture, .brand img { display: block; width: 100%; height: auto; }
.slab .brand { width: 148px; margin: 0 auto; }
.topbar .brand { width: 132px; margin-right: auto; }

/* ---------- shell ---------- */
.shell { min-height: 100dvh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.slab {
  position: sticky; top: 12px; height: calc(100dvh - 24px); margin: 12px 0 12px 12px;
  display: flex; flex-direction: column; gap: 28px;
  padding: 24px 12px 14px;
  background: var(--surface); border-radius: 22px;
  color: var(--ink);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-ctl);
  color: var(--ink); text-decoration: none; font-weight: 500;
  border: 0; background: none; cursor: pointer; text-align: left; width: 100%;
  position: relative;
}
.nav-link:hover { background: var(--fill); }
.nav-link.active, .nav-link.active:hover { color: var(--accent-ink); background: var(--accent); font-weight: 600; }
.nav-link .ic { color: var(--accent); }
.nav-link.active .ic { color: inherit; }
.nav-signout { margin-top: auto; }
.topbar, .tabbar { display: none; }

.main { padding: 36px 40px 64px; max-width: 1280px; width: 100%; outline: none; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title { font-weight: 700; font-size: 34px; line-height: 1.12; letter-spacing: -.01em; }
.page-sub { color: var(--ink-3); margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); text-decoration: none; font-weight: 500; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin: 34px 0 16px; }
.section-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: var(--fill); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--fill-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-danger-ghost { border-color: transparent; background: none; color: var(--st-lost); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--st-lost) 10%, transparent); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-block { width: 100%; height: 44px; }
.btn-more { display: flex; margin: 16px auto 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: var(--r-pill); border: 0; background: var(--fill);
  color: var(--ink-2); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { color: var(--ink); background: var(--fill-hover); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }
.link-btn.quiet { color: var(--ink-3); font-weight: 500; }
/* a small press-in so taps feel physical */
.btn, .icon-btn, .seg-btn, .choice span { transition: transform .12s ease-out, background-color .12s, border-color .12s; }
.btn:active, .icon-btn:active, .seg-btn:active { transform: scale(.97); }

/* ---------- filters ---------- */
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; }
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-pill); background: var(--fill); border: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 30px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: none;
  color: var(--ink); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.seg-btn:hover { background: var(--fill); }
.seg-btn.on, .seg-btn.on:hover { background: var(--seg-on); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-seg); }
.seg-n { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .7; }
.search { position: relative; flex: 1 1 240px; max-width: 360px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }
.input, .select {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--r-ctl);
  background: var(--fill); color: var(--ink);
}
.select { width: auto; padding-right: 32px; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.input[aria-invalid="true"] { border-color: var(--st-lost); }
.input::placeholder, .inline-input::placeholder { color: var(--muted); opacity: 1; }
/* boxes typed straight into list rows: dashed until touched, so they read as "fill me in" */
.inline-input {
  width: 100%; max-width: 150px; height: 34px; padding: 0 10px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums;
}
.inline-input:hover { border-style: solid; }
.inline-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border: 1px solid var(--accent); }
.inline-input[aria-invalid="true"] { border: 1px solid var(--st-lost); }
.inline-input[disabled] { opacity: .6; }
.inline-saved { font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- finish setting up ---------- */
.setup { margin-bottom: 20px; }
.setup .panel-head { margin-bottom: 4px; }
.setup-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; }
.setup-list li { display: grid; grid-template-columns: 5ch minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 0; }
.setup-list li + li { border-top: 1px solid var(--line); }
.setup-num { font-family: var(--font-num); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.setup-what { color: var(--ink-2); }

/* ---------- panels & grid ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-12 { grid-column: 1 / -1; }
.panel { background: var(--surface); border: 0; border-radius: var(--r-panel); padding: 20px 22px 22px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.panel-note { color: var(--ink-3); font-size: 13px; }
.panel-foot-note { color: var(--ink-3); font-size: 13px; margin-top: 14px; }

/* ---------- today ---------- */
.hero { display: flex; align-items: baseline; gap: 12px; margin: 2px 0 14px; flex-wrap: wrap; }
.hero-num { font-family: var(--font-num); font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.hero-label { color: var(--ink-2); font-size: 16px; }
.due-list { list-style: none; margin: 0; padding: 0; }
.due-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 10px 10px; margin: 0 -10px; border-radius: var(--r-ctl); cursor: pointer;
}
.due-row + .due-row { box-shadow: 0 -1px 0 var(--line); }
.due-row:hover { background: var(--surface-2); }
.due-name { display: block; font-weight: 600; }
.due-detail { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 13px; flex-wrap: wrap; }
.due-when { font-size: 13px; color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.due-when.is-late::before, .late-dot { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--st-lost); }
.row-actions { display: inline-flex; gap: 8px; }
.empty { padding: 6px 0 4px; display: grid; gap: 10px; justify-items: start; color: var(--ink-2); max-width: 52ch; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.empty-block { background: var(--surface); border: 0; border-radius: var(--r-panel); padding: 36px 24px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.empty-block p { color: var(--ink-3); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; margin-bottom: 20px; }
.kpi { display: grid; gap: 4px; align-content: start; padding: 20px 22px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi-label { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.kpi-value { font-family: var(--font-num); font-size: 30px; font-weight: 700; letter-spacing: -.015em; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-sub { color: var(--ink-3); font-size: 13px; }
.kpi-sub.up { color: var(--good-text); }

/* ---------- tags & pills ---------- */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-pill); background: var(--fill); border: 0; color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 7px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; white-space: nowrap; color: color-mix(in srgb, var(--st) 35%, var(--ink)); background: color-mix(in srgb, var(--st) 15%, var(--surface)); }
.pill .ic { width: 14px; height: 14px; color: var(--st); }
.pill[data-s="Open"] { --st: var(--st-open); }
.pill[data-s="Follow-up"] { --st: var(--st-follow); }
.pill[data-s="Closed"], .pill[data-s="Received"] { --st: var(--st-closed); }
.pill[data-s="Lost"] { --st: var(--st-lost); }
.pill[data-s="Pending"] { --st: var(--st-follow); }
.pill[data-s="Follow-up"] .ic, .pill[data-s="Pending"] .ic { color: color-mix(in srgb, var(--st-follow) 70%, var(--ink)); }

/* ---------- charts ---------- */
.colchart { --plot-h: 190px; }
.colchart-plot { position: relative; height: var(--plot-h); margin-left: 34px; }
.gridline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.gridline.base { border-top-color: var(--line-strong); }
.gridline span { position: absolute; right: calc(100% + 8px); top: -9px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.colchart-bars { position: absolute; inset: 0; display: flex; gap: 2px; }
.col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; border-radius: 4px; }
.col:hover, .col:focus-visible { background: color-mix(in srgb, var(--mark) 7%, transparent); }
.col-bar { width: min(24px, 72%); background: var(--mark); border-radius: 4px 4px 0 0; }
.colchart-x { display: flex; gap: 2px; margin: 8px 0 0 34px; }
.colchart-x span { flex: 1 1 0; text-align: center; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: visible; min-width: 0; }

.rbars { display: grid; gap: 10px; }
.rbar { display: grid; grid-template-columns: minmax(84px, 128px) minmax(0, 1fr); align-items: center; gap: 12px; border-radius: var(--r-ctl); padding: 2px 0; }
.rbar[data-action] { cursor: pointer; }
.rbar[data-action]:hover .rbar-label { color: var(--ink); text-decoration: underline; }
.rbar-label { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rbar-fill { height: 14px; background: var(--mark); border-radius: 0 4px 4px 0; min-width: 2px; }
.rbar-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.rbars.has-extra .rbar { grid-template-columns: minmax(84px, 128px) minmax(0, 1fr) auto; }
.rbar-extra { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; min-width: 74px; }

.segbar { display: flex; gap: 2px; height: 8px; border-radius: var(--r-pill); overflow: hidden; margin: 4px 0 16px; }
.seg-part { min-width: 3px; }
.status-rows { display: grid; }
.status-row {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 48px; align-items: center; gap: 10px;
  padding: 9px 8px; margin: 0 -8px; border: 0; background: none; border-radius: var(--r-ctl);
  text-align: left; cursor: pointer; color: var(--ink);
}
.status-row + .status-row { box-shadow: 0 -1px 0 var(--line); }
.status-row:hover { background: var(--surface-2); }
.status-row .ic { color: var(--st); }
.status-row[data-status="Follow-up"] .ic { color: color-mix(in srgb, var(--st-follow) 70%, var(--ink)); }
.sr-name { font-weight: 500; }
.sr-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.sr-share { color: var(--ink-3); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }

details.tv { margin-top: 14px; }
details.tv summary { cursor: pointer; color: var(--ink-3); font-size: 13px; width: max-content; }
details.tv summary:hover { color: var(--ink); }
details.tv .mini { margin-top: 10px; }

#tip {
  position: fixed; z-index: 60; pointer-events: none;
  display: grid; gap: 1px; padding: 8px 11px; border-radius: var(--r-ctl);
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-pop);
  font-size: 12.5px; transform: translate(-50%, calc(-100% - 10px)); max-width: 240px;
}
#tip[hidden] { display: none; }
#tip strong { font-size: 14px; font-weight: 600; }
#tip span { opacity: .78; }

/* ---------- small tables ---------- */
.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 13px; padding: 0 8px 8px; border-bottom: 1px solid var(--line); }
.mini td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.mini th:first-child, .mini td:first-child { padding-left: 0; }
.mini th:last-child, .mini td:last-child { padding-right: 0; }
.mini tfoot td { border-bottom: 0; font-weight: 600; }
.mini tr.click { cursor: pointer; }
.mini tr.click:hover td { background: var(--surface-2); }
.mini .name-link { font-weight: 600; text-decoration: none; }
.mini .name-link:hover { text-decoration: underline; }

/* ---------- lists (customers, visits, payments) ---------- */
.list { background: var(--surface); border: 0; border-radius: var(--r-panel); overflow: hidden; }
.list-head, .row { display: grid; align-items: center; gap: 16px; padding: 12px 18px; }
.list-head { color: var(--ink-3); font-size: 13px; font-weight: 500; padding-top: 11px; padding-bottom: 11px; border-bottom: 1px solid var(--line); background: transparent; }
.row + .row { border-top: 1px solid var(--line); }
.row[data-action] { cursor: pointer; }
.row[data-action]:hover { background: var(--surface-2); }
.row strong { font-weight: 600; }
.list-count { color: var(--ink-3); font-size: 13px; text-align: center; margin-top: 12px; }

.list-cust .list-head, .list-cust .row { grid-template-columns: 76px minmax(150px, 1.4fr) minmax(140px, 1.3fr) minmax(100px, 1fr) minmax(90px, .8fr) 140px 100px 92px; }
.list-cust .c-meta { display: contents; }
.list-cust .c-date { order: -1; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.c-name { min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.c-note { font-style: italic; }
.c-mat { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; }
.c-mat .sub { width: 100%; }
.c-arch, .c-att, .c-follow { font-size: 14px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.c-follow { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.c-act { justify-content: flex-end; }

.list-pay .list-head, .list-pay .row { grid-template-columns: minmax(180px, 2fr) minmax(110px, 1fr) minmax(120px, 1fr) 110px 120px; }
.p-amt { font-variant-numeric: tabular-nums; }
.p-act { display: flex; justify-content: flex-end; }
.p-follow { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); white-space: nowrap; }

.day + .day { margin-top: 22px; }
.day-head { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 0 0 8px 2px; }
.list-vis .row { grid-template-columns: minmax(160px, 1.2fr) 150px minmax(0, 2fr); }
.name-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.name-link:hover { text-decoration: underline; }

/* ---------- architects ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.acard {
  display: grid; gap: 8px; align-content: start; padding: 18px 18px 16px;
  background: var(--surface); border: 0; border-radius: var(--r-panel);
  text-decoration: none; color: var(--ink); transition: box-shadow .15s;
}
.acard:hover { box-shadow: var(--shadow-seg); }
.acard-name { font-size: 16px; font-weight: 600; line-height: 1.3; }
.acard-likes { color: var(--ink-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.acard-likes.none { color: var(--muted); }
.acard-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-3); padding-top: 8px; border-top: 1px solid var(--line); }
.acard-stats b { color: var(--ink); font-weight: 600; }
.stat-inline { display: grid; gap: 2px; margin-bottom: 14px; }
.stat-big { font-family: var(--font-num); font-size: 30px; font-weight: 700; letter-spacing: -.015em; }
.stat-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 24px; }
.stat-pair .stat-inline { margin-bottom: 0; align-content: start; }
.age-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.age-strip > div { display: grid; gap: 2px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-ctl); min-width: 0; }
.age-num { font-family: var(--font-num); font-size: 24px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.age-label { font-size: 13px; color: var(--ink-3); }
.sub-head { font-size: 13px; font-weight: 600; color: var(--ink-3); margin: 0 0 2px; }
.simple-list a.li-main { color: inherit; text-decoration: none; }
.simple-list a.li-main:hover { text-decoration: underline; }
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 8px; margin: 0 -8px; border-radius: var(--r-ctl); align-items: center; }
.simple-list li + li { box-shadow: 0 -1px 0 var(--line); }
.simple-list li[data-action] { cursor: pointer; }
.simple-list li[data-action]:hover { background: var(--surface-2); }
.simple-list .li-main { font-weight: 500; min-width: 0; }
.simple-list .li-side { color: var(--ink-2); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.profile { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px 28px; margin: 0; }
.profile dt { color: var(--ink-3); font-size: 13px; margin-bottom: 3px; }
.profile dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- drawer (forms) ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; animation: fade .16s ease-out; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(480px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--shadow-pop); border-radius: 18px 0 0 18px;
  animation: slide-in .2s cubic-bezier(.2, .8, .2, 1);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 28px; display: grid; gap: 18px; align-content: start; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.spacer { flex: 1; }
.field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.f-label { font-size: 14px; font-weight: 600; color: var(--ink-2); padding: 0; }
.req { font-weight: 500; font-size: 12.5px; color: var(--ink-3); margin-left: 6px; }
.f-hint { font-size: 12.5px; color: var(--ink-3); }
.f-error { font-size: 13px; font-weight: 500; color: var(--st-lost); }
.f-note { font-size: 13px; color: var(--ink-2); background: var(--accent-soft); border-radius: var(--r-ctl); padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: var(--fill); color: var(--ink);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.choice input:hover + span { background: var(--fill-hover); }
.choice input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice input:active + span { transform: scale(.97); }
details.more { border-top: 1px solid var(--line); padding-top: 14px; }
details.more > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); width: max-content; list-style-position: outside; }
details.more[open] > summary { margin-bottom: 18px; }
.more-body { display: grid; gap: 18px; }
.form-error { background: color-mix(in srgb, var(--st-lost) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--st-lost) 35%, transparent); color: var(--ink); padding: 10px 12px; border-radius: var(--r-ctl); font-size: 14px; }
.form-error[hidden], .f-error[hidden], .f-note[hidden] { display: none; }

#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 70; transform: translate(-50%, 16px);
  background: var(--ink); color: var(--surface); padding: 11px 20px; border-radius: var(--r-pill);
  font-weight: 500; font-size: 14px; box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.has-action { display: flex; align-items: center; gap: 16px; padding-right: 8px; }
#toast.has-action.show { pointer-events: auto; }
.toast-undo { border: 0; background: color-mix(in srgb, var(--surface) 16%, transparent); color: var(--surface); font: inherit; font-weight: 700; padding: 0 14px; min-height: 36px; border-radius: var(--r-pill); cursor: pointer; }
.toast-undo:hover { background: color-mix(in srgb, var(--surface) 26%, transparent); }

@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(48px); opacity: 0; } }

/* ---------- login & notices ---------- */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); }
.login-slab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 48px;
  background: linear-gradient(var(--panel-wash), var(--panel-wash)), url("assets/marble-panel.jpg") center / cover;
  color: var(--slab-ink); text-align: center;
}
.login-slab .brand { width: min(440px, 78%); }
.login-tag { color: var(--slab-ink-2); max-width: 34ch; font-size: 16px; }
.login-side { display: grid; place-items: center; padding: 32px 24px; background: var(--surface); }
.login-form { width: min(360px, 100%); display: grid; gap: 16px; }
.login-form h1 { font-weight: 700; font-size: 30px; letter-spacing: -.01em; }
.login-form .page-sub { margin-top: -10px; }
.login-alt { justify-self: center; margin-top: 2px; }
/* password boxes: an eye button inside the right edge shows or hides what is typed */
.pw { position: relative; }
.pw .input { padding-right: 48px; }
.pw .input::-ms-reveal { display: none; } /* Edge's own eye would double up */
.pw-toggle {
  position: absolute; top: 0; right: 0; bottom: 0; width: 44px;
  display: grid; place-items: center; border: 0; background: none; padding: 0;
  color: var(--ink-3); border-radius: var(--r-ctl); cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); }
.pw-toggle .ic { width: 20px; height: 20px; }
.notice { max-width: 560px; margin: 12vh auto; padding: 32px; background: var(--surface); border: 0; border-radius: var(--r-panel); display: grid; gap: 12px; }
.notice h1 { font-weight: 700; font-size: 26px; letter-spacing: -.01em; }
.notice p { color: var(--ink-2); }
.notice code { background: var(--surface-2); padding: 1px 6px; border-radius: var(--r-ctl); font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .span-4, .span-5, .span-6, .span-7 { grid-column: 1 / -1; }
  .main { padding: 30px 28px 56px; }
  .list-cust .list-head, .list-cust .row { grid-template-columns: 70px minmax(140px, 1.4fr) minmax(120px, 1.2fr) minmax(90px, 1fr) 140px 100px 92px; }
  .list-cust .c-att, .list-cust .list-head .h-att { display: none; }
}

/* Phones: thumb-sized targets (44px, 8-10px apart), frosted top and tab bars, the add button top-right, forms as sheets, wrapping chips */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .slab { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 20;
    padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
    background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line); color: var(--ink);
  }
  .topbar .icon-btn { color: var(--ink); }
  .topbar .top-add { background: var(--accent); color: var(--accent-ink); }
  .topbar .top-add .ic { width: 22px; height: 22px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
  }
  .tab { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 500; border-radius: var(--r-ctl); }
  .tab .ic { width: 24px; height: 24px; }
  .tab.active { color: var(--accent); }
  .head-actions .btn-primary { display: none; }
  .main { padding: 16px 16px calc(100px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .page-title { font-size: 32px; }
  .panel { padding: 16px; }
  .grid { gap: 14px; margin-bottom: 14px; }
  .section-head { margin-top: 26px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 16px; }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .kpi-value { font-size: 26px; }
  .hero-num { font-size: 48px; }
  .search { max-width: none; flex-basis: 100%; }
  .input, .select { height: 44px; }
  .btn, .btn-sm { height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .row-actions { gap: 10px; }
  /* chip groups wrap as separate chips instead of scrolling sideways */
  .seg { background: none; border: 0; padding: 0; gap: 8px; flex-wrap: wrap; overflow: visible; }
  .seg-btn { height: 44px; padding: 0 16px; background: var(--fill); }
  .seg-btn.on, .seg-btn.on:hover { background: var(--ink); color: var(--surface); box-shadow: none; }
  .choice span { height: 44px; padding: 0 14px; }
  .inline-input { height: 44px; max-width: 180px; }
  .toast-undo { min-height: 44px; }
  .setup-list li { grid-template-columns: 5ch minmax(0, 1fr); }
  .setup-list .btn { grid-column: 2; justify-self: start; }
  .choices { gap: 8px; }
  #toast { bottom: calc(96px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; }

  .list-head { display: none; }
  .row { padding: 14px 16px; gap: 6px 12px; }
  .list-cust .row { grid-template-columns: minmax(0, 1fr) auto; }
  .list-cust .c-name { grid-area: 1 / 1; }
  .list-cust .c-status { grid-area: 1 / 2; justify-self: end; }
  .list-cust .c-mat { grid-area: 2 / 1 / 3 / 3; }
  .list-cust .c-meta { grid-area: 3 / 1; display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: center; }
  .list-cust .c-act { grid-area: 3 / 2; }
  .list-cust .c-meta > span { font-size: 13px; color: var(--ink-3); }
  .list-cust .c-meta > span:empty { display: none; }
  .list-cust .c-arch::before { content: "Architect "; color: var(--muted); }
  .list-cust .c-att { display: inline; }
  .list-cust .c-att::before { content: "By "; color: var(--muted); }
  .list-cust .c-follow::before { content: "Follow up "; color: var(--muted); }

  .list-pay .row { grid-template-columns: minmax(0, 1fr) auto; }
  .list-pay .p-name { grid-area: 1 / 1; }
  .list-pay .p-status { grid-area: 1 / 2; justify-self: end; }
  .list-pay .p-amt { grid-area: 2 / 1; font-size: 14px; }
  .list-pay .p-follow { grid-area: 3 / 1; font-size: 13px; }
  .list-pay .p-act { grid-area: 2 / 2 / 4 / 3; align-self: end; }

  .list-vis .row { grid-template-columns: minmax(0, 1fr) auto; }
  .list-vis .v-notes { grid-column: 1 / -1; }
  .list-vis .v-notes:empty { display: none; }

  /* forms slide up as a sheet, leaving a sliver of the page visible above */
  .drawer { top: calc(10px + env(safe-area-inset-top)); width: 100vw; border-radius: 14px 14px 0 0; animation: sheet-up .28s cubic-bezier(.2, .8, .2, 1); }
  .drawer-head { padding-top: 16px; }
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-slab { padding: 40px 22px 32px; gap: 18px; }
  .login-slab .brand { width: min(280px, 76%); }
}

/* ---------- loading placeholder (grey shapes shaped like the dashboard) ---------- */
.sk { display: block; background: var(--fill); border-radius: var(--r-ctl); position: relative; overflow: hidden; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: sk-sweep 1.4s ease-in-out infinite; }
@keyframes sk-sweep { to { transform: translateX(100%); } }
.sk-title { width: 260px; max-width: 70%; height: 34px; margin-bottom: 26px; }
.sk-line { height: 14px; margin-top: 12px; }
.sk-big { width: 90px; height: 48px; margin: 6px 0 10px; }
.sk-kpi { height: 92px; border-radius: var(--r-panel); margin-bottom: 20px; }

/* Reduce Transparency: solid bars instead of frosted ones */
@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
}
/* Increase Contrast: darker secondary text and separators */
@media (prefers-contrast: more) {
  :root { --ink-3: #48484A; --muted: #545458; --line: #C7C7CC; --line-strong: #8E8E93; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root { --ink-3: #C7C7CC; --muted: #AEAEB2; --line: #545458; --line-strong: #8E8E93; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
