/* InstantLogs SaaS UI */

:root {
  --bg: #16181d;
  --bg-elev: #1d2027;
  --bg-elev-2: #252932;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-selected: rgba(56, 139, 253, 0.16);
  --border: #2f343e;
  --border-strong: #454c59;
  --text: #d6d9df;
  --text-muted: #8b93a1;
  --text-strong: #ffffff;
  --accent: #4c9aff;
  --accent-bg: rgba(76, 154, 255, 0.14);
  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, 0.12);
  --warn: #f2b84b;
  --warn-bg: rgba(242, 184, 75, 0.12);
  --ok: #3fcf8e;
  --ok-bg: rgba(63, 207, 142, 0.12);
  --debug: #8b93a1;
  --mark-bg: rgba(255, 196, 0, 0.28);
  --mark-text: #ffe08a;
  --json-key: #7cc4ff;
  --json-str: #a5d6a7;
  --json-num: #f8b36b;
  --json-lit: #d4a5ff;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --log-size: 13px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #f6f7f9;
  --bg-elev-2: #eceef2;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-selected: rgba(9, 105, 218, 0.12);
  --border: #dde1e6;
  --border-strong: #c3c9d2;
  --text: #1f2328;
  --text-muted: #636c76;
  --text-strong: #000000;
  --accent: #0969da;
  --accent-bg: rgba(9, 105, 218, 0.1);
  --danger: #cf222e;
  --danger-bg: rgba(207, 34, 46, 0.08);
  --warn: #9a6700;
  --warn-bg: rgba(212, 167, 44, 0.15);
  --ok: #1a7f37;
  --ok-bg: rgba(26, 127, 55, 0.1);
  --debug: #8c959f;
  --mark-bg: rgba(255, 210, 0, 0.45);
  --mark-text: inherit;
  --json-key: #0550ae;
  --json-str: #116329;
  --json-num: #953800;
  --json-lit: #8250df;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
}

a { color: var(--accent); }

button, input, select { font: inherit; color: inherit; }

code, pre, .mono { font-family: var(--mono); }

[hidden] { display: none !important; }

/* ---------- App shell ---------- */

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  height: 52px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-strong);
  text-decoration: none;
  white-space: nowrap;
}
.brand img { width: 30px; height: 30px; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-muted);
}
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs strong {
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spacer { flex: 1; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: block;
}
.avatar:hover { border-color: var(--accent); }

.main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.page {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px 48px;
}
.page-inner { max-width: 880px; margin: 0 auto; }

/* ---------- Generic controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { border-color: var(--text-muted); background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn-icon { width: 32px; padding: 0; }
.btn-sm.btn-icon { width: 26px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.1); border-color: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); border-color: transparent; }
.btn.is-on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.btn.is-warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }

.input {
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  min-width: 0;
}
.input:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.input.mono { font-family: var(--mono); font-size: 13px; }

.field-row { display: flex; gap: 8px; }
.field-row .input { flex: 1; }

.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-accent { background: var(--accent-bg); color: var(--accent); border-color: transparent; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.notice {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.notice-warn { border-color: var(--warn); background: var(--warn-bg); }
.notice-danger { border-color: var(--danger); background: var(--danger-bg); }

.copyable {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 10px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
}
.copyable > span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.code-block {
  position: relative;
  margin: 8px 0 16px;
}
.code-block pre {
  margin: 0;
  padding: 12px 14px;
  padding-right: 70px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}
.code-block .btn { position: absolute; top: 8px; right: 8px; }
.code-block em { color: var(--warn); font-style: normal; }

h1, h2, h3 { color: var(--text-strong); }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 20px 0 8px; }

/* ---------- Welcome ---------- */

.welcome { text-align: center; max-width: 640px; margin: 40px auto; }
.welcome h1 { font-size: 30px; margin: 0 0 4px; }
.welcome .lead { color: var(--text-muted); font-size: 16px; margin: 0 0 24px; }
.welcome .code-block { text-align: left; }

/* ---------- Loggers list ---------- */

.list-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.list-head h2 { margin: 0; margin-right: auto; }
.list-head .input { width: 220px; }

.loggers { display: grid; gap: 10px; }

.logger-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.logger-card:hover { border-color: var(--accent); }
.logger-card .name { font-weight: 600; font-size: 15px; color: var(--text-strong); display: flex; gap: 8px; align-items: center; }
.logger-card .meta { font-size: 12px; color: var(--text-muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logger-card .usage { grid-row: span 2; display: flex; gap: 16px; text-align: right; }
.usage-item .v { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.usage-item .k { font-size: 11px; color: var(--text-muted); }

.create-card { margin-bottom: 16px; }

.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

/* ---------- Log viewer ---------- */

.viewer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  flex-wrap: wrap;
}

.filterbox {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  cursor: text;
}
.filterbox:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: -1px; }
.filterbox.is-invalid { border-color: var(--danger); outline-color: var(--danger); }
.filterbox .icon { color: var(--text-muted); padding: 0 2px; font-size: 13px; }
.filterbox input {
  flex: 1;
  min-width: 140px;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 13px;
  height: 24px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  height: 22px;
  padding: 0 2px 0 8px;
  border-radius: 4px;
  background: var(--accent-bg);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  line-height: 1;
  padding: 0;
}
.chip button:hover { background: var(--accent-bg); }
.chip-and { font-size: 10px; color: var(--text-muted); font-weight: 600; }

.toolbar-group { display: flex; gap: 4px; align-items: center; }
.toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

.filter-error {
  padding: 4px 12px;
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-bg);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
}

.logs-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
}

