/* Hermes Console — global styles */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Sans+SC:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #F4F1EB;
  --panel: #FBFAF6;
  --panel-2: #FFFFFF;
  --ink: #1A1816;
  --ink-2: #4A4742;
  --ink-3: #6B6760;
  --muted: #8C8881;
  --line: #E5E0D5;
  --line-2: #D4CDBE;
  --line-3: #BFB7A4;
  --accent: oklch(0.62 0.14 55);
  --accent-soft: oklch(0.62 0.14 55 / 0.10);
  --accent-line: oklch(0.62 0.14 55 / 0.45);
  --blue: oklch(0.55 0.13 240);
  --blue-soft: oklch(0.55 0.13 240 / 0.10);
  --green: oklch(0.58 0.11 160);
  --green-soft: oklch(0.58 0.11 160 / 0.12);
  --red: oklch(0.55 0.18 25);
  --shadow-sm: 0 1px 0 rgba(20,18,15,0.04);
  --shadow: 0 1px 2px rgba(20,18,15,0.04), 0 4px 16px rgba(20,18,15,0.04);
  --font-sans: "IBM Plex Sans SC", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #161513;
  --panel: #1E1C19;
  --panel-2: #25221E;
  --ink: #F4F1EA;
  --ink-2: #C8C3B7;
  --ink-3: #95907F;
  --muted: #6F6A5D;
  --line: #2F2C26;
  --line-2: #3D3932;
  --line-3: #524C42;
  --accent: oklch(0.72 0.14 55);
  --accent-soft: oklch(0.72 0.14 55 / 0.14);
  --accent-line: oklch(0.72 0.14 55 / 0.5);
  --blue: oklch(0.7 0.13 240);
  --blue-soft: oklch(0.7 0.13 240 / 0.14);
  --green: oklch(0.7 0.11 160);
  --green-soft: oklch(0.7 0.11 160 / 0.14);
  --shadow-sm: 0 1px 0 rgba(0,0,0,0.3);
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "ss02";
}

button { font-family: inherit; }

