/* Shashu IDE shell — Freebuff-inspired, dark chat-first workspace. */

:root {
  color-scheme: dark;
  --font-ui: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "Cascadia Mono", Consolas, ui-monospace, monospace;

  --sidebar-w: 252px;
  --topbar-h: 46px;
  --status-h: 26px;
  --chat-max: 780px;
  --row-h: 34px;
  --pad: 16px;
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;

  --accent: #cfdcc0;
  --accent-ink: #171c12;
  --accent-soft: rgba(207, 220, 192, .12);
  --accent-line: rgba(207, 220, 192, .38);

  --bg: #171717;
  --bg-deep: #101010;
  --side: #121212;
  --panel: #1e1e1e;
  --panel-2: #242424;
  --raise: #2a2a2a;
  --field: #1a1a1a;
  --field-border: #333333;
  --text: #ece9e2;
  --muted: #a5a199;
  --faint: #7a766d;
  --line: #2b2b2b;
  --line-soft: #242424;
  --line-strong: #393939;
  --hover: #202020;
  --active: #282828;
  --user-bubble: #2b2b2b;
  --success: #a3c99a;
  --success-soft: rgba(163, 201, 154, .12);
  --danger: #e79a9a;
  --danger-soft: rgba(231, 154, 154, .12);
  --warn: #dfc07e;
  --warn-soft: rgba(223, 192, 126, .12);
  --info: #a7c4dc;
  --info-soft: rgba(167, 196, 220, .12);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --shadow-sm: 0 4px 18px rgba(0, 0, 0, .22);
}

html[data-theme="graphite"] {
  --bg: #0f1112;
  --bg-deep: #0a0c0d;
  --side: #0b0d0e;
  --panel: #171a1c;
  --panel-2: #1d2123;
  --raise: #23282a;
  --field: #121517;
  --field-border: #2b3337;
  --text: #e9eded;
  --muted: #9aa3a4;
  --faint: #6f7879;
  --line: #252b2e;
  --line-soft: #1f2426;
  --line-strong: #333c40;
  --hover: #181c1e;
  --active: #21272a;
  --user-bubble: #232a2d;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
}

html[data-theme="steel"] {
  color-scheme: dark;
  --accent: #dbe6ee;
  --accent-ink: #081016;
  --accent-soft: rgba(219, 230, 238, .12);
  --accent-line: rgba(219, 230, 238, .38);
  --bg: #04090e;
  --bg-deep: #020509;
  --side: #060b10;
  --panel: #0a1319;
  --panel-2: #101b22;
  --raise: #16242c;
  --field: #050c11;
  --field-border: rgba(168, 194, 210, .26);
  --text: #eef4f8;
  --muted: #9db0bd;
  --faint: #71838f;
  --line: rgba(168, 194, 210, .20);
  --line-soft: rgba(168, 194, 210, .10);
  --line-strong: rgba(190, 220, 235, .34);
  --hover: rgba(127, 231, 255, .05);
  --active: rgba(127, 231, 255, .09);
  --user-bubble: #16232b;
  --success: #9fe0c0;
  --success-soft: rgba(159, 224, 192, .12);
  --danger: #e9a0a0;
  --danger-soft: rgba(233, 160, 160, .12);
  --warn: #dfc07e;
  --warn-soft: rgba(223, 192, 126, .12);
  --info: #7fe7ff;
  --info-soft: rgba(127, 231, 255, .12);
  --cyan: #7fe7ff;
  --silver: #e9f2f7;
  --steel: #9db0bd;
  --shadow: 0 24px 60px rgba(0, 0, 0, .58);
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, .38);
}

html[data-theme="daylight"] {
  color-scheme: light;
  --bg: #f7f6f1;
  --bg-deep: #efeee8;
  --side: #f1f0ea;
  --panel: #ffffff;
  --panel-2: #f4f3ee;
  --raise: #ecebe5;
  --field: #ffffff;
  --field-border: #d8d5cb;
  --text: #262520;
  --muted: #6d6a62;
  --faint: #928d82;
  --line: #e2dfd6;
  --line-soft: #ebe8e0;
  --line-strong: #d2cec4;
  --hover: #ecebe5;
  --active: #e6e3da;
  --user-bubble: #e8e5dd;
  --success: #4c7a3f;
  --success-soft: rgba(76, 122, 63, .1);
  --danger: #a94a4a;
  --danger-soft: rgba(169, 74, 74, .1);
  --warn: #8a6a1f;
  --warn-soft: rgba(138, 106, 31, .12);
  --info: #41687f;
  --info-soft: rgba(65, 104, 127, .1);
  --shadow: 0 20px 55px rgba(52, 47, 33, .14);
  --shadow-sm: 0 4px 18px rgba(52, 47, 33, .08);
}

html[data-density="compact"] {
  --row-h: 30px;
  --pad: 12px;
  --chat-max: 740px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
::selection { background: var(--accent-soft); color: var(--text); }
kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  color: var(--faint);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 5px;
  white-space: nowrap;
}
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 14%, transparent);
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text) 24%, transparent); }

:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

/* ============================== shell ============================== */

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
}
.app.collapsed { --sidebar-w: 64px; }

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

/* ============================== sidebar ============================== */

.side-top {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 52px;
  padding: 0 12px 0 14px;
  flex: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}
button.brand {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
button.brand:hover .brand-mark { border-color: var(--line-strong); color: var(--text); }
.brand-mark {
  width: 25px;
  height: 25px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 3px;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--accent);
}
.brand-mark svg { width: 100%; height: 100%; }
.brand-name {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -.015em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}
.brand-badge {
  font-size: 9px;
  font-weight: 600;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 4px;
  margin-left: 1px;
  letter-spacing: .02em;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { background: var(--active); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.small { width: 24px; height: 24px; }
.icon-btn.small svg { width: 14px; height: 14px; }

.side-collapse { display: none; }
.app.collapsed .side-collapse { display: inline-grid; }

.new-chat, .side-search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: var(--row-h);
  margin: 2px 10px;
  padding: 0 9px;
  flex: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  text-align: left;
}
.new-chat svg, .side-search svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.new-chat:hover, .side-search:hover { background: var(--hover); }
.new-chat kbd, .side-search kbd { margin-left: auto; }
.side-search { color: var(--muted); margin-top: 0; }

.side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0 8px;
}
.side-sec { margin-bottom: 18px; }
.side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 18px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: .01em;
}
.side-label .count { font-weight: 500; font-variant-numeric: tabular-nums; }
.side-label .mini {
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 10.5px;
  padding: 0;
}
.side-label .mini:hover { color: var(--text); }

.thread-list { display: flex; flex-direction: column; padding: 0 8px; }
.thread {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
  width: 100%;
  min-width: 0;
}
.thread svg { width: 13px; height: 13px; flex: none; opacity: .7; }
.thread span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread:hover { background: var(--hover); color: var(--text); }
.thread.active { background: var(--active); color: var(--text); }
.thread-empty { padding: 2px 10px 0; font-size: 11.5px; color: var(--faint); }
.thread-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px 3px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.thread.oc-thread.running { color: var(--text); }
.thread-live {
  width: 6px;
  height: 6px;
  margin-left: auto;
  flex: none;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.realm-list { display: flex; flex-direction: column; padding: 0 8px; }
.realm {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 30px;
  padding: 0 10px;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
}
.realm:hover { background: var(--hover); color: var(--text); }
.realm .realm-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; opacity: .8; }
.realm .realm-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.realm .realm-count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.realm.active { background: var(--active); color: var(--text); }

.side-foot {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.engine-mini, .host-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  text-align: left;
}
.engine-mini:hover, .host-row:hover { background: var(--hover); color: var(--text); }
.engine-mini span, .host-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.host-row .icon-btn { margin-left: auto; width: 22px; height: 22px; }
.dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--faint);
}
.dot.ok { background: var(--success); }
.dot.bad { background: var(--danger); }
.dot.warn { background: var(--warn); }
.dot.engine-online { background: var(--info); }
.dot.engine-local { background: var(--accent); }

.app.collapsed .brand-name,
.app.collapsed .new-chat span,
.app.collapsed .new-chat kbd,
.app.collapsed .side-search span,
.app.collapsed .side-search kbd,
.app.collapsed .side-label,
.app.collapsed .side-sec,
.app.collapsed .engine-mini span,
.app.collapsed .host-row span,
.app.collapsed .host-row .icon-btn { display: none; }
.app.collapsed .side-top { padding: 0; justify-content: center; }
.app.collapsed .brand { flex: none; }
.app.collapsed .new-chat, .app.collapsed .side-search { justify-content: center; padding: 0; }
.app.collapsed .side-foot { padding: 8px 6px; }
.app.collapsed .engine-mini, .app.collapsed .host-row { justify-content: center; padding: 0; }
.app.collapsed .side-collapse { display: none; }

/* ============================== topbar / tabs ============================== */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  flex: none;
  padding: 0 10px 0 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
#sideToggle { display: none; }
.app.collapsed #sideToggle { display: inline-grid; }

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  max-width: 230px;
  padding: 0 9px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
}
.tab svg { width: 14px; height: 14px; flex: none; opacity: .8; }
.tab .tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}
.tab .tab-close {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-right: -3px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--faint);
  opacity: 0;
}
.tab .tab-close svg { width: 11px; height: 11px; }
.tab:hover .tab-close, .tab.active .tab-close { opacity: 1; }
.tab .tab-close:hover { background: var(--raise); color: var(--text); }
#tabAdd { width: 26px; height: 26px; }
#tabAdd svg { width: 14px; height: 14px; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.workspace-tag {
  font-size: 11px;
  color: var(--faint);
  padding-left: 8px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}
.top-sep { width: 1px; height: 18px; background: var(--line); margin: 0 2px; }

/* ============================== views ============================== */

.views {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
}
.view {
  display: none;
  flex: 1;
  min-width: 0;
  min-height: 0;
}
.view.active { display: flex; }
.view-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 32px 18px;
}
.view-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.view-head p {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 620px;
}
.head-actions { display: flex; align-items: center; gap: 10px; flex: none; }

/* ============================== opencode ============================== */

.opencode-view {
  flex-direction: column;
  min-height: 0;
}
.oc-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  height: 42px;
  padding: 0 12px 0 14px;
  background: linear-gradient(180deg, rgba(9, 16, 21, .92), rgba(4, 9, 13, .84));
  border-bottom: 1px solid var(--line);
}
.oc-head::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 2%, rgba(190, 220, 235, .40) 22%, rgba(127, 231, 255, .50) 72%, transparent);
}
.oc-head-id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.oc-badge {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 6px;
  color: var(--cyan);
  background: var(--info-soft);
  border: 1px solid rgba(127, 231, 255, .30);
  box-shadow: inset 0 0 10px rgba(127, 231, 255, .08);
}
.oc-badge svg { width: 14px; height: 14px; }
.oc-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
  white-space: nowrap;
}
.oc-sep { width: 1px; height: 14px; flex: none; background: var(--line); }
.oc-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .03em;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.oc-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.oc-connect { height: 28px; min-height: 28px; padding: 0 11px; font-size: 11.5px; }
#opencodeFrame {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: block;
  border: 0;
  background: var(--bg-deep);
}

/* ============================== chat ============================== */

.chat-view {
  flex-direction: column;
  position: relative;
}
.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 30px 24px 8px;
  scroll-behavior: smooth;
}
.chat-inner {
  width: 100%;
  max-width: var(--chat-max);
  margin: 0 auto;
}
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: min(48vh, 420px);
  padding: 26px 0 20px;
}
.empty-mark {
  width: 42px;
  height: 42px;
  padding: 6px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--accent);
  margin-bottom: 16px;
}
.empty-mark svg { width: 100%; height: 100%; }
.chat-empty h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.chat-empty p {
  margin: 7px 0 24px;
  font-size: 13px;
  color: var(--muted);
  max-width: 440px;
}
.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  width: 100%;
  max-width: 540px;
  text-align: left;
}
.suggest {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  text-align: left;
  min-width: 0;
}
.suggest:hover { background: var(--panel-2); border-color: var(--line-strong); }
.suggest .s-icon { color: var(--muted); flex: none; margin-top: 1px; }
.suggest .s-icon svg { width: 15px; height: 15px; }
.suggest b { display: block; font-size: 12.5px; font-weight: 600; }
.suggest small { display: block; margin-top: 2px; font-size: 11px; color: var(--faint); line-height: 1.4; }
.chat-empty .apart {
  margin-top: 18px;
  font-size: 10.5px;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 7px;
}
.chat-empty .apart .dot { width: 5px; height: 5px; }

