:root {
  --red: #E44544;
  --red-600: #C9302F;
  --red-50: #FDF1F1;
  --red-100: #FADCDC;
  --ink: #1D1F23;
  --ink-2: #474C55;
  --muted: #868C96;
  --line: #ECEDF0;
  --line-2: #E1E3E7;
  --bg: #F6F6F8;
  --card: #FFFFFF;
  --ok: #1F8A5B;
  --ok-50: #E9F6EF;
  --warn: #B26A00;
  --warn-50: #FFF5E5;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 28, .04), 0 4px 16px rgba(20, 22, 28, .06);
  --shadow-lg: 0 10px 40px rgba(20, 22, 28, .18);
  --head: 'Poppins', 'Open Sans', system-ui, sans-serif;
  --body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--body); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--red); text-decoration: none; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; }
.brand .word { font-family: var(--head); font-weight: 600; color: var(--red); line-height: 1; font-size: 16px; }
.brand .word span { display: block; }
.brand .btag { font-family: var(--head); font-size: 11px; font-weight: 500; color: var(--ink-2); letter-spacing: .08em;
  text-transform: uppercase; border-left: 1px solid var(--line-2); padding-left: 10px; margin-left: 2px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; background: #17181B; color: #fff; }
.login .formwrap { background: #17181B; }
.login .art { position: relative; overflow: hidden; padding: 40px 28px 24px; display: flex; flex-direction: column;
  justify-content: flex-end; min-height: 42vh; }
.login .art svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.login .art .claim { position: relative; font-family: var(--head); font-weight: 600; font-size: 34px; line-height: 1.1; }
.login .art .claim em { font-style: normal; color: var(--red); }
.login .art .sub { position: relative; color: #C9CBD1; margin-top: 10px; max-width: 420px; }
.login .art .brand { position: absolute; top: calc(24px + var(--safe-t)); left: 28px; }
.login .art .brand .word { color: #fff; }
.login form { background: #fff; color: var(--ink); min-height: 100%; padding: 28px 24px calc(28px + var(--safe-b)); border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column; gap: 14px; }
.login form h2 { margin-bottom: 4px; }
.login .err { color: var(--red-600); font-size: 14px; min-height: 20px; }
@media (min-width: 900px) {
  .login { grid-template-columns: 1.2fr 1fr; }
  .login .art { min-height: 100vh; padding: 64px; }
  .login .art .claim { font-size: 54px; }
  .login form { border-radius: 0; justify-content: center; padding: 64px; max-width: 520px; width: 100%; margin: auto; background: transparent; color: #fff; }
  .login { background: #17181B; }
  .login .formwrap { background: #fff; display: flex; }
  .login .formwrap form { color: var(--ink); }
}

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, textarea.input, select.input { width: 100%; border: 1.5px solid var(--line-2); background: #fff; border-radius: 12px;
  padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px; }
.input:focus { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-50); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.45; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 12px; font-weight: 600; font-size: 15px; transition: transform .08s, background .15s, opacity .15s;
  white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-600); }
.btn.primary:disabled { opacity: .45; pointer-events: none; }
.btn.ghost { background: #fff; border: 1.5px solid var(--line-2); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink-2); }
.btn.soft { background: var(--red-50); color: var(--red-600); }
.btn.block { width: 100%; height: 52px; font-size: 16px; border-radius: 14px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.link { height: auto; padding: 0; color: var(--red); font-weight: 600; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); }
.iconbtn:hover { background: var(--bg); }

/* ---------- shell ---------- */
.shell { min-height: 100%; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); padding: calc(10px + var(--safe-t)) 16px 10px; }
.topbar .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.search { position: relative; margin-top: 10px; }
.search svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; height: 46px; border-radius: 23px; border: 1.5px solid transparent; background: var(--bg);
  padding: 0 44px 0 44px; font-size: 16px; outline: none; transition: border-color .15s, background .15s; }
.search input:focus { background: #fff; border-color: var(--red); }
.search .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.event-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--red-600);
  background: var(--red-50); border-radius: 20px; padding: 4px 10px 4px 8px; max-width: 220px; }
.event-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-pill svg.i { width: 14px; height: 14px; }

main.view { padding: 16px 16px calc(96px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
.section { margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; }
.section h2 { font-size: 15px; color: var(--ink-2); font-weight: 600; text-transform: none; }
.section .count { color: var(--muted); font-size: 13px; }

.bottomnav { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + var(--safe-b)); }
.bottomnav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600;
  color: var(--muted); padding: 6px 0; position: relative; }
.bottomnav button.on { color: var(--red); }
.bottomnav .badge { position: absolute; top: 2px; left: calc(50% + 6px); background: var(--red); color: #fff; font-size: 10px;
  min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.fab { width: 58px; height: 58px; margin: -26px auto 0; border-radius: 50%; background: var(--red); color: #fff !important;
  box-shadow: 0 8px 24px rgba(228, 69, 68, .45); display: flex !important; align-items: center; justify-content: center; }
.fab svg.i { width: 28px; height: 28px; stroke-width: 2.2; }
.sidebar { display: none; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 4px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 17px;
  background: #fff; border: 1.5px solid var(--line-2); font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { color: var(--muted); font-weight: 500; }
.chip.on .n { color: #C9CBD1; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px;
  font-weight: 600; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.tag.red { background: var(--red-50); color: var(--red-600); }
.tag.dark { background: var(--ink); color: #fff; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- cards & lists ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.list { display: flex; flex-direction: column; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left;
  width: 100%; transition: background .12s; }
.item:last-child { border-bottom: 0; }
.item:hover { background: #FAFAFB; }
.item.sel { background: var(--red-50); }
.item .meta { flex: 1; min-width: 0; }
.item .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .line { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .right { color: var(--muted); font-size: 12px; text-align: right; flex: none; }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  font-family: var(--head); font-weight: 600; font-size: 15px; color: #fff; letter-spacing: .02em; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--red-100); border-top-color: var(--red); border-radius: 50%;
  animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* follow-up strip */
.due { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.due::-webkit-scrollbar { display: none; }
.due .card { flex: none; width: 240px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.due .when { font-size: 12px; font-weight: 700; color: var(--warn); }
.due .when.over { color: var(--red-600); }
.due .what { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- match cards ---------- */
.matches { display: flex; flex-direction: column; gap: 10px; }
.match { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.match .who { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; }
.match .who .meta { flex: 1; min-width: 0; }
.match .who .name { font-weight: 600; }
.match .who .line { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match .reason { font-size: 14px; color: var(--ink-2); background: var(--bg); border-radius: 10px; padding: 10px 12px; position: relative; }
.match .reason::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; background: var(--red); border-radius: 2px; }
.match .actions { display: flex; gap: 8px; }
.rank { width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex: none; }

/* ---------- detail ---------- */
.detail { display: flex; flex-direction: column; gap: 14px; }
.hero { padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.hero h1 { margin-top: 8px; }
.hero .headline { color: var(--ink-2); font-weight: 600; }
.hero .sub { color: var(--muted); font-size: 14px; }
.quick { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.quick a, .quick button { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 58px; font-size: 11px;
  font-weight: 600; color: var(--ink-2); }
.quick .ic { width: 44px; height: 44px; border-radius: 14px; background: var(--red-50); color: var(--red-600); display: flex;
  align-items: center; justify-content: center; }
.block { padding: 16px; }
.block h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--ink); }
.block h3 svg.i { width: 18px; height: 18px; color: var(--red); }
.block h3 .spacer { flex: 1; }
.offer-seek { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .offer-seek { grid-template-columns: 1fr 1fr; } }
.os-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.os-list li { display: flex; gap: 8px; font-size: 14px; align-items: flex-start; }
.os-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; margin-top: 8px; flex: none; background: var(--ok); }
.os-list.seek li::before { background: var(--red); }
.os-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 14px; }
.kv .k { color: var(--muted); }
.kv .v { word-break: break-word; }
.timeline { display: flex; flex-direction: column; gap: 12px; }
.note { font-size: 14px; display: flex; gap: 10px; }
.note .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); display: flex; align-items: center;
  justify-content: center; flex: none; color: var(--ink-2); }
.note .dot svg.i { width: 14px; height: 14px; }
.note .when { font-size: 12px; color: var(--muted); }
.cardimg { width: 100%; border-radius: 12px; display: block; border: 1px solid var(--line); }
.alert { border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.alert.warn { background: var(--warn-50); color: #6B4300; }
.alert.err { background: var(--red-50); color: var(--red-600); }
.alert .row { display: flex; gap: 8px; flex-wrap: wrap; }
.fu { display: flex; flex-direction: column; gap: 10px; }
.fu .date { font-weight: 700; }
.fu .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- sheet / modal ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(20, 22, 28, .42); z-index: 50; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; top: calc(var(--safe-t) + 8px); background: #fff;
  border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: up .26s cubic-bezier(.2, .8, .2, 1);
  box-shadow: var(--shadow-lg); }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet .sh { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.sheet .sh h2 { flex: 1; }
.sheet .sb { flex: 1; overflow-y: auto; padding: 16px 18px; -webkit-overflow-scrolling: touch; }
.sheet .sf { padding: 12px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet.detail-sheet { background: var(--bg); }
.sheet.detail-sheet .sh { background: #fff; border-radius: 22px 22px 0 0; }
@media (min-width: 720px) {
  .sheet { left: 50%; top: 50%; bottom: auto; right: auto; width: 560px; max-height: min(88vh, 860px); transform: translate(-50%, -50%);
    border-radius: 22px; animation: pop .2s; }
  .sheet .sf { padding-bottom: 14px; border-radius: 0 0 22px 22px; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, -48%); } }
}

/* capture */
.capture-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { border-radius: 18px; border: 1.5px dashed var(--line-2); padding: 18px 12px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; min-height: 128px; font-weight: 600; color: var(--ink-2);
  background: #FCFCFD; position: relative; overflow: hidden; transition: border-color .15s, background .15s; }
.tile:hover { border-color: var(--red); }
.tile .big { width: 52px; height: 52px; border-radius: 50%; background: var(--red-50); color: var(--red); display: flex;
  align-items: center; justify-content: center; }
.tile .big svg.i { width: 26px; height: 26px; }
.tile .hint { font-size: 12px; font-weight: 500; color: var(--muted); }
.tile.rec { border-style: solid; border-color: var(--red); background: var(--red-50); }
.tile.rec .big { background: var(--red); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(228, 69, 68, .5); } 70% { box-shadow: 0 0 0 16px rgba(228, 69, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(228, 69, 68, 0); } }
.tile.has { border-style: solid; padding: 0; }
.tile.has img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.tile .x { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.6);
  color: #fff; display: flex; align-items: center; justify-content: center; z-index: 2; }
.tile .x svg.i { width: 16px; height: 16px; }
.langtoggle { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 3px; }
.langtoggle button { height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.langtoggle button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.rowline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 8px; }
.expander { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; font-size: 14px; margin-top: 14px; }
.steps { display: flex; flex-direction: column; gap: 12px; padding: 22px 6px; }
.step { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 600; }
.step.on { color: var(--ink); }
.step.done { color: var(--ok); }
.step .dotc { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; }
.step.done .dotc { background: var(--ok); border-color: var(--ok); }
.step svg.i { width: 18px; height: 18px; }
.result-head { display: flex; align-items: center; gap: 14px; padding: 16px; }
.result-head .meta { flex: 1; min-width: 0; }
.success { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 700; font-size: 14px; margin-bottom: 10px; }

/* ask */
.ask-wrap { display: flex; flex-direction: column; gap: 16px; }
.ask-empty { text-align: center; padding: 28px 8px 8px; }
.ask-empty .orb { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; background: var(--red-50); color: var(--red);
  display: flex; align-items: center; justify-content: center; }
.ask-empty .orb svg.i { width: 30px; height: 30px; }
.ask-empty p { color: var(--muted); max-width: 420px; margin: 6px auto 18px; }
.suggest { display: flex; flex-direction: column; gap: 8px; align-items: stretch; max-width: 460px; margin: 0 auto; }
.suggest button { text-align: left; background: #fff; border: 1.5px solid var(--line-2); border-radius: 14px; padding: 12px 14px;
  font-size: 14px; color: var(--ink-2); }
.suggest button:hover { border-color: var(--red); color: var(--ink); }
.bubble { align-self: flex-end; background: var(--ink); color: #fff; border-radius: 18px 18px 4px 18px; padding: 10px 14px;
  max-width: 85%; font-size: 15px; white-space: pre-wrap; }
.answer { display: flex; flex-direction: column; gap: 10px; }
.answer .text { font-size: 15px; background: #fff; border-radius: 18px 18px 18px 4px; padding: 12px 14px; box-shadow: var(--shadow); }
.askbar { position: fixed; z-index: 25; left: 0; right: 0; bottom: calc(68px + var(--safe-b)); padding: 10px 12px;
  background: linear-gradient(transparent, var(--bg) 30%); }
.askbar .in { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; background: #fff;
  border-radius: 24px; box-shadow: var(--shadow); padding: 6px 6px 6px 16px; border: 1.5px solid var(--line-2); }
.askbar textarea { flex: 1; border: 0; outline: none; resize: none; padding: 9px 0; max-height: 140px; font-size: 16px; background: transparent; }
.askbar .send { width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; }
.askbar .mic { width: 40px; height: 40px; border-radius: 50%; color: var(--ink-2); display: flex; align-items: center; justify-content: center; }
.askbar .mic.rec { background: var(--red-50); color: var(--red); animation: pulse 1.4s infinite; }
.typing { display: inline-flex; gap: 4px; padding: 14px; background: #fff; border-radius: 18px; box-shadow: var(--shadow); align-self: flex-start; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* settings */
.menu { display: flex; flex-direction: column; }
.menu .mi { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.menu .mi:last-child { border-bottom: 0; }
.menu .mi .t { flex: 1; font-weight: 600; }
.menu .mi .d { color: var(--muted); font-size: 13px; font-weight: 400; display: block; }
.menu .mi svg.i { color: var(--ink-2); }
.menu .mi.dis { opacity: .55; cursor: default; }
.soon { font-size: 11px; font-weight: 700; color: var(--red-600); background: var(--red-50); padding: 3px 8px; border-radius: 8px; }

#toast { position: fixed; z-index: 100; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0;
  pointer-events: none; transition: all .2s; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- desktop ---------- */
@media (min-width: 1024px) {
  body { background: var(--bg); }
  .shell { display: grid; grid-template-columns: 248px minmax(340px, 420px) minmax(0, 1fr); height: 100vh; overflow: hidden; }
  .shell.wide { grid-template-columns: 248px minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; gap: 4px; background: #fff; border-right: 1px solid var(--line); padding: 22px 14px; }
  .sidebar .brand { padding: 0 8px 22px; }
  .sidebar .btn.primary { margin: 0 4px 18px; height: 48px; }
  .sidebar .nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; font-weight: 600; color: var(--ink-2); width: 100%; text-align: left; }
  .sidebar .nav:hover { background: var(--bg); }
  .sidebar .nav.on { background: var(--red-50); color: var(--red-600); }
  .sidebar .nav .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; min-width: 20px; height: 20px;
    border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
  .sidebar .foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--muted); }
  .bottomnav { display: none; }
  .colmain { overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); }
  .shell.wide .colmain { border-right: 0; }
  .topbar .row.mobile-only { display: none; }
  .topbar .search { margin-top: 0; }
  main.view { padding-bottom: 40px; }
  .shell.wide main.view { max-width: 820px; }
  .coldetail { overflow-y: auto; padding: 24px; }
  .coldetail .detail { max-width: 720px; margin: 0 auto; }
  .askbar { left: 248px; bottom: 0; padding: 16px 24px 20px; }
  .ask-wrap { padding-bottom: 80px; }
  #toast { bottom: 32px; }
  .placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 10px; text-align: center; }
  .placeholder img { width: 64px; opacity: .5; }
}
@media (max-width: 1023px) { .coldetail { display: none; } }
.field .langtoggle { align-self: flex-start; }
@media (min-width: 1024px) {
  .shell.wide .coldetail { display: none; }
  .shell.wide .topbar { display: none; }
}

/* desktop overview (right pane when no contact is open) */
.overview { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.ov-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 8px 2px 4px; }
.ov-head h1 { font-size: 26px; }
.ov-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; }
.ov-act { padding: 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; transition: transform .12s, box-shadow .12s; }
button.ov-act:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.ov-act .big { width: 44px; height: 44px; border-radius: 14px; background: var(--red-50); color: var(--red); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.ov-act.ask { background: var(--ink); color: #fff; }
.ov-act.ask .big { background: rgba(255,255,255,.1); color: #fff; }
.ov-act.ask .input { margin-top: 6px; height: 42px; font-size: 14px; background: #fff; color: var(--ink); border-color: transparent; }
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ov-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.ov-row:first-of-type { border-top: 0; }
.ov-who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.ov-stats div { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.ov-stats b { font-family: var(--head); font-size: 22px; }
.ov-stats span { font-size: 12px; color: var(--muted); }
.ov-bars { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.ov-bar { display: grid; grid-template-columns: 150px 1fr 28px; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; text-align: left; font-size: 13px; }
.ov-bar:hover { background: var(--bg); }
.ov-bar .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); font-weight: 600; }
.ov-bar .track { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.ov-bar .fill { display: block; height: 100%; background: var(--red); border-radius: 4px; }
.ov-bar .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (min-width: 1024px) {
  .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .chip.more { border-style: dashed; color: var(--muted); }
}
@media (max-width: 1280px) { .ov-actions { grid-template-columns: 1fr 1fr; } .ov-act.ask { grid-column: span 2; } .ov-grid { grid-template-columns: 1fr; } }
.detail-close { max-width: 720px; margin: -8px auto 8px; display: flex; justify-content: flex-end; }
.detail-close .iconbtn { background: #fff; box-shadow: var(--shadow); }
.ov-grid > *, .ov-actions > * { min-width: 0; }
.ov-bar { grid-template-columns: minmax(90px, 40%) 1fr 28px; }

/* ===== v5: desktop = sidebar + one page; contacts open in a right-hand drawer ===== */
@media (min-width: 1024px) {
  .shell, .shell.wide { grid-template-columns: 248px minmax(0, 1fr); }
  .coldetail { display: none !important; }
  .topbar { display: none !important; }
  .colmain { border-right: 0; }
  main.view { max-width: 1320px; padding: 28px 32px 48px; }
  main.view.v-ask, main.view.v-followups, main.view.v-more { max-width: 860px; }
  .askbar { left: 248px; }

  /* drawer */
  .sheet.detail-sheet { left: auto; right: 0; top: 0; bottom: 0; transform: none; width: min(660px, 94vw); max-height: none;
    border-radius: 22px 0 0 22px; animation: drawer .24s cubic-bezier(.2, .8, .2, 1); }
  .sheet.detail-sheet .sh { border-radius: 22px 0 0 0; }
  @keyframes drawer { from { transform: translateX(60px); opacity: .3; } }
  .backdrop { background: rgba(20, 22, 28, .28); }
}

/* contacts header */
.cx-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.cx-head > div:first-child { min-width: 150px; }
.cx-search { position: relative; flex: 1; display: flex; align-items: center; }
.cx-search > svg.i { position: absolute; left: 16px; color: var(--muted); }
.cx-search input { width: 100%; height: 48px; border-radius: 14px; border: 1.5px solid var(--line-2); background: #fff; padding: 0 84px 0 46px;
  font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; }
.cx-search input:focus { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-50); }
.cx-search .iconbtn { position: absolute; right: 40px; }
.cx-search kbd { position: absolute; right: 12px; font: 600 12px var(--body); color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 7px; background: var(--bg); }
.sortsel { width: auto; height: 48px; padding: 0 12px; font-size: 14px; border-radius: 14px; }
.cx-head .btn.primary { height: 48px; border-radius: 14px; }
.cx-body { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }

/* facets */
.facets { position: sticky; top: 0; display: flex; flex-direction: column; gap: 20px; }
.fg { display: flex; flex-direction: column; gap: 1px; }
.fg .os-h { margin-bottom: 6px; }
.fi { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.fi:hover { background: #fff; }
.fi.on { background: var(--red-50); color: var(--red-600); font-weight: 600; }
.fi input { accent-color: var(--red); width: 15px; height: 15px; margin: 0; }
.fi .fl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi .fn { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.fg .btn.link { align-self: flex-start; margin: 4px 8px 0; font-size: 13px; }
.activef { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.chip.sm { height: 30px; font-size: 12px; padding: 0 10px; }
.chip.sm svg.i { width: 14px; height: 14px; }

/* table */
.tblwrap + .tblwrap { margin-top: 8px; }
.tblwrap .section:first-child { margin-top: 0; }
.tbl { overflow: hidden; }
.tr { display: grid; grid-template-columns: minmax(220px, 2.3fr) minmax(140px, 1.5fr) minmax(110px, 1fr) minmax(150px, 1.5fr) 110px;
  gap: 16px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; transition: background .12s; }
.tr:last-child { border-bottom: 0; }
button.tr:hover { background: #FAFAFB; }
.tr.sel { background: var(--red-50); box-shadow: inset 3px 0 0 var(--red); }
.tr.th { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 12px; padding-bottom: 10px; background: #FCFCFD; }
.tr .cell { min-width: 0; font-size: 14px; }
.tr .cell .line, .tr .who .line { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr .who { display: flex; align-items: center; gap: 12px; }
.tr .who .meta { min-width: 0; }
.tr .who .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr .cell.tags { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 1280px) { .tr { grid-template-columns: minmax(200px, 2.3fr) minmax(130px, 1.5fr) minmax(140px, 1.4fr) 100px; } .tr > :nth-child(3) { display: none; } }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; transition: transform .12s; }
.kpi:hover { transform: translateY(-2px); }
.kpi b { font-family: var(--head); font-size: 28px; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.warn b { color: var(--red); }
.ov-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.overview { max-width: none; }
.pair { padding: 12px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.pair:first-of-type { border-top: 0; padding-top: 0; }
.pair .pp { display: flex; align-items: center; gap: 10px; color: var(--red); }
.pair .pp .ov-who { flex: 0 1 auto; color: var(--ink); }
.pair .reason { color: var(--ink-2); background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.list.flat { box-shadow: none; border-radius: 0; margin: 0 -16px -16px; }
.list.flat .item { padding: 10px 16px; }
@media (max-width: 1023px) { .kpis { grid-template-columns: repeat(2, 1fr); } .ov-grid { grid-template-columns: 1fr; } .ov-actions { grid-template-columns: 1fr 1fr; } .ov-act.ask { grid-column: span 2; } }