/* ── App skeleton ────────────────────────────────── */
.app {
  display: grid;
  grid-template-rows: 48px 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.app-body {
  display: grid;
  grid-template-columns: 52px 1fr;
  min-height: 0;
  border-top: 1px solid var(--line);
}

.console-grid {
  display: grid;
  grid-template-columns: 244px 1fr 360px;
  min-height: 0;
  height: 100%;
  background: var(--bg);
}

/* ── NavRail (far-left icon strip) ───────────────── */
.navrail {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 4px;
}
.nav-btn {
  appearance: none;
  width: 36px; height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  border-radius: 7px;
  cursor: pointer;
  display: grid; place-items: center;
  position: relative;
  transition: color 0.12s, background 0.12s;
}
.nav-btn:hover { color: var(--ink); background: var(--bg); }
.nav-btn.active {
  color: var(--ink);
  background: var(--line);
}
.nav-btn.active::before {
  content: "";
  position: absolute;
  left: -8px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.nav-btn svg { width: 18px; height: 18px; }
.nav-btn .nav-tip {
  position: absolute;
  left: 100%;
  margin-left: 8px;
  background: var(--ink);
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.12s, transform 0.12s;
  pointer-events: none;
  z-index: 10;
}
.nav-btn:hover .nav-tip { opacity: 1; transform: translateX(0); }
.navrail-spacer { flex: 1; }
.nav-divider {
  width: 24px;
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

/* ── Projects view ──────────────────────────────── */
.proj-view {
  height: 100%;
  overflow-y: auto;
  background: var(--bg);
}
.proj-view::-webkit-scrollbar { width: 8px; }
.proj-view::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: 4px; }

.proj-head {
  padding: 22px 32px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.proj-head-l h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.proj-head-l p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}
.proj-head-r {
  display: flex; gap: 8px;
}

.proj-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.kpi {
  background: var(--panel);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-label {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.kpi-val {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.kpi-val.accent { color: var(--accent); }
.kpi-val.green { color: var(--green); }
.kpi-val.muted { color: var(--ink-3); }
.kpi-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}

.proj-toolbar {
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.proj-filter-group {
  display: flex;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  overflow: hidden;
  background: var(--panel-2);
}
.proj-filter-group button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  padding: 5px 12px;
  color: var(--ink-3);
  cursor: pointer;
  border-right: 1px solid var(--line-2);
}
.proj-filter-group button:last-child { border-right: 0; }
.proj-filter-group button:hover { color: var(--ink); }
.proj-filter-group button.on { background: var(--ink); color: var(--bg); }

.proj-search {
  flex: 1;
  max-width: 320px;
  height: 28px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--panel-2);
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  outline: none;
}
.proj-search:focus { border-color: var(--ink); }
.proj-search::placeholder { color: var(--muted); }

.proj-toolbar-spacer { flex: 1; }

/* Project table */
.proj-table-wrap {
  padding: 0 32px 32px;
}
.proj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.proj-table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.proj-table tbody tr {
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}
.proj-table tbody tr:last-child { border-bottom: 0; }
.proj-table tbody tr:hover { background: var(--bg); }
.proj-table tbody td {
  padding: 12px 14px;
  vertical-align: middle;
}
.proj-table .col-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  width: 64px;
}
.proj-table .col-name b {
  display: block;
  font-weight: 500;
  font-size: 13px;
  color: var(--ink);
}
.proj-table .col-name span {
  font-size: 11.5px;
  color: var(--ink-3);
  display: block;
  margin-top: 1px;
}
.proj-table .col-stage { width: 132px; }
.proj-table .col-progress { width: 140px; }
.proj-table .col-skills { width: 80px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.proj-table .col-owner { width: 110px; }
.proj-table .col-updated { width: 100px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.proj-table .col-status { width: 90px; }
.proj-table .col-priority { width: 50px; }

/* Mini pipeline visual in row */
.mini-pipe {
  display: flex; align-items: center;
}
.mini-pipe .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--line-2);
  flex-shrink: 0;
}
.mini-pipe .dot.done { background: var(--green); }
.mini-pipe .dot.run {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 1.4s ease-in-out infinite;
}
.mini-pipe .dot.fail { background: var(--red); }
.mini-pipe .ln {
  flex: 1;
  height: 2px;
  background: var(--line-2);
  margin: 0 4px;
}
.mini-pipe .ln.done { background: var(--green); }

.progress-bar {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.progress-bar i {
  display: block;
  height: 100%;
  background: var(--ink-2);
  border-radius: 2px;
}
.progress-bar.running i { background: var(--accent); }
.progress-bar.done i { background: var(--green); }
.progress-bar.failed i { background: var(--red); }
.progress-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 3px;
}

.owner {
  display: flex; align-items: center; gap: 8px;
}
.owner-av {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.status-pill-table {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
  background: var(--panel-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.status-pill-table::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--muted);
}
.status-pill-table.running { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.status-pill-table.running::before { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.status-pill-table.done { color: var(--green); border-color: oklch(0.58 0.11 160 / 0.4); background: var(--green-soft); }
.status-pill-table.done::before { background: var(--green); }
.status-pill-table.queued::before { background: var(--ink-3); }
.status-pill-table.paused { color: var(--blue); border-color: oklch(0.55 0.13 240 / 0.4); background: var(--blue-soft); }
.status-pill-table.paused::before { background: var(--blue); }
.status-pill-table.failed { color: var(--red); border-color: oklch(0.55 0.18 25 / 0.4); background: oklch(0.55 0.18 25 / 0.08); }
.status-pill-table.failed::before { background: var(--red); }

.priority {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.priority.P0 { background: oklch(0.55 0.18 25 / 0.12); color: var(--red); }
.priority.P1 { background: var(--accent-soft); color: var(--accent); }
.priority.P2 { background: var(--line); color: var(--ink-3); }

/* Library + Settings placeholders */
.placeholder-view {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--ink-3);
  background: var(--bg);
  padding: 40px;
}
.placeholder-view h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink-2);
}
.placeholder-view p {
  margin: 0;
  font-size: 13px;
  max-width: 360px;
}

/* ── Skill Library ─────────────────────────────── */
.sk-master-detail {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: calc(100% - 280px);
  min-height: 520px;
  margin: 0 32px 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.sk-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--panel);
}
.sk-list::-webkit-scrollbar { width: 6px; }
.sk-list::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: 4px; }
.sk-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
}
.sk-row:hover { background: var(--bg); }
.sk-row.active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.sk-row-head { display: flex; align-items: center; gap: 8px; }
.sk-glyph {
  width: 18px; height: 18px;
  border-radius: 4px;
  color: white;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  display: grid; place-items: center;
}
.sk-row-name { flex: 1; font-weight: 500; font-size: 13px; }
.sk-status {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
}
.sk-status.stable { color: var(--green); border-color: oklch(0.58 0.11 160 / 0.4); background: var(--green-soft); }
.sk-status.beta { color: var(--blue); border-color: oklch(0.55 0.13 240 / 0.4); background: var(--blue-soft); }
.sk-status.experimental { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.sk-row-meta {
  display: flex; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.sk-ver { color: var(--ink-2); }
.sk-spark {
  display: flex; align-items: flex-end; gap: 2px;
  height: 18px;
}
.sk-spark i {
  flex: 1;
  background: var(--ink-3);
  border-radius: 1px;
  min-height: 2px;
  opacity: 0.6;
}
.sk-spark i.last { background: var(--accent); opacity: 1; }

.sk-detail-wrap { overflow-y: auto; background: var(--bg); }
.sk-detail-wrap::-webkit-scrollbar { width: 8px; }
.sk-detail-wrap::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: 4px; }
.sk-detail { padding: 24px 28px; }
.sk-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 80px 20px; }

