/* ============ FactorXP ============ */
:root {
  --bg: #0b0d12;
  --bg-2: #0f1218;
  --surface: #151923;
  --surface-2: #1b2030;
  --surface-3: #232a3c;
  --border: #252c3d;
  --border-2: #313a50;
  --text: #e9edf5;
  --text-2: #b4bccd;
  --muted: #8089a0;
  --accent: #7c5cff;
  --accent-2: #22d3aa;
  --accent-soft: rgba(124, 92, 255, .14);
  --pos: #2fd392;
  --pos-soft: rgba(47, 211, 146, .13);
  --neg: #ff5c7a;
  --neg-soft: rgba(255, 92, 122, .13);
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, .14);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 16px;
  --radius-sm: 10px;
  --grad: linear-gradient(135deg, #7c5cff 0%, #22d3aa 100%);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f5f9; --bg-2: #eceef4; --surface: #ffffff; --surface-2: #f5f6fa; --surface-3: #eceff5;
    --border: #e3e6ee; --border-2: #d3d8e3; --text: #141824; --text-2: #3d4558; --muted: #6d7589;
    --accent: #6a4cf5; --accent-soft: rgba(106, 76, 245, .10); --pos: #0fa56d; --pos-soft: rgba(15, 165, 109, .10);
    --neg: #e0335a; --neg-soft: rgba(224, 51, 90, .09); --warn: #c77c06; --warn-soft: rgba(199, 124, 6, .10);
    --shadow: 0 8px 24px rgba(20, 24, 40, .08); color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f5f9; --bg-2: #eceef4; --surface: #ffffff; --surface-2: #f5f6fa; --surface-3: #eceff5;
  --border: #e3e6ee; --border-2: #d3d8e3; --text: #141824; --text-2: #3d4558; --muted: #6d7589;
  --accent: #6a4cf5; --accent-soft: rgba(106, 76, 245, .10); --pos: #0fa56d; --pos-soft: rgba(15, 165, 109, .10);
  --neg: #e0335a; --neg-soft: rgba(224, 51, 90, .09); --warn: #c77c06; --warn-soft: rgba(199, 124, 6, .10);
  --shadow: 0 8px 24px rgba(20, 24, 40, .08); color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 650; }
.hide { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 240px; flex: none; position: sticky; top: 0; height: 100vh; height: 100dvh;
  border-right: 1px solid var(--border); background: var(--bg-2);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -.02em; padding: 0 8px 18px; }
.brand img { border-radius: 9px; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 520;
}
.side-nav a:hover { background: var(--surface); color: var(--text); }
.side-nav a.active { background: var(--accent-soft); color: var(--text); }
.side-nav a.active svg { color: var(--accent); }
.side-foot { margin-top: auto; padding: 10px 8px 0; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(12px + var(--safe-t)) 28px 12px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid transparent;
}
.topbar .brand-sm { display: none; padding: 0; font-size: 17px; }
.topbar-title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; flex: 1; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.view { padding: 8px 28px 48px; max-width: 1180px; width: 100%; outline: none; }

.tabbar, .fab { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { padding: calc(10px + var(--safe-t)) 16px 10px; }
  .topbar .brand-sm { display: flex; }
  .topbar-title { display: none; }
  .topbar-actions { margin-left: auto; }
  .view { padding: 4px 16px calc(96px + var(--safe-b)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--bg-2) 90%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + var(--safe-b));
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 560;
    color: var(--muted); border-radius: 10px;
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--text); }
  .tabbar a.active svg { color: var(--accent); }
  .fab {
    display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(78px + var(--safe-b)); z-index: 31;
    width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--grad); color: #fff; box-shadow: 0 10px 28px rgba(124, 92, 255, .45);
  }
  .fab svg { width: 26px; height: 26px; }
  body.no-fab .fab { display: none; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 10px 0 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.025em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
@media (max-width: 860px) { .page-head h1 { font-size: 23px; } }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1020px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  min-width: 0;
}
.card.pad-0 { padding: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.card-head .link { color: var(--accent); font-size: 13px; font-weight: 600; }
.label { font-size: 12.5px; color: var(--muted); font-weight: 560; letter-spacing: .01em; }
.big { font-size: 28px; font-weight: 720; letter-spacing: -.03em; }
.huge { font-size: 38px; font-weight: 760; letter-spacing: -.035em; line-height: 1.1; }
@media (max-width: 680px) { .huge { font-size: 32px; } }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 8px; }
.stat-icon svg { width: 18px; height: 18px; }

