/* Lanna Concierge CRM. Mobile first, brand colours, one accent, quiet surfaces. */
@font-face { font-family: "Onest"; src: url("/fonts/onest-cyrillic-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; src: url("/fonts/onest-latin-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; src: url("/fonts/onest-cyrillic-500.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; src: url("/fonts/onest-latin-500.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; src: url("/fonts/onest-cyrillic-600.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; src: url("/fonts/onest-latin-600.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; src: url("/fonts/unbounded-cyrillic-300.woff2") format("woff2"); font-weight: 300; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; src: url("/fonts/unbounded-latin-300.woff2") format("woff2"); font-weight: 300; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #ffffff;
  --surface: #faf7f5;
  --ink: #191110;
  --ink-soft: #574c49;
  --muted: #7d716d;
  --line: #ece4e0;
  --accent: #d88a6a;
  --accent-ink: #9c4f33;
  --tint: #f8ece6;
  --chart: #b8643f;
  --chart-track: #f3e4dc;
  --ok: #2b7a4b;
  --ok-bg: #e7f3ec;
  --warn: #8a5a00;
  --warn-bg: #fdf1dc;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --note: #fff7e2;
  --s1: #f3d6c8; --s2: #ebbca5; --s3: #e0a083; --s4: #cf8460; --s5: #b8643f; --s6: #93492a;
  --radius: 14px;
  --tap: 44px;
  --text: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Unbounded", "Onest", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--text); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.sheet-open { overflow: hidden; }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
a:active, button:active { opacity: 0.72; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.strong { font-weight: 600; }
.bad { color: var(--bad); }
.read { color: var(--accent-ink); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.error { color: var(--bad); margin-top: 12px; }
.pad { padding: 16px; }
.icon { flex: none; display: block; }

/* Shell */
.app { min-height: 100dvh; padding-bottom: calc(64px + var(--safe-b)); }
.app-chat { padding-bottom: 0; }
.main { max-width: 760px; margin: 0 auto; }
.screen { padding: 0 max(16px, env(safe-area-inset-left)) 24px max(16px, env(safe-area-inset-right)); display: grid; gap: 14px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; min-height: 56px; padding-top: var(--safe-t); margin: 0 -16px; padding-left: 16px; padding-right: 8px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { flex: 1; font-family: var(--display); font-weight: 300; font-size: 1.25rem; letter-spacing: -0.01em; }
.tabbar { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--bg); border-top: 1px solid var(--line); padding: 0 max(4px, env(safe-area-inset-left)) var(--safe-b) max(4px, env(safe-area-inset-right)); }
.tab { flex: 1; max-width: 120px; min-height: 60px; display: grid; justify-items: center; align-content: center; gap: 2px; font-size: 0.6875rem; color: var(--muted); }
.tab.is-on { color: var(--ink); font-weight: 600; }
.tab.is-on .icon { color: var(--accent-ink); }
.section-title { font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 10px; }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 500; text-align: center; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-quiet { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 0.875rem; }
.btn-wide { width: 100%; }
.btn:disabled, .icon-btn:disabled { opacity: 0.45; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; flex: none; width: var(--tap); height: var(--tap); border-radius: 999px; border: 0; background: transparent; color: var(--ink); }
.icon-btn.is-on { background: var(--tint); color: var(--accent-ink); }
.icon-btn-primary { background: var(--ink); color: var(--bg); }
.link { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); color: var(--accent-ink); font-weight: 500; background: none; border: 0; padding: 0; }
.input { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 16px; }
textarea.input { resize: vertical; line-height: 1.4; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 0.8125rem; color: var(--ink-soft); font-weight: 500; }
.field-hint { font-size: 0.75rem; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; }
.switch { display: flex; align-items: center; gap: 10px; min-height: var(--tap); }
.switch input { width: 20px; height: 20px; accent-color: var(--ink); }
.stack { display: grid; gap: 10px; }

/* Chips and filters */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-quiet { background: var(--surface); color: var(--ink-soft); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.filter { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: 0.875rem; }
.filter.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filter-n { font-variant-numeric: tabular-nums; opacity: 0.7; }
.filter-bad:not(.is-on) { border-color: var(--bad-bg); color: var(--bad); }

/* Lists */
.rows { display: grid; }
.row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 64px; }
.row-static { align-items: center; }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-title { display: flex; align-items: center; gap: 6px; font-weight: 500; min-width: 0; }
.is-unread .row-title { font-weight: 600; }
.row-meta { font-size: 0.8125rem; color: var(--muted); }
.row-text { font-size: 0.875rem; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-side { display: grid; justify-items: end; align-content: start; gap: 6px; flex: none; }
.row-time { font-size: 0.75rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.ai-mark { color: var(--accent-ink); display: inline-flex; }
.cards { display: grid; gap: 12px; }
.card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); min-width: 0; }
.card h3 { font-size: 1rem; font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-links { display: flex; flex-wrap: wrap; gap: 0 18px; }
.empty { padding: 28px 8px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.empty-title { font-weight: 600; }
.empty-text { color: var(--muted); font-size: 0.875rem; max-width: 30em; display: grid; gap: 10px; justify-items: center; }
.banner { padding: 12px 14px; border-radius: var(--radius); font-size: 0.875rem; display: grid; gap: 6px; }
.banner-quiet { background: var(--surface); color: var(--ink-soft); }
.banner-ai { background: var(--tint); }
.banner-title { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent-ink); }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.panel { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel h2 { font-size: 1rem; font-weight: 600; }
.panel-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .panel-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.pairs { display: grid; gap: 6px; }
.pairs div { display: flex; justify-content: space-between; gap: 12px; font-size: 0.875rem; }
.pairs dt { color: var(--muted); }
.pairs dd { font-weight: 500; text-align: right; }
.menu { display: grid; }
.menu-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 1rem; }
.menu-item.is-on { font-weight: 600; }
.menu-item .icon:last-child:not(:first-child) { margin-left: auto; color: var(--accent-ink); }

/* Sheet, toasts, spinner */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(25, 17, 16, 0.38); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 88dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: 20px 20px 0 0; padding-bottom: var(--safe-b); }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 20px; } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; font-size: 1.0625rem; font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 16px 18px 20px; display: grid; gap: 14px; }
.toasts { position: fixed; z-index: 60; left: 0; right: 0; bottom: calc(84px + var(--safe-b)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { max-width: 520px; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 0.875rem; box-shadow: 0 6px 24px rgba(25, 17, 16, 0.18); }
.toast-bad { background: var(--bad); }
.spinner { display: grid; place-items: center; padding: 40px; }
.spinner-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner-dot { animation-duration: 2.4s; } }

/* Auth */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left)); }
.auth-card { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.auth h1 { font-family: var(--display); font-weight: 300; font-size: 2rem; }
.brand { font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); font-weight: 600; }

/* Lead conversation */
.lead { padding-bottom: 0; }
.lead-top { padding-right: 4px; }
.lead-title { flex: 1; min-width: 0; display: grid; text-align: left; background: none; border: 0; padding: 4px 0; }
.stage-pill { flex: none; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--tint); font-size: 0.8125rem; font-weight: 600; }
.stage-done.stage-pill { background: var(--ok-bg); color: var(--ok); }
.stage-lost.stage-pill { background: var(--surface); color: var(--muted); }
.stage-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.stage-dot.stage-new { background: var(--s1); } .stage-dot.stage-talk { background: var(--s2); } .stage-dot.stage-fit { background: var(--s3); }
.stage-dot.stage-deal { background: var(--s4); } .stage-dot.stage-docs { background: var(--s5); } .stage-dot.stage-submitted { background: var(--s6); }
.stage-dot.stage-done { background: var(--ok); } .stage-dot.stage-lost { background: #a59a96; }
.thread { display: grid; gap: 12px; align-content: start; padding: 12px 0 calc(150px + var(--safe-b)); }
.due-line { display: flex; align-items: center; gap: 8px; }
.summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; font-size: 0.9375rem; }
.summary summary { display: flex; align-items: center; gap: 6px; min-height: 48px; font-weight: 600; cursor: pointer; list-style: none; color: var(--accent-ink); }
.summary summary::-webkit-details-marker { display: none; }
.summary[open] { padding-bottom: 14px; display: grid; gap: 8px; }
.facts { display: grid; gap: 4px; font-size: 0.875rem; }
.facts div { display: grid; grid-template-columns: 8.5em 1fr; gap: 8px; }
.facts dt { color: var(--muted); }
.messages { display: grid; gap: 8px; }
.msg { max-width: 86%; display: grid; gap: 4px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px 13px; border-radius: 16px; }
.msg-in { justify-self: start; }
.msg-in .msg-body { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg-out { justify-self: end; }
.msg-out .msg-body { background: var(--ink); color: var(--bg); border-bottom-right-radius: 6px; }
.msg-out .msg-meta { justify-content: flex-end; }
.msg-note { justify-self: stretch; max-width: none; }
.msg-note .msg-body { background: var(--note); border-radius: 12px; font-size: 0.9375rem; }
.msg-label { font-size: 0.75rem; color: var(--warn); font-weight: 600; }
.msg-event { justify-self: center; max-width: 92%; }
.msg-event .msg-body { background: none; padding: 2px 4px; color: var(--muted); font-size: 0.8125rem; text-align: center; }
.msg-meta { display: flex; align-items: center; gap: 8px; font-size: 0.6875rem; color: var(--muted); padding: 0 4px; }
.composer { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 8px max(10px, env(safe-area-inset-left)) calc(8px + var(--safe-b)) max(10px, env(safe-area-inset-right)); }
.composer-row { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 4px; }
.input.composer-input { flex: 1; min-width: 0; resize: none; max-height: 160px; border-radius: 22px; padding: 11px 14px; }
.composer-note { max-width: 760px; margin: 0 auto 6px; font-size: 0.8125rem; color: var(--muted); }
.notes { display: grid; gap: 6px; padding-left: 18px; list-style: disc; color: var(--ink-soft); font-size: 0.9375rem; }

/* Partners and answers */
.answer { background: var(--surface); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.answer-warn { background: var(--warn-bg); }
.answer-text { white-space: pre-wrap; }
.copy-field { display: grid; gap: 6px; }

/* Training */
.ask { display: grid; gap: 10px; }
.results { display: grid; gap: 10px; }
.results li { padding: 10px 12px; border-radius: 12px; background: var(--surface); display: grid; gap: 4px; }
.prose { display: grid; gap: 10px; line-height: 1.55; }
.prose h2 { font-family: var(--display); font-weight: 300; font-size: 1.375rem; line-height: 1.25; }
.md { display: grid; gap: 10px; }
.md h3, .prose h3 { font-size: 1.0625rem; font-weight: 600; margin-top: 10px; }
.md h4 { font-size: 0.9375rem; font-weight: 600; margin-top: 6px; }
.md ul, .prose ul { list-style: disc; padding-left: 20px; display: grid; gap: 6px; }
.flash { display: grid; gap: 16px; padding: 22px 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.flash-q { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.flash-a { font-size: 1.0625rem; background: var(--tint); padding: 14px; border-radius: 12px; }

/* Dashboard */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.seg button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: none; font-size: 0.8125rem; color: var(--ink-soft); }
.seg button.is-on { background: var(--ink); color: var(--bg); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { display: grid; gap: 4px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); text-align: left; min-width: 0; }
.tile-link:hover { border-color: var(--accent); }
.tile-label { font-size: 0.8125rem; color: var(--muted); }
.tile-value { font-size: 1.625rem; font-weight: 600; letter-spacing: -0.01em; }
.tile-sub { font-size: 0.75rem; color: var(--muted); }
.bars { display: grid; gap: 2px; }
.bars-row { width: 100%; display: grid; grid-template-columns: minmax(6.5em, 34%) 1fr; align-items: center; gap: 10px; min-height: 36px; background: none; border: 0; padding: 0; text-align: left; font-size: 0.875rem; }
button.bars-row:hover .bars-label { color: var(--accent-ink); }
.bars-label { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bars-fill { display: block; height: 14px; min-width: 4px; background: var(--chart); border-radius: 0 4px 4px 0; }
.bars-value { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); flex: none; }
.columns-wrap { display: grid; gap: 6px; }
.columns-readout { font-size: 0.875rem; color: var(--ink-soft); min-height: 1.4em; }
.columns { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--line); }
.col { flex: 1; height: 100%; display: flex; align-items: flex-end; background: none; border: 0; padding: 0; min-width: 2px; }
.col-fill { display: block; width: 100%; max-width: 24px; margin: 0 auto; min-height: 3px; background: var(--chart); border-radius: 4px 4px 0 0; }
.col.is-on .col-fill { background: var(--ink); }
.columns-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }
.meter { height: 8px; border-radius: 999px; background: var(--chart-track); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--chart); border-radius: 999px; }
.table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 480px; }
.table th, .table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; padding-left: 0; }
.table thead th { font-size: 0.75rem; color: var(--muted); font-weight: 500; }

@media (hover: hover) {
  .row:hover { background: var(--surface); }
  .btn-quiet:hover { border-color: var(--accent); }
  .menu-item:hover { color: var(--accent-ink); }
}