.sk-detail-head {
  display: flex; justify-content: space-between; gap: 16px;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.sk-d-title { display: flex; align-items: center; gap: 8px; }
.sk-d-title h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.sk-ver-pill {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--line); color: var(--ink-2);
  padding: 2px 6px; border-radius: 4px;
}
.sk-d-desc { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.sk-d-actions { display: flex; gap: 6px; flex-shrink: 0; }

.sk-d-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 18px;
}
.sk-stat { background: var(--panel); padding: 12px 14px; }
.sk-stat .lbl { font-size: 11px; color: var(--ink-3); margin-bottom: 4px; }
.sk-stat .val { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sk-stat .val.green { color: var(--green); }

.sk-d-section { margin-bottom: 22px; }
.sk-d-section h4 {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
}
.sk-d-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}

.sk-chart {
  display: flex; align-items: flex-end; gap: 8px;
  height: 110px;
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}
.sk-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.sk-bar i {
  width: 100%;
  background: var(--ink-3);
  border-radius: 2px;
  min-height: 4px;
  opacity: 0.7;
}
.sk-bar i.last { background: var(--accent); opacity: 1; }
.sk-bar .x { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); }

.sk-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0;
  color: var(--ink-2);
  white-space: pre-wrap;
}
.sk-code .kw { color: var(--blue); }

.sk-deps { display: flex; flex-wrap: wrap; gap: 6px; }
.sk-dep {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--blue);
}

.sk-log {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.sk-log thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.sk-log tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
}
.sk-log tbody tr:last-child td { border-bottom: 0; }
.sk-log .ok { color: var(--green); }
.sk-log .warn { color: var(--accent); }

/* ── Settings ──────────────────────────────────── */
.set-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  margin: 0 32px 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  min-height: 540px;
}
.set-nav {
  border-right: 1px solid var(--line);
  padding: 8px;
  display: flex; flex-direction: column;
  gap: 2px;
  background: var(--panel);
}
.set-nav-btn {
  appearance: none;
  border: 0; background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.set-nav-btn:hover { background: var(--bg); }
.set-nav-btn.on { background: var(--ink); color: var(--bg); }
.set-nav-label { font-weight: 500; font-size: 12.5px; }
.set-nav-desc { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.set-nav-btn.on .set-nav-desc { color: rgba(255,255,255,0.55); }

.set-form { padding: 24px 28px; overflow-y: auto; }
.set-h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.set-h3-sub { margin: 0 0 20px; font-size: 12.5px; color: var(--ink-3); line-height: 1.55; max-width: 560px; }

.set-field {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  align-items: start;
}
.set-field:first-of-type { border-top: 0; }
.set-field-label { font-weight: 500; font-size: 13px; }
.set-field-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }

.set-toggle {
  position: relative;
  width: 32px; height: 18px;
  border: 0;
  border-radius: 999px;
  background: var(--line-3);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s;
}
.set-toggle[data-on="1"] { background: var(--green); }
.set-toggle i {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: transform 0.15s;
}
.set-toggle[data-on="1"] i { transform: translateX(14px); }

.set-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--panel-2);
  overflow: hidden;
}
.set-card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.set-card-head b { font-weight: 500; font-size: 13px; flex: 1; }
.set-card-body { padding: 4px 16px; }
.set-card-body .set-field { grid-template-columns: 140px 1fr; padding: 10px 0; }