.hero {
  position: relative; overflow: hidden; border: 0; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(34, 211, 170, .55) 0%, rgba(34, 211, 170, 0) 55%), linear-gradient(135deg, #3b2bb0 0%, #7c5cff 55%, #5a3fe0 100%);
}
.hero .label, .hero .muted { color: rgba(255, 255, 255, .78); }
.hero .chip { background: rgba(255, 255, 255, .16); color: #fff; border-color: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.grad { background: var(--grad); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, transparent); background: var(--neg-soft); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 560;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
button.chip:hover { border-color: var(--border-2); color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--text); }
.chip.xs { height: 22px; padding: 0 8px; font-size: 11.5px; }
.chip.pos { background: var(--pos-soft); color: var(--pos); border-color: transparent; }
.chip.neg { background: var(--neg-soft); color: var(--neg); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--bg-2);
  outline: none; font-size: 15px; transition: border-color .15s;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 13px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px;
  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='%238089a0' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input-group { display: flex; gap: 8px; }
.input-group .input:first-child { flex: 1; min-width: 0; }
.input-group select.input { width: 104px; flex: none; }
.amount-input { font-size: 26px; font-weight: 700; height: 58px; letter-spacing: -.02em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); min-width: 0;
}
.item:last-child { border-bottom: 0; }
.item.clickable { cursor: pointer; border-radius: 10px; }
.item.clickable:hover { background: var(--surface-2); }
.item .t { font-weight: 600; font-size: 14.5px; }
.item .s { font-size: 12.5px; color: var(--muted); }
.item .amt { font-weight: 680; text-align: right; white-space: nowrap; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; font-size: 18px; background: var(--surface-2);
}
.avatar.person { border-radius: 50%; font-size: 15px; font-weight: 700; color: #fff; }
.day-head { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 16px 4px 4px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .e-icon { font-size: 34px; margin-bottom: 8px; }

/* ---------- Progress ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s ease; }
.bar.pos > i { background: var(--pos); }
.bar.warn > i { background: var(--warn); }
.bar.neg > i { background: var(--neg); }
.ring { position: relative; width: 148px; height: 148px; flex: none; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring .c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }

/* ---------- Rates ---------- */
.rate-card { position: relative; overflow: hidden; }
.rate-card .pair { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text-2); }
.flag { font-size: 20px; line-height: 1; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); display: inline-block; box-shadow: 0 0 0 0 rgba(47, 211, 146, .6); animation: pulse 2s infinite; }
.live-dot.stale { background: var(--warn); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 211, 146, .55); } 70% { box-shadow: 0 0 0 8px rgba(47, 211, 146, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 211, 146, 0); } }
.spark { width: 100%; height: 44px; display: block; margin-top: 10px; }
.converter { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.converter .swap { width: 44px; height: 44px; border-radius: 12px; }

.chart { width: 100%; height: 220px; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }

/* ---------- Sync pill ---------- */
.sync-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600;
}
.sync-pill .d { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.sync-pill.ok .d { background: var(--pos); }
.sync-pill.busy .d { background: var(--accent); animation: blink 1s infinite; }
.sync-pill.err .d { background: var(--neg); }
.sync-pill.local .d { background: var(--warn); }
@keyframes blink { 50% { opacity: .3; } }
@media (max-width: 420px) { .sync-pill .lbl { display: none; } .sync-pill { padding: 0 10px; } }

/* ---------- Modal / sheet ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(5, 7, 12, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; animation: fade .15s ease;
}
.modal {
  width: min(560px, 100%); max-height: min(88vh, 900px); overflow: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); animation: pop .18s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.modal-body { padding: 12px 20px 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
.modal-foot .left { margin-right: auto; }
@media (max-width: 680px) {
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal { width: 100%; border-radius: 22px 22px 0 0; max-height: 92vh; animation: up .22s ease; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
@keyframes up { from { transform: translateY(40%); opacity: .4; } }

/* ---------- Toast ---------- */
.toast-root { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-b)); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (max-width: 860px) { .toast-root { bottom: calc(150px + var(--safe-b)); } }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
  animation: pop .2s ease; max-width: 90vw;
}
.toast.err { background: var(--neg); color: #fff; }

/* ---------- AI chat ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 150px); min-height: 420px; }
@media (max-width: 860px) { .chat-wrap { height: calc(100dvh - 190px - var(--safe-b)); } }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 6px 2px 16px; }
.msg { max-width: 86%; padding: 11px 15px; border-radius: 18px; font-size: 14.5px; line-height: 1.55; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg.ai p { margin: 0 0 8px; } .msg.ai p:last-child { margin-bottom: 0; }
.msg.ai ul, .msg.ai ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.ai table { border-collapse: collapse; margin: 6px 0; font-size: 13px; display: block; overflow-x: auto; }
.msg.ai th, .msg.ai td { border: 1px solid var(--border-2); padding: 5px 9px; text-align: left; }
.msg.ai code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.msg.ai h4 { margin: 6px 0 6px; font-size: 14.5px; }
.msg.err { background: var(--neg-soft); border-color: transparent; color: var(--neg); }
.typing { display: inline-flex; gap: 4px; } .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; }
.action-card { align-self: flex-start; width: min(420px, 92%); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); border-radius: 16px; padding: 14px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--border); }
.chat-input textarea { flex: 1; min-height: 46px; max-height: 140px; resize: none; padding: 12px 14px; border-radius: 14px; }
.chat-input .btn { height: 46px; width: 46px; padding: 0; border-radius: 14px; }
.mic-on { background: var(--neg) !important; color: #fff !important; border-color: transparent !important; }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.note { font-size: 13px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 11px 13px; border-radius: 12px; }
.note.warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.note a, .md-link { color: var(--accent); font-weight: 600; }
.bc-plot { position: relative; display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 8px; }
.bc-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.bc-col .b { width: 100%; max-width: 40px; border-radius: 8px 8px 3px 3px; background: var(--accent); min-height: 3px; opacity: .75; }
.bc-col .b.cur { background: var(--grad); opacity: 1; }
.bc-col .b.over { background: var(--neg); }
.bc-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--warn); opacity: .8; pointer-events: none; }
.bc-labels { display: flex; gap: 10px; margin-top: 6px; }
.bc-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.cat-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.person-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 600; font-size: 13.5px; }
.person-chip .avatar { width: 28px; height: 28px; font-size: 12px; }
button.person-chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
button.person-chip:not(.on) { opacity: .55; }
.split-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; padding: 6px 0; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 28px 0 12px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; color: transparent !important; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (max-width: 520px) {
  .hero .ring { width: 104px !important; height: 104px !important; }
  .hero .ring .big { font-size: 22px; }
  .hero .huge { font-size: 28px; }
}
.suggest { white-space: normal; height: auto; min-height: 30px; padding: 6px 12px; text-align: left; line-height: 1.35; }
.chat-log > * { max-width: 100%; }
.chat-log { overflow-x: hidden; }

/* ---------- Login ---------- */
body.locked .app, body.locked .fab, body.locked .tabbar { display: none !important; }
.login-screen {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b));
  background: radial-gradient(80% 60% at 100% 0%, rgba(34, 211, 170, .16), transparent 60%), radial-gradient(70% 60% at 0% 100%, rgba(124, 92, 255, .20), transparent 60%), var(--bg);
}
.login-card {
  width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; text-align: center; }
.login-card h1 b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card > p { margin: 0; text-align: center; }
.login-logo { border-radius: 18px; margin: 0 auto; }
.login-card .btn.block { height: 46px; }