.messages { display: flex; flex-direction: column; padding-bottom: 18px; }
.msg {
  display: flex;
  margin: 0 0 26px;
  animation: rise .16s ease-out;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  max-width: 100%;
  padding: 9px 13px;
  border-radius: 12px;
  background: var(--user-bubble);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.user .u-meta {
  margin-top: 5px;
  text-align: right;
  font-size: 10px;
  color: var(--faint);
}
.msg.user .bubble-wrap { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; max-width: min(78%, 620px); }
.msg.assistant { gap: 10px; }
.asst-avatar {
  width: 22px;
  height: 22px;
  flex: none;
  margin-top: 1px;
  padding: 3px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--accent);
}
.asst-avatar svg { width: 100%; height: 100%; }
.asst-wrap { min-width: 0; flex: 1; }
.asst-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  margin-bottom: 4px;
}
.asst-name { font-size: 12px; font-weight: 650; color: var(--text); }
.asst-meta { font-size: 10.5px; color: var(--faint); }
.asst-meta .sep { margin: 0 4px; opacity: .6; }
.asst-tools {
  margin-left: auto;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s;
}
.msg.assistant:hover .asst-tools { opacity: 1; }
.asst-text {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  overflow-wrap: anywhere;
}
.asst-text p { margin: 0 0 9px; }
.asst-text p:last-child { margin-bottom: 0; }
.asst-text ul, .asst-text ol { margin: 4px 0 10px; padding-left: 20px; }
.asst-text li { margin: 2px 0; }
.asst-text code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text);
}
.asst-text pre {
  margin: 8px 0;
  padding: 11px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}
.asst-text pre code { background: transparent; border: 0; padding: 0; font-size: 11.5px; line-height: 1.55; }
.asst-text a { color: var(--accent); }
.asst-text strong { font-weight: 650; color: var(--text); }
.workline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
  margin: 1px 0 7px;
  padding: 2px 6px 2px 2px;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--faint);
  font-size: 11.5px;
}
.workline:hover { color: var(--muted); background: var(--hover); }
.workline .work-chev {
  transition: transform .15s;
}
.workline.open .work-chev { transform: rotate(90deg); }
.workline.working .work-chev { display: none; }
.workline .timer { font-variant-numeric: tabular-nums; }
.agent-steps {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 3px;
  padding: 1px 7px 1px 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: .02em;
}
.trace-pulse {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: tracePulse 1.8s ease-in-out infinite;
}
@keyframes tracePulse {
  0%, 100% { opacity: .35; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
.spinner {
  width: 11px;
  height: 11px;
  flex: none;
  border: 1.5px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite;
}
.typing-dots i:nth-child(2) { animation-delay: .16s; }
.typing-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes blink { 0%, 70%, 100% { opacity: .25; } 35% { opacity: 1; } }

.actions { display: flex; flex-direction: column; gap: 6px; margin: 9px 0 2px; }
.action-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}
.action-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
}
.action-head .a-icon { color: var(--muted); flex: none; }
.action-head .a-icon svg { width: 14px; height: 14px; }
.action-head .a-label { font-size: 12px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  margin-left: auto;
  flex: none;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .03em;
  border-radius: 5px;
  padding: 2px 5px;
  background: var(--success-soft);
  color: var(--success);
}
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.action-result {
  border-top: 1px solid var(--line-soft);
  padding: 7px 10px 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.action-card.failed { border-color: color-mix(in srgb, var(--danger) 32%, var(--line)); }
.error-card {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 34%, var(--line));
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}
.error-card svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.error-card .retry {
  margin-left: auto;
  flex: none;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 5px;
  color: var(--danger);
  font-size: 10.5px;
  padding: 2px 7px;
}
.error-card .retry:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.asst-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--faint);
}
.asst-actions-row .model-pill {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
}
.asst-actions-row .copy-btn { margin-left: auto; }

/* ============================== composer ============================== */

.composer-area {
  flex: none;
  padding: 6px 24px 16px;
  background: linear-gradient(to bottom, transparent, var(--bg) 26%);
}
.composer {
  max-width: var(--chat-max);
  margin: 0 auto;
}
.composer-box {
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.composer-box:focus-within { border-color: var(--accent-line); }
#prompt {
  display: block;
  width: 100%;
  min-height: 48px;
  max-height: 190px;
  padding: 14px 14px 4px;
  border: 0;
  outline: 0;
  background: transparent;
  resize: none;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  overflow-y: auto;
}
#prompt::placeholder { color: var(--faint); }
.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px 8px 10px;
}
.composer-left, .composer-right { display: flex; align-items: center; gap: 5px; min-width: 0; }
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}
.chip-btn:hover { color: var(--text); background: var(--hover); }
.chip-btn .dot { width: 5px; height: 5px; }
.chip-btn.ghost { border-color: transparent; color: var(--faint); }
.chip-btn.ghost:hover { border-color: var(--line); }
.composer-right .hint { font-size: 10px; color: var(--faint); padding-right: 3px; }
.send-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
}
.send-btn svg { width: 15px; height: 15px; }
.send-btn:hover { filter: brightness(1.06); }
.send-btn:disabled { background: var(--panel-2); color: var(--faint); cursor: default; filter: none; }
.send-btn.stop { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-strong); }
.composer-note {
  max-width: var(--chat-max);
  margin: 8px auto 0;
  text-align: center;
  font-size: 10px;
  color: var(--faint);
}

/* ============================== map ============================== */

.map-view { position: relative; background: #05080a; display: none; flex-direction: column; width: 100%; height: 100%; min-height: 0; }
.map-view.active { display: flex; }
.map-modes {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: #060c14;
  border-bottom: 1px solid rgba(126, 231, 255, .12);
  flex: 0 0 auto;
  z-index: 3;
}
.map-modes .mode-btn {
  appearance: none;
  border: 1px solid rgba(126, 231, 255, .16);
  background: rgba(126, 231, 255, .04);
  color: #8ea6ba;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.map-modes .mode-btn:hover { color: #cfe6f2; border-color: rgba(126, 231, 255, .34); }
.map-modes .mode-btn.active {
  background: linear-gradient(145deg, rgba(126, 231, 255, .2), rgba(56, 189, 248, .12));
  border-color: rgba(126, 231, 255, .5);
  color: #7fe7ff;
}
.map-modes .mode-note {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #5d7186;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-stage { position: relative; flex: 1 1 auto; min-height: 0; }
#analyzerFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #050a12;
}
@media (max-width: 720px) {
  .map-modes .mode-note { display: none; }
}
#mapFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #05080a;
}
.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 10px;
  background: #05080a;
  color: #8ea1ab;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  z-index: 2;
  transition: opacity .25s;
}
.map-loading.hide { opacity: 0; pointer-events: none; }
.map-loading .spinner { width: 18px; height: 18px; margin-bottom: 8px; }
.map-fail { text-align: center; max-width: 320px; line-height: 1.6; text-transform: none; letter-spacing: 0; font-size: 12px; }
.map-fail button { margin-top: 12px; }

/* ============================== plugins ============================== */

.plugins-view { flex-direction: column; }
.plugins-view .view-scroll { display: flex; flex-direction: column; }
.search-field {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 240px;
  height: 32px;
  padding: 0 9px;
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 7px;
  color: var(--faint);
}
.search-field:focus-within { border-color: var(--accent-line); }
.search-field svg { width: 14px; height: 14px; flex: none; }
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
  color: var(--text);
}
.search-field input::placeholder { color: var(--faint); }

.filterbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 32px 12px;
}
.cat-chips, .status-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.fchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.fchip:hover { background: var(--hover); color: var(--text); }
.fchip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.fchip .dot { width: 5px; height: 5px; }
.fchip .n { font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }
.fchip.active .n { color: var(--muted); }
.status-chips { padding-top: 1px; }
.status-chips .fchip { height: 23px; font-size: 10.5px; border-color: transparent; padding: 0 8px; }
.status-chips .fchip.active { border-color: var(--line-strong); background: var(--panel); }
.plugins-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px 10px;
  font-size: 11px;
  color: var(--faint);
}
#favFilter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font-size: 10.5px;
}
#favFilter:hover { color: var(--text); background: var(--hover); }
#favFilter.active { color: var(--warn); border-color: var(--line); background: var(--panel); }

.plugin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  align-items: start;
  min-height: 0;
  flex: none;
}
.plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
  gap: 9px;
  padding: 0 24px 36px 32px;
  align-content: start;
}
.plugin-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 11px 12px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  text-align: left;
}
.plugin-card:hover { background: var(--panel-2); border-color: var(--line-strong); }
.plugin-card.selected { border-color: var(--accent-line); background: var(--panel-2); }
.pc-top { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.pc-icon {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--raise);
  border: 1px solid var(--line);
  color: var(--muted);
}
.pc-icon svg { width: 14px; height: 14px; }
.pc-name {
  min-width: 0;
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-top: 2px;
}
.pc-star {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--faint);
  opacity: .55;
}
.pc-star svg { width: 13px; height: 13px; }
.pc-star:hover { background: var(--hover); color: var(--warn); opacity: 1; }
.pc-star.on { color: var(--warn); opacity: 1; }
.pc-status { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--faint); }
.pc-status .dot { width: 5px; height: 5px; }
.pc-use {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pc-use.muted { color: var(--faint); }
.plugin-empty {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.plugin-detail {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 420px;
  border-left: 1px solid var(--line);
  padding: 22px 22px 30px;
  background: var(--bg);
}
.pd-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  text-align: center;
  color: var(--faint);
}
.pd-empty .pd-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  color: var(--muted);
}
.pd-empty .pd-mark svg { width: 16px; height: 16px; }
.pd-empty b { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pd-empty small { margin-top: 4px; font-size: 11px; max-width: 190px; line-height: 1.5; }
.pd-head { display: flex; align-items: flex-start; gap: 11px; }
.pd-icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--accent);
}
.pd-icon svg { width: 18px; height: 18px; }
.pd-title { min-width: 0; flex: 1; }
.pd-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.pd-cat { margin-top: 3px; font-size: 10.5px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.pd-cat .dot { width: 5px; height: 5px; }
.pd-close { margin-left: auto; }
.pd-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-size: 10.5px;
  color: var(--muted);
}
.pd-status .dot { width: 5px; height: 5px; }
.pd-desc { margin: 16px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.pd-label {
  margin: 20px 0 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--faint);
  text-transform: uppercase;
}
.use-list { display: flex; flex-wrap: wrap; gap: 5px; }
.use-chip {
  font-size: 10.5px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 7px;
  line-height: 1.35;
}
.pd-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 20px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { background: var(--raise); border-color: var(--line-strong); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--hover); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); color: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.pd-note {
  margin-top: 11px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--faint);
}
.pd-feedback {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.5;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
}
.pd-feedback.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 28%, var(--line)); }
.pd-feedback.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 28%, var(--line)); }

/* ============================== settings ============================== */

.settings-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 780px);
  gap: 42px;
  padding: 0 32px 70px;
  align-items: start;
}
.settings-nav {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.settings-nav button {
  text-align: left;
  height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.settings-nav button:hover { background: var(--hover); color: var(--text); }
.settings-nav button.active { background: var(--active); color: var(--text); }
.settings-body { min-width: 0; }
.set-section {
  padding: 2px 0 26px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 14px;
}
.set-section:last-child { border-bottom: 0; margin-bottom: 0; }
.set-section h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.set-section > p {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 620px;
}
.set-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.set-row:last-child { border-bottom: 0; }
.set-row.stack { flex-direction: column; align-items: stretch; gap: 12px; }
.set-row .sr-label { min-width: 0; }
.set-row .sr-label b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.set-row .sr-label small { display: block; margin-top: 3px; font-size: 11px; color: var(--faint); line-height: 1.45; max-width: 420px; }
.set-row .sr-control { flex: none; display: flex; align-items: center; gap: 7px; }
.set-row.stack .sr-control { flex: 1 1 auto; width: 100%; }
.input, .select, textarea.input {
  height: 31px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  font-size: 12px;
  outline: 0;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent-line); }
.input::placeholder { color: var(--faint); }
.input.grow { flex: 1; width: 100%; }
textarea.input { height: auto; min-height: 64px; padding: 8px 9px; resize: vertical; line-height: 1.5; }
.set-row .input { width: 240px; }
.set-row .select { width: 240px; }
.set-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-status { margin-top: 9px; font-size: 11px; color: var(--faint); line-height: 1.5; min-height: 16px; }
.set-status.ok { color: var(--success); }
.set-status.bad { color: var(--danger); }
.seg {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--field);
  gap: 2px;
}
.seg button {
  height: 25px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--active); color: var(--text); }