.logs-area {
  flex: 1;
  min-width: 0;
  position: relative;
}

.logs {
  position: absolute;
  inset: 0;
  overflow: auto;
  font-family: var(--mono);
  font-size: var(--log-size);
  line-height: 1.5;
  padding: 4px 0 24px;
  overflow-anchor: none;
}

.ln {
  border-left: 3px solid transparent;
  min-width: max-content;
}
.ln-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0 12px 0 0;
  cursor: default;
}
.logs.wrap .ln { min-width: 0; }
.ln:hover { background: var(--bg-hover); }
.ln.is-selected { background: var(--bg-selected); }
.ln-no {
  flex-shrink: 0;
  width: 6ch;
  text-align: right;
  color: var(--text-muted);
  opacity: 0.6;
  user-select: none;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.ln-no:hover { opacity: 1; color: var(--accent); }
.logs.no-numbers .ln-no { width: 1ch; color: transparent; }
.ln-ts { flex-shrink: 0; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ln-lvl { flex-shrink: 0; width: 5ch; font-weight: 700; font-size: 0.9em; }
.ln-src { flex-shrink: 0; color: var(--accent); width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ln-msg { white-space: pre; flex: 1; }
.logs.wrap .ln-msg { white-space: pre-wrap; word-break: break-word; min-width: 0; }
.ln-msg mark { background: var(--mark-bg); color: var(--mark-text); border-radius: 2px; }

.ln.lvl-error { border-left-color: var(--danger); }
.ln.lvl-error .ln-lvl { color: var(--danger); }
.ln.lvl-warn { border-left-color: var(--warn); }
.ln.lvl-warn .ln-lvl { color: var(--warn); }
.ln.lvl-info .ln-lvl { color: var(--ok); }
.ln.lvl-debug .ln-lvl, .ln.lvl-debug .ln-msg { color: var(--debug); }

/* ---------- Table mode ---------- */

.tgrid {
  display: grid;
  grid-template-columns: var(--cols);
  column-gap: 12px;
  align-items: start;
}
.logs.table .ln, .logs.table .thead { width: max-content; min-width: 100%; }
.logs.table .ln-main { display: grid; gap: 0 12px; }
.td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.logs.wrap .td:last-child { white-space: pre-wrap; word-break: break-word; }
.td mark { background: var(--mark-bg); color: var(--mark-text); border-radius: 2px; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; }
.ln.lvl-debug .td { color: var(--debug); }
.logs.table .ln-ts { color: var(--text-muted); }

.thead {
  /* Same font as the rows: column widths are expressed in ch */
  position: sticky;
  top: -4px;
  z-index: 2;
  margin-top: -4px;
  padding: 4px 12px 4px 3px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  user-select: none;
}
.th-label, .th-no { font-family: var(--sans); font-size: 12px; font-weight: 600; }
.th {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  cursor: pointer;
  padding-right: 8px;
}
.th:hover { color: var(--text); }
.th-no { cursor: default; justify-content: flex-end; padding-right: 0; }
.th-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-sort { color: var(--accent); font-size: 10px; }
.th-hide {
  display: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.th:hover .th-hide { display: inline; }
.th-hide:hover { color: var(--danger); }
.th-rs {
  position: absolute;
  top: -4px;
  bottom: -4px;
  right: -8px;
  width: 9px;
  cursor: col-resize;
  z-index: 1;
}
.th-rs:hover, .th-rs:active { background: linear-gradient(var(--accent), var(--accent)) center / 2px 100% no-repeat; }

/* ---------- Line detail (parsed fields) ---------- */

.ln-detail {
  /* Stays in view when the table scrolls horizontally */
  position: sticky;
  left: 6ch;
  width: min(900px, 70vw);
  margin: 4px 12px 8px 6ch;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 12px;
  white-space: normal;
}
.ln-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-family: var(--sans); }
.kv-fields { display: grid; grid-template-columns: max-content 1fr max-content; }
.kv-row { display: contents; }
.kv-row > span { padding: 2px 8px 2px 0; border-top: 1px solid var(--border); }
.kv-k { color: var(--json-key); }
.kv-v { white-space: pre-wrap; word-break: break-word; color: var(--text); }
.kv-v mark { background: var(--mark-bg); color: var(--mark-text); }
.kv-acts { display: flex; gap: 2px; opacity: 0.35; }
.kv-row:hover > span { background: var(--bg-hover); }
.kv-row:hover .kv-acts { opacity: 1; }
.kv-acts .btn-sm { height: 20px; padding: 0 6px; }

/* ---------- Fields panel ---------- */

.fields-panel {
  width: 300px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 8px;
  font-size: 13px;
}
.fp-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.fp-formats { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.fp-search { width: 100%; height: 28px; margin-bottom: 6px; }
.fp-field { border-bottom: 1px solid var(--border); }
.fp-head { display: flex; align-items: center; gap: 6px; padding: 3px 2px; }
.fp-head input { margin: 0; cursor: pointer; }
.fp-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 0;
}
.fp-name:hover { color: var(--accent); }
.fp-cov { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fp-values { padding: 0 0 6px 20px; }
.fp-val {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 12px;
}
.fp-bar { position: absolute; left: 0; top: 2px; bottom: 2px; background: var(--accent-bg); border-radius: 3px; z-index: 0; }
.fp-vtext { position: relative; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-count { position: relative; color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.fp-val .btn-sm { position: relative; height: 18px; padding: 0 5px; opacity: 0; }
.fp-val:hover .btn-sm { opacity: 1; }
.fp-section { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.fp-title { font-weight: 600; margin-bottom: 2px; }

/* ---------- Segmented control & local chips ---------- */

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.seg-btn {
  height: 30px;
  padding: 0 10px;
  border: 0;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  cursor: pointer;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border-strong); }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-on { background: var(--accent-bg); color: var(--accent); }

.chip-local { background: var(--ok-bg); color: var(--ok); }
.chip-local b { font-weight: 700; opacity: 0.8; }
.chip-local button:hover { background: var(--ok-bg); }
.logs.no-levels .ln { border-left-color: transparent; }

.j-key { color: var(--json-key); }
.j-str { color: var(--json-str); }
.j-num { color: var(--json-num); }
.j-lit { color: var(--json-lit); }
.j-pretty {
  display: block;
  margin: 4px 0 6px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  white-space: pre;
  overflow-x: auto;
}

.line-actions {
  position: absolute;
  right: 12px;
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 3;
}

.logs-placeholder {
  padding: 32px 16px;
  font-family: var(--sans);
  font-size: 14px;
  background: var(--bg);
  z-index: 2;
}

.jump {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  box-shadow: var(--shadow);
  border-radius: 999px;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  height: 26px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}
.statusbar .num { font-variant-numeric: tabular-nums; color: var(--text); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); margin-right: 6px; vertical-align: 0; }
.st-live .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); animation: pulse 2s infinite; }
.st-paused .dot { background: var(--warn); }
.st-error .dot { background: var(--danger); }
.st-connecting .dot { background: var(--accent); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }

.selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

/* ---------- Menus & drawers ---------- */

.menu {
  position: absolute;
  z-index: 50;
  min-width: 220px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.menu label, .menu .menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.menu label:hover, .menu .menu-item:hover { background: var(--bg-hover); }
.menu .menu-item { width: 100%; border: 0; background: transparent; text-align: left; text-decoration: none; color: inherit; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu .menu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; }
.menu select { background: var(--bg); border: 1px solid var(--border-strong); border-radius: 4px; height: 26px; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 60;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100vw);
  z-index: 61;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.drawer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 0;
}
.drawer-head h2 { margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text-strong); border-bottom-color: var(--accent); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-elev); }
.stat .v { font-size: 20px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--text-muted); }

