:root {
  --bg: #0a0a0a;
  --bg-2: #111111;
  --bg-3: #171717;
  --bg-4: #1c1c1c;
  --bg-hover: #222222;
  --border: #2a2a2a;
  --border-2: #333;
  --text: #f0f0f0;
  --muted: #8a8a8a;
  --muted-2: #6a6a6a;
  --accent: #5b8cff;
  --ok: #3ecf8e;
  --warn: #f5a524;
  --danger: #ff5c6c;
  --sidebar-w: 248px;
  --top-h: 48px;
  --radius: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }

/* Shell */
#app {
  display: grid;
  grid-template-rows: var(--top-h) 1fr;
  height: 100vh;
  width: 100vw;
}

/* Top bar */
.topbar {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 40;
  padding: 0 10px 0 0;
}
.top-left {
  display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 100%;
  border-right: 1px solid var(--border);
}
.ws-chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;
  max-width: 180px;
}
.ws-chip:hover { background: var(--bg-3); }
.ws-icon {
  width: 22px; height: 22px; border-radius: 6px; background: #222;
  display: grid; place-items: center; font-size: 12px; flex: 0 0 auto;
  border: 1px solid var(--border);
}
.ws-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 6px; color: var(--muted);
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
.top-center { display: flex; align-items: center; gap: 8px; padding-left: 14px; font-size: 13px; font-weight: 600; }
.top-center .count { color: var(--muted); font-weight: 500; margin-left: 4px; }
.badge-beta {
  font-size: 10px; font-weight: 700; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 7px; margin-left: 6px; text-transform: lowercase;
}
.top-right { display: flex; align-items: center; gap: 4px; }
.top-action {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px;
  color: var(--muted); font-size: 13px;
}
.top-action:hover { background: var(--bg-3); color: var(--text); }
.kbd {
  font-size: 10px; color: var(--muted-2); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-family: var(--mono); background: var(--bg-2);
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, #5b8cff, #3dd6c6);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-left: 6px;
}

/* Body */
.body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
}

/* Sidebar */
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex; flex-direction: column; min-height: 0;
}
.side-nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--muted); font-size: 13px; width: 100%; text-align: left;
}
.side-item:hover { background: var(--bg-3); color: var(--text); }
.side-item.active { background: var(--bg-3); color: var(--text); }
.side-item .shortcut { margin-left: auto; display: flex; gap: 2px; }
.side-item.primary { color: var(--text); }
.side-divider { height: 1px; background: var(--border); margin: 8px 10px; }

.comp-list {
  flex: 1; overflow: auto; padding: 4px 8px 12px; display: flex; flex-direction: column; gap: 8px;
}
.comp-thumb {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-2);
  cursor: pointer; text-align: left; padding: 0; width: 100%;
}
.comp-thumb:hover, .comp-thumb.active { border-color: #444; }
.comp-thumb .preview {
  height: 96px; background: #0d0d0d; border-bottom: 1px solid var(--border);
  display: grid; place-items: center; color: var(--muted-2); font-size: 11px; font-family: var(--mono);
  position: relative; overflow: hidden;
}
.comp-thumb .preview canvas { width: 100%; height: 100%; display: block; opacity: 0.85; }
.comp-thumb .meta {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px;
}
.comp-thumb .meta .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.dot.off { background: var(--muted-2); }
.dot.busy { background: var(--warn); }

.side-foot {
  border-top: 1px solid var(--border); padding: 10px; display: flex; align-items: center; gap: 8px;
}
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who .n { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who .r { font-size: 11px; color: var(--muted); }

/* Main canvas area */
.main {
  position: relative; min-width: 0; min-height: 0; background: var(--bg);
  overflow: hidden;
}

/* Infinite canvas */
.canvas-viewport {
  position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none;
  background:
    radial-gradient(circle at 1px 1px, #1a1a1a 1px, transparent 0) 0 0 / 24px 24px,
    var(--bg);
}
.canvas-viewport.panning { cursor: grabbing; }
.canvas-world {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform;
}
.canvas-toolbar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; border-radius: 12px;
  background: rgba(20,20,20,0.92); border: 1px solid var(--border); backdrop-filter: blur(8px);
  z-index: 20;
}
.canvas-toolbar button {
  width: 34px; height: 34px; border-radius: 8px; color: var(--muted); display: grid; place-items: center;
}
.canvas-toolbar button:hover, .canvas-toolbar button.active { background: var(--bg-hover); color: var(--text); }
.canvas-toolbar .sep { width: 1px; background: var(--border); margin: 4px 2px; }

.pc-card {
  position: absolute; width: 320px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-3); overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  user-select: none;
}
.pc-card.selected { border-color: #4a6fa5; box-shadow: 0 0 0 1px #4a6fa5, 0 16px 48px rgba(0,0,0,0.45); }
.pc-card .screen {
  height: 190px; background: #0b0b0b; border-bottom: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.pc-card .screen .fake-term {
  position: absolute; inset: 10px; border-radius: 6px; background: #0e0e0e; border: 1px solid #222;
  padding: 10px; font-family: var(--mono); font-size: 10px; color: #9fefb0; line-height: 1.45;
  overflow: hidden;
}
.pc-card .bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px;
}
.pc-card .bar .title { flex: 1; font-weight: 600; }
.pc-card .bar .os { color: var(--muted); font-weight: 500; }
.pc-new {
  position: absolute; width: 320px; height: 248px; border-radius: 12px;
  border: 1px dashed #3a3a3a; color: var(--muted); display: grid; place-items: center;
  gap: 8px; background: transparent;
}
.pc-new:hover { border-color: #555; color: var(--text); background: rgba(255,255,255,0.02); }
.pc-new .plus { font-size: 28px; line-height: 1; }

/* Follow / jump chips */
.presence {
  position: absolute; top: 12px; right: 12px; z-index: 15; display: flex; gap: 8px; align-items: center;
}
.presence .chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--border); font-size: 12px; color: var(--muted);
}
.presence .chip strong { color: var(--text); font-weight: 600; }