.preset-row { display: flex; flex-wrap: wrap; gap: 5px; }
.preset {
  height: 25px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
}
.preset:hover { background: var(--hover); color: var(--text); }
.preset.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.engine-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-block { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-block > span { font-size: 10.5px; color: var(--faint); }
.field-block .input, .field-block .select { width: 100%; }
.field-note { font-size: 10.5px; color: var(--faint); line-height: 1.5; margin-top: 2px; }
.engine-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.engine-foot .set-status { margin: 0; flex: 1; min-width: 180px; }

.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
  color: var(--muted);
  font-size: 11px;
}
.theme-card:hover { border-color: var(--line-strong); }
.theme-card.active { border-color: var(--accent-line); color: var(--text); }
.theme-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  height: 46px;
  padding: 7px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, .06);
}
.theme-preview i { display: block; height: 4px; border-radius: 2px; }
.theme-card .theme-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.theme-card .theme-name .tick { color: var(--accent); opacity: 0; }
.theme-card.active .theme-name .tick { opacity: 1; }
.accent-row { display: flex; gap: 8px; }
.accent-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}
.accent-swatch:hover { transform: scale(1.06); }
.accent-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset, inset 0 0 0 1px rgba(0, 0, 0, .18); }
.switch {
  position: relative;
  width: 32px;
  height: 18px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--field);
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .14s, background .14s;
}
.switch.on { background: var(--accent-soft); border-color: var(--accent-line); }
.switch.on::after { transform: translateX(14px); background: var(--accent); }
.voice-card { display: flex; align-items: center; gap: 12px; padding: 14px; }
.voice-card .v-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--accent);
}
.voice-card .v-icon svg { width: 17px; height: 17px; }
.voice-card .v-copy { flex: 1; min-width: 0; }
.voice-card .v-copy b { display: block; font-size: 12.5px; font-weight: 600; }
.voice-card .v-copy small { display: block; margin-top: 3px; font-size: 11px; color: var(--faint); line-height: 1.5; }
.voice-hint { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.voice-hint code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
}

.tg-card { padding: 14px; }
.tg-head { display: flex; align-items: center; gap: 10px; }
.tg-head .tg-icon {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--info);
}
.tg-head .tg-icon svg { width: 16px; height: 16px; }
.tg-head .tg-who { flex: 1; min-width: 0; }
.tg-head .tg-who b { display: block; font-size: 12.5px; font-weight: 600; }
.tg-head .tg-who small { display: block; margin-top: 2px; font-size: 11px; color: var(--faint); }
.tg-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 7px;
  white-space: nowrap;
}
.tg-body { margin-top: 13px; display: flex; flex-direction: column; gap: 10px; }
.tg-row { display: flex; gap: 6px; align-items: stretch; }
.tg-row .input { flex: 1; width: auto; }
.tg-note { font-size: 10.5px; color: var(--faint); line-height: 1.55; }
.tg-note a { color: var(--muted); text-decoration: underline; }
.tg-send { border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 2px; display: flex; flex-direction: column; gap: 7px; }
.tg-send .tg-row { align-items: flex-end; }
.tg-send textarea.input { flex: 1; width: auto; min-height: 58px; }
.tg-feedback { font-size: 11px; line-height: 1.5; min-height: 15px; color: var(--faint); }
.tg-feedback.ok { color: var(--success); }
.tg-feedback.bad { color: var(--danger); }

.privacy-list { display: flex; flex-direction: column; }
.privacy-item {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  align-items: flex-start;
}
.privacy-item:last-child { border-bottom: 0; }
.privacy-item .p-check {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
}
.privacy-item .p-check svg { width: 10px; height: 10px; }
.privacy-item b { display: block; font-size: 12px; font-weight: 600; }
.privacy-item small { display: block; margin-top: 2px; font-size: 11px; color: var(--faint); line-height: 1.5; }
.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line-soft);
}
.kv {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.kv:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.kv span { display: block; font-size: 10px; color: var(--faint); }
.kv b { display: block; margin-top: 3px; font-size: 12px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.shortcut-table { display: flex; flex-direction: column; }
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--muted);
}
.shortcut-row:last-child { border-bottom: 0; }
.shortcut-row .keys { display: flex; gap: 4px; flex: none; }
.about-card { display: flex; gap: 14px; padding: 16px; align-items: flex-start; }
.about-mark {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 6px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--accent);
}
.about-mark svg { width: 100%; height: 100%; }
.about-copy b { display: block; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.about-copy small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--faint); line-height: 1.55; }
.about-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ============================== status bar ============================== */

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--status-h);
  flex: none;
  padding: 0 10px;
  border-top: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
}
.status-left, .status-right { display: flex; align-items: center; gap: 7px; min-width: 0; }
.status-left span, .status-right span, .status-right button { overflow: hidden; text-overflow: ellipsis; }
.status-right button {
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 10px;
  padding: 0 2px;
  height: 18px;
}
.status-right button:hover { color: var(--text); }
.status-sep { width: 1px; height: 11px; background: var(--line); flex: none; }
.statusbar .dot { width: 5px; height: 5px; }

/* ============================== command palette ============================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  background: rgba(0, 0, 0, .46);
  backdrop-filter: blur(3px);
}
html[data-theme="daylight"] .overlay { background: rgba(40, 37, 30, .24); }
.palette {
  width: min(620px, 100%);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: paletteIn .14s ease-out;
}
@keyframes paletteIn {
  from { opacity: 0; transform: translateY(-5px) scale(.992); }
  to { opacity: 1; transform: none; }
}
.palette-input {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 48px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
}
.palette-input svg { width: 16px; height: 16px; flex: none; }
.palette-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13.5px;
  color: var(--text);
}
.palette-input input::placeholder { color: var(--faint); }
.palette-list { max-height: 380px; overflow-y: auto; padding: 6px; }
.pal-group-label {
  padding: 8px 9px 4px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}
.pal-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  min-width: 0;
}
.pal-item svg { width: 14px; height: 14px; flex: none; color: var(--faint); }
.pal-item .pal-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.pal-item .pal-hint { margin-left: auto; font-size: 10px; color: var(--faint); flex: none; }
.pal-item:hover, .pal-item.active { background: var(--active); color: var(--text); }
.pal-item.active svg { color: var(--accent); }
.pal-empty { padding: 36px 12px; text-align: center; font-size: 12px; color: var(--faint); }
.palette-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 30px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  font-size: 9.5px;
  color: var(--faint);
}

/* ============================== toasts ============================== */

.toasts {
  position: fixed;
  right: 16px;
  bottom: calc(var(--status-h) + 12px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(340px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--accent);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  animation: toastIn .18s ease-out;
}
.toast.bad { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--success); }
.toast svg { width: 14px; height: 14px; flex: none; margin-top: 1px; color: var(--muted); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ============================== misc ============================== */

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hide { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================== suite ============================== */

.suite-view .view-scroll { padding-bottom: 38px; }
.suite-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 32px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--line);
}
.suite-stat {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 58px;
  padding: 10px 13px;
  border: 0;
  background: var(--panel);
  text-align: left;
}
.suite-stat:hover { background: var(--panel-2); }
.suite-stat-copy { min-width: 0; }
.suite-stat small {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--faint);
}
.suite-stat b {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suite-stat .chev { width: 12px; height: 12px; margin-left: auto; flex: none; color: var(--faint); opacity: .7; }
.suite-stat:hover .chev { color: var(--text); opacity: 1; }

.suite-section { padding: 0 32px; margin-top: 26px; }
.suite-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.suite-section-head h2 {
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.suite-section-head span { font-size: 10.5px; color: var(--faint); }
.suite-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.suite-card {
  display: flex;
  flex-direction: column;
  min-height: 166px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  transition: border-color .15s ease, transform .15s ease;
}
.suite-card:hover { border-color: var(--line-strong); }
.suite-card.featured {
  grid-column: span 2;
  background:
    radial-gradient(circle at 86% 0%, var(--accent-soft), transparent 46%),
    var(--panel);
}
.sc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.sc-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--accent);
}
.sc-icon svg { width: 15px; height: 15px; }
.sc-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  white-space: nowrap;
}
.sc-badge.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, var(--line)); }
.sc-badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.sc-badge.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.suite-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.suite-card p {
  margin: 6px 0 12px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 64ch;
}
.sc-status {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: auto;
  padding-top: 3px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--faint);
}
.sc-status .dot { width: 5px; height: 5px; margin-top: 5px; }
.sc-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.sc-foot .btn { min-height: 28px; font-size: 11.5px; }
.suite-foot {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 30px 32px 0;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--faint);
}
.suite-foot svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--accent); }
.suite-foot b { display: block; font-size: 11.5px; font-weight: 600; color: var(--text); }
.suite-foot span { display: block; margin-top: 2px; font-size: 10.5px; line-height: 1.55; }

/* ============================== responsive ============================== */

@media (max-width: 1180px) {
  :root { --sidebar-w: 224px; }
  .settings-layout { grid-template-columns: 168px minmax(0, 1fr); gap: 28px; }
  .plugin-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .view-head { padding: 24px 24px 16px; }
  .filterbar { padding: 0 24px 12px; }
  .plugins-meta { padding: 0 24px 10px; }
  .plugin-grid { padding: 0 18px 32px 24px; }
  .settings-layout { padding: 0 24px 60px; }
  .suite-status { margin: 0 24px 8px; }
  .suite-section { padding: 0 24px; }
  .suite-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .suite-card.featured { grid-column: span 2; }
  .suite-foot { margin: 26px 24px 0; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 252px;
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: var(--shadow);
  }
  .app.side-open .sidebar { transform: none; z-index: 16; }
  .app.side-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(0, 0, 0, .36);
  }
  .app.collapsed .sidebar { width: 252px; }
  #sideToggle { display: inline-grid; }
  .app.collapsed #sideToggle { display: inline-grid; }
  .workspace-tag { display: none; }
  .plugin-layout { grid-template-columns: minmax(0, 1fr); }
  .plugin-detail {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 0;
    order: -1;
  }
  .pd-empty { min-height: 120px; }
  .plugin-detail.hidden, .plugin-detail.empty { display: none; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .view-head { flex-direction: column; align-items: stretch; gap: 12px; padding: 20px 16px 14px; }
  .view-head h1 { font-size: 21px; }
  .head-actions { width: 100%; }
  .search-field { width: 100%; }
  .filterbar { padding: 0 16px 10px; }
  .plugins-meta { padding: 0 16px 8px; }
  .plugin-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); padding: 0 16px 24px; }
  .settings-layout { padding: 0 16px 50px; }
  .settings-nav { overflow-x: auto; flex-wrap: nowrap; }
  .settings-nav button { flex: none; }
  .suite-status { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 16px 6px; }
  .suite-stat { min-height: 52px; padding: 9px 11px; }
  .suite-section { padding: 0 16px; margin-top: 22px; }
  .suite-grid { grid-template-columns: 1fr; }
  .suite-card.featured { grid-column: span 1; }
  .suite-card { min-height: 0; }
  .suite-foot { margin: 24px 16px 0; }
  .chat-scroll { padding: 20px 14px 6px; }
  .composer-area { padding: 4px 12px 12px; }
  .suggestions { grid-template-columns: 1fr; }
  .msg.user .bubble-wrap { max-width: 86%; }
  .tabs { gap: 1px; }
  .tab { padding: 0 7px; max-width: 150px; }
  .composer-right .hint { display: none; }
  .engine-grid { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: 1fr; }
  .set-row { gap: 10px; }
  .set-row .input, .set-row .select { width: 180px; }
  .statusbar .status-right #statusGuard { display: none; }
  .toasts { bottom: calc(var(--status-h) + 8px); }
}

@media (max-width: 520px) {
  .chip-btn.ghost { display: none; }
  .workspace-tag, .top-sep { display: none; }
  .tab .tab-close { opacity: 1; }
  .statusbar #statusTools { display: none; }
  .set-row { flex-direction: column; align-items: stretch; }
  .set-row .input, .set-row .select { width: 100%; }
  .engine-foot { align-items: stretch; }
  .theme-grid { grid-template-columns: 1fr; }
  .status-chips { display: none; }
  .kv-grid { grid-template-columns: 1fr; }
  .kv:nth-child(odd) { border-right: 0; }
}

/* ============================== IDE wiring states ============================== */

.plugin-card { cursor: pointer; }
.pc-star.on svg { fill: currentColor; }
#micBtn.listening {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
#sendBtn.stop svg { width: 13px; height: 13px; }
.thread .thread-time {
  margin-left: auto;
  font-size: 9.5px;
  color: var(--faint);
  flex: none;
}
.palette-foot kbd { margin-right: 3px; }

/* ============================== steel · map tactical chrome ============================== */

