/* db.shareos.ai — brand tokens from /brand.css; rounded like the chat workspace. */
:root { --r: 10px; --side: 264px; --drawer: 440px; --line: var(--sv-hairline); --muted: var(--sv-ink-secondary); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--sv-font-sans); color: var(--sv-ink); background: var(--sv-surface); }
button, input, select { font: inherit; color: inherit; }
.faint { color: var(--muted); }
.pad { padding: 24px; }
.mono { font-family: var(--sv-font-mono); font-size: 12.5px; }
.mark { font-size: 16px; white-space: nowrap; }
.mark span { color: var(--muted); margin-left: 4px; }

.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); display: grid; gap: 16px; }

#app { height: 100%; display: grid; grid-template: 52px 1fr / var(--side) 1fr auto; }
.bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--sv-surface-raised); }
.grow { flex: 1; }
.bar > * { flex: none; }
.bar > .grow { flex: 1; }
select, input[type=search] { background: var(--sv-surface-raised); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.btn { background: var(--sv-surface-raised); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.btn:hover { border-color: var(--sv-ink); }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.btn.icon { padding: 5px 9px; }
.views { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.views button { border: 0; background: none; padding: 5px 14px; cursor: pointer; }
.views button[aria-pressed=true] { background: var(--sv-emphasis-surface); color: var(--sv-emphasis-ink); }

.side { border-right: 1px solid var(--line); overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.side input { width: 100%; }
.group h3 { margin: 10px 6px 4px; font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.src { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.src:hover { background: var(--sv-surface-sunken); }
.src[aria-current=true] { background: var(--sv-emphasis-surface); color: var(--sv-emphasis-ink); }
.src[aria-current=true] .count { color: inherit; opacity: .7; }
.src .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

main { overflow: auto; min-width: 0; min-height: 0; position: relative; }

/* Map */
.map { position: absolute; inset: 0; }
.map svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.map svg.dragging { cursor: grabbing; }
.map .edge { fill: none; stroke: var(--sv-ink-tertiary); stroke-opacity: .35; stroke-width: 1.3; }
.map .edge.hot { stroke: var(--sv-accent); stroke-opacity: 1; stroke-width: 2.2; }
.map .node rect { fill: var(--sv-surface-raised); stroke: var(--line); stroke-width: 1; }
.map .node { cursor: pointer; }
.map .node text { fill: var(--sv-ink); font-size: 13px; }
.map .node .n { fill: var(--muted); font-size: 11.5px; }
.map .node.hot rect { stroke: var(--sv-ink); stroke-width: 1.6; }
.map.focus .node:not(.hot), .map.focus .edge:not(.hot) { opacity: .18; }
.map-legend { position: absolute; left: 16px; bottom: 16px; background: var(--sv-surface-raised); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; max-width: 360px; font-size: 12.5px; color: var(--muted); }
.map-legend b { color: var(--sv-ink); font-weight: 500; }

/* Table */
.head { padding: 20px 24px 12px; display: grid; gap: 8px; }
.head h1 { margin: 0; font-size: 22px; font-weight: 500; }
.head .sub { color: var(--muted); }
.rel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rel .lbl { color: var(--muted); font-size: 12.5px; margin-right: 2px; }
.tools { display: flex; gap: 8px; align-items: center; padding: 0 24px 12px; flex-wrap: wrap; }
.tools input { width: 280px; }
.filter { display: inline-flex; gap: 6px; align-items: center; background: var(--sv-surface-sunken); border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12.5px; }
.filter button { border: 0; background: none; cursor: pointer; padding: 0 6px; }
.grid-wrap { overflow: auto; border-top: 1px solid var(--line); }
table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 7px 12px; text-align: left; vertical-align: top; max-width: 320px; }
th { position: sticky; top: 0; background: var(--sv-surface-raised); font-weight: 500; font-size: 12.5px; white-space: nowrap; z-index: 1; }
th .t { color: var(--muted); font-weight: 400; margin-left: 4px; font-size: 11px; }
th.link { color: var(--sv-ink); }
th:first-child, td:first-child { position: sticky; left: 0; background: var(--sv-surface-raised); z-index: 2; border-right: 1px solid var(--line); }
th:first-child { z-index: 3; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--sv-surface-sunken); }
tbody tr[aria-selected=true] td { background: color-mix(in srgb, var(--sv-accent) 14%, var(--sv-surface-raised)); }
td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td .nil { color: var(--muted); opacity: .6; }
.pager { display: flex; gap: 8px; align-items: center; padding: 12px 24px 24px; color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px 1px 6px; background: var(--sv-surface-raised); cursor: pointer; font-size: 12.5px; white-space: nowrap; vertical-align: middle; }
.chip:hover { border-color: var(--sv-ink); }
.chip .txt { overflow: hidden; text-overflow: ellipsis; }
.chip.more { padding: 1px 9px; }
.pill { display: inline-block; border-radius: 999px; padding: 0 8px; font-size: 12px; background: var(--sv-surface-sunken); border: 1px solid var(--line); }
.pill.ok { border-color: color-mix(in srgb, var(--sv-accent) 60%, transparent); }
.pill.warn { border-color: var(--sv-attention); color: var(--sv-attention); }

/* Drawer */
.drawer { width: var(--drawer); border-left: 1px solid var(--line); background: var(--sv-surface-raised); overflow: auto; padding: 18px 20px 40px; }
.drawer h2 { margin: 4px 0 2px; font-size: 18px; font-weight: 500; overflow-wrap: anywhere; }
.drawer .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.drawer section { margin-top: 18px; }
.drawer h4 { margin: 0 0 8px; font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(96px, 36%) 1fr; gap: 6px 12px; }
.kv > .k { color: var(--muted); overflow-wrap: anywhere; }
.kv > .v { overflow-wrap: anywhere; white-space: pre-wrap; min-width: 0; }
.kv > .v .chip { margin: 0 4px 4px 0; }
details { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 0 0 6px; }
details summary { cursor: pointer; color: var(--muted); }
pre { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.5 var(--sv-font-mono); max-height: 420px; overflow: auto; }
.back { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.back .row { display: flex; align-items: center; gap: 8px; }
.back .chips { display: flex; flex-wrap: wrap; gap: 4px; }

.tip { position: fixed; pointer-events: none; z-index: 10; background: var(--sv-emphasis-surface); color: var(--sv-emphasis-ink); padding: 5px 9px; border-radius: 6px; font-size: 12.5px; max-width: 320px; }
.error { margin: 24px; padding: 12px 14px; border: 1px solid var(--sv-attention); border-radius: var(--r); color: var(--sv-attention); }

@media (max-width: 900px) {
  #app { grid-template: 52px auto 1fr / minmax(0, 1fr); }
  .bar { overflow-x: auto; gap: 8px; padding: 0 10px; }
  #theme { display: none; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 34vh; }
  .drawer { position: fixed; inset: 52px 0 0 auto; width: min(100%, var(--drawer)); z-index: 5; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .25); }
  .bar .mark span, #fresh { display: none; }
  .tools input { width: 100%; }
}