/* Panel views (templates, settings, account) */
.panel-view {
  position: absolute; inset: 0; overflow: auto; padding: 28px 32px 48px; background: var(--bg);
}
.panel-view h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -0.02em; }
.panel-view .lead { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.tabs { display: flex; gap: 16px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab {
  padding: 10px 2px; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab:hover { color: var(--text); }

.tpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px;
}
.tpl-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 12px; padding: 18px;
  min-height: 160px; text-align: left; display: flex; flex-direction: column; gap: 12px;
}
.tpl-card:hover { border-color: #444; background: var(--bg-4); }
.tpl-icon {
  width: 40px; height: 40px; border-radius: 10px; background: #1a1a1a; border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 18px;
}
.tpl-card h3 { margin: 0; font-size: 16px; }
.tpl-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }

/* Settings layout */
.settings-layout {
  display: grid; grid-template-columns: 220px 1fr; gap: 28px; max-width: 980px;
}
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav .group { font-size: 11px; color: var(--muted-2); padding: 12px 10px 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.settings-nav button {
  text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-size: 13px;
}
.settings-nav button:hover, .settings-nav button.active { background: var(--bg-3); color: var(--text); }
.settings-body { min-width: 0; }
.settings-body h2 { margin: 0 0 6px; font-size: 20px; }
.settings-body .desc { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field input, .field textarea, .field select {
  width: 100%; max-width: 420px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: #456; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 520px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg-3); color: var(--text);
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: #fff; color: #111; border-color: #fff; }
.btn-primary:hover { filter: brightness(0.95); }
.btn-danger { color: var(--danger); border-color: #4a2228; background: #1a0f11; }
.btn-ghost { background: transparent; }
.meter { margin: 14px 0 18px; max-width: 560px; }
.meter .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.meter .bar { height: 6px; border-radius: 99px; background: #222; overflow: hidden; }
.meter .bar > i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.meter .bar > i.warn { background: var(--warn); }
.meter .bar > i.danger { background: var(--danger); }
.card-box {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--bg-2);
  max-width: 560px; margin-bottom: 12px;
}
.danger-zone {
  border: 1px solid #4a2228; border-radius: 12px; padding: 16px; max-width: 560px; background: #12090b;
}
.danger-zone h3 { margin: 0 0 6px; color: var(--danger); font-size: 14px; }
.list-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border);
  max-width: 560px;
}
.list-row:last-child { border-bottom: 0; }
.key-pill {
  font-family: var(--mono); font-size: 12px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; color: var(--muted);
}

/* Modals / drawers */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 80;
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: min(440px, 100%); background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px; box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.drawer {
  position: fixed; top: var(--top-h); right: 0; bottom: 0; width: min(380px, 100%);
  background: var(--bg-2); border-left: 1px solid var(--border); z-index: 70;
  display: flex; flex-direction: column;
}
.drawer header {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  border-bottom: 1px solid var(--border); font-weight: 600;
}
.drawer .body { padding: 14px 16px; overflow: auto; flex: 1; }
.comment {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: var(--bg-3);
}
.comment .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }

/* Command palette */
.cmd-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90;
  display: grid; place-items: start center; padding-top: 12vh;
}
.cmd {
  width: min(560px, 92vw); background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,0.55);
}
.cmd input {
  width: 100%; border: 0; background: transparent; padding: 14px 16px; outline: none;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.cmd .list { max-height: 320px; overflow: auto; padding: 6px; }
.cmd .item {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; color: var(--muted); font-size: 13px;
  display: flex; justify-content: space-between; gap: 10px;
}
.cmd .item:hover, .cmd .item.active { background: var(--bg-hover); color: var(--text); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #fff; color: #111; padding: 10px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.empty-hint {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  color: var(--muted-2); font-size: 13px; pointer-events: none; text-align: center;
}

/* Sidebar collapse */
#app.sidebar-collapsed { --sidebar-w: 64px; }
#app.sidebar-collapsed .ws-name,
#app.sidebar-collapsed .side-item span:not(.si),
#app.sidebar-collapsed .side-item .shortcut,
#app.sidebar-collapsed .comp-list .meta .name,
#app.sidebar-collapsed .side-foot .who { display: none; }
#app.sidebar-collapsed .side-item { justify-content: center; padding: 10px; }
#app.sidebar-collapsed .side-item .si { margin: 0; }

.si { width: 18px; text-align: center; flex: 0 0 auto; }
.presence .chip.ok { color: var(--ok); border-color: #1e3d30; }

/* PC card stream iframe */
.pc-card .screen .pc-iframe {
  width: 100%; height: 100%; border: 0; pointer-events: none; background: #000;
  transform: scale(0.35); transform-origin: 0 0; width: 285%; height: 285%;
}
.pc-card .screen .fake-term .err { color: #ff8a96; }
.pc-card .bar .menu { width: 26px; height: 26px; color: var(--muted); }
.pc-card .bar .menu:hover { color: var(--text); background: var(--bg-hover); }

/* Context menu */
.ctx-menu {
  position: fixed; z-index: 120; min-width: 160px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 10px; padding: 6px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}
.ctx-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px;
  font-size: 13px; color: var(--text);
}
.ctx-menu button:hover { background: var(--bg-hover); }
.ctx-menu button.danger { color: var(--danger); }

/* Settings modal (Orgo-style) */
.settings-modal {
  width: min(860px, 96vw); height: min(640px, 90vh); display: grid;
  grid-template-columns: 220px 1fr; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; box-shadow: 0 28px 90px rgba(0,0,0,0.55);
}
.settings-modal .settings-nav {
  border-right: 1px solid var(--border); padding: 14px 10px; overflow: auto; background: var(--bg);
}
.settings-modal .settings-panel { display: flex; flex-direction: column; min-width: 0; }
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.settings-head h2 { margin: 0; font-size: 16px; }
.settings-modal .settings-body { padding: 18px 20px 28px; overflow: auto; flex: 1; }
.profile-row { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; margin: 0; }

/* Connect panel */
.connect-panel {
  position: fixed; top: calc(var(--top-h) + 12px); right: 16px; width: min(380px, 94vw);
  max-height: calc(100vh - var(--top-h) - 32px); overflow: auto;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px;
  z-index: 75; box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.connect-tabs {
  display: flex; align-items: center; gap: 4px; padding: 10px 10px 0; position: sticky; top: 0;
  background: var(--bg-2); z-index: 1;
}
.connect-tabs button {
  flex: 1; padding: 8px; border-radius: 8px; font-size: 13px; color: var(--muted); font-weight: 600;
}
.connect-tabs button.active { background: var(--bg-3); color: var(--text); }
.connect-tabs .connect-x { flex: 0 0 auto; width: 28px; }
.connect-body { padding: 14px 16px 18px; }
.connect-ctx {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; font-family: var(--mono); font-size: 11px; line-height: 1.5;
  white-space: pre-wrap; color: #cfcfcf; max-height: 220px; overflow: auto; margin: 0 0 12px;
}
.connect-steps { margin: 14px 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* Stream overlay */
.stream-overlay {
  position: fixed; inset: 0; z-index: 85; background: #050505; display: flex; flex-direction: column;
}
.stream-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.stream-title { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
.stream-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stream-body { flex: 1; position: relative; min-height: 0; background: #000; }
.stream-body iframe { width: 100%; height: 100%; border: 0; }
.stream-empty {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px;
  color: var(--text); background: #0a0a0a;
}

/* Account plan + credits */
.sec-h { margin: 0 0 6px; font-size: 14px; }
.sec-p { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.credit-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.credit-opt {
  min-width: 64px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-2); font-weight: 600; font-size: 13px;
}
.credit-opt.active, .credit-opt:hover { border-color: #fff; background: var(--bg-3); }
.plan-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px;
  max-width: 980px;
}
.plan-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 18px; background: var(--bg-2);
}
.plan-card.current { border-color: #3a3a3a; }
.plan-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.plan-blurb { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.plan-price { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.plan-price span { font-size: 14px; font-weight: 500; color: var(--muted); }
.plan-includes { margin: 16px 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.plan-card ul { list-style: none; margin: 0; padding: 0; }
.plan-card li { font-size: 13px; color: var(--muted); padding: 4px 0; }
.pill {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); vertical-align: middle;
}

.modal-sm { width: min(380px, 100%); }
.btn-wide { width: 100%; }
.advanced { margin: 8px 0 4px; color: var(--muted); font-size: 13px; }
.advanced summary { cursor: pointer; margin-bottom: 10px; }
.advanced[open] summary { margin-bottom: 12px; }

/* New computer floating card form (inline feel) */
.modal .field input, .modal .field select, .modal .field textarea { max-width: none; }

/* E3B monitoring dashboard */
.e3b-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.e3b-brand {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #7aa2ff;
}
.e3b-actions { display: flex; align-items: center; gap: 12px; }
.e3b-auto { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.e3b-kpis {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
  margin-bottom: 18px;
}
.e3b-kpi {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
}
.e3b-kpi .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.e3b-kpi .value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }
.e3b-kpi .hint { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.e3b-toolbar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap;
}
.e3b-toolbar input, .e3b-toolbar select {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; outline: none; font-size: 13px;
}
.e3b-toolbar input { min-width: 240px; flex: 1; }
.e3b-table-wrap {
  border: 1px solid var(--border); border-radius: 12px; overflow: auto; background: var(--bg-2);
  max-height: calc(100vh - 340px);
}
.e3b-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.e3b-table th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-2);
  white-space: nowrap;
}
.e3b-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle;
  white-space: nowrap;
}
.e3b-table tr:hover td { background: rgba(255,255,255,0.02); }
.e3b-state {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-transform: lowercase;
}
.e3b-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.e3b-state .dot.warn { background: var(--warn); }
.e3b-state .dot.off { background: var(--muted-2); }
.e3b-mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.e3b-detail {
  position: fixed; right: 16px; bottom: 16px; width: min(420px, 94vw); max-height: 50vh;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5); z-index: 76; display: flex; flex-direction: column;
}
.e3b-detail header {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.e3b-detail pre { margin: 0; flex: 1; overflow: auto; max-height: 28vh; border: 0; border-radius: 0; }
.e3b-detail .modal-actions { padding: 10px 14px; margin: 0; }

.e3b-tabs { margin-bottom: 16px; }
.e3b-chart {
  display: flex; align-items: flex-end; gap: 4px; height: 120px;
  padding: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  overflow-x: auto;
}
.e3b-bar {
  flex: 0 0 14px; background: linear-gradient(180deg, #7aa2ff, #3d5a9e);
  border-radius: 4px 4px 2px 2px; min-height: 2px; position: relative;
}
.e3b-bar:hover { filter: brightness(1.15); }
.e3b-bill-form {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px;
  max-width: 900px;
}
.e3b-bill-form .btn { grid-column: 1 / -1; justify-self: start; }

/* Auth / Clerk */
#app.auth-hidden { visibility: hidden; pointer-events: none; }
.auth-gate {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(91,140,255,0.12), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(61,214,198,0.08), transparent 45%),
    #0a0a0a;
  padding: 24px;
}
.auth-gate.hidden { display: none; }
.auth-card {
  width: min(420px, 100%);
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 28px 24px 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
}
.auth-brand {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #7aa2ff; margin-bottom: 10px;
}
.auth-card h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: -0.02em; }
.auth-lead { margin: 0 0 18px; color: #8a8a8a; font-size: 14px; line-height: 1.45; }
.auth-foot { margin: 16px 0 0; font-size: 12px; text-align: center; }
.clerk-user-btn { margin-left: 8px; display: flex; align-items: center; }
#clerkSignIn { min-height: 280px; }