html[data-theme="steel"] body {
  background:
    radial-gradient(1100px 720px at 50% 44%, rgba(42, 86, 108, .20), transparent 64%),
    radial-gradient(900px 640px at 88% 74%, rgba(56, 118, 144, .10), transparent 68%),
    linear-gradient(158deg, #04090e 0%, #020509 52%, #04080c 100%);
}
html[data-theme="steel"] body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 48%, transparent 40%, rgba(1, 4, 8, .74) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .014) 0 1px, transparent 1px 3px);
}
html[data-theme="steel"] .app { position: relative; z-index: 1; }
html[data-theme="steel"] .main { background: transparent; }
html[data-theme="steel"] .sidebar {
  background: linear-gradient(180deg, rgba(8, 14, 19, .97), rgba(3, 8, 12, .98));
  border-right-color: rgba(168, 194, 210, .18);
  box-shadow: inset -1px 0 0 rgba(127, 231, 255, .04);
}
html[data-theme="steel"] .topbar {
  position: relative;
  background: linear-gradient(180deg, rgba(9, 16, 21, .92), rgba(4, 9, 13, .84));
  border-bottom-color: rgba(168, 194, 210, .18);
}
html[data-theme="steel"] .topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 2%, rgba(190, 220, 235, .40) 22%, rgba(127, 231, 255, .50) 72%, transparent);
}
html[data-theme="steel"] .statusbar {
  background: linear-gradient(180deg, rgba(4, 9, 13, .92), rgba(1, 4, 7, .97));
  border-top-color: rgba(168, 194, 210, .18);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 9px;
}

