/* bloot admin — tokens from the admin Figma (0jYN2X2aKNo2x8KiBNJmeW), Dark mode. */
@font-face { font-family: 'Geist'; src: url('fonts/Geist-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('fonts/GeistMono-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --bg-canvas: #0a0a0a; --bg-surface: #121212; --bg-raised: #1a1a1a; --bg-hover: #232323; --bg-selected: #2c2c2c;
  --border: #232323; --border-strong: #2e2e2e;
  --fg: #f2f2f0; --fg-2: #a6a6a1; --fg-3: #86857f; --fg-inverse: #0a0a0a;
  --accent: #0338fa; --accent-text: #8fa6ff; --accent-subtle: #0b1a4d; --focus: #3d63ff;
  --success: #3dd68c; --warning: #f5b83d; --danger: #ff6359;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;
  --shadow-popover: 0 12px 32px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.25);
  --shadow-modal: 0 24px 64px rgba(0,0,0,.6), 0 4px 12px rgba(0,0,0,.3);
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg-canvas); color: var(--fg); }
body { font: 400 14px/1.43 var(--font); letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.icon { width: 20px; height: 20px; fill: currentColor; flex: none; display: block; }
.icon.sm { width: 16px; height: 16px; }
.icon.xs { width: 12px; height: 12px; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0; }
.muted { color: var(--fg-2); }
.faint { color: var(--fg-3); }
.meta { font-size: 12px; line-height: 1.33; color: var(--fg-3); letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ── top bar ─────────────────────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 24px;
  padding: 0 24px; background: var(--bg-canvas); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--fg-2); }
.brand svg { width: 24px; height: 16px; fill: var(--fg); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav a { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-full);
  color: var(--fg-2); font-weight: 500; font-size: 13px; white-space: nowrap; }
.nav a:hover { color: var(--fg); background: var(--bg-surface); }
.nav a.on { color: var(--fg); background: var(--bg-hover); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--fg); color: var(--fg-inverse);
  font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.topbar .me { margin-left: auto; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-selected); color: var(--fg); display: inline-flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex: none; letter-spacing: 0; }
.avatar.lg { width: 64px; height: 64px; font-size: 18px; }
button.avatar { border: 0; cursor: pointer; }

/* ── page ────────────────────────────────────────────────────────────────── */
main { max-width: 1248px; margin: 0 auto; padding: 32px 24px 96px; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; min-height: 36px; }
h1 { font-size: 24px; line-height: 1.33; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 16px; line-height: 1.5; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.updated { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-3); }
.updated .icon { width: 14px; height: 14px; }
.section-title { margin: 32px 0 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; color: var(--fg); margin-bottom: 16px; }
.back .icon { width: 14px; height: 14px; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.split { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid.cols-4, .grid.cols-3 { grid-template-columns: 1fr; } main { padding: 24px 16px 80px; } }

.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.card.pad { padding: 16px; }
.card.pad-lg { padding: 20px; }
.stat .label { font-size: 13px; color: var(--fg-2); }
.stat .value { font-size: 28px; line-height: 1.14; font-weight: 600; letter-spacing: -0.02em; margin: 6px 0 8px; font-variant-numeric: tabular-nums; }
.stat .value.warn { color: var(--warning); }
.stat.clickable { cursor: pointer; text-align: left; color: inherit; width: 100%; }
.stat.clickable:hover { border-color: var(--border-strong); }
.stat.selected { border-color: var(--fg-3); background: var(--bg-raised); }
.stat .head { display: flex; align-items: center; gap: 10px; }
.stat .head img { width: 28px; height: 28px; border-radius: 7px; }
.stat .pair { display: flex; gap: 24px; margin-top: 14px; }
.stat .pair .value { font-size: 20px; margin: 0 0 2px; }

/* ── rows / lists ────────────────────────────────────────────────────────── */
.rows > .row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--border); }
.rows > .row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 13px; font-weight: 500; line-height: 1.23; }
.row .icon.warn { color: var(--warning); }

.product-line { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; }
.product-line img, .picon { width: 20px; height: 20px; border-radius: 5px; flex: none; }
.product-line .n { margin-left: auto; color: var(--fg-2); font-variant-numeric: tabular-nums; }