.set-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--line);
  color: var(--ink-3);
}
.set-tag-on {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid oklch(0.58 0.11 160 / 0.4);
}
.set-tags-row { display: flex; gap: 6px; flex-wrap: wrap; }

.set-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0 12px;
}
.set-table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.set-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.set-table tbody tr:last-child td { border-bottom: 0; }

.set-members { display: flex; align-items: center; gap: 6px; }

.set-quota-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.set-quota-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--panel-2);
}
.set-quota-label { font-size: 11px; color: var(--ink-3); }
.set-quota-val { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.set-quota-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.set-quota-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.set-quota-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); margin-top: 6px; }

.set-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-2);
}

/* ── Header ─────────────────────────────────────── */
.hdr {
  display: flex;
  align-items: center;
  padding: 0 14px 0 18px;
  background: var(--panel);
  gap: 16px;
  font-size: 12px;
}
.hdr-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
  border-right: 1px solid var(--line);
  height: 28px;
}
.hdr-logo {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: -0.02em;
}
.hdr-title {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 12.5px;
}
.hdr-title .v { color: var(--muted); font-weight: 400; margin-left: 6px; font-family: var(--font-mono); font-size: 11px; }

.hdr-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.hdr-crumbs span.sep { color: var(--line-3); }
.hdr-crumbs .cur { color: var(--ink); }

.hdr-spacer { flex: 1; }