/* HUD plate */
html[data-theme="steel"] .side-top { height: 58px; padding: 8px 10px; }
html[data-theme="steel"] .brand {
  height: 40px;
  padding: 0 13px 0 7px;
  background: linear-gradient(150deg, rgba(126, 150, 166, .34), rgba(20, 28, 35, .30) 46%, rgba(70, 88, 100, .20));
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .35));
}
html[data-theme="steel"] button.brand:hover {
  background: linear-gradient(150deg, rgba(140, 170, 186, .44), rgba(24, 34, 42, .38) 50%, rgba(80, 110, 125, .26));
}
html[data-theme="steel"] button.brand:hover .brand-mark { border-color: rgba(127, 231, 255, .55); }
html[data-theme="steel"] .brand-mark {
  width: 27px;
  height: 27px;
  border-radius: 0;
  border-color: rgba(201, 222, 233, .40);
  background: linear-gradient(152deg, rgba(14, 22, 28, .96), rgba(4, 8, 12, .94));
  color: #eef6fa;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
  box-shadow: inset 0 0 12px rgba(127, 231, 255, .10), 0 0 12px rgba(80, 180, 210, .12);
}
html[data-theme="steel"] .brand-name {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  background: linear-gradient(176deg, #ffffff 3%, #e2ebf1 30%, #a3b2bd 52%, #eaf3f8 74%, #8b9ca9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 10px rgba(127, 231, 255, .14)) drop-shadow(0 1px 0 rgba(0, 0, 0, .5));
}
html[data-theme="steel"] .brand-badge {
  border-radius: 0;
  border-color: rgba(127, 231, 255, .26);
  color: #9db8c6;
  letter-spacing: .14em;
  text-transform: uppercase;
}
html[data-theme="steel"] .side-collapse { color: #9db0bd; }

/* sidebar rails */
html[data-theme="steel"] .new-chat,
html[data-theme="steel"] .side-search {
  border-radius: 0;
  border-color: transparent;
  background: linear-gradient(180deg, rgba(16, 26, 33, .55), rgba(6, 11, 15, .55));
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
html[data-theme="steel"] .new-chat:hover,
html[data-theme="steel"] .side-search:hover {
  background: linear-gradient(180deg, rgba(24, 38, 47, .72), rgba(8, 14, 19, .72));
  box-shadow: inset 0 0 0 1px rgba(127, 231, 255, .16);
}
html[data-theme="steel"] .side-label {
  font-family: var(--font-display);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #7e919d;
}
html[data-theme="steel"] .thread,
html[data-theme="steel"] .realm,
html[data-theme="steel"] .engine-mini,
html[data-theme="steel"] .host-row {
  border-radius: 0;
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
html[data-theme="steel"] .thread.active,
html[data-theme="steel"] .realm.active,
html[data-theme="steel"] .settings-nav button.active,
html[data-theme="steel"] .seg button.active {
  background: linear-gradient(180deg, rgba(41, 58, 68, .72), rgba(12, 20, 26, .82));
  box-shadow: inset 0 0 0 1px rgba(127, 231, 255, .14), inset 0 1px 0 rgba(255, 255, 255, .05);
  color: var(--text);
}
html[data-theme="steel"] .side-foot { border-top-color: rgba(168, 194, 210, .18); }
html[data-theme="steel"] kbd {
  border-radius: 0;
  background: rgba(16, 26, 33, .8);
  border-color: rgba(168, 194, 210, .18);
  color: #8fa3b1;
}

/* tabs */
html[data-theme="steel"] .tab {
  border-radius: 0;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
html[data-theme="steel"] .tab:hover { background: rgba(127, 231, 255, .05); color: #dfe9ef; }
html[data-theme="steel"] .tab.active {
  background: linear-gradient(180deg, rgba(35, 48, 58, .92), rgba(10, 16, 21, .96));
  border-color: rgba(168, 194, 210, .30);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 18px rgba(80, 180, 210, .08);
  color: #f2f7fa;
}
html[data-theme="steel"] .workspace-tag {
  border-left-color: rgba(168, 194, 210, .20);
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* headings */
html[data-theme="steel"] .view-head h1,
html[data-theme="steel"] .chat-empty h1 {
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: linear-gradient(176deg, #ffffff 3%, #e2ebf1 30%, #a3b2bd 52%, #eaf3f8 74%, #8b9ca9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(127, 231, 255, .14)) drop-shadow(0 1px 0 rgba(0, 0, 0, .5));
}
html[data-theme="steel"] .view-head p,
html[data-theme="steel"] .chat-empty p { color: var(--muted); }
html[data-theme="steel"] .set-section h2 {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #c7d6df;
}
html[data-theme="steel"] .suite-section-head h2 { color: #8497a5; letter-spacing: .14em; }

/* marks / avatars */
html[data-theme="steel"] .empty-mark,
html[data-theme="steel"] .asst-avatar,
html[data-theme="steel"] .sc-icon,
html[data-theme="steel"] .pd-icon,
html[data-theme="steel"] .about-mark,
html[data-theme="steel"] .voice-card .v-icon,
html[data-theme="steel"] .tg-head .tg-icon,
html[data-theme="steel"] .pd-empty .pd-mark {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .28);
  background: linear-gradient(152deg, rgba(20, 32, 40, .90), rgba(5, 10, 14, .94));
  color: #dbe6ee;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
  box-shadow: inset 0 0 12px rgba(127, 231, 255, .08);
}
html[data-theme="steel"] .empty-mark { width: 46px; height: 46px; padding: 8px; }

/* chat */
html[data-theme="steel"] .suggest {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .22);
  background: linear-gradient(180deg, rgba(16, 26, 33, .88), rgba(6, 11, 15, .92));
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
html[data-theme="steel"] .suggest:hover {
  background: linear-gradient(180deg, rgba(24, 38, 47, .94), rgba(8, 14, 19, .96));
  border-color: rgba(127, 231, 255, .42);
  box-shadow: inset 0 0 16px rgba(127, 231, 255, .05), 0 0 20px rgba(80, 180, 210, .12);
}
html[data-theme="steel"] .suggest .s-icon { color: #9db0bd; }
html[data-theme="steel"] .msg.user .bubble {
  border: 1px solid rgba(168, 194, 210, .22);
  border-radius: 0;
  background: linear-gradient(160deg, rgba(35, 50, 60, .92), rgba(13, 21, 27, .96));
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
html[data-theme="steel"] .asst-text { line-height: 1.68; }
html[data-theme="steel"] .asst-text a { color: var(--cyan); }
html[data-theme="steel"] .asst-text code {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .18);
  background: rgba(127, 231, 255, .06);
}
html[data-theme="steel"] .asst-text pre {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .20);
  background: rgba(2, 6, 10, .72);
}
html[data-theme="steel"] .workline { border-radius: 0; }
html[data-theme="steel"] .action-card {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .22);
  background: linear-gradient(180deg, rgba(16, 26, 33, .88), rgba(6, 11, 15, .92));
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
html[data-theme="steel"] .badge { border-radius: 0; letter-spacing: .1em; text-transform: uppercase; }
html[data-theme="steel"] .error-card { border-radius: 0; }
html[data-theme="steel"] .msg.assistant .asst-name { letter-spacing: .04em; }

/* composer */
html[data-theme="steel"] .composer-area { background: linear-gradient(to bottom, transparent, #02060a 30%); }
html[data-theme="steel"] .composer-box {
  border-color: rgba(168, 194, 210, .28);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(14, 23, 30, .92), rgba(5, 10, 14, .96));
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 0 24px rgba(127, 231, 255, .03);
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .45));
}
html[data-theme="steel"] .composer-box:focus-within {
  border-color: rgba(127, 231, 255, .55);
  box-shadow: inset 0 0 22px rgba(127, 231, 255, .07), inset 0 1px 0 rgba(255, 255, 255, .08);
  filter: drop-shadow(0 0 22px rgba(80, 180, 210, .18));
}
html[data-theme="steel"] .chip-btn {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .22);
  background: rgba(10, 18, 24, .6);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
html[data-theme="steel"] .chip-btn:hover {
  border-color: rgba(127, 231, 255, .34);
  background: rgba(127, 231, 255, .06);
}
html[data-theme="steel"] .chip-btn.ghost { background: transparent; border-color: transparent; }
html[data-theme="steel"] .send-btn {
  border-radius: 0;
  background: linear-gradient(180deg, #eef6fa, #b9c9d6 58%, #8fa3b1);
  color: #061016;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 16px rgba(120, 200, 225, .18);
}
html[data-theme="steel"] .send-btn:hover {
  filter: brightness(1.08);
  box-shadow: inset 0 1px 0 #fff, 0 0 22px rgba(127, 231, 255, .3);
}
html[data-theme="steel"] .send-btn:disabled {
  background: linear-gradient(180deg, #1a262e, #0f171d);
  color: #64757f;
  box-shadow: none;
  filter: none;
}
html[data-theme="steel"] .send-btn.stop {
  background: linear-gradient(180deg, #24333d, #0d151b);
  color: var(--text);
  border: 1px solid rgba(168, 194, 210, .3);
}
html[data-theme="steel"] .composer-note { letter-spacing: .04em; }

/* map */
html[data-theme="steel"] .map-view,
html[data-theme="steel"] #mapFrame,
html[data-theme="steel"] .map-loading { background: #03070c; }

/* plugins */
html[data-theme="steel"] .search-field {
  border-radius: 0;
  background: rgba(5, 12, 17, .8);
  border-color: rgba(168, 194, 210, .24);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
html[data-theme="steel"] .search-field:focus-within {
  border-color: rgba(127, 231, 255, .5);
  box-shadow: inset 0 0 16px rgba(127, 231, 255, .06);
}
html[data-theme="steel"] .fchip {
  border-radius: 0;
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
html[data-theme="steel"] .fchip.active {
  border-color: rgba(127, 231, 255, .40);
  background: rgba(127, 231, 255, .08);
  box-shadow: inset 0 0 12px rgba(127, 231, 255, .06);
}
html[data-theme="steel"] .plugin-card {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .20);
  background: linear-gradient(180deg, rgba(18, 28, 35, .88), rgba(7, 12, 17, .92));
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
html[data-theme="steel"] .plugin-card:hover {
  border-color: rgba(127, 231, 255, .40);
  background: linear-gradient(180deg, rgba(24, 38, 47, .94), rgba(8, 14, 19, .96));
  box-shadow: inset 0 0 18px rgba(127, 231, 255, .05), 0 0 20px rgba(80, 180, 210, .10);
}
html[data-theme="steel"] .plugin-card.selected {
  border-color: rgba(127, 231, 255, .55);
  background: linear-gradient(180deg, rgba(26, 42, 52, .94), rgba(8, 14, 19, .96));
  box-shadow: inset 0 0 20px rgba(127, 231, 255, .07);
}
html[data-theme="steel"] .pc-icon {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .22);
  background: rgba(10, 18, 24, .8);
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 0 100%);
}
html[data-theme="steel"] .pc-star { border-radius: 0; }
html[data-theme="steel"] .plugin-detail {
  background: rgba(3, 8, 12, .72);
  border-left-color: rgba(168, 194, 210, .18);
}
html[data-theme="steel"] .use-chip {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .20);
  background: rgba(10, 18, 24, .7);
  clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}
html[data-theme="steel"] .pd-status { border-radius: 0; background: rgba(10, 18, 24, .8); }
html[data-theme="steel"] .btn {
  border-radius: 0;
  border-color: rgba(150, 177, 192, .30);
  background: linear-gradient(180deg, rgba(28, 38, 46, .94), rgba(9, 14, 19, .96));
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}
html[data-theme="steel"] .btn:hover {
  border-color: rgba(127, 231, 255, .55);
  color: #fff;
  box-shadow: inset 0 0 14px rgba(127, 231, 255, .08), 0 0 18px rgba(80, 180, 210, .14);
}
html[data-theme="steel"] .btn.primary {
  background: linear-gradient(180deg, #eef6fa, #b9c9d6 60%, #8fa3b1);
  border-color: transparent;
  color: #061016;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 16px rgba(120, 200, 225, .16);
}
html[data-theme="steel"] .btn.primary:hover { filter: brightness(1.06); color: #061016; }
html[data-theme="steel"] .btn.ghost { background: transparent; border-color: rgba(168, 194, 210, .22); color: var(--muted); }
html[data-theme="steel"] .btn.ghost:hover { background: rgba(127, 231, 255, .06); color: var(--text); }
html[data-theme="steel"] .btn.danger {
  background: transparent;
  border-color: rgba(233, 160, 160, .35);
  color: var(--danger);
}

/* settings */
html[data-theme="steel"] .set-card {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .22);
  background: linear-gradient(180deg, rgba(16, 26, 33, .86), rgba(6, 11, 15, .92));
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
html[data-theme="steel"] .set-row { border-bottom-color: rgba(168, 194, 210, .10); }
html[data-theme="steel"] .input,
html[data-theme="steel"] .select,
html[data-theme="steel"] textarea.input {
  border-radius: 0;
  background: rgba(5, 12, 17, .82);
  border-color: rgba(168, 194, 210, .24);
}
html[data-theme="steel"] .input:focus,
html[data-theme="steel"] .select:focus,
html[data-theme="steel"] textarea.input:focus {
  border-color: rgba(127, 231, 255, .5);
  box-shadow: inset 0 0 14px rgba(127, 231, 255, .06);
}
html[data-theme="steel"] .seg {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .24);
  background: rgba(5, 12, 17, .82);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
html[data-theme="steel"] .seg button { border-radius: 0; }
html[data-theme="steel"] .preset {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .20);
  clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}
html[data-theme="steel"] .preset.active {
  border-color: rgba(127, 231, 255, .44);
  background: rgba(127, 231, 255, .08);
}
html[data-theme="steel"] .theme-card {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .20);
  background: linear-gradient(180deg, rgba(18, 28, 35, .86), rgba(7, 12, 17, .92));
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
html[data-theme="steel"] .theme-card:hover {
  border-color: rgba(127, 231, 255, .36);
  box-shadow: inset 0 0 14px rgba(127, 231, 255, .04);
}
html[data-theme="steel"] .theme-card.active {
  border-color: rgba(127, 231, 255, .55);
  box-shadow: inset 0 0 18px rgba(127, 231, 255, .07), 0 0 16px rgba(80, 180, 210, .10);
}
html[data-theme="steel"] .theme-preview { border-radius: 0; border-color: rgba(168, 194, 210, .20); }
html[data-theme="steel"] .switch { background: rgba(5, 12, 17, .82); border-color: rgba(168, 194, 210, .28); }
html[data-theme="steel"] .switch.on { background: rgba(127, 231, 255, .10); border-color: rgba(127, 231, 255, .45); }
html[data-theme="steel"] .switch.on::after { background: var(--cyan); }
html[data-theme="steel"] .voice-card .v-icon,
html[data-theme="steel"] .tg-head .tg-icon { color: #cfe4f2; }
html[data-theme="steel"] .voice-hint code {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .18);
  background: rgba(10, 18, 24, .7);
}
html[data-theme="steel"] .shortcut-row { border-bottom-color: rgba(168, 194, 210, .10); }
html[data-theme="steel"] .kv { border-bottom-color: rgba(168, 194, 210, .10); }
html[data-theme="steel"] .kv:nth-child(odd) { border-right-color: rgba(168, 194, 210, .10); }

/* suite */
html[data-theme="steel"] .suite-status {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .20);
  background: rgba(168, 194, 210, .14);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
html[data-theme="steel"] .suite-stat {
  background: linear-gradient(180deg, rgba(16, 26, 33, .92), rgba(6, 11, 15, .96));
}
html[data-theme="steel"] .suite-stat:hover { background: linear-gradient(180deg, rgba(24, 38, 47, .96), rgba(8, 14, 19, .98)); }
html[data-theme="steel"] .suite-stat small { color: #8497a5; letter-spacing: .12em; }
html[data-theme="steel"] .suite-card {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .20);
  background: linear-gradient(180deg, rgba(18, 28, 35, .88), rgba(7, 12, 17, .93));
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
html[data-theme="steel"] .suite-card:hover {
  border-color: rgba(127, 231, 255, .38);
  box-shadow: inset 0 0 20px rgba(127, 231, 255, .05), 0 0 22px rgba(80, 180, 210, .10);
}
html[data-theme="steel"] .suite-card.featured {
  background:
    radial-gradient(circle at 86% 0%, rgba(127, 231, 255, .10), transparent 46%),
    linear-gradient(180deg, rgba(18, 28, 35, .92), rgba(7, 12, 17, .95));
}
html[data-theme="steel"] .sc-badge { border-radius: 0; letter-spacing: .1em; }
html[data-theme="steel"] .suite-foot {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .20);
  background: linear-gradient(180deg, rgba(16, 26, 33, .78), rgba(6, 11, 15, .88));
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
html[data-theme="steel"] .suite-foot svg { color: #cfe4f2; }

/* overlays */
html[data-theme="steel"] .overlay { background: rgba(1, 4, 8, .66); }
html[data-theme="steel"] .palette {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .32);
  background: linear-gradient(180deg, rgba(12, 20, 26, .98), rgba(4, 9, 13, .98));
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .55));
}
html[data-theme="steel"] .palette-input { border-bottom-color: rgba(168, 194, 210, .16); }
html[data-theme="steel"] .pal-item { border-radius: 0; }
html[data-theme="steel"] .pal-item:hover,
html[data-theme="steel"] .pal-item.active {
  background: rgba(127, 231, 255, .07);
  box-shadow: inset 0 0 0 1px rgba(127, 231, 255, .14);
}
html[data-theme="steel"] .palette-foot { border-top-color: rgba(168, 194, 210, .16); }
html[data-theme="steel"] .toast {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .28);
  border-left-color: var(--cyan);
  background: linear-gradient(180deg, rgba(18, 28, 35, .98), rgba(6, 11, 15, .98));
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
html[data-theme="steel"] :focus-visible { outline: 1px solid var(--cyan); outline-offset: 3px; }
html[data-theme="steel"] ::selection { background: rgba(127, 231, 255, .20); color: #fff; }
.map-fail .btn { margin-top: 12px; }

/* Agent view: plan, tasks, memory, usage, audit --------------------------- */
.agent-view .view-scroll { padding-bottom: 44px; }
.ag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.ag-wide { grid-column: 1 / -1; }
.ag-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.ag-card h2 {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.ag-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.ag-card-head h2 { margin: 0; }
#agObjective {
  width: 100%;
  min-height: 68px;
  resize: vertical;
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}
#agObjective:focus { outline: none; border-color: var(--accent-line); }
.ag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.ag-row .hint { flex: 1 1 220px; }
.ag-plan {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 13px;
}
.ag-plan li { margin: 4px 0; }
.ag-meter {
  height: 8px;
  border-radius: 99px;
  background: var(--panel-2);
  overflow: hidden;
  margin: 4px 0 10px;
}
.ag-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .3s ease;
}
.ag-line { color: var(--muted); font-size: 13px; margin: 0; }
.ag-detail { color: var(--faint); font-style: normal; font-size: 12px; }
.ag-chip {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 1px 8px;
  white-space: nowrap;
}
.ag-input-row { display: flex; gap: 8px; }
.ag-input-row input {
  flex: 1;
  min-width: 0;
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}
.ag-input-row input:focus { outline: none; border-color: var(--accent-line); }
.ag-mem,
.ag-audit {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}
.ag-mem li,
.ag-audit li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
}
.ag-mem li span { flex: 1; min-width: 0; word-break: break-word; }
.ag-mem button { margin-left: auto; flex: none; }
.ag-audit li b { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.ag-audit li span { min-width: 0; word-break: break-word; }
.ag-ts { color: var(--faint); font-variant-numeric: tabular-nums; flex: none; }
.ag-tasks { display: flex; flex-direction: column; gap: 10px; }
.ag-task {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--panel-2);
}
.ag-task-top {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.ag-task-top b { font-size: 13px; font-weight: 600; }
.ag-task-top .ag-chip { margin-left: auto; }
.ag-status {
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.ag-status.done { color: var(--success); border-color: var(--success); }
.ag-status.partial,
.ag-status.awaiting_approval { color: var(--warn); border-color: var(--warn); }
.ag-status.failed,
.ag-status.cancelled { color: var(--danger); border-color: var(--danger); }
.ag-status.running,
.ag-status.pending { color: var(--accent); border-color: var(--accent-line); }
.ag-steps {
  list-style: none;
  margin: 9px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ag-steps li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--muted);
}
.ag-steps li.done { color: var(--text); }
.ag-steps li.failed,
.ag-steps li.blocked { color: var(--danger); }
.ag-steps .ag-detail { flex: 1 1 100%; }
.ag-actions { display: flex; gap: 8px; margin-top: 9px; }
.ag-task p.ag-line { margin-top: 8px; }
@media (max-width: 900px) {
  .ag-grid { grid-template-columns: 1fr; }
}

/* ============================== MCP studio ============================== */

.mcp-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 32px 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(90deg, var(--panel-2), var(--panel));
}
.mcp-banner-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
}
.mcp-banner-icon svg { width: 15px; height: 15px; }
.mcp-banner-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mcp-banner-copy b { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text); }
.mcp-banner-copy span { font-size: 10.5px; line-height: 1.45; color: var(--faint); }
.mcp-banner-stats { display: flex; align-items: center; gap: 14px; flex: none; }
.mcp-banner-stats span { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.mcp-banner-stats b { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.mcp-banner-stats small { font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.mcp-banner-stats .bad b { color: var(--danger); }
.mcp-banner .btn { height: 27px; font-size: 11px; flex: none; }

.mcp-tag {
  display: inline-flex;
  align-items: center;
  height: 15px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  vertical-align: middle;
}

.mcp-overlay {
  align-items: center;
  padding: max(16px, 4vh) 20px;
  z-index: 110;
}
.mcp-studio {
  display: flex;
  flex-direction: column;
  width: min(1120px, 100%);
  height: min(86vh, 780px);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: paletteIn .16s ease-out;
}

.mcp-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.mcp-head-mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}
.mcp-head-mark svg { width: 18px; height: 18px; }
.mcp-head-copy { min-width: 0; flex: 1; }
.mcp-head-copy h2 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text); }
.mcp-head-copy p { margin: 2px 0 0; font-size: 10.5px; line-height: 1.45; color: var(--faint); }
.mcp-head-stats { display: flex; align-items: center; gap: 16px; flex: none; padding-right: 4px; }
.mcp-head-stats span { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.mcp-head-stats b { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.mcp-head-stats small { font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.mcp-head-stats .bad b { color: var(--danger); }

.mcp-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

.mcp-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--side);
}
.mcp-side-top { display: flex; align-items: center; gap: 7px; padding: 12px 12px 8px; flex: none; }
.mcp-side-top .btn { flex: 1; justify-content: center; height: 30px; }
.mcp-template-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 0 12px 11px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.mcp-mini-label {
  width: 100%;
  margin-bottom: 3px;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.mcp-template-row button {
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}
.mcp-template-row button:hover { background: var(--hover); border-color: var(--line-strong); color: var(--text); }

.mcp-servers {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mcp-server {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  min-width: 0;
}
.mcp-server:hover { background: var(--hover); }
.mcp-server.active { background: var(--panel-2); border-color: var(--line-strong); }
.mcp-server-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mcp-server-copy b { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-server-copy small { font-size: 9.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-server-state { flex: none; font-size: 9px; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.mcp-server-empty { padding: 20px 10px; text-align: center; font-size: 11px; line-height: 1.55; color: var(--faint); }
.mcp-side-note {
  flex: none;
  padding: 10px 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 9.5px;
  line-height: 1.5;
  color: var(--faint);
}

.mcp-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--faint);
  opacity: .7;
}
.mcp-dot.ok { background: var(--success); opacity: 1; box-shadow: 0 0 0 3px var(--success-soft); }
.mcp-dot.warn { background: var(--warn); opacity: 1; box-shadow: 0 0 0 3px var(--warn-soft); }
.mcp-dot.bad { background: var(--danger); opacity: 1; box-shadow: 0 0 0 3px var(--danger-soft); }

.mcp-pane { min-height: 0; overflow-y: auto; background: var(--bg); }

.mcp-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 54px 28px 48px;
  text-align: center;
}
.mcp-welcome-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.mcp-welcome-mark svg { width: 22px; height: 22px; }
.mcp-welcome h3 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--text); }
.mcp-welcome p { margin: 7px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
.mcp-steps { display: flex; flex-direction: column; gap: 7px; width: 100%; max-width: 330px; margin: 18px 0 0; text-align: left; }
.mcp-steps div { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted); }
.mcp-steps b {
  width: 19px;
  height: 19px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 9.5px;
  color: var(--accent);
  background: var(--panel);
}
.mcp-welcome-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.mcp-welcome-note {
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
  width: 100%;
  max-width: 390px;
  font-size: 9.5px;
  line-height: 1.55;
  color: var(--faint);
}

.mcp-form { display: flex; flex-direction: column; gap: 12px; max-width: 720px; padding: 18px 22px 26px; }
.mcp-form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mcp-form-head h3 { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text); }
.mcp-form-head p { margin: 3px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--faint); }
.mcp-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mcp-fields { display: flex; flex-direction: column; gap: 10px; }
.mcp-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 10.5px; color: var(--muted); }
.mcp-field > span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mcp-field > span small { font-size: 9px; font-weight: 400; color: var(--faint); }
.mcp-field .input { width: 100%; }
.mcp-transport { align-self: flex-start; height: 32px; }
.mcp-note { margin: 0; font-size: 9.5px; line-height: 1.5; color: var(--faint); }

.mcp-flags, .mcp-flag-grid {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 10px;
  background: var(--panel);
}
.mcp-flag { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.mcp-flag + .mcp-flag { border-top: 1px solid var(--line-soft); }
.mcp-flag > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mcp-flag b { font-size: 11.5px; font-weight: 600; color: var(--text); }
.mcp-flag small { font-size: 9.5px; line-height: 1.4; color: var(--faint); }

.mcp-error {
  padding: 8px 10px;
  border-left: 2px solid var(--danger);
  border-radius: 0 6px 6px 0;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10.5px;
  line-height: 1.5;
}
.mcp-form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mcp-form-hint { font-size: 9.5px; color: var(--faint); }

.mcp-detail { display: flex; flex-direction: column; gap: 12px; max-width: 780px; padding: 18px 22px 26px; }
.mcp-detail-head { display: flex; align-items: flex-start; gap: 12px; }
.mcp-detail-head > div:first-child { min-width: 0; flex: 1; }
.mcp-detail-head h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-detail-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; font-size: 10px; color: var(--faint); }
.mcp-detail-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.mcp-detail-actions .btn { height: 27px; font-size: 10.5px; }
.mcp-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
}
.mcp-pill.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 32%, var(--line)); }
.mcp-pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 32%, var(--line)); }
.mcp-pill.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 32%, var(--line)); }
.mcp-pill .mcp-dot { width: 5px; height: 5px; box-shadow: none; }

