/* Real Estate CRM: design system.
   Layers: tokens -> base -> layout (sidebar, top bar) -> components -> pages. The scripts generate markup using the class names
   below (card, row, btn, pill, tpl, grid, stat, tbl, tip, msg ...), so restyling happens here without touching them. */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* surfaces and text */
  --bg: #f4f6fa;  --card: #ffffff;  --ink: #0f172a;  --ink-2: #334155;  --muted: #64748b;
  --line: #e5e9f1;  --line-strong: #d3dae6;  --hover: #f1f4f9;

  /* brand */
  --accent: #0f766e;  --accent-hover: #0b5f58;  --accent-soft: rgba(15, 118, 110, .09);  --accent-ink: #ffffff;
  --brand-1: #14b8a6;  --brand-2: #0e7490;

  /* meaning */
  --good: #15803d;  --good-soft: rgba(22, 163, 74, .12);
  --warm: #b45309;  --warm-soft: rgba(217, 119, 6, .13);
  --danger: #dc2626;  --danger-soft: rgba(220, 38, 38, .09);
  --info: #1d4ed8;  --info-soft: rgba(37, 99, 235, .10);
  --hot: var(--danger);  --cold: var(--muted);

  /* sidebar (dark in both themes) */
  --side: #0b1324;  --side-ink: #c7d2e2;  --side-muted: #71819c;  --side-line: rgba(255, 255, 255, .08);
  --side-hover: rgba(255, 255, 255, .06);  --side-active: rgba(45, 212, 191, .13);  --side-bar: #2dd4bf;

  --radius: 14px;  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --ring: 0 0 0 3px rgba(15, 118, 110, .25);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a1120;  --card: #111b2e;  --ink: #e8eef8;  --ink-2: #c3cee0;  --muted: #8b9bb4;
  --line: #1c2a42;  --line-strong: #2a3b58;  --hover: #16233a;
  --accent: #2dd4bf;  --accent-hover: #5eead4;  --accent-soft: rgba(45, 212, 191, .12);  --accent-ink: #04201d;
  --good: #4ade80;  --good-soft: rgba(74, 222, 128, .13);  --warm: #fbbf24;  --warm-soft: rgba(251, 191, 36, .14);
  --danger: #f87171;  --danger-soft: rgba(248, 113, 113, .13);  --info: #7ab0ff;  --info-soft: rgba(96, 165, 250, .14);
  --side: #070d1a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --ring: 0 0 0 3px rgba(45, 212, 191, .3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1120;  --card: #111b2e;  --ink: #e8eef8;  --ink-2: #c3cee0;  --muted: #8b9bb4;
    --line: #1c2a42;  --line-strong: #2a3b58;  --hover: #16233a;
    --accent: #2dd4bf;  --accent-hover: #5eead4;  --accent-soft: rgba(45, 212, 191, .12);  --accent-ink: #04201d;
    --good: #4ade80;  --good-soft: rgba(74, 222, 128, .13);  --warm: #fbbf24;  --warm-soft: rgba(251, 191, 36, .14);
    --danger: #f87171;  --danger-soft: rgba(248, 113, 113, .13);  --info: #7ab0ff;  --info-soft: rgba(96, 165, 250, .14);
    --side: #070d1a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --ring: 0 0 0 3px rgba(45, 212, 191, .3);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.012em; color: var(--ink); }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 15.5px; font-weight: 650; margin-bottom: 8px; }
