/* Tavra Lite admin — dark, Geist, matches the Tavra visual language.
   No design system dependency, all inline tokens at :root. */

:root {
  --bg:              #0b0c10;
  --surface:         #14151b;
  --surface-2:       #1a1c24;
  --border:          rgba(255,255,255,0.08);
  --border-strong:   rgba(255,255,255,0.14);
  --text:            #ecedf1;
  --text-2:          #a8acb7;
  --text-3:          #6b6f7c;
  --accent:          #b8b6ff;   /* periwinkle — same as landing */
  --accent-2:        #9d9bff;
  --ok:              #34d399;
  --warn:            #f59e0b;
  --err:             #f87171;
  --mono:            "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: "Geist", system-ui, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

.hidden { display: none !important; }
.empty { padding: 40px; text-align: center; color: var(--text-3); font-size: 13px; }

/* Token gate */
.gate {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: 100;
}
.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 380px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.gate-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.gate-sub { font-size: 12px; color: var(--text-2); margin: 0 0 18px; line-height: 1.55; }
.gate-sub code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-family: var(--mono); font-size: 11px; }
.gate-card input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  margin-bottom: 12px;
}
.gate-card input:focus { border-color: var(--accent); }
.gate-card button {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #14161f;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}
.gate-card button:hover { background: var(--accent-2); }
.gate-err { color: var(--err); font-size: 11px; margin: 10px 0 0; min-height: 14px; }

/* Topbar */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-t {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  background: var(--accent); color: #14161f;
  border-radius: 6px; font-weight: 700; font-family: var(--mono);
  font-size: 14px;
}
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.brand-tier { color: var(--text-3); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: inherit;
  font-family: inherit;
}
button.pill { cursor: pointer; }
button.pill:hover { border-color: var(--text-3); color: var(--text); }
.pill-muted { color: var(--text-3); }
.pill-ok    { color: var(--ok);   border-color: color-mix(in srgb, var(--ok)   50%, transparent); }
.pill-warn  { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.pill-err   { color: var(--err);  border-color: color-mix(in srgb, var(--err)  50%, transparent); }

.btn-ghost {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-3); }

/* Summary row */
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 2px; font-family: var(--mono); }
.stat-hint  { font-size: 11px; color: var(--text-3); }

/* Tabs */
.tabs {
  display: flex; gap: 4px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tab {
  padding: 12px 16px;
  background: transparent;
  border: 0;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab-active { color: var(--text); border-bottom-color: var(--accent); }

.tab-panel { padding: 20px 28px 40px; }
.panel-header { margin-bottom: 16px; }
.panel-header h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.panel-header p  { margin: 0; color: var(--text-3); font-size: 12px; }

.filter-row {
  display: flex; flex-wrap: wrap; gap: 12px 18px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.filter-row label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; }

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl thead th {
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); color: var(--text); }
.tbl code, .mono { font-family: var(--mono); font-size: 11.5px; color: var(--text); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-active { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot-idle   { background: var(--text-3); }

/* Events list */
.events-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 0;
  max-height: 65vh;
  overflow-y: auto;
}
.event-row {
  display: grid;
  grid-template-columns: 90px 130px 180px 1fr;
  gap: 12px;
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 11.5px;
  border-bottom: 1px solid var(--border);
}
.event-row:last-child { border-bottom: 0; }
.event-row .ts { color: var(--text-3); }
.event-row .kind { color: var(--accent); font-weight: 500; }
.event-row .sid  { color: var(--text-3); }
.event-row .body { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0,0,0,0.55); animation: fadein 120ms ease; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(720px, 95vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: slidein 200ms cubic-bezier(0.2,0.7,0.2,1);
}
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
@keyframes slidein { from { transform: translateX(20px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }
.drawer-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-title { font-size: 15px; font-weight: 600; }
.drawer-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; font-family: var(--mono); }
.drawer-body {
  overflow-y: auto;
  padding: 20px 24px 40px;
  flex: 1;
}
.drawer-body h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 20px 0 8px; font-weight: 600; }
.drawer-body h3:first-child { margin-top: 0; }
.drawer-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  overflow-x: auto;
  max-height: 400px;
  white-space: pre;
}

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 12px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); font-family: var(--mono); font-size: 11.5px; word-break: break-all; }

/* Drawer actions strip — sits above the timeline */
.drawer-actions {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
}
.drawer-actions-hint { font-size: 11px; color: var(--text-3); }

.linky { color: var(--accent); font-size: 11px; }
.dom-row:hover .linky { text-decoration: underline; }

/* Inline DOM viewer inside the session drawer */
.dom-viewer {
  margin-top: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.dom-viewer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.dom-viewer-actions { display: flex; gap: 8px; }
.dom-viewer-pre {
  margin: 0;
  padding: 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  overflow: auto;
  max-height: 500px;
  white-space: pre;
  background: var(--surface-2);
  border: 0;
  border-radius: 0;
}

/* Whitelist editor */
.wl-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  max-width: 640px;
}
.wl-list { list-style: none; margin: 0 0 14px; padding: 0; }
.wl-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.wl-item:hover { border-color: var(--text-3); }
.wl-empty { color: var(--text-3); font-size: 12px; padding: 20px; text-align: center; list-style: none; }
.wl-add {
  display: flex; gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.wl-add input {
  flex: 1;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.wl-add input:focus { border-color: var(--accent); }
.wl-add button {
  padding: 8px 16px;
  background: var(--accent);
  color: #14161f;
  border: 0;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.wl-hint { font-size: 11px; color: var(--text-3); margin: 10px 0 0; }
.wl-hint code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-family: var(--mono); font-size: 10px; }

@media (max-width: 800px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .topbar, .tabs, .tab-panel { padding-left: 16px; padding-right: 16px; }
  .event-row { grid-template-columns: 70px 100px 1fr; }
  .event-row .sid { display: none; }
}