.mcp-meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.mcp-meta-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}
.mcp-meta-grid b { font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-meta-grid small { font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }

.mcp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 3px;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.mcp-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.mcp-link svg { width: 11px; height: 11px; }
.mcp-link:hover { color: var(--text); background: var(--hover); }
.mcp-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.mcp-tool {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}
.mcp-tool:hover { background: var(--panel-2); border-color: var(--line-strong); }
.mcp-tool.active { border-color: var(--accent-line); background: var(--panel-2); }
.mcp-tool-name { font-family: var(--font-mono); font-size: 10.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-tool small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 9.5px;
  line-height: 1.45;
  color: var(--faint);
}
.mcp-empty-line { margin: 0; padding: 10px 0; font-size: 10.5px; line-height: 1.5; color: var(--faint); }

.mcp-runner {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  background: var(--panel);
}
.mcp-runner-head { display: flex; align-items: flex-start; gap: 10px; }
.mcp-runner-head > div { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mcp-runner-head b { font-family: var(--font-mono); font-size: 11.5px; color: var(--text); }
.mcp-runner-head small { font-size: 9.5px; line-height: 1.45; color: var(--faint); }
.mcp-runner-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.mcp-run-actions .btn, .mcp-runner-actions .btn { height: 27px; font-size: 10.5px; }
.mcp-run-note { font-size: 9.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.mcp-output { padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-deep); }
.mcp-output.bad { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.mcp-output-label { margin-bottom: 4px; font-size: 8.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.mcp-output-label + pre { margin-bottom: 8px; }
.mcp-output pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.mcp-log { border: 1px solid var(--line); border-radius: 7px; background: var(--panel); padding: 8px 10px; }
.mcp-log summary { font-size: 10px; color: var(--muted); cursor: pointer; }
.mcp-log summary span { color: var(--faint); font-variant-numeric: tabular-nums; }
.mcp-log pre {
  margin: 7px 0 0;
  max-height: 170px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--faint);
  white-space: pre-wrap;
  word-break: break-word;
}
.mcp-danger-note { margin: 0; font-size: 9.5px; line-height: 1.55; color: var(--faint); }

.mcp-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 32px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 9.5px;
  color: var(--faint);
}
.mcp-foot > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-protocol { flex: none; font-family: var(--font-mono); letter-spacing: .04em; }

html[data-theme="steel"] .mcp-banner {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .24);
  background: linear-gradient(90deg, rgba(18, 30, 38, .92), rgba(6, 12, 17, .94));
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  box-shadow: inset 0 0 24px rgba(127, 231, 255, .03);
}
html[data-theme="steel"] .mcp-banner-icon,
html[data-theme="steel"] .mcp-head-mark,
html[data-theme="steel"] .mcp-welcome-mark {
  border-radius: 0;
  border-color: rgba(127, 231, 255, .36);
  background: rgba(127, 231, 255, .07);
  color: var(--cyan);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}
html[data-theme="steel"] .mcp-tag {
  border-radius: 0;
  border-color: rgba(127, 231, 255, .32);
  color: var(--cyan);
  background: rgba(127, 231, 255, .05);
  letter-spacing: .12em;
}
html[data-theme="steel"] .mcp-studio {
  border-radius: 0;
  border-color: rgba(127, 231, 255, .30);
  background: linear-gradient(180deg, rgba(10, 18, 24, .99), rgba(3, 7, 11, .99));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .5), inset 0 0 40px rgba(127, 231, 255, .025);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
html[data-theme="steel"] .mcp-head {
  border-bottom-color: rgba(168, 194, 210, .22);
  background: linear-gradient(180deg, rgba(22, 36, 44, .95), rgba(7, 13, 18, .96));
}
html[data-theme="steel"] .mcp-head-copy h2,
html[data-theme="steel"] .mcp-welcome h3,
html[data-theme="steel"] .mcp-form-head h3,
html[data-theme="steel"] .mcp-detail-head h3 {
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--silver);
}
html[data-theme="steel"] .mcp-head-copy p { letter-spacing: .03em; }
html[data-theme="steel"] .mcp-side {
  border-right-color: rgba(168, 194, 210, .18);
  background: rgba(4, 9, 13, .92);
}
html[data-theme="steel"] .mcp-side-top .btn { height: 30px; }
html[data-theme="steel"] .mcp-template-row { border-bottom-color: rgba(168, 194, 210, .12); }
html[data-theme="steel"] .mcp-template-row button {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .20);
  color: var(--steel);
}
html[data-theme="steel"] .mcp-template-row button:hover {
  border-color: rgba(127, 231, 255, .45);
  background: rgba(127, 231, 255, .06);
  color: var(--silver);
}
html[data-theme="steel"] .mcp-server { border-radius: 0; }
html[data-theme="steel"] .mcp-server.active {
  background: rgba(127, 231, 255, .07);
  border-color: rgba(127, 231, 255, .34);
  box-shadow: inset 2px 0 0 var(--cyan);
}
html[data-theme="steel"] .mcp-side-note { border-top-color: rgba(168, 194, 210, .12); }
html[data-theme="steel"] .mcp-pane { background: rgba(3, 7, 11, .72); }
html[data-theme="steel"] .mcp-steps b { border-radius: 0; border-color: rgba(127, 231, 255, .32); color: var(--cyan); background: rgba(127, 231, 255, .05); }
html[data-theme="steel"] .mcp-flags,
html[data-theme="steel"] .mcp-flag-grid,
html[data-theme="steel"] .mcp-meta-grid > div,
html[data-theme="steel"] .mcp-tool,
html[data-theme="steel"] .mcp-runner,
html[data-theme="steel"] .mcp-log {
  border-radius: 0;
  border-color: rgba(168, 194, 210, .22);
  background: linear-gradient(180deg, rgba(16, 26, 33, .85), rgba(5, 10, 14, .92));
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
html[data-theme="steel"] .mcp-tool:hover { border-color: rgba(127, 231, 255, .40); }
html[data-theme="steel"] .mcp-tool.active {
  border-color: rgba(127, 231, 255, .55);
  background: linear-gradient(180deg, rgba(24, 40, 50, .92), rgba(6, 12, 17, .95));
  box-shadow: inset 0 0 18px rgba(127, 231, 255, .06);
}
html[data-theme="steel"] .mcp-runner { border-color: rgba(127, 231, 255, .42); }
html[data-theme="steel"] .mcp-pill { border-radius: 0; letter-spacing: .1em; }
html[data-theme="steel"] .mcp-pill.ok { border-color: rgba(159, 224, 192, .38); }
html[data-theme="steel"] .mcp-pill.warn { border-color: rgba(223, 192, 126, .38); }
html[data-theme="steel"] .mcp-pill.bad { border-color: rgba(233, 160, 160, .38); }
html[data-theme="steel"] .mcp-error { border-radius: 0; background: rgba(233, 160, 160, .08); }
html[data-theme="steel"] .mcp-output { border-radius: 0; border-color: rgba(168, 194, 210, .22); background: rgba(1, 4, 7, .9); }
html[data-theme="steel"] .mcp-dot { border-radius: 50%; }
html[data-theme="steel"] .mcp-dot.ok { box-shadow: 0 0 8px rgba(159, 224, 192, .6); }
html[data-theme="steel"] .mcp-dot.warn { box-shadow: 0 0 8px rgba(223, 192, 126, .55); }
html[data-theme="steel"] .mcp-dot.bad { box-shadow: 0 0 8px rgba(233, 160, 160, .55); }
html[data-theme="steel"] .mcp-foot {
  border-top-color: rgba(168, 194, 210, .22);
  background: linear-gradient(180deg, rgba(16, 26, 33, .94), rgba(5, 10, 14, .96));
  letter-spacing: .03em;
}
html[data-theme="steel"] .mcp-protocol { color: var(--cyan); opacity: .8; }

@media (max-width: 980px) {
  .mcp-body { grid-template-columns: 230px minmax(0, 1fr); }
  .mcp-head-stats { gap: 12px; }
  .mcp-banner { margin: 0 24px 12px; }
}

@media (max-width: 760px) {
  .mcp-overlay { padding: 0; align-items: stretch; }
  .mcp-studio { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; clip-path: none; }
  .mcp-head { padding: 10px 12px; gap: 9px; }
  .mcp-head-copy p { display: none; }
  .mcp-head-stats { display: none; }
  .mcp-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .mcp-side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 208px; }
  .mcp-side-top { justify-content: space-between; }
  .mcp-side-top .btn { flex: 0 0 auto; min-width: 124px; }
  .mcp-servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); align-content: start; }
  .mcp-side-note { display: none; }
  .mcp-template-row { border-bottom: 0; padding-bottom: 9px; }
  .mcp-form, .mcp-detail { padding: 14px 14px 22px; }
  .mcp-form-grid { grid-template-columns: minmax(0, 1fr); }
  .mcp-meta-grid { grid-template-columns: minmax(0, 1fr); }
  .mcp-welcome { padding: 28px 18px 22px; }
  .mcp-welcome-mark { margin-bottom: 10px; }
  .mcp-banner {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    grid-template-areas: "icon copy add" "stats stats stats";
    gap: 8px 10px;
    margin: 0 16px 12px;
  }
  .mcp-banner-icon { grid-area: icon; align-self: center; }
  .mcp-banner-copy { grid-area: copy; }
  .mcp-banner-stats {
    grid-area: stats;
    justify-content: flex-start;
    gap: 18px;
    padding-top: 7px;
    border-top: 1px solid var(--line-soft);
  }
  .mcp-banner-stats span { align-items: flex-start; }
  .mcp-banner .btn { grid-area: add; align-self: center; }
}