/* ── buttons, chips, inputs ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px;
  border-radius: var(--r-full); border: 0; background: var(--bg-hover); color: var(--fg); font-weight: 500; font-size: 13px;
  cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg-selected); }
.btn.sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn.primary { background: var(--fg); color: var(--fg-inverse); }
.btn.primary:hover { background: #ffffff; }
.btn.danger { color: var(--danger); }
.btn.danger-solid { background: var(--danger); color: #1a0402; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.icon-only { width: 36px; padding: 0; }
.btn.icon-only.sm { width: 28px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn .icon { width: 16px; height: 16px; }
.icon-btn { background: transparent; border: 0; color: var(--fg-3); width: 28px; height: 28px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--bg-hover); color: var(--fg); }
.icon-btn .icon { width: 16px; height: 16px; }

.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-full);
  background: var(--bg-hover); color: var(--fg-2); font-size: 12px; font-weight: 500; white-space: nowrap; letter-spacing: 0; }
.dot { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; }
.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--fg-3); flex: none; }
.dot.ok::before { background: var(--success); }
.dot.warn::before { background: var(--warning); }
.dot.bad::before { background: var(--danger); }

.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: var(--r-full); background: var(--bg-canvas); flex-wrap: wrap; }
.seg button, .seg a { height: 28px; padding: 0 12px; border: 0; border-radius: var(--r-full); background: transparent; color: var(--fg-2);
  font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button:hover, .seg a:hover { color: var(--fg); }
.seg .on { background: var(--bg-hover); color: var(--fg); }
.seg .count { color: var(--fg-3); font-variant-numeric: tabular-nums; }

.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; min-width: 300px; flex: 0 1 380px;
  border: 1px solid var(--border); border-radius: var(--r-full); background: var(--bg-surface); color: var(--fg-3); }
.search:focus-within { border-color: var(--fg-3); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font-size: 13px; }
.search input::placeholder { color: var(--fg-3); }
.filters .sort { margin-left: auto; font-size: 12px; color: var(--fg-3); }

.field { display: block; margin-top: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.input, textarea.input { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-canvas); color: var(--fg); font-size: 13px; outline: 0; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.4; }
.input:focus { border-color: var(--focus); }

/* ── tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; font-weight: 400; font-size: 12px; color: var(--fg-3); padding: 12px 16px; white-space: nowrap;
  border-bottom: 1px solid var(--border); letter-spacing: 0; }
table.list td { padding: 0 16px; height: 56px; border-top: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
table.list tr:first-child td { border-top: 0; }
table.list tbody tr.link { cursor: pointer; }
table.list tbody tr.link:hover td { background: var(--bg-raised); }
table.list td.wrap { white-space: normal; max-width: 420px; }
table.list td.clip { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
table.list td.right, table.list th.right { text-align: right; }
table.list td.date { color: var(--fg-2); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.person .sub { font-size: 12px; color: var(--fg-3); letter-spacing: 0; }
.table-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--fg-3); }
.table-foot .spacer { flex: 1; }
.empty { padding: 40px 16px; text-align: center; color: var(--fg-3); font-size: 13px; }
.loading { padding: 40px 16px; text-align: center; color: var(--fg-3); font-size: 13px; }
.error-box { padding: 24px 16px; text-align: center; color: var(--fg-2); font-size: 13px; }
.error-box .btn { margin-top: 12px; }
.share-bar { width: 160px; height: 6px; border-radius: 3px; background: var(--bg-selected); overflow: hidden; }
.share-bar > i { display: block; height: 100%; background: var(--fg-2); border-radius: 3px; }

/* ── person page ─────────────────────────────────────────────────────────── */
.person-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.person-head .who { flex: 1; min-width: 260px; }
.person-head .line { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; font-size: 13px; color: var(--fg-2); }
.person-head .line .tg { display: inline-flex; align-items: center; gap: 5px; }
.person-head .line .tg .icon { width: 14px; height: 14px; }
.person-head .actions { display: flex; gap: 12px; align-items: center; }
.copy { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--fg-2); }
.copy .icon { width: 12px; height: 12px; color: var(--fg-3); }
.facts { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-bottom: 24px; }
.facts > div { padding: 14px 16px; border-left: 1px solid var(--border); min-width: 0; }
.facts > div:first-child { border-left: 0; }
.facts .k { font-size: 12px; color: var(--fg-3); letter-spacing: 0; }
.facts .v { font-size: 13px; font-weight: 500; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } .facts > div:nth-child(5) { border-left: 0; } .facts > div:nth-child(n+5) { border-top: 1px solid var(--border); } }
@media (max-width: 640px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .facts > div { border-left: 0 !important; border-top: 1px solid var(--border); } .facts > div:nth-child(-n+2) { border-top: 0; } }
.notice { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--bg-surface); font-size: 13px; }
.notice .icon { color: var(--warning); }
.notice.bad .icon { color: var(--danger); }
.notice .grow { flex: 1; }
.tabs { margin-bottom: 16px; }
.note-card { padding: 16px; margin-bottom: 24px; display: flex; gap: 16px; align-items: flex-start; }
.note-card .grow { flex: 1; white-space: pre-wrap; font-size: 13px; }
.foot-note { margin-top: 12px; font-size: 12px; color: var(--fg-3); }