.meter { height: 8px; border-radius: 4px; background: var(--bg-elev-2); overflow: hidden; }
.meter > div { height: 100%; background: var(--accent); }
.blocks { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 8px; }
.block { height: 28px; border-radius: 4px; background: var(--bg-elev-2); position: relative; overflow: hidden; border: 1px solid var(--border); }
.block > div { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); opacity: 0.7; }
.block.is-empty { border-style: dashed; background: transparent; }

.item-list { display: grid; gap: 8px; }
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; color: var(--text-strong); }
.item .sub { font-size: 12px; color: var(--text-muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.secret-box { margin-top: 10px; display: grid; gap: 6px; }
.secret-box label { font-size: 12px; color: var(--text-muted); }

.chips-list { display: flex; flex-wrap: wrap; gap: 6px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: grid;
  gap: 6px;
  justify-items: center;
  pointer-events: none;
}
.toast {
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  color: var(--text-strong);
  font-size: 13px;
  max-width: 90vw;
}
.toast-error { border-color: var(--danger); color: var(--danger); }

/* ---------- Embed ---------- */

body.embed .topbar { display: none; }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .logs-wrap { position: relative; }
  .ln-detail { left: 0; width: calc(100vw - 16px); margin-left: 4px; }
  .fields-panel { position: absolute; z-index: 5; top: 0; bottom: 0; left: 0; width: 85vw; box-shadow: var(--shadow); }
  .topbar { padding: 0 8px; gap: 8px; }
  .brand span { display: none; }
  .logger-card { grid-template-columns: 1fr; }
  .logger-card .usage { grid-row: auto; text-align: left; }
  .list-head .input { width: 100%; }
  .hide-sm { display: none !important; }
  .blocks { grid-template-columns: repeat(5, 1fr); }
}