.hdr-run {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-2);
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--panel-2);
}
.hdr-run .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
}
.hdr-run.running .dot { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.hdr-run.done .dot { background: var(--green); }

.hdr-btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--ink);
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hdr-btn:hover { border-color: var(--line-3); }
.pagenav { display:flex; gap:2px; margin-left:16px; }
.pagenav .pn { font-size:12px; text-decoration:none; color:var(--muted); padding:4px 10px; border-radius:6px; line-height:1; }
.pagenav .pn:hover { background:var(--panel-2); color:var(--ink); }
.pagenav .pn.active { color:var(--ink); background:var(--panel-2); font-weight:600; }
.hdr-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.hdr-btn.primary {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.hdr-btn.primary:hover { background: var(--ink-2); }
.hdr-btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.hdr-btn .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 2px;
}
.hdr-btn.primary .kbd { color: rgba(255,255,255,0.55); border-color: rgba(255,255,255,0.2); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── Left: Agent rail ────────────────────────────── */
.rail {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.rail-section {
  padding: 14px 14px 8px;
}
.rail-section h4 {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rail-section h4 .count {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink-3);
}

.agent-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  position: relative;
}
.agent-card:hover { border-color: var(--line-3); }
.agent-card.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.agent-card.running {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.agent-card.running::before {
  content: "";
  position: absolute;
  left: -1px; top: -1px; bottom: -1px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px 0 0 2px;
}

.agent-card-row {
  display: flex; align-items: center; gap: 8px;
}
.agent-glyph {
  width: 22px; height: 22px;
  border-radius: 5px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: -0.02em;
  color: white;
}
.agent-name { font-weight: 500; font-size: 12.5px; flex: 1; }
.agent-status {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.agent-status.running { color: var(--accent); }
.agent-status.done { color: var(--green); }
.agent-meta {
  display: flex; gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.agent-meta b { color: var(--ink-2); font-weight: 500; }

.rail-spacer { flex: 1; }

.rail-runs {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.rail-runs .run-item {
  display: flex; justify-content: space-between;
  padding: 4px 0;
}
.rail-runs .run-item .ok { color: var(--green); }

/* ── Center: workflow + chat ─────────────────────── */
.center {
  display: grid;
  grid-template-rows: 200px 1fr;
  min-height: 0;
  background: var(--bg);
}

/* Workflow strip */
.wf {
  border-bottom: 1px solid var(--line);
  background: 
    linear-gradient(var(--bg), var(--bg)),
    radial-gradient(circle at 1px 1px, var(--line-2) 1px, transparent 1px) 0 0 / 18px 18px;
  background-blend-mode: normal;
  position: relative;
  display: flex; flex-direction: column;
  padding: 14px 24px;
}
.wf-bg {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--line-2) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.5;
  pointer-events: none;
}
.wf-head {
  display: flex; align-items: center; justify-content: space-between;
  z-index: 1;
  margin-bottom: 8px;
}
.wf-head h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.wf-head .legend {
  display: flex; gap: 14px;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-3);
}
.wf-head .legend i {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}

.wf-canvas {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  position: relative;
  z-index: 1;
}
.wf-node {
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 10px 14px;
  width: 200px;
  display: flex; flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.wf-node:hover { border-color: var(--line-3); }
.wf-node.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink), var(--shadow); }
.wf-node.running {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 6px var(--accent-soft);
}
.wf-node.done {
  border-color: var(--green);
}
.wf-node.idle {
  opacity: 0.7;
}

.wf-node-head {
  display: flex; align-items: center; gap: 8px;
}
.wf-node-head .agent-glyph { width: 18px; height: 18px; font-size: 9px; border-radius: 4px; }
.wf-node-name { font-weight: 600; font-size: 12.5px; flex: 1; }
.wf-node-code {
  font-family: var(--font-mono); font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.wf-node-row {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3);
}
.wf-node-row .v { color: var(--ink); }

.wf-edge {
  flex: 0 0 56px;
  height: 2px;
  background: var(--line-2);
  position: relative;
}
.wf-edge::after {
  content: "";
  position: absolute;
  right: -1px; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--line-2);
}
.wf-edge.flow {
  background: var(--accent);
}
.wf-edge.flow::after { border-left-color: var(--accent); }
.wf-edge.flow .pulse {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: edge-pulse 1.6s linear infinite;
}
.wf-edge.done {
  background: var(--green);
}
.wf-edge.done::after { border-left-color: var(--green); }

@keyframes edge-pulse {
  from { left: -4%; }
  to   { left: 104%; }
}

/* Chat */
.chat {
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--panel);
}
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.chat-head .agent-glyph { width: 26px; height: 26px; font-size: 10.5px; }
.chat-head .who { font-weight: 600; font-size: 13px; }
.chat-head .status-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
}
.chat-head .status-pill.running {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}
.chat-head-spacer { flex: 1; }
.chat-head .meta-stat {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.chat-head .meta-stat b { color: var(--ink); font-weight: 500; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 8px;
  display: flex; flex-direction: column;
  gap: 14px;
}
.chat-body::-webkit-scrollbar { width: 8px; }
.chat-body::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: 4px; }