h4 { font-size: 14px; font-weight: 650; margin: 16px 0 8px; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-underline-offset: 3px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code { font: 12.5px var(--mono); background: var(--hover); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
pre { font: 13px/1.6 var(--mono); background: var(--hover); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; overflow: auto; margin: 8px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.hide { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.2em; }
.ok { color: var(--good); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 300; box-shadow: var(--shadow); }
.skip:focus { left: 12px; }

/* ---------- forms ---------- */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0 12px; height: 38px; min-width: 0; max-width: 100%; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
select[multiple] { height: auto; padding: 6px; background-image: none; }
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:not([type=checkbox]):not([type=radio]):hover, select:hover, textarea:hover { border-color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--hover); color: var(--muted); cursor: not-allowed; }
input[readonly] { background: var(--hover); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0 4px 0 0; vertical-align: -3px; cursor: pointer; }
input[type=file] { font: inherit; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 550; color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); height: 34px; padding: 0 12px; margin-right: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--hover); }
input[type=date], input[type=datetime-local], input[type=number] { font-variant-numeric: tabular-nums; }
label { cursor: pointer; }
label.muted { font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.row > * { flex: 1; min-width: 140px; }
.row > .btn, .row > button, .row > label, .row > span, .row > .pill { flex: 0 0 auto; min-width: 0; }
.row > input[type=checkbox], .row > input[type=radio] { flex: 0 0 auto; min-width: 16px; }

/* ---------- buttons ---------- */
.btn, button.link { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: var(--radius-sm); font-weight: 560; white-space: nowrap;
  color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, box-shadow .12s, transform .06s;
}
a.btn { text-decoration: none; }
.btn:hover { background: var(--hover); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(15, 118, 110, .35), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line-strong)); background: var(--card); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
td .btn, .tpl .btn, .tbl .btn { height: 30px; padding: 0 11px; font-size: 13px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 550; text-align: left; text-decoration: none; }
button.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- cards, grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card:has(> .tbl:only-child) { padding: 0; overflow: hidden; }
.card > h3:first-child { font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card.err { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two > .card { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 26px; line-height: 1.15; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; text-transform: capitalize; }
.tpl { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; background: var(--card); }
.tpl:hover { border-color: var(--line-strong); }
.tpl pre { font-family: var(--font); font-size: 13.5px; background: var(--bg); white-space: pre-wrap; }
.tip { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 11px 14px; margin: 14px 0; color: var(--ink-2); }
.tip b { color: var(--ink); }
.guide { max-width: 820px; }
.guide h2 { font-size: 22px; margin: 6px 0 10px; }
.guide h3 { font-size: 16.5px; margin: 26px 0 8px; padding-top: 4px; }
.guide ul, .guide ol { padding-left: 22px; margin: 6px 0 12px; }
.guide li { margin: 6px 0; color: var(--ink-2); }
.guide p { color: var(--ink-2); }

/* ---------- tables ---------- */
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; background: var(--bg); color: var(--muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
tr:last-child > td { border-bottom: 0; }
tr:hover > td { background: var(--hover); }
tr[data-lead], tr[data-b] { cursor: pointer; }
td .muted { font-size: 12.5px; }
td .btn + .btn, td .btn + button { margin-left: 4px; }

/* ---------- badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; background: var(--hover); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill[data-tone="good"], .pill.ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill[data-tone="warn"] { background: var(--warm-soft); color: var(--warm); border-color: transparent; }
.pill[data-tone="bad"], .pill.err { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill[data-tone="info"] { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill[data-tone]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.t-hot { color: var(--hot); font-weight: 650; }  .t-warm { color: var(--warm); font-weight: 650; }  .t-cold { color: var(--cold); font-weight: 550; }

/* ---------- conversation ---------- */
.msg { padding: 9px 14px; border-radius: 16px 16px 16px 4px; margin: 6px 0; max-width: 78%; background: var(--hover); border: 1px solid var(--line); }
.msg.out { margin-left: auto; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); border-radius: 16px 16px 4px 16px; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 16px 12px 12px; overflow-y: auto; z-index: 60; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 14px; }
.logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); box-shadow: 0 6px 16px rgba(20, 184, 166, .35), inset 0 1px 0 rgba(255, 255, 255, .25); }
.logo svg { width: 22px; height: 22px; }
.brand-text { min-width: 0; line-height: 1.25; }
.brand-text b { display: block; color: #fff; font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.brand-text span { display: block; color: var(--side-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#brand { color: #e2e8f0; }
.side nav { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; }
.nav-group { font-size: 11px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--side-muted); padding: 12px 10px 4px; }
.side nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 11px; border: 0; background: none; border-radius: 10px; color: var(--side-ink); font: inherit; font-weight: 520; text-align: left; cursor: pointer; position: relative; transition: background .12s, color .12s; }
.side nav button:hover { background: var(--side-hover); color: #fff; }
.side nav button.on { background: var(--side-active); color: #fff; }
.side nav button.on::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-bar); }
.side nav button.on .ico { color: var(--side-bar); }
.side-foot { margin-top: auto; position: sticky; bottom: -12px; background: var(--side); padding: 12px 0 12px;  border-top: 1px solid var(--side-line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 650; color: #fff; flex: none; background: linear-gradient(135deg, #475569, #334155); border: 1px solid var(--side-line); }
.who { min-width: 0; flex: 1; line-height: 1.25; }
.who b { display: block; color: #e2e8f0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { color: var(--side-muted); font-size: 12px; text-transform: capitalize; }
.side .icon-btn { color: var(--side-muted); }
.side .icon-btn:hover { background: var(--side-hover); color: #fff; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; padding: 14px 32px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.top .titles { min-width: 0; flex: 1; }
.top h1 { font-size: 21px; font-weight: 680; letter-spacing: -.02em; line-height: 1.25; }
.top p { margin: 1px 0 0; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }
#menu { display: none; }
#view { padding: 26px 32px 64px; width: 100%; max-width: 1280px; margin: 0 auto; animation: enter .18s ease-out; }
#banner { margin: 16px 32px 0; padding: 11px 16px; border-radius: 12px; background: var(--info-soft); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent); color: var(--ink-2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#banner.warn { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.scrim { display: none; }

/* ---------- feedback: progress, toasts, skeletons ---------- */
#progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 400; opacity: 0; pointer-events: none; transition: opacity .2s; overflow: hidden; }
#progress.on { opacity: 1; }
#progress::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: slide 1s ease-in-out infinite; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 500; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; background: #0f172a; color: #f1f5f9; box-shadow: var(--shadow-lg); font-size: 14px; animation: enter .2s ease-out; border-left: 4px solid var(--brand-1); }
.toast.bad { border-left-color: #f87171; }
.toast .ico { margin-top: 2px; color: var(--brand-1); }
.toast.bad .ico { color: #f87171; }
.skel { background: linear-gradient(90deg, var(--line) 25%, var(--hover) 50%, var(--line) 75%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------- voice ---------- */
.voice { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.voice .v-said { flex: 1; min-width: 220px; }
.voice .btn.rec { background: var(--danger); border-color: var(--danger); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.v-help { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin: 8px 0; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); font-size: 13.5px; }
.v-help > span { flex: 1; min-width: 220px; }
.v-help .btn { height: 32px; font-size: 13px; }
.icon-btn.dictate { width: 34px; height: 34px; border: 1px solid var(--line-strong); margin-left: 6px; vertical-align: middle; }
.icon-btn.dictate.rec { background: var(--danger); border-color: var(--danger); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; margin-right: 6px; animation: spin .7s linear infinite; }
.btn.primary .spin { border-color: var(--accent-ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.voice .btn.working { opacity: .85; }
.v-status { min-height: 1.3em; margin: 4px 0 12px; font-size: 13px; }
.voiced { animation: voiced 2.5s ease-out; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 25%, transparent); } }
@keyframes voiced { 0%, 60% { background: var(--accent-soft); border-color: var(--accent); } }

/* ---------- pipeline board ---------- */
.pipe-bar { padding: 14px 16px; }
.pipe-bar .row { margin-bottom: 4px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 14px; scroll-snap-type: x proximity; align-items: start; }
.col { background: color-mix(in srgb, var(--tone) 6%, var(--hover)); border: 1px solid var(--line); border-top: 3px solid var(--tone); border-radius: var(--radius); padding: 10px 10px 12px; min-height: 220px; scroll-snap-align: start; transition: background .12s, border-color .12s; }
.col.over { background: color-mix(in srgb, var(--tone) 16%, var(--card)); border-color: var(--tone); }
.col > header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.col > header b { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.col .count { background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 650; padding: 0 9px; }
.col-sum { font-size: 12px; padding: 0 4px 8px; }
.cards { display: grid; gap: 9px; }
.empty { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 18px 8px; text-align: center; font-size: 13px; }
.lead-card { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; box-shadow: var(--shadow-sm); cursor: grab; }
.lead-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.lead-card.drag { opacity: .45; }
.lead-card .ctop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lead-card .open { font-weight: 620; color: var(--ink); text-align: left; }
.lead-card .open:hover { color: var(--accent); }
.lead-card .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--cold); }
.lead-card .dot.t-hot { background: var(--hot); } .lead-card .dot.t-warm { background: var(--warm); }
.lead-card .wants { color: var(--ink-2); font-size: 13px; margin: 4px 0 6px; }
.lead-card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.lead-card .av { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.lead-card .age { margin-left: auto; }
.lead-card .move { width: 100%; margin-top: 8px; height: 30px; font-size: 12.5px; color: var(--muted); }
body.readonly .lead-card { cursor: default; }
:root[data-theme="dark"] button.u { color: #04201d; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); display: grid; place-items: center; z-index: 450; padding: 16px; animation: enter .15s ease-out; overflow-y: auto; }
.modal { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 22px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border: 1px solid var(--line); }
.modal h3 { font-size: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- inventory ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 16px 0 14px; }
.kpis.slim { margin: 0 0 18px; }
.kpi { --c: var(--ink); text-align: left; border: 1px solid var(--line); border-left: 4px solid var(--c); background: var(--card); border-radius: 12px; padding: 12px 16px; font: inherit; color: inherit; box-shadow: var(--shadow-sm); }
button.kpi { cursor: pointer; transition: transform .1s, box-shadow .12s, border-color .12s; }
button.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
button.kpi.on { background: color-mix(in srgb, var(--c) 9%, var(--card)); border-color: var(--c); }
.kpi b { display: block; font-size: 26px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.k-total { --c: var(--ink-2); } .k-available { --c: var(--good); } .k-hold { --c: var(--warm); } .k-booked { --c: var(--info); } .k-sold { --c: var(--muted); }
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px 0; margin-bottom: 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); }
.hero-top { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.hero-title { flex: 1; min-width: 220px; }
.hero-title h2 { font-size: 26px; font-weight: 700; letter-spacing: -.025em; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 11px; border-radius: 999px; background: var(--hover); border: 1px solid var(--line); color: var(--ink-2); }
.tag .ico { width: 14px; height: 14px; } .tag.good { background: var(--good-soft); color: var(--good); border-color: transparent; } .tag.warn { background: var(--warm-soft); color: var(--warm); border-color: transparent; }
.stack.tall { height: 14px; border-radius: 8px; margin: 4px 0 10px; }
.value-line { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13.5px; padding-bottom: 6px; }
.value-line b { font-size: 15px; }
.tabs { display: flex; gap: 4px; margin: 10px -6px 0; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 16px; font: inherit; font-weight: 560; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.proj { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s, box-shadow .15s; }
.proj:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.proj .band { height: 6px; background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); }
.proj .body { padding: 18px 20px 16px; }
.proj .head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.proj h3 { font-size: 18px; margin: 0 0 2px; } .proj .head p { margin: 0; }
.proj .mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 10px; }
.proj .mini b { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; } .proj .mini span { font-size: 12px; color: var(--muted); }
.proj .nounits { margin: 14px 0; padding: 14px; border: 1px dashed var(--line-strong); border-radius: 10px; text-align: center; color: var(--muted); font-size: 13px; }
.proj .foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; font-size: 12.5px; }
.stack { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line); margin: 8px 0; }
.stack i, .legend i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.s-available { background: var(--good); } .s-hold { background: var(--warm); } .s-booked { background: var(--info); } .s-sold { background: var(--muted); }
.s-available-pill { background: var(--good-soft); color: var(--good); } .s-hold-pill { background: var(--warm-soft); color: var(--warm); } .s-booked-pill { background: var(--info-soft); color: var(--info); } .s-sold-pill { background: var(--hover); color: var(--muted); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar select, .toolbar input { flex: 0 1 190px; } .toolbar .legend { margin-left: auto; }
.towers { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 22px 34px; align-items: start; }
.tower { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 12px; }
.tower .plan { justify-items: start; }
.tower-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tower-head h4 { margin: 0; font-size: 16px; } .tower-head .muted { font-size: 12.5px; }
.plan { display: grid; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.floor { display: flex; align-items: center; gap: 10px; }
.floor .fl { width: 30px; text-align: right; color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }
.cells { display: flex; gap: 6px; }
button.u { min-width: 58px; height: 36px; border: 1px solid transparent; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; color: #fff; padding: 0 10px; transition: transform .08s, opacity .12s, box-shadow .12s; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14); }
button.u:hover { transform: translateY(-2px); box-shadow: var(--shadow), inset 0 -2px 0 rgba(0, 0, 0, .14); }
button.u.dim { opacity: .18; }
:root[data-theme="dark"] button.u { color: #04201d; }
.empty-state { text-align: center; padding: 38px 24px 30px; }
.empty-state .art { width: 150px; color: var(--accent); margin: 0 auto 6px; display: block; }
.empty-state h3 { font-size: 21px; justify-content: center; margin-bottom: 6px; }
.empty-state > p { max-width: 520px; margin: 0 auto 18px; }
.steps { list-style: none; padding: 0; margin: 20px auto 0; max-width: 560px; text-align: left; display: grid; gap: 4px; }
.steps li { display: flex; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.steps li.done { background: var(--good-soft); border-color: transparent; }
.steps .num { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; flex: none; }
.steps li.done .num { background: var(--good); color: #fff; }
.steps .num .ico { width: 16px; height: 16px; }
.steps b { display: block; } .steps p { margin: 2px 0 6px; font-size: 13.5px; }
@media (max-width: 920px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .toolbar .legend { margin-left: 0; width: 100%; } }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hero { padding: 16px 14px 0; } }
.facts { width: 100%; margin: 8px 0; } .facts td { padding: 6px 8px; font-size: 13.5px; border-bottom: 1px solid var(--line); } .facts td:nth-child(odd) { color: var(--muted); width: 22%; }
.sheet { width: 100%; } .sheet td { padding: 7px 8px; font-size: 13.5px; } .sheet .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sheet .sum td { font-weight: 650; border-top: 1px solid var(--line-strong); } .sheet .disc td { color: var(--good); }
.changes { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.plan-box { margin-bottom: 12px; }
@media (max-width: 920px) { .board { grid-auto-columns: 82vw; } }

/* ---------- project details, unit types, send to lead ---------- */
.th { width: 100%; max-width: 220px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--hover); display: block; }
.th.sq { width: 84px; height: 84px; aspect-ratio: 1; } .th.plan { max-width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; }
.th.none, .th.doc { display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12.5px; padding: 8px; word-break: break-all; }
.th.doc { font-size: 26px; gap: 4px; align-content: center; } .th.doc span { font-size: 11px; }
.media-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.media-pick { align-items: flex-start; } .media-pick > div { min-width: 200px; }
.gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; } .gallery .g { position: relative; }
.gallery .x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.tagbox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--card); }
.tagbox input { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 160px; height: 30px !important; padding: 0 4px !important; }
.tg { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 6px 3px 12px; font-size: 13px; font-weight: 560; }
.tg button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.ideas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.type { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.type .fp { padding: 12px 12px 0; cursor: zoom-in; } .type .tb { padding: 12px 16px 14px; } .type h4 { margin: 0 0 4px; font-size: 16px; } .type .tb p { margin: 2px 0; font-size: 13px; }
.fp-mini { display: flex; gap: 12px; align-items: center; margin: 8px 0; cursor: zoom-in; } .fp-mini .th { max-width: 150px; } .fp-mini span { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; max-height: 340px; overflow-y: auto; padding: 4px; }
.pm { border: 2px solid var(--line); border-radius: 10px; background: var(--card); padding: 6px; cursor: pointer; display: grid; gap: 4px; font: inherit; color: inherit; text-align: left; }
.pm:hover { border-color: var(--line-strong); } .pm.on { border-color: var(--accent); background: var(--accent-soft); }
.pm img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 7px; } .pm .ic { font-size: 30px; display: grid; place-items: center; aspect-ratio: 1; background: var(--hover); border-radius: 7px; }
.pm .nm { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks { display: grid; gap: 6px; } .checks label { display: flex; gap: 8px; align-items: center; cursor: pointer; } .checks label.off { opacity: .6; cursor: not-allowed; }

/* ---------- labelled fields ---------- */
.fld { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; min-width: 120px; cursor: default; }
.fld > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.fld > span i { font-weight: 400; color: var(--muted); font-style: normal; }
.fld.grow { flex: 2 1 220px; } .fld.narrow { flex: 0 1 96px; min-width: 80px; }
.fld > input, .fld > select { width: 100%; }
.type-row { align-items: flex-end; flex-wrap: nowrap; gap: 10px; }
.type-row .fld { min-width: 0; }
@media (max-width: 920px) { .type-row { flex-wrap: wrap; } .type-row .fld { min-width: 120px; } }

/* ---------- instant response ---------- */
.ch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 12px; align-items: start; }
.ch-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--card); }
.ch-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.ch-head { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 15px; }
.ch-body { display: grid; gap: 8px; margin-top: 10px; } .ch-body > * { width: 100%; }
.ch-body details summary { cursor: pointer; padding: 4px 0; }

/* ---------- sign-in ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1.05fr) minmax(360px, 1fr); }
.auth-brand { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 10% -10%, rgba(45, 212, 191, .28), transparent 60%), radial-gradient(700px 500px at 100% 100%, rgba(14, 116, 144, .45), transparent 60%), linear-gradient(160deg, #0b1324 0%, #0d2c3a 100%); }
.auth-brand::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at 30% 30%, #000, transparent 75%); pointer-events: none; }
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand h2 { color: #fff; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.12; letter-spacing: -.03em; font-weight: 700; max-width: 17ch; margin-bottom: 14px; }
.auth-brand p { color: #a9bbd0; font-size: 16px; max-width: 42ch; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: #d3deec; }
.auth-points .ico { color: #2dd4bf; margin-top: 3px; }
.auth-foot { color: #6f819c; font-size: 13px; }
.auth-form { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h2 { font-size: 26px; font-weight: 700; letter-spacing: -.025em; margin-bottom: 4px; }
.auth-card > .sub { color: var(--muted); margin-bottom: 22px; }
.auth-card .row { margin-bottom: 14px; }
.auth-card input { height: 44px !important; font-size: 15px; }
.auth-card .btn { height: 44px; font-size: 15px; }
.auth-card .row .btn.primary { flex: 1; }
.auth-card .logo { margin-bottom: 22px; display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }
@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-102%); transition: transform .22s ease; }
  .nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 55; animation: enter .15s; }
  #menu { display: inline-grid; }
  .top { padding: 12px 16px; }
  .top h1 { font-size: 18px; }
  .top p { display: none; }
  #view { padding: 18px 16px 56px; min-width: 0; }
  .card { min-width: 0; }
  #banner { margin: 12px 16px 0; }
  .card { padding: 16px; border-radius: 12px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card .logo { display: grid; }
  #quick-lead span { display: none; }
}
@media (max-width: 560px) {
  .row > * { min-width: 100%; }
  .row > .btn, .row > button, .row > label { min-width: 0; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .stat b { font-size: 22px; }
  th, td { padding: 10px 12px; }
  .btn { height: 42px; }
  td .btn { height: 34px; }
  #toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }

/* ---- the alerts bell ---- */
.bell-wrap { position: relative; display: inline-flex; }
.bell-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad, #dc2626); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.bell-panel { position: absolute; right: 0; top: 46px; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 12px; box-shadow: 0 12px 36px rgba(0, 0, 0, .22); z-index: 60; }
.bell-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line, #e5e7eb); }
.bell-head b { flex: 1; }
.bell-item { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line, #e5e7eb); }
.bell-item.unread { background: color-mix(in srgb, var(--accent, #2563eb) 8%, transparent); }
.bell-main { flex: 1; cursor: pointer; min-width: 0; }
.bell-main .muted { overflow-wrap: anywhere; }
.small { font-size: 12px; }
