*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --line: #e5e8ef;
  --line-2: #d3d8e3;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #667085;
  --brand: #2546d8;
  --brand-ink: #1b35ab;
  --brand-soft: #eef1ff;
  --brand-soft-2: #dbe2ff;
  --green: #127a45;
  --green-strong: #12804a;
  --green-soft: #e8f6ee;
  --red: #c9271b;
  --red-soft: #fdecea;
  --amber: #a14a06;
  --amber-soft: #fff3e2;
  --orange: #b93d0b;
  --orange-soft: #ffeee4;
  --purple: #5b3cc0;
  --purple-soft: #f1edfd;
  --teal: #0b6b86;
  --teal-soft: #e4f4f8;
  --slate-soft: #eef0f4;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .18);
  --nav-h: 64px;
  --side-w: 240px;
  /* chart roles (single-hue charts use series-1; de-emphasis is the "rest") */
  --series-1: #2a78d6;
  --series-1-soft: rgba(42, 120, 214, .10);
  --deemph: #c5cad5;
  --grid: #eceef3;
  --axis: #d3d8e3;
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brand-soft-2); outline-offset: 2px; }

.ic { flex-shrink: 0; display: block; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.spacer { flex: 1; }
.mt { margin-top: 14px; }
.mt-8 { margin-top: 8px; }
.row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.req { color: var(--red); }
.nowrap { white-space: nowrap; }

/* ---------- boot / auth ---------- */
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; gap: 12px; padding: 24px; text-align: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--brand-soft-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.center-pad { display: grid; place-items: center; padding: 48px 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(165deg, #e9edff 0%, var(--bg) 55%); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px 22px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 22px; margin: 18px 0 4px; }
.auth-card .lead { color: var(--ink-3); margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; color: var(--ink); }
.logo { width: 36px; height: 36px; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex-shrink: 0; }
.demo-box { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.demo-title { font-size: 13px; font-weight: 700; color: var(--ink-3); margin-bottom: 10px; }
.demo-box .btn { justify-content: space-between; margin-bottom: 8px; }

/* ---------- app shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.main { padding-bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.side { display: none; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.bottom-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-decoration: none; }
.bottom-nav a.on { color: var(--brand); }
.bottom-nav .dot { position: absolute; top: 8px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; }
.fab-slot { display: flex; align-items: center; justify-content: center; }
.fab { width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 18px rgba(37, 70, 216, .35); margin-top: -20px; cursor: pointer; }
.fab:active { transform: scale(.97); }

@media (min-width: 960px) {
  .side {
    display: flex; flex-direction: column; gap: 2px; position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: var(--side-w);
    background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px 14px; overflow-y: auto;
  }
  .side .brand { padding: 0 8px 16px; }
  .side-cta { margin: 0 4px 14px; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none; }
  .side-link:hover { background: var(--surface-2); text-decoration: none; }
  .side-link.on { background: var(--brand-soft); color: var(--brand-ink); }
  .side-link .count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; border-radius: 99px; padding: 1px 7px; }
  .side-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); margin-top: 10px; }
  .side-me:hover { background: var(--surface-2); text-decoration: none; }
  .side-me small { display: block; color: var(--ink-3); font-size: 12px; }
  .main { margin-left: var(--side-w); padding-bottom: 48px; }
  .bottom-nav { display: none; }
  .hide-desktop { display: none !important; }
}
@media (max-width: 959px) { .hide-mobile { display: none !important; } }

/* ---------- page header ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(244, 246, 250, .94); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
.topbar-in { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 8px 16px; max-width: 1180px; margin: 0 auto; }
.titles { flex: 1; min-width: 0; }
.topbar h1 { font-size: 20px; font-weight: 750; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 13px; color: var(--ink-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page { max-width: 1180px; margin: 0 auto; padding: 4px 16px 24px; }
.page.narrow { max-width: 720px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); cursor: pointer; flex-shrink: 0; text-decoration: none; }
.icon-btn:hover { background: var(--slate-soft); text-decoration: none; }
.avatar-btn { width: 40px; height: 40px; border-radius: 13px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; font-size: 14px; text-decoration: none; flex-shrink: 0; }
.avatar-btn:hover { text-decoration: none; background: var(--brand-soft-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 650; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.btn-soft:hover { background: var(--brand-soft-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--slate-soft); }
.btn-danger { color: var(--red); border-color: #f2c4bf; }
.btn-danger:hover { background: var(--red-soft); }
.btn-green { background: var(--green-strong); border-color: var(--green-strong); color: #fff; }
.btn-green:hover { background: var(--green); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; gap: 6px; }
.btn-lg { min-height: 50px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.round-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); text-decoration: none; flex-shrink: 0; border: 0; cursor: pointer; }
.round-btn:hover { background: #d6efe1; text-decoration: none; }

/* ---------- chips & segmented ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  min-height: 38px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 14px; font-weight: 550; color: var(--ink-2); cursor: pointer; line-height: 1.25; text-align: left; flex-shrink: 0;
}
.chip:hover { border-color: #b9c1d3; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.tone-bad.on { background: var(--red); border-color: var(--red); }
.chip.tone-good.on { background: var(--green-strong); border-color: var(--green-strong); }
.sublabel { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 8px; }
.sublabel:first-child { margin-top: 0; }

.seg { display: inline-flex; background: #e8ebf1; border-radius: 12px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
.seg button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 650; color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- cards, lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.list { overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; min-height: 62px; }
.row:first-child { border-top: 0; }
a.row:hover, .row-link:hover { background: var(--surface-2); text-decoration: none; }
.row-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; text-decoration: none; margin: -12px 0 -12px -14px; padding: 12px 0 12px 14px; border-radius: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.row-end { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.day-head { padding: 8px 14px; background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; border-top: 1px solid var(--line); }
.day-head:first-child { border-top: 0; }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.due.bad { color: var(--red); }
.avatar { width: 40px; height: 40px; border-radius: 13px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 750; font-size: 14px; flex-shrink: 0; }
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 17px; font-size: 19px; }
.avatar.broker { background: var(--teal-soft); color: var(--teal); }
.time-box { width: 58px; flex-shrink: 0; text-align: center; padding: 6px 0; border-radius: 10px; background: var(--slate-soft); }
.time-box b { display: block; font-size: 13.5px; }
.time-box small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--slate-soft); color: var(--ink-2); line-height: 1.6; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--brand-soft); color: var(--brand-ink); }
.badge.st-new { background: var(--slate-soft); color: var(--ink-2); }
.badge.st-contacted { background: var(--brand-soft); color: var(--brand-ink); }
.badge.st-interested { background: var(--teal-soft); color: var(--teal); }
.badge.st-visit_scheduled { background: var(--amber-soft); color: var(--amber); }
.badge.st-visit_done { background: var(--orange-soft); color: var(--orange); }
.badge.st-negotiation { background: var(--purple-soft); color: var(--purple); }
.badge.st-won { background: var(--green-soft); color: var(--green); }
.badge.st-lost { background: var(--red-soft); color: var(--red); }
.badge-btn { border: 0; cursor: pointer; font-size: 13px; padding: 5px 10px 5px 12px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 18px; }
.field > .label, .label { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.label .opt { font-weight: 500; color: var(--ink-3); }
.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
select.input {
  padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.input-sm { min-height: 38px; padding: 6px 10px; font-size: 14px; border-radius: 10px; }
select.input-sm { padding-right: 30px; background-position: right 8px center; }
textarea.input { min-height: 80px; resize: vertical; line-height: 1.45; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.hint.bad { color: var(--red); }
.form-error { background: var(--red-soft); color: var(--red); padding: 11px 13px; border-radius: 10px; font-size: 14px; font-weight: 550; margin-bottom: 14px; }
.form-section { margin-bottom: 14px; }
.form-section > h2 { font-size: 15px; font-weight: 750; margin-bottom: 14px; }
.form-foot { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, rgba(244, 246, 250, 0)); z-index: 5; }
@media (min-width: 960px) { .form-foot { bottom: 0; } }
.toggle-link { background: none; border: 0; color: var(--brand); font-weight: 650; padding: 4px 0; cursor: pointer; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 550; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.lookup { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; }
.lookup .ic { margin-top: 1px; }
.lookup.ok { background: var(--green-soft); color: var(--green); }
.lookup.warn { background: var(--amber-soft); color: var(--amber); }
.lookup.bad { background: var(--red-soft); color: var(--red); }
.lookup.info { background: var(--brand-soft); color: var(--brand-ink); }
.lookup a { color: inherit; text-decoration: underline; font-weight: 650; }

.picked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 12px; }
.picker-list { border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; max-height: 260px; overflow-y: auto; }
.picker-item { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-top: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.picker-item:first-child { border-top: 0; }
.picker-item:hover { background: var(--surface-2); }
.picker-item span { display: block; font-size: 13px; color: var(--ink-3); }
.subcard { border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px; margin-top: 10px; background: var(--surface-2); }

/* ---------- search & filters ---------- */
.search { position: relative; margin-bottom: 10px; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 40px; }
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.filter-selects { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filter-selects .input { width: auto; flex: 0 0 auto; max-width: 220px; }

/* ---------- notices ---------- */
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-size: 14px; font-weight: 550; margin-bottom: 10px; text-decoration: none; line-height: 1.4; }
.notice span { flex: 1; }
a.notice:hover { text-decoration: none; filter: brightness(.98); }
.notice.amber { background: var(--amber-soft); color: var(--amber); }
.notice.red { background: var(--red-soft); color: var(--red); }
.notice.green { background: var(--green-soft); color: var(--green); }
.empty { text-align: center; padding: 30px 18px; color: var(--ink-3); }
.empty .empty-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--slate-soft); display: grid; place-items: center; margin: 0 auto 12px; color: var(--ink-3); }
.empty h3 { font-size: 15px; color: var(--ink); margin-bottom: 4px; }
.empty p { font-size: 14px; }

/* ---------- home / KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; color: inherit; display: block; text-decoration: none; box-shadow: var(--shadow); min-width: 0; }
a.kpi:hover { border-color: var(--line-2); text-decoration: none; }
.kpi-label { font-size: 12.5px; color: var(--ink-3); font-weight: 650; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.kpi-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.red .kpi-value { color: var(--red); }
.meter { height: 6px; border-radius: 99px; background: #dde7f7; overflow: hidden; margin-top: 9px; }
.meter > i { display: block; height: 100%; background: var(--series-1); border-radius: 99px; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 12px; }
.section { margin-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.section-head h2 { font-size: 16.5px; font-weight: 750; letter-spacing: -.01em; }

/* ---------- detail pages ---------- */
.detail { display: flex; flex-direction: column; gap: 12px; }
.detail > .section { margin-top: 12px; }
.hero { padding: 18px 16px 16px; }
.hero-top { display: flex; gap: 14px; align-items: center; }
.hero h2 { font-size: 21px; letter-spacing: -.015em; }
.phone-big { font-size: 15px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.hero-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.contact-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.contact-actions .btn { flex-direction: column; min-height: 60px; gap: 4px; font-size: 13px; padding: 0 6px; }
.contact-actions .wa { background: var(--green-soft); color: var(--green); }
.contact-actions .wa:hover { background: #d6efe1; }
.contact-actions .call { background: var(--brand); color: #fff; }
.contact-actions .call:hover { background: var(--brand-ink); }
.action-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.followup-card { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.followup-card .ic { color: var(--brand); }
.followup-card.overdue { border-color: #f2c4bf; background: #fffafa; }
.followup-card.overdue .ic, .followup-card.overdue .fu-when { color: var(--red); }
.fu-when { font-weight: 700; font-size: 15.5px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 0; }
@media (min-width: 760px) { .kv { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kv dt { font-size: 12.5px; color: var(--ink-3); font-weight: 650; }
.kv dd { margin: 3px 0 0; font-weight: 550; overflow-wrap: anywhere; }
.timeline .item { display: flex; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.timeline .item:first-child { border-top: 0; }
.tl-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--slate-soft); color: var(--ink-2); }
.tl-icon.good { background: var(--green-soft); color: var(--green); }
.tl-icon.blue { background: var(--brand-soft); color: var(--brand-ink); }
.tl-icon.warn { background: var(--amber-soft); color: var(--amber); }
.tl-icon.bad { background: var(--red-soft); color: var(--red); }
.tl-title { font-weight: 600; font-size: 14.5px; }
.tl-body { font-size: 14px; color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.deal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.visit-when { font-size: 22px; margin-top: 10px; letter-spacing: -.015em; }
.visit-centre { display: flex; gap: 10px; margin-top: 10px; }
.visit-centre .ic { color: var(--ink-3); margin-top: 2px; }
.visit-client { display: flex; gap: 12px; align-items: center; }
.target { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 18px; }

/* check-in */
.step { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.step:first-of-type { margin-top: 12px; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: var(--slate-soft); display: grid; place-items: center; font-weight: 750; font-size: 13px; flex-shrink: 0; color: var(--ink-2); }
.step.done .step-num { background: var(--green-strong); color: #fff; }
.photo { display: block; width: 100%; max-height: 360px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--slate-soft); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* ---------- sheet (bottom sheet / dialog) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(16, 24, 40, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
.sheet { background: var(--surface); width: 100%; max-width: 580px; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: up .2s ease-out; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { flex: 1; font-size: 17px; font-weight: 750; }
.sheet-body { padding: 18px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 8px; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; max-height: 88vh; }
  .sheet-foot { padding-bottom: 14px; }
}
@keyframes up { from { transform: translateY(28px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { background: #101828; color: #fff; padding: 12px 15px; border-radius: 12px; font-size: 14.5px; font-weight: 550; box-shadow: var(--shadow-lg); animation: up .2s ease-out; }
.toast.error { background: var(--red); }
.toast.warn { background: #8a4105; }
@media (min-width: 960px) { .toasts { bottom: 28px; left: calc(50% + var(--side-w) / 2); } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data td.name { font-weight: 650; }
table.data td .sub { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.status-ok { color: var(--green); font-weight: 650; }
.status-skip { color: var(--amber); font-weight: 650; }
.status-invalid { color: var(--red); font-weight: 650; }

/* ---------- settings / admin ---------- */
.menu-list .row { min-height: 56px; }
.menu-list .row .ic:first-child { color: var(--ink-2); }
.opt-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.opt-row:first-child { border-top: 0; }
.opt-row.off .opt-label { color: var(--ink-3); text-decoration: line-through; }
.opt-label { flex: 1; min-width: 0; font-weight: 600; }
.opt-label small { display: block; font-weight: 500; color: var(--ink-3); font-size: 12.5px; text-decoration: none; }
.mini-btn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex-shrink: 0; }
.mini-btn:hover { background: var(--surface-2); }
.mini-btn:disabled { opacity: .35; cursor: default; }
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #cdd3de; border-radius: 99px; transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--green-strong); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--brand-soft-2); }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.password-reveal { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 18px; font-weight: 700; letter-spacing: .04em; padding: 10px 12px; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 10px; }

/* ---------- dashboard & charts ---------- */
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-row .input { width: auto; }
.refetching { opacity: .55; transition: opacity .2s; }
.chart-card { padding: 16px 16px 12px; }
.chart-card h2 { font-size: 15.5px; font-weight: 750; }
.chart-card .chart-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.chart-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.colchart { position: relative; }
.colchart svg { display: block; width: 100%; height: auto; overflow: visible; }
.colchart .tick { font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.colchart .grid { stroke: var(--grid); stroke-width: 1; }
.colchart .base { stroke: var(--axis); stroke-width: 1; }
.colchart .hit { fill: transparent; cursor: default; outline: none; }
.colchart .col-group:hover .mark, .colchart .col-group:focus-within .mark { filter: brightness(1.12); }
.colchart .peak { font-size: 11.5px; font-weight: 700; fill: var(--ink-2); }
.tooltip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; min-width: 140px; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.tooltip .tt-title { color: var(--ink-3); font-weight: 650; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; min-width: 26px; }
.tooltip .key { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 550; }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-fill { height: 14px; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }
.bar-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); font-size: 13px; }
.bar-val small { color: var(--ink-3); font-weight: 550; margin-left: 4px; }
.bar-row:hover .bar-fill { filter: brightness(1.12); }
.inline-bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.inline-bar i { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--series-1); }
.spark { display: block; }
.spark path { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.table-toggle { background: none; border: 0; color: var(--brand); font-weight: 650; font-size: 13px; padding: 6px 0 0; cursor: pointer; }
.perf td.name a { color: var(--ink); }
.perf .zero { color: var(--ink-3); }
.flag { display: inline-flex; align-items: center; gap: 4px; color: var(--amber); font-weight: 650; font-size: 12.5px; }