.msg {
  max-width: 78%;
  font-size: 13px;
  line-height: 1.55;
}
.msg .who-line {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.msg .who-line .glyph {
  width: 16px; height: 16px;
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 8.5px; font-weight: 600;
  color: white;
}
.msg .body {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.msg.user { align-self: flex-end; }
.msg.user .body {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.msg.user .who-line { justify-content: flex-end; }

.msg.tool .body {
  background: transparent;
  border: 1px dashed var(--line-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
}
.msg.tool .body::before { content: "▸ "; color: var(--blue); }

.msg.memory .body {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
}
.msg.memory .body::before { content: "◉ MEM "; color: var(--accent); font-weight: 600; }

.typing {
  display: inline-flex; gap: 3px;
  padding: 8px 12px;
}
.typing i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s ease-in-out infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.chat-input-wrap {
  border-top: 1px solid var(--line);
  padding: 14px 24px 18px;
  background: var(--panel);
}
.chat-input {
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.chat-input:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20,18,15,0.05);
}
.chat-input textarea {
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--ink);
  width: 100%;
  min-height: 40px;
  max-height: 140px;
}
.chat-input textarea::placeholder { color: var(--muted); }

.chat-input-toolbar {
  display: flex; align-items: center; gap: 8px;
}
.chat-input-toolbar .chips { display: flex; gap: 6px; flex: 1; }
.chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
  background: var(--panel);
  cursor: pointer;
}
.chip:hover { border-color: var(--line-3); color: var(--ink-2); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ── Right: inspector ───────────────────────────── */
.inspector {
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.inspector::-webkit-scrollbar { width: 8px; }
.inspector::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: 4px; }

.insp-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  gap: 0;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}
.insp-tab {
  appearance: none;
  border: 0; background: transparent;
  padding: 10px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex; align-items: center; gap: 6px;
}
.insp-tab:hover { color: var(--ink-2); }
.insp-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.insp-tab .badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  background: var(--line);
  color: var(--ink-3);
  padding: 1px 5px;
  border-radius: 999px;
}
.insp-tab.active .badge { background: var(--ink); color: var(--bg); }

.insp-body { padding: 14px 16px; }

/* Memory layers */
.mem-intro {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.55;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.mem-intro b { color: var(--ink-2); font-weight: 500; }

.mem-layer {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--panel-2);
}
.mem-layer-head {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
}
.mem-layer-head:hover { background: var(--bg); }
.mem-layer-row {
  display: flex; align-items: center; gap: 8px;
}
.mem-id {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--line);
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.mem-name { font-weight: 500; font-size: 12.5px; flex: 1; }
.mem-en {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.mem-bar {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.mem-bar-fill {
  height: 100%;
  background: var(--ink-2);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.3, 0.7, 0.4, 1);
}
.mem-layer.writing .mem-bar-fill {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.mem-layer.writing .mem-id {
  background: var(--accent);
  color: white;
}
.mem-stats {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.mem-stats .num { color: var(--ink); font-weight: 500; }

.mem-layer-detail {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-size: 11.5px;
}
.mem-desc {
  padding: 8px 0 6px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.5;
}
.mem-decay {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  padding-bottom: 8px;
}
.mem-items {
  display: flex; flex-direction: column;
  gap: 4px;
}
.mem-item {
  display: grid;
  grid-template-columns: 50px 80px 1fr;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}
.mem-item:last-child { border-bottom: 0; }
.mem-item .k {
  color: var(--blue);
}
.mem-item .v { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-item .new {
  background: var(--accent);
  color: white;
  font-size: 9px;
  padding: 0 4px;
  border-radius: 3px;
  margin-left: 4px;
}

/* Skills */
.skill-intro {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.55;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.skill-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.skill {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--panel-2);
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
  overflow: hidden;
}
.skill.flash {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.skill.flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  animation: flash 0.6s ease-out;
  pointer-events: none;
}
@keyframes flash {
  0% { opacity: 0.18; }
  100% { opacity: 0; }
}
.skill-row {
  display: flex; align-items: baseline; gap: 8px;
}
.skill-name { font-weight: 500; font-size: 12.5px; flex: 1; }
.skill-inv {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.skill-row-2 {
  display: flex; align-items: center; gap: 10px;
}
.skill-level {
  display: inline-flex; gap: 2px;
}
.skill-level i {
  width: 4px; height: 12px;
  background: var(--line-2);
  border-radius: 1px;
}
.skill-level i.on { background: var(--accent); }
.skill-spark {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.skill-spark i {
  flex: 1;
  background: var(--ink-3);
  border-radius: 1px;
  min-height: 2px;
  transition: height 0.4s, background 0.2s;
}
.skill-spark i.last { background: var(--accent); }
.skill-delta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green);
  background: var(--green-soft);
  padding: 1px 5px;
  border-radius: 3px;
}

.skill-empty {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  padding: 24px 0;
}

/* misc */
.kbd-hint {
  position: absolute;
  bottom: 12px; right: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
