/* =========================================================
   MYCALIUM — application styles
   Palette: deep forest black + electric lime, neutral text.
   ========================================================= */
:root {
  --bg: #0B1512;
  --bg-2: #14231D;
  --bg-3: #1A2C24;
  --bg-input: #0F1C17;
  --lime: #B8F36B;
  --lime-dim: rgba(184, 243, 107, .14);
  --lime-faint: rgba(184, 243, 107, .06);
  --text: #E8F0E9;
  --muted: #82958A;
  --line: #263A30;
  --line-2: #2F4639;
  --ok: #B8F36B;
  --warn: #F2C14E;
  --danger: #F2766B;
  --info: #7CC8F2;
  --st-online: #B8F36B;
  --st-busy: #F2C14E;
  --st-neg: #7CC8F2;
  --st-off: #5B6B62;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 8px 24px rgba(0, 0, 0, .28);
  --glow: 0 0 0 1px rgba(184, 243, 107, .25), 0 0 24px rgba(184, 243, 107, .12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --side-w: 248px;
  --top-h: 60px;
  --gap: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
  background-image: radial-gradient(circle at 1px 1px, rgba(184, 243, 107, .045) 1px, transparent 0);
  background-size: 28px 28px;
}
body.compact { --gap: 12px; font-size: 13px; }
body.no-glow { --glow: 0 0 0 1px var(--line-2); }
body.no-motion *, body.no-motion *::before, body.no-motion *::after { transition: none !important; animation: none !important; }
a { color: inherit; text-decoration: none; }
code, .mono, kbd, pre { font-family: var(--mono); }
code { font-size: .88em; background: var(--bg-3); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
h4 { font-size: 14px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.pad { padding: 16px; }
.center { text-align: center; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.ic { width: 18px; height: 18px; flex: none; }
::selection { background: rgba(184, 243, 107, .3); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--bg); }

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: rgba(11, 21, 18, .96);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40;
  transition: transform .25s ease;
}
.brand { display: flex; align-items: center; height: var(--top-h); padding: 0 18px; border-bottom: 1px solid var(--line); flex: none; }
.brand svg { display: block; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.nav-group { margin-top: 12px; }
.nav-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 6px 10px; font-weight: 600; display: block; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: #B6C4BB;
  transition: background .15s, color .15s; position: relative; font-weight: 500;
}
.nav-item .ic { width: 17px; height: 17px; opacity: .85; }
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active { background: var(--lime-faint); color: var(--lime); box-shadow: inset 0 0 0 1px rgba(184, 243, 107, .18); }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.nav-count { margin-left: auto; font: 500 11px var(--mono); color: var(--muted); }
.nav-count:empty { display: none; }
.side-foot { border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 10px; flex: none; }
.ws-select select { width: 100%; }
.profile { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); }
.profile:hover { background: var(--bg-2); }
.profile div { display: grid; line-height: 1.25; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 0 6px; }
.side-social { display: flex; gap: 6px; padding: 0 2px; }
.main { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: rgba(11, 21, 18, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; font-size: 13px; }
.crumbs a:hover { color: var(--lime); }
.crumb-home { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.crumb-sep { color: var(--line-2); }
.crumbs strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.gsearch { position: relative; margin-left: auto; width: min(340px, 34vw); }
.gsearch input { width: 100%; padding-left: 34px; padding-right: 32px; height: 36px; }
.gsearch-ic { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.gsearch kbd { position: absolute; right: 8px; top: 8px; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.demo-pill, .ws-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px dashed var(--line-2); border-radius: 999px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.demo-pill .ic, .ws-pill .ic { width: 14px; height: 14px; }
.ws-pill { border-style: solid; font-family: var(--mono); }
.net-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px 0 8px; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--net) 12%, transparent); border: 1px solid color-mix(in srgb, var(--net) 45%, transparent);
  color: var(--text); font: 500 12px var(--font); transition: box-shadow .2s;
}
.net-chip:hover { box-shadow: 0 0 16px color-mix(in srgb, var(--net) 35%, transparent); }
.conn-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.notif-wrap { position: relative; }
.notif-count { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--lime); color: var(--bg); font: 700 10px/16px var(--mono); text-align: center; padding: 0 4px; }
.page { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; outline: none; }
.scrim { display: none; }
.only-mobile { display: none !important; }

/* ---------- Popovers ---------- */
.popover {
  position: absolute; top: calc(100% + 8px); right: 0; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(-4px); transition: .15s; z-index: 50;
}
.popover.open { opacity: 1; pointer-events: auto; transform: none; }
.gsearch-pop { left: 0; right: 0; padding: 6px; max-height: 420px; overflow: auto; }
.gres { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; }
.gres span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gres:hover, .gres.sel { background: var(--lime-faint); }
.gres-sem { border-top: 1px solid var(--line); margin-top: 4px; color: var(--lime); border-radius: 0 0 7px 7px; }
.notif-pop { width: 340px; max-height: 460px; overflow: auto; }
.pop-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif { display: grid; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.notif span { color: var(--muted); }
.notif:hover { background: var(--bg-3); }
.notif.unread strong::before { content: ""; display: inline-block; width: 6px; height: 6px; background: var(--lime); border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.link-btn { background: none; border: 0; color: var(--lime); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }

/* ---------- Controls ---------- */
input, select, textarea {
  background: var(--bg-input); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; padding: 8px 10px; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
input::placeholder, textarea::placeholder { color: #5E7166; }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(184, 243, 107, .5); box-shadow: 0 0 0 3px rgba(184, 243, 107, .1); }
select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2382958A' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
.invalid { border-color: var(--danger) !important; }
input[type="range"] { padding: 0; accent-color: var(--lime); background: none; border: 0; }
input[type="checkbox"] { accent-color: var(--lime); width: 16px; height: 16px; }
label.field { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
label.field > span em { color: var(--lime); font-style: normal; }
.fields { display: grid; gap: 14px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-size: 12px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font: 500 13px var(--font); cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .2s, transform .1s; white-space: nowrap;
}
.btn .ic { width: 16px; height: 16px; }
.btn:hover { border-color: rgba(184, 243, 107, .45); background: var(--bg-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--lime); color: #0B1512; border-color: var(--lime); font-weight: 600; }
.btn-primary:hover { background: #C8F88A; box-shadow: var(--glow); border-color: #C8F88A; }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(242, 118, 107, .12); border-color: rgba(242, 118, 107, .45); color: #FFB3AC; }
.btn-danger:hover { background: rgba(242, 118, 107, .2); border-color: var(--danger); }
.btn-ok { background: rgba(184, 243, 107, .1); border-color: rgba(184, 243, 107, .45); color: var(--lime); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; transition: .15s; position: relative; flex: none;
}
.icon-btn:hover { color: var(--text); background: var(--bg-2); border-color: var(--line); }
.icon-btn .ic { width: 17px; height: 17px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px; background: var(--bg-input); }
.seg button { background: none; border: 0; color: var(--muted); font: 500 12px var(--font); padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--bg-3); color: var(--lime); }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 20px; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + span { background: rgba(184, 243, 107, .3); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--lime); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: var(--gap); }
.toolbar .search-in { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.toolbar .search-in input { width: 100%; padding-left: 34px; }
.toolbar .search-in .ic { position: absolute; left: 10px; top: 10px; color: var(--muted); width: 16px; height: 16px; }

/* ---------- Cards ---------- */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .ic, .card-head h3 .ic { color: var(--lime); width: 16px; height: 16px; }
.card-body { padding: 16px; }
a.card { display: block; transition: border-color .2s, box-shadow .2s, transform .2s; }
a.card:hover { border-color: rgba(184, 243, 107, .4); box-shadow: var(--glow); transform: translateY(-1px); }
.grid { display: grid; gap: var(--gap); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-side { grid-template-columns: 280px minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.section { margin-top: var(--gap); }

/* Page header with illustration */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; padding: 18px 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(120deg, rgba(20, 35, 29, .9), rgba(11, 21, 18, .6)); position: relative; overflow: hidden; }
.page-head-text { display: grid; gap: 6px; min-width: 0; }
.page-head-text p { max-width: 720px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.page-illus { width: 220px; flex: none; opacity: .95; }
.illus { width: 100%; height: auto; display: block; }

/* Stats */
.stat { padding: 14px 16px; display: grid; gap: 4px; }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.stat-top .ic { width: 16px; height: 16px; color: var(--lime); opacity: .8; }
.stat-label { font-size: 12px; font-weight: 500; }
.stat-value { font: 600 26px/1.15 var(--mono); letter-spacing: -.02em; }
.stat-value small { font-size: 14px; color: var(--muted); }
.stat-sub { font-size: 12px; color: var(--muted); }
.up { color: var(--lime); }

/* Badges, pills, dots */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font: 500 11.5px var(--font); border: 1px solid; white-space: nowrap; text-transform: capitalize; }
.badge-ok { color: var(--lime); border-color: rgba(184, 243, 107, .35); background: rgba(184, 243, 107, .08); }
.badge-warn { color: var(--warn); border-color: rgba(242, 193, 78, .35); background: rgba(242, 193, 78, .08); }
.badge-danger { color: var(--danger); border-color: rgba(242, 118, 107, .35); background: rgba(242, 118, 107, .08); }
.badge-info { color: var(--info); border-color: rgba(124, 200, 242, .35); background: rgba(124, 200, 242, .08); }
.badge-muted { color: var(--muted); border-color: var(--line-2); background: transparent; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st-off); flex: none; }
.st-online .dot, .dot.st-online { background: var(--st-online); box-shadow: 0 0 8px var(--st-online); }
.st-busy .dot, .dot.st-busy { background: var(--st-busy); }
.st-negotiating .dot, .dot.st-negotiating { background: var(--st-neg); box-shadow: 0 0 8px var(--st-neg); animation: pulse 1.6s infinite; }
.st-offline .dot, .dot.st-offline { background: var(--st-off); }
@keyframes pulse { 50% { opacity: .45; } }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap; }
.pill.st-online { color: var(--st-online); border-color: rgba(184, 243, 107, .3); }
.pill.st-busy { color: var(--st-busy); border-color: rgba(242, 193, 78, .3); }
.pill.st-negotiating { color: var(--st-neg); border-color: rgba(124, 200, 242, .3); }
.pill.st-offline { color: var(--muted); }
.prio { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 5px; }
.prio-high { color: #FFB3AC; background: rgba(242, 118, 107, .12); }
.prio-medium { color: var(--warn); background: rgba(242, 193, 78, .1); }
.prio-low { color: var(--muted); background: var(--bg-3); }
.tag { display: inline-flex; font: 500 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }

/* Avatars */
.avatar { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--bg-3); border: 1px solid var(--line-2); color: var(--lime); font: 600 12px var(--mono); text-transform: uppercase; flex: none; }
.avatar-xs { width: 20px; height: 20px; border-radius: 6px; font-size: 9px; }
.avatar-lg { width: 52px; height: 52px; border-radius: 13px; font-size: 17px; }
.avatar-st { position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--bg-2); background: var(--st-off); }
.avatar-xs .avatar-st { width: 7px; height: 7px; border-width: 1.5px; right: -2px; bottom: -2px; }
.avatar-st.st-online { background: var(--st-online); }
.avatar-st.st-busy { background: var(--st-busy); }
.avatar-st.st-negotiating { background: var(--st-neg); }
.agent-chip { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--mono); color: var(--text); padding: 2px 8px 2px 3px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg-input); white-space: nowrap; }
a.agent-chip:hover { border-color: rgba(184, 243, 107, .4); color: var(--lime); }
.room-link { font-family: var(--mono); font-size: 12.5px; color: var(--lime); }
.room-link:hover { text-decoration: underline; }
.mention { color: var(--lime); font-family: var(--mono); font-size: .92em; background: var(--lime-faint); padding: 0 3px; border-radius: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font: 600 11px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(184, 243, 107, .03); }
tr.clickable { cursor: pointer; }
td.mono, .mono { font-size: 12.5px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--gap); overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; font: inherit; font-weight: 500; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--lime); border-bottom-color: var(--lime); }
.tab-count { font: 500 11px var(--mono); background: var(--bg-3); border-radius: 5px; padding: 0 6px; color: var(--muted); }

/* Progress */
.progress { height: 6px; background: var(--bg-input); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.progress span { display: block; height: 100%; background: var(--lime); border-radius: 6px; box-shadow: 0 0 10px rgba(184, 243, 107, .5); transition: width .4s ease; }
.progress.lg { height: 10px; }

/* Lists & timelines */
.list > * { border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-width: 0; }
a.li:hover { background: rgba(184, 243, 107, .03); }
.li-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.li-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline { position: relative; padding: 6px 16px 6px 16px; }
.tl-item { position: relative; padding: 8px 0 8px 26px; display: grid; gap: 2px; }
.tl-item::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl-item:first-child::before { top: 14px; }
.tl-item:last-child::before { bottom: calc(100% - 14px); }
.tl-item::after { content: ""; position: absolute; left: 2px; top: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg-2); border: 2px solid var(--lime); }
.tl-item.t-muted::after { border-color: var(--muted); }
.tl-item.t-warn::after { border-color: var(--warn); }
.tl-item.t-danger::after { border-color: var(--danger); }
.tl-item.t-info::after { border-color: var(--info); }
.tl-text { font-size: 13px; }
.tl-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Charts */
.chart { width: 100%; height: 190px; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font: 10px var(--mono); }
.chart .hit .cross, .chart .hit .cross-dot { opacity: 0; transition: opacity .1s; }
.chart .hit .cross { stroke: var(--line-2); }
.chart .hit .cross-dot { fill: var(--lime); stroke: var(--bg-2); stroke-width: 2; }
.chart .hit:hover .cross, .chart .hit:hover .cross-dot { opacity: 1; }
.barlist { display: grid; gap: 10px; }
.barlist-row { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 10px; font-size: 12.5px; }
.barlist-track { height: 10px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.barlist-fill { display: block; height: 100%; background: var(--lime); border-radius: 0 4px 4px 0; }
.barlist-fill.f-muted { background: var(--muted); }
.barlist-fill.f-info { background: var(--info); }
.barlist-val { text-align: right; color: var(--text); }
.tooltip { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 100; background: #0A120F; border: 1px solid var(--line-2); color: var(--text); font: 12px var(--mono); padding: 6px 9px; border-radius: 7px; opacity: 0; transition: opacity .1s; box-shadow: var(--shadow); max-width: 320px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Health */
.health { display: grid; grid-template-columns: 1fr auto auto; gap: 10px 14px; align-items: center; padding: 14px 16px; font-size: 13px; }
.health .mono { color: var(--muted); }

/* Token card */
.token-card { --net: var(--lime); padding: 16px; border-radius: var(--radius-lg); border: 1px solid color-mix(in srgb, var(--net) 35%, var(--line)); background: linear-gradient(135deg, color-mix(in srgb, var(--net) 10%, var(--bg-2)), var(--bg-2) 60%); display: grid; gap: 10px; }
.token-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.token-id { display: flex; align-items: center; gap: 10px; }
.token-id div { display: grid; line-height: 1.3; }
.token-net { font-size: 12px; color: var(--muted); }
.net-pill { display: inline-flex; align-items: center; gap: 5px; font: 600 11px var(--mono); color: var(--net-soft); border: 1px solid color-mix(in srgb, var(--net) 50%, transparent); border-radius: 999px; padding: 2px 8px; }
.ca-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text); font-weight: 600; }
.ca-label .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.ca-row { display: flex; align-items: flex-start; gap: 6px; }
.ca { flex: 1; display: block; font-size: 12.5px; line-height: 1.5; word-break: break-all; overflow-wrap: anywhere; padding: 8px 10px; background: var(--bg-input); border: 1px solid color-mix(in srgb, var(--net) 30%, var(--line)); color: var(--text); }
.token-links { display: flex; gap: 6px; flex-wrap: wrap; }
.net-mark { flex: none; }

/* Simulation note */
.sim-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px dashed rgba(184, 243, 107, .35); background: var(--lime-faint); font-size: 12.5px; color: #C9D6CD; }
.sim-note .ic { color: var(--lime); width: 16px; height: 16px; margin-top: 2px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid var(--line-2); background: var(--bg-3); }
.notice .ic { width: 17px; height: 17px; margin-top: 1px; }
.notice-warn { border-color: rgba(242, 193, 78, .4); background: rgba(242, 193, 78, .07); color: #F7DB98; }
.notice-danger { border-color: rgba(242, 118, 107, .45); background: rgba(242, 118, 107, .08); color: #FFC3BD; }
.notice-ok { border-color: rgba(184, 243, 107, .4); background: rgba(184, 243, 107, .07); color: #DDF8BA; }
.notice-info { border-color: rgba(124, 200, 242, .35); background: rgba(124, 200, 242, .06); color: #C4E6F8; }

/* Empty state */
.empty { display: grid; justify-items: center; gap: 6px; padding: 28px 16px; text-align: center; }
.empty .illus { width: 180px; opacity: .8; margin-bottom: 4px; }

/* Code */
.code { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #08100D; overflow: hidden; }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); font: 11px var(--mono); color: var(--muted); }
.code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.65; color: #D6E2D9; }
.copy-btn { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; font: 500 11px var(--font); padding: 3px 8px; cursor: pointer; }
.copy-btn:hover { color: var(--lime); border-color: rgba(184, 243, 107, .4); }
.copy-btn .ic { width: 13px; height: 13px; }
.t-cmd { color: var(--lime); font-weight: 600; }
.t-flag { color: #9FD4F5; }
.t-str { color: #F2D38A; }
.t-com { color: #5E7166; font-style: italic; }
.t-key { color: #9FD4F5; }
.t-arg { color: #E6A5F0; }

/* Markdown */
.md { font-size: 13.5px; line-height: 1.65; }
.md h1 { font-size: 19px; margin: 4px 0 10px; }
.md h2 { font-size: 16px; margin: 18px 0 8px; }
.md h3 { font-size: 14px; margin: 14px 0 6px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md .task-li { list-style: none; margin-left: -20px; display: flex; gap: 8px; align-items: baseline; }
.md-check { width: 13px; height: 13px; border: 1.5px solid var(--muted); border-radius: 3px; display: inline-block; flex: none; transform: translateY(2px); }
.md-check.on { background: var(--lime); border-color: var(--lime); box-shadow: inset 0 0 0 2px var(--bg-2); }
.md blockquote { margin: 10px 0; padding: 6px 12px; border-left: 3px solid var(--lime); background: var(--lime-faint); color: #C9D6CD; border-radius: 0 6px 6px 0; }
.md pre { background: #08100D; border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; }
.md a { color: var(--lime); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 9, 7, .72); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 80; padding: 16px; opacity: 0; transition: opacity .18s; }
.modal-backdrop.in { opacity: 1; }
.modal { width: min(540px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: 0 30px 80px rgba(0, 0, 0, .5), var(--glow); transform: translateY(8px) scale(.98); transition: transform .18s; }
.modal-backdrop.in .modal { transform: none; }
.modal-wide { width: min(820px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding-top: 6px; }

/* Toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 120; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px; padding: 11px 14px; border-radius: var(--radius-sm); background: #0F1C17; border: 1px solid rgba(184, 243, 107, .35); box-shadow: var(--shadow), 0 0 20px rgba(184, 243, 107, .1); font-size: 13px; animation: tin .2s ease; transition: opacity .3s, transform .3s; }
.toast .ic { color: var(--lime); width: 17px; height: 17px; }
.toast-error { border-color: rgba(242, 118, 107, .5); }
.toast-error .ic { color: var(--danger); }
.toast-warn { border-color: rgba(242, 193, 78, .5); }
.toast-warn .ic { color: var(--warn); }
.toast.out { opacity: 0; transform: translateX(20px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Page specific ---------- */
/* Rooms */
.room-card { padding: 16px; display: grid; gap: 12px; }
.room-card h3 { font-family: var(--mono); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.room-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.room-meta div { background: var(--bg-input); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; display: grid; }
.room-meta strong { font: 600 15px var(--mono); }
.room-meta span { font-size: 11px; color: var(--muted); }
.avatars { display: flex; }
.avatars .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--bg-2); }
.avatars .avatar:first-child { margin-left: 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Chat */
.chat { display: flex; flex-direction: column; height: 560px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.msg { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.msg-head strong { font-family: var(--mono); }
.msg-text { font-size: 13.5px; color: #D3DED6; margin-top: 2px; overflow-wrap: anywhere; }
.msg.you .msg-head strong { color: var(--lime); }
.chat-input { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 8px; align-items: flex-end; position: relative; }
.chat-input textarea { flex: 1; min-height: 40px; height: 40px; resize: none; }
.mention-pop { position: absolute; bottom: calc(100% - 4px); left: 12px; width: 260px; padding: 4px; }
.mention-pop button { display: flex; width: 100%; gap: 8px; align-items: center; background: none; border: 0; color: var(--text); padding: 6px 8px; border-radius: 6px; cursor: pointer; font: 13px var(--font); text-align: left; }
.mention-pop button:hover, .mention-pop button.sel { background: var(--lime-faint); }
.convos { display: grid; align-content: start; }
.convo { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.convo:hover { background: rgba(184, 243, 107, .03); }
.convo.active { background: var(--lime-faint); box-shadow: inset 3px 0 0 var(--lime); }
.convo-main { flex: 1; min-width: 0; display: grid; }
.convo-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.convo-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 12px 14px 6px; font-weight: 600; }

/* Agents */
.agent-card { padding: 16px; display: grid; gap: 12px; }
.agent-top { display: flex; gap: 12px; align-items: center; }
.agent-top > div { min-width: 0; display: grid; }
.agent-handle { font: 12px var(--mono); color: var(--muted); }
.agent-task { font-size: 12.5px; color: #C9D6CD; background: var(--bg-input); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 36px; }
.status-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.status-legend span { display: inline-flex; gap: 6px; align-items: center; }

/* Negotiations */
.lifecycle { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 4px 0; }
.lc-step { position: relative; text-align: center; padding-top: 30px; font: 500 11.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.lc-step::before { content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--bg-2); z-index: 1; box-sizing: border-box; }
.lc-step::after { content: ""; position: absolute; top: 19px; left: -50%; width: 100%; height: 2px; background: var(--line-2); }
.lc-step:first-child::after { display: none; }
.lc-step.done { color: var(--text); }
.lc-step.done::before { background: var(--lime); border-color: var(--lime); }
.lc-step.done::after, .lc-step.current::after { background: var(--lime); }
.lc-step.current { color: var(--lime); }
.lc-step.current::before { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(184, 243, 107, .15), 0 0 14px rgba(184, 243, 107, .5); }
.lc-step.fail { color: var(--muted); }
.lc-step.fail::before { border-color: var(--danger); border-style: dashed; }
.neg-card { padding: 16px; display: grid; gap: 12px; }
.round { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-input); overflow: hidden; }
.round-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(20, 35, 29, .6); }
.round-head h4 { font-family: var(--mono); font-size: 13px; }
.proposal { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.issue-chip { display: inline-flex; gap: 6px; font-size: 12px; border: 1px solid var(--line-2); border-radius: 7px; padding: 3px 8px; background: var(--bg-2); }
.issue-chip span { color: var(--muted); }
.issue-chip strong { font-weight: 600; font-family: var(--mono); font-size: 11.5px; }
.issue-chip.changed { border-color: rgba(242, 193, 78, .5); }
.issue-chip.changed strong { color: var(--warn); }
.resp { display: grid; grid-template-columns: 150px 92px 1fr; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: start; font-size: 13px; }
.resp:last-child { border-bottom: 0; }
.resp-act { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; padding: 3px 0; border-radius: 6px; width: 84px; }
.act-accept { color: var(--lime); background: rgba(184, 243, 107, .1); }
.act-reject { color: var(--danger); background: rgba(242, 118, 107, .1); }
.act-counter { color: var(--warn); background: rgba(242, 193, 78, .1); }
.act-pending { color: var(--muted); background: var(--bg-3); }
.resp-body { display: grid; gap: 5px; min-width: 0; }
.ev { font-size: 12.5px; display: flex; gap: 6px; }
.ev b { font: 600 11px var(--mono); padding: 0 5px; border-radius: 4px; height: 18px; line-height: 18px; flex: none; }
.ev-for b { color: var(--lime); background: rgba(184, 243, 107, .1); }
.ev-against b { color: var(--danger); background: rgba(242, 118, 107, .1); }
.conf { display: flex; align-items: center; gap: 8px; font: 12px var(--mono); }
.conf-bar { width: 70px; height: 5px; background: var(--bg-3); border-radius: 4px; overflow: hidden; }
.conf-bar span { display: block; height: 100%; background: var(--lime); }
.cause { font: 500 11px var(--mono); color: var(--info); }
.cause.social { color: var(--warn); }
.outcome { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: var(--radius); }
.outcome .ic { width: 28px; height: 28px; }
.outcome-ok { background: rgba(184, 243, 107, .07); border: 1px solid rgba(184, 243, 107, .4); box-shadow: 0 0 30px rgba(184, 243, 107, .08); }
.outcome-ok .ic { color: var(--lime); }
.outcome-fail { background: repeating-linear-gradient(-45deg, rgba(130, 149, 138, .05) 0 8px, transparent 8px 16px); border: 1px dashed var(--muted); }
.outcome-fail .ic { color: var(--muted); }
.outcome-open { background: rgba(124, 200, 242, .05); border: 1px solid rgba(124, 200, 242, .3); }
.outcome-open .ic { color: var(--info); }
.issue-form { display: grid; gap: 10px; }
.issue-row { display: grid; grid-template-columns: 140px 1fr; gap: 10px; align-items: center; font-size: 13px; }
.radio-set { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-set label { cursor: pointer; }
.radio-set input { position: absolute; opacity: 0; pointer-events: none; }
.radio-set span { display: inline-block; font-size: 12px; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--bg-input); transition: .15s; }
.radio-set input:checked + span { border-color: var(--lime); color: var(--lime); background: var(--lime-faint); }
.radio-set input:focus-visible + span { outline: 2px solid var(--lime); }
.action-set { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.action-set label { cursor: pointer; }
.action-set input { position: absolute; opacity: 0; }
.action-set span { display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border: 1px solid var(--line-2); border-radius: 8px; font-weight: 600; font-size: 13px; background: var(--bg-input); transition: .15s; }
.action-set input[value="accept"]:checked + span { border-color: var(--lime); color: var(--lime); background: rgba(184, 243, 107, .1); }
.action-set input[value="reject"]:checked + span { border-color: var(--danger); color: var(--danger); background: rgba(242, 118, 107, .1); }
.action-set input[value="counter"]:checked + span { border-color: var(--warn); color: var(--warn); background: rgba(242, 193, 78, .1); }
.range-row { display: flex; gap: 12px; align-items: center; }
.range-row input { flex: 1; }
.range-row output { font: 600 14px var(--mono); color: var(--lime); width: 40px; text-align: right; }
.engine-badge { display: inline-flex; align-items: center; gap: 8px; font: 500 12px var(--mono); color: var(--lime); border: 1px solid rgba(184, 243, 107, .3); padding: 4px 10px; border-radius: 999px; background: var(--lime-faint); }
.list-in { display: flex; gap: 6px; }
.list-in input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 4px 3px 9px; border-radius: 6px; background: var(--bg-3); border: 1px solid var(--line); }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 14px; line-height: 1; }

/* Consensus */
.metric { padding: 16px; display: grid; gap: 6px; }
.metric-k { display: flex; justify-content: space-between; align-items: baseline; }
.metric-k strong { font: 700 13px var(--mono); color: var(--lime); letter-spacing: .06em; }
.metric-v { font: 600 30px/1.1 var(--mono); }
.metric-d { font-size: 12px; color: var(--muted); }
.gauge-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; padding: 18px; }
.gauge { width: 200px; }
.formula { font: 13px var(--mono); padding: 10px 12px; border-radius: 8px; background: #08100D; border: 1px solid var(--line); color: #D6E2D9; overflow-x: auto; white-space: nowrap; }
.formula b { color: var(--lime); }
.trust-scale { display: grid; grid-template-columns: 6fr 2fr 2fr; height: 8px; border-radius: 6px; overflow: hidden; gap: 2px; margin-top: 8px; position: relative; }
.trust-scale span:nth-child(1) { background: rgba(242, 118, 107, .55); }
.trust-scale span:nth-child(2) { background: rgba(242, 193, 78, .6); }
.trust-scale span:nth-child(3) { background: var(--lime); }
.trust-marker { position: absolute; top: -4px; width: 3px; height: 16px; background: var(--text); border-radius: 2px; box-shadow: 0 0 0 2px var(--bg-2); }
.trust-labels { display: grid; grid-template-columns: 6fr 2fr 2fr; gap: 2px; font: 10.5px var(--mono); color: var(--muted); margin-top: 6px; }
.pos-row { display: grid; grid-template-columns: 150px 1fr 120px; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.pos-row:last-child { border-bottom: 0; }
.shift { display: flex; align-items: center; gap: 8px; font: 12px var(--mono); }
.shift-track { position: relative; flex: 1; height: 6px; background: var(--bg-3); border-radius: 4px; }
.shift-a, .shift-b { position: absolute; top: -3px; width: 12px; height: 12px; border-radius: 50%; transform: translateX(-50%); }
.shift-a { background: var(--bg-2); border: 2px solid var(--muted); }
.shift-b { background: var(--lime); box-shadow: 0 0 8px rgba(184, 243, 107, .6); }
.shift-line { position: absolute; top: 2px; height: 2px; background: rgba(184, 243, 107, .5); }
.shift-line.down { background: rgba(242, 118, 107, .6); }

/* Plans */
.task-row td:first-child { width: 36px; }
.check { width: 18px; height: 18px; border: 1.5px solid var(--muted); border-radius: 5px; background: none; cursor: pointer; display: grid; place-items: center; padding: 0; color: var(--bg); transition: .15s; }
.check:hover { border-color: var(--lime); }
.check.on { background: var(--lime); border-color: var(--lime); }
.check .ic { width: 13px; height: 13px; stroke-width: 3; }
tr.done .t-title { color: var(--muted); text-decoration: line-through; }
.plan-path { font: 12px var(--mono); color: var(--muted); }
.mini-progress { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.mini-progress .progress { flex: 1; }
.mini-progress span.mono { width: 34px; text-align: right; color: var(--muted); font-size: 11.5px; }

/* Memory explorer */
.explorer { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 620px; }
.tree { border-right: 1px solid var(--line); padding: 10px 6px; overflow: auto; font: 12.5px var(--mono); }
.tree-root { color: var(--muted); padding: 4px 8px 8px; font-size: 11.5px; }
.tree-node { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; color: #C9D6CD; user-select: none; }
.tree-node:hover { background: var(--bg-3); }
.tree-node.active { background: var(--lime-faint); color: var(--lime); }
.tree-node .ic { width: 15px; height: 15px; }
.tree-node .chev { width: 12px; height: 12px; transition: transform .15s; color: var(--muted); }
.tree-node.open > .chev { transform: rotate(90deg); }
.tree-node .folder-ic { color: var(--lime); opacity: .8; }
.tree-kids { padding-left: 14px; display: none; }
.tree-kids.open { display: block; }
.tree-count { margin-left: auto; color: var(--muted); font-size: 11px; }
.viewer { display: flex; flex-direction: column; min-width: 0; }
.viewer-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.viewer-path { font: 12.5px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.viewer-path b { color: var(--text); font-weight: 500; }
.viewer-body { padding: 18px 22px; flex: 1; overflow: auto; }
.editor { display: grid; grid-template-columns: 1fr 1fr; flex: 1; min-height: 460px; }
.editor.mode-write { grid-template-columns: 1fr; }
.editor.mode-write .ed-preview { display: none; }
.editor.mode-preview { grid-template-columns: 1fr; }
.editor.mode-preview .ed-src { display: none; }
.ed-src { border: 0; border-right: 1px solid var(--line); border-radius: 0; font: 13px/1.6 var(--mono); padding: 16px; resize: none; background: #0A1410; min-height: 460px; }
.ed-preview { padding: 16px 20px; overflow: auto; }
.source-truth { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; padding: 14px 16px; }
.st-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; background: var(--bg-input); }
.st-box .ic { color: var(--lime); }
.st-box.derived .ic { color: var(--muted); }
.st-box div { display: grid; font-size: 12px; }
.st-box strong { font-size: 13px; }
.st-arrow { color: var(--muted); font: 11px var(--mono); text-align: center; }

/* Search */
.sem-box { position: relative; }
.sem-box input { width: 100%; height: 50px; font-size: 15px; padding-left: 46px; padding-right: 120px; border-radius: var(--radius); }
.sem-box > .ic { position: absolute; left: 15px; top: 16px; color: var(--lime); }
.sem-box .btn { position: absolute; right: 7px; top: 7px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.example { font-size: 12.5px; padding: 6px 11px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg-input); color: #C9D6CD; cursor: pointer; transition: .15s; font-family: var(--font); }
.example:hover { border-color: rgba(184, 243, 107, .45); color: var(--lime); }
.result { padding: 14px 16px; display: grid; gap: 8px; }
.result-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.result-key { font: 600 13px var(--mono); color: var(--lime); }
.score { display: inline-flex; align-items: center; gap: 8px; font: 600 12px var(--mono); margin-left: auto; }
.score-ring { width: 26px; height: 26px; }
.result-prev { font-size: 13px; color: #B9C7BE; line-height: 1.55; }
.result-prev mark { background: rgba(184, 243, 107, .2); color: var(--text); border-radius: 3px; padding: 0 2px; }

/* Graph */
.graph-wrap { position: relative; height: 640px; overflow: hidden; border-radius: var(--radius-lg); background: radial-gradient(ellipse at center, rgba(184, 243, 107, .05), transparent 70%), #09120F; cursor: grab; touch-action: none; }
.graph-wrap.dragging { cursor: grabbing; }
.graph-wrap svg { width: 100%; height: 100%; display: block; }
.g-edge { stroke: #35503F; stroke-width: 1.1; transition: opacity .2s, stroke .2s; }
.g-edge.hl { stroke: var(--lime); stroke-width: 1.8; }
.g-node { cursor: pointer; transition: opacity .2s; }
.g-node .shape { stroke-width: 1.6; transition: .2s; }
.g-node text { font: 10px var(--mono); fill: #B6C4BB; pointer-events: none; paint-order: stroke; stroke: #09120F; stroke-width: 3px; }
.g-node:hover .shape, .g-node.sel .shape { filter: drop-shadow(0 0 6px rgba(184, 243, 107, .8)); }
.g-node.sel text { fill: var(--lime); }
.faded { opacity: .12; }
.graph-tools { position: absolute; right: 12px; top: 12px; display: grid; gap: 6px; }
.graph-tools .icon-btn { background: var(--bg-2); border-color: var(--line); }
.graph-legend { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px; background: rgba(11, 21, 18, .85); border: 1px solid var(--line); padding: 8px 10px; border-radius: 8px; font-size: 11.5px; color: var(--muted); }
.graph-legend span { display: inline-flex; align-items: center; gap: 6px; }
.derived-banner { position: absolute; left: 12px; top: 12px; font: 11.5px var(--mono); color: var(--muted); background: rgba(11, 21, 18, .85); border: 1px solid var(--line); padding: 6px 10px; border-radius: 8px; display: flex; gap: 6px; align-items: center; }
.derived-banner .ic { width: 14px; height: 14px; color: var(--lime); }

/* Activity */
.act-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-3); border: 1px solid var(--line); color: var(--lime); flex: none; }
.act-ic .ic { width: 15px; height: 15px; }
.act-ic.k-del { color: var(--danger); }
.act-ic.k-search { color: var(--info); }
.act-ic.k-sync, .act-ic.k-index { color: var(--muted); }
.day-sep { padding: 8px 16px; font: 600 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; background: rgba(11, 21, 18, .5); }

/* Integrations */
.integ { display: grid; gap: 14px; padding: 16px; }
.integ-head { display: flex; align-items: center; gap: 12px; }
.integ-logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-input); border: 1px solid var(--line-2); color: var(--lime); }
.steps { counter-reset: s; display: grid; gap: 14px; }
.step { position: relative; padding-left: 36px; display: grid; gap: 8px; }
.step::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(184, 243, 107, .45); color: var(--lime); font: 600 12px/22px var(--mono); text-align: center; }
.allow-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.allow-row:last-child { border-bottom: 0; }

/* API docs */
.doc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.doc-nav { position: sticky; top: calc(var(--top-h) + 16px); padding: 10px; display: grid; gap: 2px; max-height: calc(100vh - 100px); overflow: auto; }
.doc-nav a { font: 12.5px var(--mono); color: var(--muted); padding: 5px 8px; border-radius: 6px; }
.doc-nav a:hover { color: var(--lime); background: var(--lime-faint); }
.doc-nav .nav-title { margin-top: 8px; }
.cmd { padding: 18px; display: grid; gap: 12px; scroll-margin-top: 80px; }
.cmd h3 { font: 600 15px var(--mono); color: var(--lime); }
.params { width: 100%; font-size: 12.5px; }
.params td { padding: 7px 10px; }
.params td:first-child { font-family: var(--mono); color: #9FD4F5; white-space: nowrap; }

/* Settings */
.set-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.set-nav { padding: 8px; display: grid; gap: 2px; position: sticky; top: calc(var(--top-h) + 16px); }
.set-nav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; color: #B6C4BB; font-size: 13px; }
.set-nav a:hover { background: var(--bg-3); }
.set-nav a.active { background: var(--lime-faint); color: var(--lime); }
.set-nav .ic { width: 16px; height: 16px; }
.set-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row > div { display: grid; gap: 2px; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.logo-tile { display: grid; place-items: center; gap: 10px; padding: 22px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-input); min-height: 130px; }
.logo-tile.light { background: #E8F0E9; color: #0B1512; }
.logo-tile .muted { font-size: 11.5px; }
.illus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.illus-grid figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg-input); }
.illus-grid figcaption { font: 11px var(--mono); color: var(--muted); text-align: center; margin-top: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .g-main, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .g-side { grid-template-columns: 1fr; }
  .explorer { grid-template-columns: 220px minmax(0, 1fr); }
  .demo-pill { display: none; }
  .hide-sm { display: none !important; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 35; opacity: 0; pointer-events: none; transition: .2s; }
  .scrim.open { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 0 12px; gap: 8px; }
  .crumbs { display: none; }
  .gsearch { width: auto; flex: 1; }
  .gsearch kbd { display: none; }
  .page { padding: 16px 12px; }
  .page-illus { display: none; }
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-tall .chart, .chart { height: 180px; }
  .top-logo { display: inline-flex !important; }
  .span-2 { grid-column: auto; }
  .explorer { grid-template-columns: 1fr; }
  .tree { border-right: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
  .editor { grid-template-columns: 1fr; }
  .ed-src { border-right: 0; border-bottom: 1px solid var(--line); min-height: 280px; }
  .doc-layout, .set-layout { grid-template-columns: 1fr; }
  .doc-nav, .set-nav { position: static; }
  .set-nav { display: flex; overflow-x: auto; }
  .set-nav a { white-space: nowrap; }
  .resp { grid-template-columns: 1fr; gap: 8px; }
  .pos-row { grid-template-columns: 1fr; }
  .gauge-wrap { grid-template-columns: 1fr; justify-items: center; }
  .source-truth { grid-template-columns: 1fr; }
  .st-arrow { transform: rotate(90deg); }
  .issue-row { grid-template-columns: 1fr; }
  .fields-2 { grid-template-columns: 1fr; }
  .graph-wrap { height: 480px; }
  .chat { height: 70vh; }
  .notif-pop { width: min(340px, calc(100vw - 24px)); right: -8px; }
  .kv { grid-template-columns: 110px 1fr; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: minmax(0, 1fr); }
  .gsearch input { font-size: 16px; }
  .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .net-chip span { display: none; }
  .net-chip { padding: 0 7px; }
  .conn-dot { display: none; }
  .room-meta { grid-template-columns: repeat(3, 1fr); }
  .lc-step { font-size: 9.5px; letter-spacing: 0; }
  .action-set { grid-template-columns: 1fr; }
  .barlist-row { grid-template-columns: 90px 1fr 36px; }
  .page-head { padding: 14px; }
  h1 { font-size: 19px; }
}
body.no-mono .mono, body.no-mono td.mono, body.no-mono .stat-value { font-family: var(--font); }
/* Form controls always fit their column */
label.field > input, label.field > select, label.field > textarea, .field select, .field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) { width: 100%; max-width: 100%; }
label.field, .field { min-width: 0; }
.g-main > *, .g-2 > *, .g-3 > *, .g-side > * { min-width: 0; }
.chart-tall .chart { height: 280px; }

/* Wallet login */
.wallet-wrap { position: relative; }
.wallet-btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font: 600 12.5px var(--font); cursor: pointer; white-space: nowrap; transition: .15s; }
.wallet-btn .ic { width: 15px; height: 15px; }
.wallet-btn.btn-primary { background: var(--lime); color: #0B1512; border-color: var(--lime); }
.wallet-btn.btn-primary:hover { box-shadow: var(--glow); }
.wallet-btn.on { background: color-mix(in srgb, var(--net) 12%, var(--bg-2)); border-color: color-mix(in srgb, var(--net) 45%, transparent); font-weight: 500; }
.wallet-btn[disabled] { opacity: .6; cursor: wait; }
.wallet-pop { width: 320px; }
.wallet-pop .ca { font-size: 12px; }
.wallet-list { display: grid; gap: 8px; }
.wallet-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-input); color: var(--text); font: inherit; cursor: pointer; transition: .15s; }
.wallet-opt:hover { border-color: rgba(184, 243, 107, .5); box-shadow: var(--glow); }
.wallet-opt[disabled] { opacity: .6; cursor: wait; }
.wallet-opt .grow { display: grid; }
.side-wallet { display: inline-flex !important; align-items: center; gap: 5px; margin-top: 2px; }
@media (max-width: 560px) { .hide-xs { display: none; } .wallet-btn { padding: 0 9px; } .wallet-pop { width: min(320px, calc(100vw - 24px)); right: -60px; } }
@media (max-width: 1500px) { .ws-pill { display: none; } }