/* ── chart ───────────────────────────────────────────────────────────────── */
.chart-card { padding: 20px; }
.chart-card .head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.chart-card .head .seg { margin-left: auto; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.bars > i { flex: 1; min-width: 2px; background: var(--bg-selected); border-radius: 2px 2px 0 0; position: relative; }
.bars > i.now { background: var(--fg); }
.bars > i:hover { background: var(--fg-3); }
.bars > i.now:hover { background: var(--fg); }
.bars > i::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: 6px; padding: 3px 7px; font-size: 11px; color: var(--fg);
  white-space: nowrap; pointer-events: none; opacity: 0; font-style: normal; z-index: 2; }
.bars > i:hover::after { opacity: 1; }
.axis { display: flex; justify-content: space-between; margin-top: 12px; font-size: 12px; color: var(--fg-3); }

/* ── system ──────────────────────────────────────────────────────────────── */
.meter { height: 6px; border-radius: 3px; background: var(--bg-selected); margin: 10px 0 8px; overflow: hidden; }
.meter > i { display: block; height: 100%; min-width: 4px; border-radius: 3px; background: var(--fg-2); }
.meter.warn > i { background: var(--warning); }
.switch-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--fg-2); margin-top: 6px; }

/* ── dialogs, menus, toasts ──────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.48); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center; padding: 96px 16px 32px; overflow-y: auto; }
.dialog { width: 100%; max-width: 480px; background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal); }
.dialog.wide { max-width: 760px; }
.dialog:focus { outline: none; }
.dialog .d-head { display: flex; align-items: center; gap: 12px; padding: 20px 20px 0; }
.dialog .d-head h2 { flex: 1; }
.dialog .d-body { padding: 16px 20px 20px; font-size: 13px; color: var(--fg-2); }
.dialog .d-body p { margin: 0 0 8px; }
.dialog .d-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 16px 20px; border-top: 1px solid var(--border); }
.dialog .d-foot .left { margin-right: auto; }
.dialog .summary { margin-top: 16px; font-size: 13px; color: var(--fg-2); }
.dialog .msg { margin-top: 12px; color: var(--danger); font-size: 13px; }
.receipt { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
@media (max-width: 760px) { .receipt { grid-template-columns: 1fr; } }
.receipt .image { background: var(--bg-hover); border-radius: var(--r-md); min-height: 400px; display: flex; align-items: center;
  justify-content: center; flex-direction: column; gap: 8px; color: var(--fg-3); overflow: hidden; font-size: 12px; }
.receipt .image img { width: 100%; height: 100%; max-height: 520px; object-fit: contain; display: block; cursor: zoom-in; }
.kv { display: grid; grid-template-columns: 150px 1fr; font-size: 13px; }
.kv > div { padding: 10px 0; border-bottom: 1px solid var(--border); }
.kv > .k { color: var(--fg-2); }
.kv > .v { color: var(--fg); min-width: 0; overflow-wrap: anywhere; }
.message-box { padding: 16px; border-radius: var(--r-md); background: var(--bg-surface); border: 1px solid var(--border); color: var(--fg);
  font-size: 14px; white-space: pre-wrap; margin: 16px 0; }
.keys { font-size: 12px; color: var(--fg-3); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-strong); color: var(--fg-2); }

.menu { position: fixed; z-index: 60; min-width: 200px; padding: 6px; background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-popover); }
.menu button, .menu .item { display: flex; width: 100%; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 0;
  border-radius: var(--r-sm); background: none; text-align: left; cursor: pointer; font-size: 13px; color: var(--fg); }
.menu button:hover { background: var(--bg-hover); }
.menu button.danger { color: var(--danger); }
.menu .icon { width: 16px; height: 16px; color: var(--fg-3); }
.menu button.danger .icon { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu .item { cursor: default; color: var(--fg-3); font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; padding: 10px 16px; border-radius: var(--r-full);
  background: var(--fg); color: var(--fg-inverse); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-popover); }
.toast.bad { background: var(--danger); color: #1a0402; }

/* ── sign-in ─────────────────────────────────────────────────────────────── */
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.signin .box { width: 100%; max-width: 360px; text-align: center; }
.signin .mark { width: 48px; height: 32px; fill: var(--fg); margin: 0 auto 20px; display: block; }
.signin h1 { margin-bottom: 8px; }
.signin p { color: var(--fg-2); margin: 0 0 24px; font-size: 14px; }
.signin .btn { width: 100%; height: 40px; }
.signin .btn + .btn { margin-top: 8px; }
.signin .waiting { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--fg-2); font-size: 13px; margin-bottom: 24px; }
.signin .err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--bg-selected); border-top-color: var(--fg); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