/* ============================== tap feedback ============================== */

.tap-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  pointer-events: none;
}
.tap-ripple {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.22);
  background: radial-gradient(circle,
    color-mix(in srgb, var(--accent) 30%, transparent) 0%,
    color-mix(in srgb, var(--accent) 12%, transparent) 46%,
    transparent 70%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 46%, transparent);
  animation: tapRipple .5s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes tapRipple {
  0% { transform: translate(-50%, -50%) scale(.22); opacity: .9; }
  55% { opacity: .55; }
  100% { transform: translate(-50%, -50%) scale(1.95); opacity: 0; }
}

.btn:active:not(:disabled),
.send-btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.chip-btn:active:not(:disabled),
.tab:active,
.pal-item:active,
.new-chat:active,
.plugin-card:active,
.suite-card:active {
  transform: scale(.975);
  transition: transform .07s ease;
}
.plugin-card:active,
.suite-card:active {
  border-color: var(--accent-line);
  background: var(--panel-2);
}


/* ==================== Free Tier Quotas Total Bar ==================== */
.oc-quota-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: none;
  height: 34px;
  padding: 0 14px;
  background: rgba(11, 19, 26, 0.96);
  border-bottom: 1px solid rgba(127, 231, 255, 0.15);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--muted, #8b9bb0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.qbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.qbar-icon {
  font-size: 13px;
  color: #7fe7ff;
}
.qbar-label {
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
}
.qbar-stat {
  color: #94a3b8;
  white-space: nowrap;
}
.qbar-progress-wrap {
  flex: 1;
  max-width: 200px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.qbar-progress {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.qbar-remaining {
  color: #9beeff;
  font-weight: 600;
  white-space: nowrap;
}
.qbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.qbar-badge.local {
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  font-size: 10.5px;
  white-space: nowrap;
}
.qbar-details-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10.5px;
  cursor: pointer;
}
.qbar-details-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}
.qbar-dropdown {
  position: absolute;
  top: 76px;
  right: 14px;
  width: 480px;
  background: #0b131a;
  border: 1px solid rgba(127, 231, 255, 0.25);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 14px;
  z-index: 100;
  font-family: var(--font-sans, sans-serif);
}
.qbar-drop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
}
.qbar-drop-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
}
.qbar-drop-close:hover { color: #fff; }
.qbar-drop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qbar-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px;
}
.qbar-card.highlight {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.05);
}
.qcard-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 4px;
}
.qcard-stat {
  font-size: 13px;
  color: #9beeff;
  margin-bottom: 2px;
}
.qcard-sub {
  font-size: 10px;
  color: #64748b;
  line-height: 1.3;
}


/* Embedded Freebuff Terminal Drawer */
.freebuff-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52%;
  min-height: 240px;
  max-height: 85%;
  background: #080c14;
  border-top: 2px solid #8b5cf6;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  z-index: 60;
  animation: slideUpDrawer 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUpDrawer {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.fb-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  font-size: 13px;
  user-select: none;
}
.fb-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f1f5f9;
}
.fb-icon {
  font-size: 15px;
}
.fb-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.4);
}
.fb-status {
  font-size: 11px;
  color: #34d399;
  font-weight: 500;
}
.fb-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fb-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.fb-btn:hover {
  background: #334155;
  color: #f8fafc;
}
.fb-btn-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.fb-btn-close:hover {
  color: #f43f5e;
}
.fb-terminal-output {
  flex: 1;
  padding: 10px 14px;
  overflow-y: auto;
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.45;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
  background: #040711;
  user-select: text;
}
.fb-terminal-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #0b1120;
  border-top: 1px solid #1e293b;
}
.fb-prompt-prefix {
  color: #8b5cf6;
  font-weight: bold;
  font-family: monospace;
  font-size: 15px;
}
.fb-input {
  flex: 1;
  background: #020617;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #f8fafc;
  padding: 6px 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  outline: none;
}
.fb-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.4);
}
.fb-send-btn {
  background: #8b5cf6;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.fb-send-btn:hover {
  background: #7c3aed;
}


/* =========================================================
   88 Frontier Coding Agents & Models Directory Drawer
   ========================================================= */
.agent-directory-drawer {
  position: absolute;
  top: 48px;
  bottom: 0;
  left: 0;
  right: 0;
  background: #080c16;
  border-top: 2px solid #38bdf8;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  z-index: 65;
  animation: slideUpAgents 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
@keyframes slideUpAgents {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.ad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0d1527;
  border-bottom: 1px solid #1e293b;
  font-size: 13px;
  user-select: none;
}
.ad-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f8fafc;
}
.ad-icon { font-size: 17px; }
.ad-badge {
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.36);
  color: #38bdf8;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.ad-active-tag {
  background: rgba(52, 211, 153, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.36);
  color: #34d399;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}
.ad-btn-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.ad-btn-close:hover { color: #fff; }

.ad-switcher-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 12px 16px;
  background: #09101f;
  border-bottom: 1px solid #1e293b;
  flex-wrap: wrap;
}
.ad-switch-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 220px;
}
.ad-switch-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}
.ad-select {
  background: #111a2e;
  border: 1px solid #334155;
  color: #f1f5f9;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}
.ad-select:focus { border-color: #38bdf8; }
.ad-apply-btn {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  border: none;
  color: #040810;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.15s;
}
.ad-apply-btn:hover { opacity: 0.92; transform: translateY(-1px); }

.ad-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: #0c1424;
  border-bottom: 1px solid #1e293b;
  flex-wrap: wrap;
}
.ad-cats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ad-pill {
  background: #151f33;
  border: 1px solid #29354d;
  color: #94a3b8;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.ad-pill:hover, .ad-pill.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #e0f2fe;
}
.ad-search-wrap {
  flex: 1;
  max-width: 320px;
  min-width: 200px;
}
.ad-search-input {
  width: 100%;
  background: #151f33;
  border: 1px solid #29354d;
  color: #f1f5f9;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  outline: none;
}
.ad-search-input:focus { border-color: #38bdf8; }

.ad-grid {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.ad-card {
  background: #0d1526;
  border: 1px solid #1e2b42;
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.ad-card:hover {
  background: #111c33;
  border-color: #38bdf8;
}
.ad-card.is-active {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.08);
}
.ad-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.ad-card-rank {
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 1px 6px;
  border-radius: 3px;
}
.ad-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-card-integ {
  font-size: 10px;
  color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
  padding: 1px 5px;
  border-radius: 3px;
}
.ad-card-free {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.3;
}
.ad-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.ad-card-cat {
  font-size: 10px;
  color: #64748b;
}
.ad-card-act-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.ad-card-act-btn:hover {
  background: #38bdf8;
  color: #040810;
}

.ad-activate-free-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 8px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
  transition: all 0.15s;
}
.ad-activate-free-btn:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.5);
  transform: translateY(-1px);
}

.ad-mode-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 0 16px;
  background: #09101f;
  border-bottom: 1px solid #1e293b;
}
.ad-mode-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.ad-mode-tab:hover {
  color: #f1f5f9;
}
.ad-mode-tab.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}


/* AutoMode Zero-Lag Free Tier Switcher */
.automode-btn {
  height: 26px;
  font-size: 11px;
  padding: 0 10px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 182, 212, 0.25));
  border: 1px solid rgba(16, 185, 129, 0.6);
  color: #6ee7b7;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 4px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}
.automode-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.38), rgba(6, 182, 212, 0.38));
  border-color: #34d399;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}
.automode-btn.inactive {
  background: rgba(100, 116, 139, 0.15) !important;
  border-color: rgba(100, 116, 139, 0.35) !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
}
.automode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-green 1.8s infinite;
  display: inline-block;
}
.automode-btn.inactive .automode-dot {
  background-color: #64748b;
  box-shadow: none;
  animation: none;
}
@keyframes pulse-green {
  0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 4px #10b981; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px #34d399; }
  100% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 4px #10b981; }
}

.automode-drawer-btn {
  transition: all 0.2s ease;
}
.automode-drawer-btn.inactive {
  background: rgba(100, 116, 139, 0.2) !important;
  border-color: rgba(100, 116, 139, 0.4) !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
}


/* AutoMode Chronological Pipeline Modal & Flow Styling */
.pipeline-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pipeline-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(6px);
}
.pipeline-modal-content {
  position: relative;
  z-index: 2;
  width: 95%;
  max-width: 1040px;
  max-height: 90vh;
  overflow-y: auto;
  background: #09101f;
  border: 1px solid #1e293b;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
}
.pipe-header {
  padding: 16px 20px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pipe-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pipe-icon {
  font-size: 22px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 6px 10px;
  border-radius: 8px;
}
.pipe-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.3px;
}
.pipe-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}
.pipe-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pipe-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.pipe-badge-sub {
  font-size: 11px;
  color: #64748b;
}
.pipe-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}
.pipe-close-btn:hover {
  color: #f1f5f9;
}

/* Stepper Bar */
.pipe-stepper-wrap {
  padding: 14px 20px;
  background: #091224;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pipe-step-node {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.pipe-step-node:hover {
  background: rgba(255, 255, 255, 0.05);
}
.pipe-step-node.active .step-num {
  background: #38bdf8;
  color: #030712;
  box-shadow: 0 0 10px #38bdf8;
}
.pipe-step-node.failsafe.active .step-num {
  background: #10b981;
  color: #030712;
  box-shadow: 0 0 10px #10b981;
}
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1e293b;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.step-meta {
  display: flex;
  flex-direction: column;
}
.step-meta strong {
  font-size: 11px;
  color: #e2e8f0;
}
.step-meta span {
  font-size: 10px;
  color: #64748b;
}
.pipe-step-line {
  flex: 1;
  height: 2px;
  background: #1e293b;
  margin: 0 8px;
}

/* Simulation Toolbar */
.pipe-sim-bar {
  padding: 10px 20px;
  background: #0c1427;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sim-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
}
.sim-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.sim-btn:hover {
  background: #334155;
  color: #f8fafc;
}
.sim-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}
.sim-btn.failsafe-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #6ee7b7;
}

/* Stages Grid */
.pipe-stages-grid {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pipe-stage-card {
  background: #0d172b;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 14px 16px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.pipe-stage-card:hover {
  border-color: #334155;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.pipe-stage-card.stage-highlight {
  border-color: rgba(56, 189, 248, 0.6);
  background: linear-gradient(135deg, rgba(13, 23, 43, 1), rgba(15, 33, 64, 0.9));
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}
.pipe-stage-card.stage-4 {
  border-color: rgba(16, 185, 129, 0.4);
}
.pipe-stage-card.stage-4.stage-highlight {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}
.pipe-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.pipe-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pipe-stage-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.pipe-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}
.pipe-card-timing {
  font-size: 11px;
  font-family: monospace;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}
.pipe-card-role {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 10px;
}
.pipe-card-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
.pipe-col-title {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.pipe-chips-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pipe-item-chip {
  background: #09101f;
  border: 1px solid #1e293b;
  padding: 5px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}
.pipe-item-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pipe-item-name {
  color: #e2e8f0;
  font-weight: 600;
}
.pipe-item-sub {
  font-size: 10px;
  color: #64748b;
}
.pipe-item-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-family: monospace;
}
.pipe-card-footer {
  background: #080f1d;
  border: 1px solid #1a2538;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pipe-trigger-text {
  color: #94a3b8;
}
.pipe-trigger-text strong {
  color: #38bdf8;
}
.pipe-failsafe-text {
  color: #a7f3d0;
}
.pipe-failsafe-text strong {
  color: #34d399;
}

/* Footer Stats */
.pipe-footer {
  padding: 12px 20px;
  background: #09101f;
  border-top: 1px solid #1e293b;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.pipe-footer-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 6px;
}
.pipe-footer-stat.highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}
.pstat-val {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}
.pipe-footer-stat.highlight .pstat-val {
  color: #34d399;
}
.pstat-lbl {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
}


.qbar-badge.zero-spend-shield {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}
.qbar-badge.zero-spend-shield strong {
  color: #a7f3d0;
  font-weight: 700;
}


