/* Shared surfaces and syntax colors keep every Console view in the same theme. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #272730;
  --muted: #696974;
  --line: #e6e6ec;
  --fill: #ffffff;
  --sidebar: #fafafb;
  --status-bg: #ececf1;
  --hover: #f3f3f7;
  --selected: #eaf6fc;
  --accent: #287cac;
  --action: #287cac;
  --focus: #69b8e4;
  --danger: #ba3649;
  --ok: #247c57;
  --run: #a5681c;
  --on-accent: #ffffff;
  --faint: #777782;
  --dot: #bfc0cb;
  --warn: #a5681c;
  --code-bg: #f7f7fa;
  --selection: #d9effc;
  --danger-bg: #fff0f2;
  --syntax-keyword: #9453a6;
  --syntax-string: #28734c;
  --syntax-number: #345ca6;
  --syntax-function: #7350b0;
  --syntax-type: #91611d;
  --syntax-property: #216c80;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--fg);
  background: var(--bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101014;
  --fg: #d7d7e0;
  --muted: #a0a0ad;
  --line: #25252d;
  --fill: #101014;
  --sidebar: #101014;
  --status-bg: #1c1c24;
  --hover: #1a1a22;
  --selected: #172e3d;
  --accent: #73bde7;
  --action: #8dcced;
  --focus: #8dcced;
  --danger: #f0909c;
  --ok: #75c69f;
  --run: #dcb078;
  --faint: #878795;
  --dot: #565665;
  --warn: #dcb078;
  --code-bg: #141419;
  --selection: #24485e;
  --danger-bg: #2a1b22;
  --syntax-keyword: #d6a0dc;
  --syntax-string: #a0caa2;
  --syntax-number: #87b9eb;
  --syntax-function: #c4b0ed;
  --syntax-type: #dec493;
  --syntax-property: #94c9d6;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
body:has(#workspace.workbench:not([hidden])) { height: 100dvh; overflow: clip; }
button, input, nav, table, textarea, #account, #list-status, #empty, .status, .mono, .actions {
  font-family: inherit;
}
#login {
  max-width: 360px; margin: 16vh auto 0; padding: 28px 24px 24px;
  background: var(--fill); border: 1px solid var(--line); border-radius: 12px;
}
#login h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 32px; }
label { display: block; margin: 0 0 18px; font-size: 13px; color: var(--muted); font-weight: 500; }
input {
  display: block; width: 100%; height: 44px; margin-top: 8px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--fill);
  color: inherit; font-size: 15px;
}
input:hover { border-color: var(--faint); }
button {
  border: 1px solid var(--line); background: var(--fill); border-radius: 6px;
  height: 32px; padding: 0 12px; color: inherit; font-size: 13px; cursor: pointer;
}
button:hover { background: var(--hover); }
button:disabled { opacity: .4; cursor: not-allowed; }
button[aria-busy="true"] { cursor: wait; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
#login #auth-switch { background: transparent; color: var(--action); border: 0; height: auto; margin-top: 12px; }
#login #auth-switch:hover { background: transparent; text-decoration: underline; }
#login button {
  width: 100%; height: 44px; margin-top: 10px;
  background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 500;
}
#login button:hover { background: var(--accent); }
#dev-login {
  background: transparent; color: inherit; border-color: var(--line); font-weight: 400;
}
#dev-login:hover { background: var(--hover); }
#workspace {
  display: flex; height: 100vh; min-height: 100vh; background: var(--fill);
}
#sidebar {
  display: flex; flex-direction: column; width: 248px; flex: 0 0 248px;
  background: var(--sidebar); border-right: 1px solid var(--line); padding: 10px 8px 8px;
}
#sidebar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
  background: transparent; border-color: transparent; color: var(--muted); border-radius: 6px;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.sidebar-brand { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 2px 0 6px; margin-bottom: 6px; }
.brand-mark {
  width: 18px; height: 18px; border-radius: 5px; flex: none;
  background: var(--accent); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .08);
}
.sidebar-brand strong { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.execution {
  display: inline-flex; align-items: center; gap: 5px; margin-left: auto; min-width: 0;
  font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.execution::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot); flex: none; }
.execution[data-state="ready"]::before { background: var(--ok); box-shadow: 0 0 0 3px rgb(23 102 63 / .12); }
.execution[data-state="offline"]::before { background: var(--danger); }
.execution:empty { display: none; }
.execution:empty + #refresh { margin-left: auto; }
#list-status {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0);
}
#records { flex: 1; min-height: 0; overflow: auto; margin: 0 -8px; padding: 0 8px; }
#table { overflow: visible; background: transparent; border: none; }
#sidebar .sidebar-group ul, #sidebar .group-empty, #sidebar .group-more { display: none !important; }
.sidebar-group { margin: 0 0 4px; }
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; align-content: start;
}
.card {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  gap: 16px; min-height: 104px; padding: 14px 14px 12px; text-align: left; cursor: pointer;
  background: var(--fill); border: 1px solid var(--line); border-radius: 10px;
}
.card:hover, .card.selected { background: var(--hover); }
.card.selected { background: var(--selected); }
.card strong {
  font-size: 14px; font-weight: 600; letter-spacing: -0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.card-meta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); font-weight: 400;
}
.card-meta::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); flex: none;
}
.card[data-state="running"] .card-meta::before, .card[data-state="pending"] .card-meta::before { background: var(--run); }
.card[data-state="succeeded"] .card-meta::before { background: var(--ok); }
.card[data-state="failed"] .card-meta::before { background: var(--danger); }
.card[data-state="cancelled"] .card-meta::before { background: var(--dot); }
.card .item-action { display: inline-flex; align-items: center; height: 22px; }
.card-more { justify-self: start; height: 32px; padding: 0 12px; background: transparent; color: var(--muted); }
.object-list {
  border: 1px solid var(--line); border-radius: 8px; background: var(--fill); overflow: auto;
}
.object-head, .object-row {
  display: grid; grid-template-columns: minmax(180px, 1fr) 96px 148px 64px;
  align-items: center; column-gap: 16px; min-width: 520px; padding: 0 16px;
}
.object-head {
  height: 36px; font-size: 12px; color: var(--muted); background: var(--sidebar);
  border-bottom: 1px solid var(--line);
}
.object-row { height: 40px; font-size: 13px; border-bottom: 1px solid var(--line); }
.object-row:last-child { border-bottom: none; }
.object-row:hover { background: var(--hover); }
.object-name {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.object-name::before {
  content: ""; width: 16px; height: 16px; flex: none; border: none;
  background: center / 16px 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2371717a' stroke-width='1.3'%3E%3Cpath d='M4 2.2h5.1L12.2 5.2V13.8H4z'/%3E%3Cpath d='M9 2.4V5.4h3'/%3E%3C/svg%3E");
}
.object-row.is-tree .object-name::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2371717a' stroke-width='1.3'%3E%3Cpath d='M2 6.2V4.6h3.4l1.1 1.4H14V13H2z'/%3E%3C/svg%3E");
}
.object-size, .object-time {
  color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px;
}
.object-download {
  height: 24px; padding: 0 8px; font-size: 12px;
  background: transparent; border-color: transparent; color: var(--fg);
}
.object-download:hover { background: var(--selected); }
.object-empty { margin: 0; padding: 28px 16px; color: var(--muted); font-size: 14px; }
#stage:has(.object-list:not([hidden])) #drop { min-height: 0; margin-top: 12px; }
#stage:has(.object-list:not([hidden])) #drop-hint {
  padding: 14px 16px; text-align: left; border: 1px dashed var(--line); border-radius: 8px; background: var(--fill);
}
.group-head { display: flex; align-items: center; gap: 2px; height: 30px; padding-right: 2px; }
.group-title {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px;
  background: transparent; border: none; border-radius: 6px; text-align: left;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.group-title:hover { background: var(--hover); color: var(--fg); }
.group-title[aria-pressed="true"] { color: var(--fg); }
.group-title[aria-pressed="true"] svg { color: var(--action); }
.group-count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; padding: 0 4px; }
.group-add { width: 24px; height: 24px; }
.group-add svg { width: 14px; height: 14px; stroke-width: 1.6; }
.group-add:disabled { opacity: .35; cursor: not-allowed; }
#rows, #data-rows, #notebook-rows, #terminal-rows, #session-list { list-style: none; margin: 0; padding: 0; }
#rows > li, #data-rows > li, #notebook-rows > li, #terminal-rows > li {
  position: relative; display: flex; align-items: center; gap: 6px;
  margin: 1px 0; padding: 0 6px 0 32px; height: 30px; border-radius: 6px; cursor: pointer;
}
#rows > li::before, #data-rows > li::before, #notebook-rows > li::before, #terminal-rows > li::before {
  content: ""; position: absolute; left: 17px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
  border-radius: 50%; background: var(--dot);
}
#data-rows > li::before { width: 7px; height: 8px; margin-top: -4px; border-radius: 1.5px; background: none; border: 1.3px solid var(--faint); }
#sidebar li[data-state="running"]::before { background: var(--run); animation: pulse 1.6s ease-in-out infinite; }
#notebook-rows > li[data-state="running"]::before, #terminal-rows > li[data-state="running"]::before { background: var(--ok); animation: none; }
#sidebar li[data-state="pending"]::before { background: none; border: 1.5px solid var(--faint); }
#notebook-rows > li[data-state="pending"]::before, #terminal-rows > li[data-state="pending"]::before { border-color: var(--run); animation: pulse 1.2s ease-in-out infinite; }
#sidebar li[data-state="cancelling"]::before, #sidebar li[data-state="stopping"]::before { background: var(--warn); }
#sidebar li[data-state="succeeded"]::before { background: var(--ok); }
#sidebar li[data-state="failed"]::before { background: var(--danger); }
#sidebar li[data-state="cancelled"]::before { background: var(--dot); }
@keyframes pulse { 50% { opacity: .35; } }
#rows > li::after, #data-rows > li::after, #notebook-rows > li::after, #terminal-rows > li::after {
  content: attr(data-meta); flex: none; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums;
}
#rows > li[data-state="running"]::after { color: var(--run); }
#rows > li[data-state="failed"]::after { color: var(--danger); }
#rows > li:hover, #data-rows > li:hover, #notebook-rows > li:hover, #terminal-rows > li:hover { background: var(--hover); }
#rows > li.selected, #data-rows > li.selected, #notebook-rows > li.selected, #terminal-rows > li.selected { background: var(--selected); }
#rows > li.selected .item-title, #data-rows > li.selected .item-title,
#notebook-rows > li.selected .item-title, #terminal-rows > li.selected .item-title { font-weight: 550; }
#sidebar li:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.item-title { flex: 1; min-width: 0; font-size: 13px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-action {
  display: none; height: 22px; padding: 0 7px; font-size: 11.5px; flex: none;
  background: transparent; border-color: transparent; color: var(--muted); border-radius: 5px;
}
.item-action.close { width: 22px; padding: 0; font-size: 15px; line-height: 1; }
.item-action.close[data-armed="1"] { width: auto; padding: 0 7px; font-size: 11.5px; color: var(--danger); background: rgb(180 35 24 / .08); }
.item-action:hover { color: var(--fg); background: var(--hover); }
.item-action.close:hover { color: var(--danger); }
#sidebar li:hover .item-action, #sidebar li:focus-within .item-action { display: inline-flex; align-items: center; justify-content: center; }
#sidebar li:is(:hover, :focus-within):has(.item-action)::after { display: none; }
.group-empty { margin: 0; padding: 4px 8px 4px 32px; font-size: 12px; line-height: 1.5; color: var(--faint); }
.group-more {
  height: 26px; margin: 2px 0 0 26px; padding: 0 6px; font-size: 12px;
  background: transparent; border-color: transparent; color: var(--muted);
}
.group-more:hover { color: var(--fg); background: var(--hover); }
.sidebar-foot {
  display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 2px 0 6px;
  border-top: 1px solid var(--line);
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600;
}
.avatar:empty { visibility: hidden; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.who #account { font-size: 12.5px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who #role { font-size: 11px; color: var(--muted); }
#stage {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  padding: 16px 20px 20px; position: relative; overflow: auto;
}
.stage-toolbar {
  display: flex; align-items: center; gap: 12px; min-height: 52px;
  margin: -16px -20px 16px; padding: 0 20px; border-bottom: 1px solid var(--line);
}
.stage-toolbar #heading {
  flex: 1; margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.02em;
}
.stage-actions {
  position: relative; flex: 0 0 72px; width: 72px; height: 32px;
}
.stage-actions button {
  position: absolute; inset: 0; width: 100%; height: 32px;
}
.stage-actions button[hidden] {
  display: inline-flex !important; visibility: hidden; pointer-events: none;
}
#drop { min-height: 96px; border-radius: 8px; }
#drop.drag { box-shadow: inset 0 0 0 2px var(--action); background: rgb(154 52 18 / 0.06); }
#session-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stage-bar { display: flex; align-items: center; gap: 8px; }
.stage-bar:has(.title-input) { margin-bottom: 8px; }
.title-input {
  field-sizing: content; min-width: 6ch; max-width: min(360px, 50vw); height: 30px; padding: 0 8px; margin-left: -8px;
  border: 1px solid transparent; border-radius: 6px; background: transparent;
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--fg); text-overflow: ellipsis;
}
.title-input:hover:not(:read-only) { border-color: var(--line); }
.title-input:focus { outline: none; border-color: var(--action); background: var(--fill); }
.title-input:read-only { cursor: default; }
.nb-toolbar .title-input { margin-left: -4px; margin-right: 4px; }
#session-id {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0);
}
#session-status { margin: 0 0 8px; }
#stage-empty {
  margin: 24px 4px 0; font-size: 14px; color: var(--muted);
}
#drop-hint {
  margin: 0; padding: 48px 16px; text-align: center; color: var(--muted); font-size: 14px;
}
#session-frame-wrap {
  flex: 1; min-height: 0; position: relative;
}
#session-frame {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  border: 1px solid var(--line); border-radius: 8px; background: var(--fill);
}
#notebook-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.nb {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 8px; background: var(--fill); overflow: hidden;
}
.nb-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--fill);
}
.nb-group { display: flex; gap: 4px; flex-shrink: 0; white-space: nowrap; }
.nb-spacer { flex: 1; }
.nb-btn { height: 28px; padding: 0 10px; font-size: 12.5px; line-height: 1; white-space: nowrap; background: transparent; border-color: transparent; }
.nb-btn:hover { background: var(--hover); }
.nb-btn.nb-icon { width: 30px; padding: 0; font-size: 13px; letter-spacing: -2px; }
.nb-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.nb-btn.primary:hover { background: var(--accent); }
.nb-btn.ghost { color: var(--muted); border: 1px dashed var(--line); }
.nb-btn.ghost:hover { color: var(--fg); }
.nb-kernel {
  display: inline-flex; align-items: center; gap: 8px; max-width: 220px; height: 28px;
  padding: 0 8px 0 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--fill); color: var(--fg); font: inherit; font-size: 12.5px;
}
.nb-kernel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-kernel::after {
  content: ""; flex: none; width: 0; height: 0;
  border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
  border-top: 4px solid var(--muted);
}
.nb-kernel[aria-expanded="true"] { background: var(--selected); }
.nb-menu-mark { width: 12px; flex: none; color: var(--action); font-size: 12px; text-align: center; }
.nb-save { min-width: 4.5em; font-size: 12px; color: var(--muted); text-align: right; }
.nb-status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
}
.nb-status::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot);
}
.nb-status[data-state="idle"]::before { background: var(--ok); }
.nb-status[data-state="busy"]::before { background: var(--run); }
.nb-status[data-state="starting"]::before, .nb-status[data-state="restarting"]::before,
.nb-status[data-state="connecting"]::before { background: var(--warn); }
.nb-status[data-state="dead"]::before, .nb-status[data-state="disconnected"]::before { background: var(--danger); }
.nb-message { margin: 0; padding: 8px 14px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.nb-message.error { color: var(--danger); }
.nb-message.warn { color: var(--run); }
.nb-cells { flex: 1; min-height: 0; overflow: auto; overflow-anchor: none; padding: 14px 18px 40vh 6px; }
.nb-cell {
  position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 6px;
  padding: 4px 0; border-left: 3px solid transparent; border-radius: 2px;
}
.nb-cell.active { border-left-color: var(--action); }
.nb-gutter {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding-top: 6px;
}
.nb-run {
  width: 26px; height: 22px; padding: 0; font-size: 10px; color: var(--muted);
  background: transparent; border-color: transparent; opacity: 0;
}
.nb-cell:hover .nb-run, .nb-cell.active .nb-run { opacity: 1; }
.nb-run:hover { color: var(--action); background: var(--hover); }
.nb-count {
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--faint); padding-right: 4px;
}
.nb-cell.running .nb-count { color: var(--run); }
.nb-body { min-width: 0; }
.nb-editor {
  border: 1px solid var(--line); border-radius: 6px; background: var(--fill);
}
.nb-cell.active .nb-editor { border-color: var(--dot); background: var(--hover); }
.nb-markdown .nb-editor { background: var(--fill); }
.nb-tools {
  position: absolute; top: -6px; right: 10px; z-index: 2; display: flex; gap: 1px; padding: 1px;
  background: var(--fill); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 1px 3px rgba(28, 24, 20, .08); opacity: 0; pointer-events: none; transition: opacity .12s;
}
.nb-cell:hover .nb-tools, .nb-cell:focus .nb-tools { opacity: 1; pointer-events: auto; }
.nb-cell:focus { outline: none; background: rgb(29 78 216 / .045); }
.nb-cell:focus.active { border-left-color: var(--focus); }
.nb-cell:focus .nb-editor { border-color: var(--focus); }
.nb-more { width: 30px; padding: 0; font-size: 16px; letter-spacing: .05em; }
.nb { position: relative; }
.nb-menu {
  position: fixed; z-index: 1000; min-width: 232px; max-width: 300px; padding: 5px;
  background: var(--fill); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 12px 32px rgb(28 24 20 / .16), 0 2px 6px rgb(28 24 20 / .08);
  font-size: 13px; animation: nb-pop .09s ease-out;
}
@keyframes nb-pop { from { opacity: 0; transform: scale(.98); } }
.nb-menu-item {
  display: flex; align-items: center; gap: 16px; width: 100%; height: 28px; padding: 0 10px;
  background: transparent; border: none; border-radius: 5px; text-align: left; color: var(--fg); font-size: 13px;
}
.nb-menu-item:hover:not(:disabled), .nb-menu-item:focus-visible { background: var(--hover); outline: none; }
.nb-menu-item:disabled { color: var(--faint); cursor: default; opacity: 1; }
.nb-menu-item.danger { color: var(--danger); }
.nb-menu-item.danger:hover { background: rgb(180 35 24 / .08); }
.nb-menu-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-menu-hint { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--faint); }
.nb-menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.nb-toast {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 14px;
  background: var(--accent); color: var(--on-accent); border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 24px rgb(28 24 20 / .25);
}
.nb-toast-action {
  height: 26px; padding: 0 10px; font-size: 12.5px;
  background: rgb(255 255 255 / .1); border-color: transparent; color: var(--on-accent);
}
.nb-toast-action:hover { background: rgb(255 255 255 / .18); }
.nb-tool {
  width: 26px; height: 22px; padding: 0; font-size: 11px; color: var(--muted);
  background: transparent; border-color: transparent;
}
.nb-tool:hover { color: var(--fg); }
.nb-tool.danger:hover { color: var(--danger); }
.nb-outputs { padding: 8px 2px 4px 12px; display: flex; flex-direction: column; gap: 6px; }
.nb-out { margin: 0; max-width: 100%; }
pre.nb-out {
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word;
  max-height: 480px; overflow: auto;
}
.nb-stderr { background: var(--danger-bg); border-radius: 4px; padding: 4px 8px; }
.nb-error { background: var(--danger-bg); border-radius: 4px; padding: 6px 8px; color: var(--danger); }
.nb-html { display: block; width: 100%; height: 40px; border: none; background: transparent; }
.nb-image { display: block; max-width: 100%; height: auto; background: var(--fill); border-radius: 4px; }
.nb-muted { color: var(--muted); }
.nb-rendered { font-size: 14px; line-height: 1.6; color: var(--fg); overflow-wrap: anywhere; }
.nb-md { padding: 4px 14px; min-height: 28px; border-radius: 6px; cursor: text; }
.nb-md:hover { background: var(--fill); }
.nb-rendered h1, .nb-rendered h2, .nb-rendered h3 { letter-spacing: -0.02em; margin: 12px 0 6px; line-height: 1.25; }
.nb-rendered h1 { font-size: 24px; }
.nb-rendered h2 { font-size: 19px; }
.nb-rendered h3 { font-size: 16px; }
.nb-rendered p { margin: 6px 0; }
.nb-rendered code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.nb-rendered pre { background: var(--fill); border: 1px solid var(--line); padding: 8px 12px; border-radius: 6px; overflow: auto; }
.nb-rendered pre code { background: none; padding: 0; }
.nb-rendered blockquote { margin: 6px 0; padding: 0 12px; border-left: 3px solid var(--line); color: var(--muted); }
.nb-rendered table { width: auto; font-size: 13px; }
.nb-rendered td, .nb-rendered th { padding: 4px 12px 4px 0; white-space: normal; }
.nb-rendered th { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--fg); }
.nb-rendered a { color: var(--action); }
.nb-rendered img { max-width: 100%; }
.nb-tail { display: flex; align-items: center; gap: 8px; padding: 10px 0 0 76px; }
.nb-keys {
  position: absolute; inset: 0; z-index: 6; display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; background: rgb(28 24 20 / .18);
}
.nb-keys-box {
  width: min(460px, 100%); max-height: 100%; overflow: auto; padding: 6px 18px 14px;
  background: var(--fill); border: 1px solid var(--line); border-radius: 10px; outline: none;
  box-shadow: 0 16px 40px rgb(28 24 20 / .2); animation: nb-pop .09s ease-out;
}
.nb-keys-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 4px; font-size: 14px; }
.nb-keys-section h3 { margin: 12px 0 4px; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.nb-keys-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 13px; }
.nb-keys-row kbd {
  padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: var(--fill); font: 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); white-space: nowrap;
}
.status { margin: 0; font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
th {
  color: var(--muted); font-weight: 500; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
td, th { padding: 14px 8px 14px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td:last-child, th:last-child { padding-right: 0; }
tbody tr:hover td { background: var(--hover); }
td:first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--muted);
}
#error { color: var(--danger); font-size: 13px; margin: 0; overflow-wrap: anywhere; }
#login:not([hidden]) + #error { max-width: 340px; margin: 16px auto 0; padding: 0 20px; }
#login[hidden] + #error { position: fixed; left: 276px; top: 12px; max-width: 480px; z-index: 2; }
[hidden] { display: none !important; }
#logs {
  max-height: 320px; overflow: auto; white-space: pre; margin: 0;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--sidebar); color: var(--fg);
  font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
}
#logs:empty { display: none; }
#logs.is-placeholder {
  max-height: none; padding: 0; border: none; background: transparent;
  color: var(--muted); font-family: inherit; font-size: 14px;
}
.muted { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 12px; }
.error { color: var(--danger); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
#error:empty, .error:empty, .muted:empty, .status:empty { display: none; }
.actions { display: flex; gap: 4px; justify-content: flex-end; }
.actions button {
  height: 28px; padding: 0 8px; font-size: 12px;
  background: transparent; border-color: transparent; color: var(--muted);
}
.actions button:hover { background: var(--hover); color: var(--fg); }
.detail { flex: 1; min-height: 0; overflow: auto; }
.detail-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.detail-heading button { background: transparent; }
h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; margin: 0; }
h3 {
  font-size: 11px; font-weight: 600; color: var(--muted);
  margin: 28px 0 10px; letter-spacing: 0.12em; text-transform: uppercase;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--muted); overflow-wrap: anywhere; margin: 0 0 8px;
}
.table:focus-visible, pre:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 720px) {
  #workspace { flex-direction: column; height: auto; min-height: 100vh; }
  #sidebar { width: 100%; flex-basis: auto; max-height: 40vh; }
  body > #error { left: 16px; }
}

/* Quiet navigation, a readable content width, and one consistent toolbar. */
.theme-toggle {
  position: fixed; top: 17px; right: 28px; z-index: 30;
  width: 32px; height: 30px; border: 1px solid var(--line); background: var(--code-bg);
}
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun, [data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
::selection { background: var(--selection); color: var(--fg); }
#login { margin-top: 14vh; padding: 36px; max-width: 400px; border-radius: 10px; }
.login-brand { margin: 0 0 32px; color: var(--action); font-size: 17px; font-weight: 650; letter-spacing: -.03em; }
#login h1 { font-size: 24px; margin-bottom: 28px; }
#sidebar { width: 264px; flex-basis: 264px; padding: 0 22px 18px; }
.sidebar-brand { height: 64px; padding: 0; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.sidebar-brand strong { font-size: 18px; letter-spacing: -.025em; }
.brand-mark { display: none; }
#records { margin: 0 -10px; padding: 0 10px; }
.sidebar-group { margin-bottom: 10px; }
.group-head { min-height: 40px; }
.group-title { height: 38px; font-size: 14px; font-weight: 500; gap: 12px; padding: 0 10px; }
.group-title[aria-pressed="true"] { color: var(--action); background: var(--selected); }
.group-count { font-size: 12px; }
.sidebar-foot { padding: 18px 0 0; gap: 10px; }
#stage { padding: 32px 40px 40px; }
.stage-toolbar { min-height: 64px; margin: -32px -40px 32px; padding: 0 84px 0 40px; }
.stage-toolbar #heading { font-size: 16px; font-weight: 550; }
#board, #detail, #drop { width: 100%; max-width: 1120px; margin-left: auto; margin-right: auto; }
.card-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.card { min-height: 142px; padding: 22px; gap: 20px; border-radius: 8px; background: var(--code-bg); transition: border-color .15s, background-color .15s; }
.card:hover { border-color: var(--dot); }
.card:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.card strong { font-size: 15px; font-weight: 550; letter-spacing: -.01em; }
.card-meta { font-size: 12px; line-height: 1.6; }
.card .item-action { padding-left: 0; }
.object-list { border-radius: 8px; }
.object-head { height: 44px; background: var(--code-bg); }
.object-row { height: 54px; font-size: 14px; }
.object-size, .object-time { font-size: 13px; }
.detail-heading { margin-bottom: 12px; }
.detail h2 { font-size: 25px; letter-spacing: -.02em; }
.detail h3 { font-size: 14px; letter-spacing: 0; margin: 32px 0 14px; }
#logs { background: var(--code-bg); padding: 20px 24px; font-size: 13px; line-height: 1.8; border-radius: 8px; }
.detail table { border: 1px solid var(--line); background: var(--code-bg); }
.detail td, .detail th { padding: 14px 18px; }
.detail th { font-size: 12px; letter-spacing: 0; }
#stage-empty { margin: 48px auto; color: var(--muted); }
#login[hidden] + #error { left: 304px; top: 72px; padding: 8px 12px; background: var(--danger-bg); border-radius: 6px; }
#error:empty { display: none; }
.nb { background: var(--fill); }
.nb-editor { background: var(--code-bg); }
.nb-cell.active .nb-editor { background: var(--code-bg); border-color: var(--focus); }
.nb-rendered { line-height: 1.8; }
.nb-menu { box-shadow: 0 12px 36px rgb(0 0 0 / .22); }
.nb-keys-row kbd { background: var(--code-bg); }
#session-frame { background: var(--code-bg); color-scheme: normal; }
@media (min-width: 1600px) {
  #sidebar { width: 288px; flex-basis: 288px; padding-left: 32px; padding-right: 32px; }
  #stage { padding-left: 64px; padding-right: 64px; }
  .stage-toolbar { margin-left: -64px; margin-right: -64px; padding-left: 64px; }
}
@media (max-width: 720px) {
  #workspace { height: 100dvh; min-height: 100dvh; }
  #sidebar { width: 100%; flex-basis: auto; flex-shrink: 0; max-height: none; padding: 0 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { height: 58px; margin: 0; padding-right: 44px; border: 0; }
  .sidebar-brand .execution { font-size: 10px; }
  #records { overflow-x: auto; margin: 0; padding: 0 0 10px; flex: none; }
  #table { display: flex; gap: 6px; }
  .sidebar-group { margin: 0; flex: 0 0 auto; }
  .group-title { font-size: 12px; gap: 6px; padding: 0 8px; height: 34px; }
  .group-head { min-height: 34px; }
  .group-count, .group-add { display: none; }
  .sidebar-foot { margin: 0; padding: 8px 0; }
  .sidebar-foot .avatar, .sidebar-foot #role { display: none; }
  .who #account { font-size: 11px; }
  #stage { padding: 20px 16px; flex: 1; min-height: 0; }
  .stage-toolbar { min-height: 52px; margin: -20px -16px 20px; padding: 0 16px; }
  .theme-toggle { top: 14px; right: 16px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card { min-height: 120px; padding: 16px; }
  #login { margin: 14vh 20px 0; padding: 28px; }
  #login[hidden] + #error { top: 158px; left: 16px; right: 16px; max-width: none; }
  #session-page { min-height: 360px; }
  #logs { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Shared icon primitives also apply to standalone tools. */
.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
.ui-icon{display:inline-block;width:18px;height:18px;flex:0 0 auto;background:currentColor;mask-size:contain;mask-position:center;mask-repeat:no-repeat}
.icon-control{display:inline-flex;align-items:center;justify-content:center;gap:8px}
.nb-toolbar .ui-icon,.nb-tools .ui-icon{width:16px;height:16px}
.nb-group{flex-shrink:0}.nb-toolbar{min-height:44px;flex-wrap:wrap}.nb-btn{flex-shrink:0}