/* ============================== Video View (Free Cloud GPU Studio) ============================== */
.image-view,
.audio-view,
.video-view,
.threed-view,
.games-view,
.demigod-view,
.map-view {
  flex-direction: column;
  min-height: 0;
  width: 100%;
  height: 100%;
}
.vid-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.vid-head-id {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-base);
}
.vid-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7fe7ff;
}
.vid-title {
  color: #eef4f8;
  font-weight: 700;
}
.vid-sep {
  width: 1px;
  height: 14px;
  background: rgba(168, 194, 210, 0.2);
}
.vid-model-tag {
  font-size: 11px;
  color: #7fe7ff;
  background: rgba(127, 231, 255, 0.12);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(127, 231, 255, 0.3);
  font-weight: 600;
}
.vid-quota-tag {
  font-size: 11px;
  color: #9fe0c0;
  background: rgba(159, 224, 192, 0.1);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(159, 224, 192, 0.25);
  font-weight: 600;
}
.vid-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.vid-switcher {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(4, 9, 14, 0.65);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.vbtn {
  height: 24px;
  font-size: 11px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  transition: all 0.12s;
}
.vbtn:hover {
  color: #eef4f8;
  background: rgba(255, 255, 255, 0.05);
}
.vbtn.active {
  color: #7fe7ff;
  background: rgba(127, 231, 255, 0.15);
  border-color: rgba(127, 231, 255, 0.4);
  font-weight: 600;
}
.vid-custom-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  background: rgba(6, 24, 38, 0.85);
  border-bottom: 1px solid rgba(127, 231, 255, 0.25);
}
.vid-sub-bar {
  padding: 4px 14px;
  background: rgba(2, 5, 9, 0.95);
  border-bottom: 1px solid rgba(168, 194, 210, 0.08);
  font-size: 11px;
  color: #9db0bd;
}
.vid-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  width: 100%;
}
.vid-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #020509;
}
.studio-external {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 35%, rgba(56, 189, 248, 0.14), transparent 48%),
    #020509;
}
.studio-external[hidden] { display: none; }
.studio-external-card {
  max-width: 430px;
  padding: 24px 26px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 12px;
  background: rgba(9, 18, 30, 0.94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.studio-external-kicker {
  color: #38bdf8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
.studio-external-title {
  margin-top: 8px;
  color: #e2f6ff;
  font-size: 18px;
  font-weight: 750;
}
.studio-external-note {
  margin: 9px 0 16px;
  color: #93aebf;
  font-size: 12.5px;
  line-height: 1.55;
}
.studio-external .btn {
  background: #38bdf8;
  border: none;
  color: #04121c;
  font-weight: 800;
  cursor: pointer;
}


/* ============================== DEMIGOD — Reverse Engineer Anything Studio ============================== */
.demigod-view {
  display: none;
  flex-direction: column;
  height: 100%;
  background: #06070a;
  color: #e2e8f0;
}
.demigod-view.active {
  display: flex !important;
}
.dem-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(244, 63, 94, 0.25);
  background: #090b10;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.dem-head-id {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
}
.dem-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f43f5e;
  filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.6));
}
.dem-title {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #f43f5e, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dem-sep {
  width: 1px;
  height: 14px;
  background: rgba(244, 63, 94, 0.3);
}
.dem-model-tag {
  font-size: 11px;
  color: #fda4af;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.dem-quota-tag {
  font-size: 11px;
  color: #fdba74;
  background: rgba(251, 146, 60, 0.1);
  border: 1px solid rgba(251, 146, 60, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.dem-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dem-switcher {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.dem-run-btn {
  height: 26px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 0 12px;
  margin-left: 6px;
  background: linear-gradient(135deg, #f43f5e, #ea580c);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
  transition: all 0.2s;
}
.dem-run-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}
.dem-control-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #090c13;
  border-bottom: 1px solid rgba(244, 63, 94, 0.18);
  flex-wrap: wrap;
}
.dem-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #030508;
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: 6px;
  padding: 4px 10px;
  min-width: 300px;
}
.dem-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 12px;
  font-family: Consolas, monospace;
  outline: none;
}
.dem-presets-dropdown {
  display: flex;
  align-items: center;
  gap: 5px;
}
.dem-preset-pill {
  background: rgba(244, 63, 94, 0.1);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.dem-preset-pill:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #fff;
}
.dem-exec-btn {
  height: 32px;
  padding: 0 16px;
  background: linear-gradient(135deg, #f43f5e, #ea580c);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(244, 63, 94, 0.4);
  transition: all 0.2s;
}
.dem-exec-btn:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}
.dem-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #06080d;
}
.dem-deck-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  background: #080a10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.dem-deck-tab {
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(226, 232, 240, 0.65);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.dem-deck-tab:hover {
  color: #fff;
}
.dem-deck-tab.active {
  color: #fff;
  border-bottom-color: #f43f5e;
}
.dem-deck-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.dem-deck-pane.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dem-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.dem-metric-card {
  background: #0c0f17;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px 14px;
}
.dem-card-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.5);
  letter-spacing: 0.5px;
}
.dem-card-value {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}
.dem-evidence-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  flex: 1;
}
@media (max-width: 900px) {
  .dem-evidence-columns {
    grid-template-columns: 1fr;
  }
}
.dem-evidence-col {
  background: #090c14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dem-evidence-col.col-seen { border-top: 3px solid #10b981; }
.dem-evidence-col.col-inferred { border-top: 3px solid #f59e0b; }
.dem-evidence-col.col-unknown { border-top: 3px solid #ef4444; }
.dem-col-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.dem-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green { background: #10b981; box-shadow: 0 0 6px #10b981; }
.dot-amber { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.dot-red { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.dem-col-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #f1f5f9;
  flex: 1;
}
.dem-col-tag {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
  color: rgba(226, 232, 240, 0.7);
}
.dem-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}
.dem-ev-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.4;
  color: #cbd5e1;
}
.dem-table-wrap {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
}
.dem-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}
.dem-table th {
  background: #090c14;
  padding: 9px 12px;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
}
.dem-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-family: Consolas, monospace;
}
.dem-table tr:hover td {
  background: rgba(244, 63, 94, 0.04);
}
.dem-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #090c14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  font-size: 11.5px;
  font-weight: 700;
  color: #fda4af;
}
.dem-code-viewer {
  margin: 0;
  background: #030407;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 0 6px 6px;
  padding: 14px;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #7dd3fc;
  overflow: auto;
  max-height: 480px;
}
.dem-term-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.dem-term-pill {
  background: rgba(251, 146, 60, 0.1);
  color: #fdba74;
  border: 1px solid rgba(251, 146, 60, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: Consolas, monospace;
  cursor: pointer;
  transition: all 0.15s;
}
.dem-term-pill:hover {
  background: rgba(251, 146, 60, 0.25);
  color: #fff;
}
.dem-terminal-out {
  background: #020306;
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: 6px;
  padding: 12px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #a3e635;
  height: 380px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.8);
}
.dem-terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #090c14;
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: 6px;
  padding: 4px 10px;
}
.dem-prompt {
  font-family: Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #f43f5e;
}
.dem-terminal-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: Consolas, monospace;
  font-size: 12px;
}
.dem-term-btn {
  height: 24px;
  padding: 0 10px;
  background: #f43f5e;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* ===== DEMIGOD section tabs ===== */
.dem-subnav{display:flex;gap:6px;align-items:center;padding:6px 12px;background:#0a0710;
  border-bottom:1px solid rgba(255,255,255,.07);flex:0 0 auto;overflow-x:auto}
.dem-sub{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border-radius:8px;
  border:1px solid rgba(255,255,255,.1);background:rgba(255,255,255,.03);color:#c9d3e0;
  font:inherit;font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer}
.dem-sub:hover{border-color:#f472b6;color:#fff}
.dem-sub.active{border-color:#ec4899;background:rgba(236,72,153,.14);color:#fff;
  box-shadow:0 0 0 1px rgba(236,72,153,.35) inset}

/* ===== Realm app rail on each studio tab ===== */
.realm-rail{display:flex;align-items:center;gap:6px;padding:6px 10px;flex:0 0 auto;
  background:rgba(255,255,255,.02);border-bottom:1px solid rgba(255,255,255,.06);
  overflow-x:auto;scrollbar-width:thin}
.rr-label{font-size:10px;letter-spacing:.8px;text-transform:uppercase;color:#8b93a7;
  white-space:nowrap;margin-right:4px}
.rr-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;
  border:1px solid rgba(255,255,255,.1);background:rgba(255,255,255,.03);color:#dfe7f1;
  font:inherit;font-size:11.5px;white-space:nowrap;cursor:pointer}
.rr-chip:hover{border-color:#38bdf8;color:#fff}
.rr-dot{width:6px;height:6px;border-radius:50%;flex:0 0 auto}
.rr-empty{font-size:11px;color:#8b93a7}
.dem-subnav{display:none}
.dem-subnav.showing{display:flex}

/* Text tab: pull the embedded OpenCode UI toward the Shashu palette.
   It is cross-origin, so only compositing effects can reach it. */
#opencodeFrame {
  background: #0b0710;
  filter: sepia(.16) hue-rotate(258deg) saturate(1.22) brightness(1.02);
}

/* Text view: Matrix-inspired chrome to match the native chat panel. */
#view-opencode .oc-head {
  background: linear-gradient(180deg, rgba(0,255,156,.06), rgba(2,8,5,.9));
  border-bottom: 1px solid rgba(0,255,156,.18);
}
#view-opencode .oc-badge { color: #00ff9c; }
#view-opencode .oc-title { color: #eafff5; letter-spacing: 1px; text-transform: uppercase; }
#view-opencode .oc-sub { color: #5f8f79; }
#view-opencode .oc-sep { background: rgba(0,255,156,.18); }
#view-opencode .oc-quota-tag { border-color: rgba(0,255,156,.3); color: #00ff9c; }
#view-opencode #opencodeFrame { box-shadow: 0 0 0 1px rgba(0,255,156,.22), 0 18px 48px rgba(0,0,0,.6); filter: none; background: #020604; }

/* Static-preview banner shown when the local helper is unreachable. */
#previewBanner{display:flex;gap:8px;align-items:center;padding:7px 14px;background:rgba(251,191,36,.08);
  border-bottom:1px solid rgba(251,191,36,.35);color:#fde68a;font-size:11.5px;line-height:1.4}
#previewBanner b{color:#fff;letter-spacing:1.2px;font-size:10px;border:1px solid rgba(251,191,36,.5);
  padding:1px 6px;border-radius:999px;white-space:nowrap}

/* ==========================================================================
   iPhone 17 / iPad 11 pass
   ========================================================================== */
html { -webkit-text-size-adjust: 100%; }
.topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
.statusbar { padding-bottom: env(safe-area-inset-bottom); }
.views { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

@media (max-width: 900px) {
  .tabs {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    mask-image: linear-gradient(90deg, #000 94%, transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 94%, transparent);
  }
  .tab { scroll-snap-align: start; }
  .view-scroll { -webkit-overflow-scrolling: touch; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 6px; gap: 4px; }
  .tabs { gap: 2px; }
  .tab { height: 30px; padding: 0 7px; font-size: 11.5px; max-width: 132px; gap: 5px; }
  .tab .tab-label { font-size: 11px; }
  .topbar .icon-btn { width: 30px; height: 30px; }
  #previewBanner { font-size: 10px; padding: 6px 10px; gap: 6px; line-height: 1.45; }
  #previewBanner b { font-size: 8.5px; }
  .view-head { padding: 14px 12px 10px; gap: 8px; }
  .view-head h1 { font-size: 19px; }
  .view-head p { font-size: 12px; }
  .suite-card { padding: 14px !important; margin-left: 0 !important; margin-right: 0 !important; }
  .suite-card h2 { font-size: 16px !important; }
  .dem-subnav { padding: 6px 8px; gap: 5px; }
  .dem-sub { padding: 5px 9px; font-size: 11px; }
  .realm-rail { padding: 5px 8px; gap: 5px; }
  .rr-label { font-size: 9px; }
  .rr-chip { font-size: 10.5px; padding: 3px 8px; }
  .plugin-grid { grid-template-columns: 1fr; padding: 0 12px 20px; }
  .settings-layout { padding: 0 12px 40px; }
  .statusbar { gap: 8px; font-size: 9px; }
  .statusbar .status-right > * { display: none; }
  .statusbar .status-right #statusSettings { display: inline-flex; }
  .toasts { left: 10px; right: 10px; }
  .toast { max-width: none; font-size: 11.5px; }
  .vid-actions, .dem-actions, .head-actions { flex-wrap: wrap; gap: 6px; }
  .oc-head, .vid-head, .dem-head { flex-wrap: wrap; gap: 6px; height: auto; padding: 6px 8px; }
  .oc-sub, .vid-sub-desc { font-size: 10.5px; }
  .chip-btn { padding: 0 7px; font-size: 10px; }
  .modal, .palette { width: calc(100vw - 16px) !important; max-width: none !important; }
  input, select, textarea { font-size: 16px; } /* stops iOS zoom-on-focus */
  .set-row .input, .set-row .select { width: 100%; }
}

@media (min-width: 521px) and (max-width: 900px) {
  .view-head { padding: 20px 20px 14px; }
  .plugin-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); padding: 0 20px 24px; }
  .settings-layout { padding: 0 20px 48px; }
  .suite-card { padding: 18px !important; }
}
