:root {
  color-scheme: dark;
  --background: #111;
  --surface: #181818;
  --surface-border: #2c2c2c;
  --ink: #ddd;
  --muted: #999;
  --accent: #fff;
  --added: #7aa2d6;
  --positive: #6aa36f;
  --warning: #c2a44a;
  --negative: #c46a5f;
  --flat: #c2a44a;
  --neutral: #6b6b6b;
  --border: #333;
  --undelivered: #555;
  --line: #999;
  --center: #aaa;
  --particle: #aaa;
  --scrollbar: #444;
}

[data-theme="light"] {
  color-scheme: light;
  --background: #f3f3f1;
  --surface: #ececea;
  --surface-border: #d7d7d2;
  --ink: #222;
  --muted: #777;
  --accent: #222;
  --added: #3f6ea8;
  --positive: #4f7f55;
  --warning: #a3862f;
  --negative: #a8574d;
  --flat: #a3862f;
  --neutral: #8a8a8a;
  --border: #d3d3d0;
  --undelivered: #aaa;
  --line: #777;
  --center: #777;
  --particle: #8a8a8a;
  --scrollbar: #aaa;
}

@font-face {
  font-family: Inter;
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 14px/1.6 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button, .btn, .nav-link, .dropdown-option, .clickable-row {
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
button:active:not(:disabled), a.btn:active:not([aria-disabled="true"]) { transform: translateY(1px); }
:where(button, a, [role="button"], .dropdown-trigger):focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.clamp-2 {
  display: -webkit-box;
  max-height: 3.2em;
  overflow: hidden;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .04em;
}
.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;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-form {
  display: grid;
  gap: 12px;
  width: min(340px, 100%);
}
.key-login { display: grid; gap: 12px; }
.login-form h1 { margin-bottom: 18px; font-size: 24px; font-weight: 500; }
.login-form label { font-size: 12px; color: var(--muted); }
.login-form .btn { justify-self: start; margin-top: 4px; }
.login-hint { font-size: 11px; }
#login-error:empty { display: none; }

.console { min-height: 100vh; }
.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  padding: 0 24px 0 20px;
  border-bottom: 1px dashed var(--border);
  background: var(--background);
}
.brand {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.02em;
  text-decoration: none;
}
.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--muted), transparent) -55% 0 / 35% 100% no-repeat;
  opacity: 0;
}
.topbar.loading::after {
  opacity: .6;
  animation: loading-line 900ms linear infinite;
}
.theme-toggle {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
}
.theme-toggle:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .moon { display: block; }
.topbar-lake-action {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 5px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 11px;
}
.topbar-lake-action:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.topbar-lake-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}
.project-context { display: flex; align-items: center; min-width: 0; }
.crumb {
  min-width: 0;
  max-width: min(280px, 38vw);
  font-weight: 500;
}
.crumb .dropdown-trigger { padding: 4px 5px; }
.crumb .dropdown-trigger:disabled { color: var(--ink); opacity: 1; cursor: default; }
.account { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.account-dropdown { max-width: 180px; font-weight: 500; }
.account-dropdown .dropdown-trigger { padding: 4px 2px; }
.topbar .dropdown-chevron { display: none; }
.topbar .dropdown-trigger::after {
  content: "▾";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  transform: translateY(-1px);
}
.topbar .dropdown.open .dropdown-trigger::after { transform: translateY(-1px) rotate(180deg); }
.topbar .dropdown-trigger:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.raw-fields { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 10px; }
.raw-fields > span { overflow-wrap: anywhere; }
.raw-json { margin-top: 8px; color: var(--muted); font-size: 11px; }
.raw-json summary { cursor: pointer; }
.raw-json pre {
  max-height: 420px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--ink);
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.workspace { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: calc(100vh - 65px); }
.sidebar { padding: 30px 18px 40px 20px; border-right: 1px dashed var(--border); }
#section-nav { position: sticky; top: 94px; display: grid; gap: 3px; }
.nav-link {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  text-align: left;
  text-decoration: none;
}
.nav-link:hover, .nav-link.active { color: var(--ink); }
.nav-link.active { border-left: 1px solid var(--ink); padding-left: 7px; }
.nav-back { min-width: 0; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.nav-back .nav-link {
  max-width: 164px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-separator { height: 1px; margin: 11px 8px; background: var(--border); }
.content { width: min(100%, 980px); padding: 36px clamp(24px, 5vw, 64px) 80px; outline: none; }
.content.ideas-content-wide { width: 100%; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  min-height: 42px;
  margin-bottom: 24px;
}
.section-head h2 { min-width: 0; flex: 1 1 auto; font-size: 20px; font-weight: 500; line-height: 1.4; }
.section-head > :last-child:not(:first-child) { margin-left: auto; }
.panel {
  padding: 20px 22px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface);
}
.panel + .panel { margin-top: 16px; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head > :first-child {
  min-width: 0;
  flex: 1;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.panel-head > :last-child:not(:first-child) { margin-left: auto; }
.radar-filter-controls { display: flex; flex: 0 1 420px; min-width: 0; gap: 9px; }
.radar-filter-controls .filter-input { min-width: 0; flex: 1; }
.radar-filter-controls .field-dropdown { flex: 0 1 180px; }
.radar-filter-bar {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}
.radar-filter-group { display: flex; flex: 1; min-width: 0; gap: 2px; }
.radar-filter-group button {
  display: grid;
  flex: 1;
  place-items: center;
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.radar-filter-group button:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.radar-filter-group button[aria-pressed="true"] { border-color: var(--muted); background: var(--border); color: var(--ink); }
.radar-filter-positive { color: var(--positive); }
.radar-filter-negative { color: var(--negative); }
.radar-filter-warning { color: var(--warning, var(--flat)); }
.radar-filter-added { color: var(--added); }
.radar-filter-muted { color: var(--muted); }
.stack { border-top: 1px solid var(--border); }
.stack > .row { border-bottom: 1px solid var(--border); }
.panel .stack { border-top: 0; }
.panel .stack > .row { border-bottom: 1px solid var(--surface-border); }
.panel .stack > .row:last-child { border-bottom: 0; }
.member-group { min-width: 0; }
.member-group + .member-group { margin-top: 8px; }
.member-group-title { padding: 10px 0 4px; }
.row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 11px 0;
}
.clickable-row {
  position: relative;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 150ms ease;
}
.clickable-row::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: 7px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
  transition: transform 150ms ease;
}
.clickable-row:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.clickable-row:hover::after { transform: translate(2px, -50%); }
.row.clickable-row { padding-right: 24px; }
.panel.clickable-row { padding-right: 42px; }
.clickable-row .main > :first-child,
.panel.clickable-row > :first-child { color: var(--ink); }
.row .main { min-width: 0; flex: 1; color: var(--ink); overflow-wrap: anywhere; }
.row > .main { display: grid; gap: 1px; }
.row > .main > div { min-width: 0; overflow-wrap: anywhere; }
.row .main .muted { font-size: 11px; }
.run-id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-subtitle { overflow-wrap: anywhere; white-space: normal; }
.row .meta {
  display: grid;
  justify-items: end;
  gap: 1px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.actions { display: flex; flex-shrink: 0; align-items: center; gap: 7px; }
.dropdown { position: relative; display: inline-flex; min-width: 0; color: var(--ink); }
.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
  padding: 2px 0;
  border: 0;
  border-radius: 4px;
  outline: none;
  background: none;
  text-align: left;
}
.dropdown-trigger:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.dropdown-trigger:disabled { cursor: default; opacity: .45; }
.dropdown-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown.placeholder .dropdown-label { color: var(--muted); }
.dropdown-chevron {
  flex: 0 0 auto;
  width: 10px;
  height: 7px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 120ms ease-in;
}
.dropdown.open .dropdown-chevron { transform: rotate(180deg); transition-timing-function: cubic-bezier(0.2, 0, 0, 1); }
.dropdown-panel {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: calc(100vw - 16px);
  padding: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--background);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--ink) 7%, transparent);
  font-size: 13px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 120ms ease-in, transform 120ms ease-in;
}
.dropdown-panel.up { transform: translateY(2px); }
.dropdown-panel.open { opacity: 1; transform: none; transition-timing-function: cubic-bezier(0.2, 0, 0, 1); }
.dropdown-filter {
  flex: 0 0 auto;
  width: 100%;
  height: 31px;
  margin-bottom: 3px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: none;
  color: var(--ink);
}
.dropdown-filter:focus { border-color: var(--muted); }
.dropdown-filter::placeholder { color: var(--muted); opacity: .75; }
.dropdown-options { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.dropdown-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 18px;
  min-width: 126px;
  padding: 6px 9px 6px 13px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.dropdown-option:hover, .dropdown-option.active {
  color: var(--ink);
  background: color-mix(in srgb, var(--border) 45%, var(--background));
}
.dropdown-option.selected::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 7px;
  bottom: 7px;
  width: 1px;
  background: var(--ink);
}
.dropdown-option-label { overflow: hidden; text-overflow: ellipsis; }
.dropdown-hint { color: var(--muted); font-size: 11px; }
.dropdown-option.project-option { grid-template-columns: minmax(0, 1fr); gap: 0; }
.dropdown-option.project-option .dropdown-hint { line-height: 1.4; }
.filter-input {
  width: min(220px, 100%);
  height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: none;
  color: var(--ink);
  font-size: 12px;
}
.filter-input:focus { border-color: var(--muted); }
.filter-input::placeholder { color: var(--muted); opacity: .75; }
.form { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.form + * { margin-top: 28px; }
.form label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.input, .form .dropdown, .field-dropdown {
  min-width: 130px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: none;
  color: var(--ink);
}
.input { padding: 5px 9px; }
.form .dropdown, .field-dropdown { padding: 0; }
.form .dropdown-trigger, .field-dropdown .dropdown-trigger { height: 100%; padding: 5px 9px; }
.input:focus, .form .dropdown:focus-within, .field-dropdown:focus-within { border-color: var(--muted); }
.input::placeholder { color: var(--muted); opacity: .75; }
.btn {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--background); }
.btn.danger { border-color: var(--negative); color: var(--negative); }
.btn.link { min-height: 0; padding: 2px 0; border: 0; color: var(--muted); }
.btn.link:hover { color: var(--ink); }
.btn.ghost { border-color: var(--border); background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { border-color: var(--muted); background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.btn.ghost:active:not(:disabled) { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.btn.ghost.danger { border-color: var(--border); background: transparent; color: var(--muted); }
.btn.ghost.danger:hover:not(:disabled), .btn.ghost.danger:focus-visible { border-color: color-mix(in srgb, var(--negative) 48%, var(--border)); background: color-mix(in srgb, var(--negative) 9%, transparent); color: var(--negative); }
.btn.ghost.danger:active:not(:disabled) { background: color-mix(in srgb, var(--negative) 14%, transparent); }
.btn.ghost:disabled:hover { border-color: var(--border); background: transparent; }
.confirm-inline .btn.ghost.danger { border-color: color-mix(in srgb, var(--negative) 48%, var(--border)); background: color-mix(in srgb, var(--negative) 9%, transparent); color: var(--negative); }
.btn.link:is(button) {
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.btn.link:is(button):hover:not(:disabled) { border-color: var(--muted); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.btn.sm { min-height: 28px; padding: 3px 8px; font-size: 12px; }
.icon-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
}
.icon-button:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.content a:not(.brand):not(.nav-link):not(.clickable-row):not(.btn) {
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent);
  text-underline-offset: .16em;
}
.content a:not(.brand):not(.nav-link):not(.clickable-row):not(.btn):hover { text-decoration-color: var(--ink); }
.confirm-inline { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.confirm-inline > :first-child { margin-left: 4px; }
.pill {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  white-space: nowrap;
}
.pill.on { border-color: var(--positive); color: var(--positive); }
.pill.off { color: var(--neutral); }
.feed { margin: 0; padding: 0; list-style: none; }
.feed li { padding: 10px 0 16px; }
.feed .event {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.feed .main { padding-top: 4px; font-size: 12px; overflow-wrap: anywhere; }
.notice { padding: 9px 0; color: var(--muted); font-size: 12px; }
.notice.error {
  padding: 10px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: inset 2px 0 var(--negative);
  color: var(--negative);
}

.lake-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 70px color-mix(in srgb, #000 58%, transparent);
}
.lake-dialog::backdrop { background: color-mix(in srgb, #000 62%, transparent); }
.lake-dialog-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--surface-border);
}
.lake-dialog-head h2 { min-width: 0; flex: 1; font-size: 18px; font-weight: 500; }
.lake-dialog-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}
.lake-dialog-close:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.lake-dialog-body {
  display: grid;
  gap: 18px;
  max-height: calc(min(760px, 100vh - 32px) - 126px);
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
}
.lake-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-height: 62px;
  padding: 14px 20px;
  border-top: 1px solid var(--surface-border);
}
.lake-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.lake-fieldset legend { margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.lake-choice-list { display: grid; gap: 2px; margin-top: 4px; padding-left: 20px; }
.lake-choice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 5px 0;
  cursor: pointer;
}
.lake-choice > input { flex: 0 0 auto; margin: 4px 0 0; accent-color: var(--accent); }
.lake-choice:has(input:disabled) { color: var(--muted); cursor: default; opacity: .65; }
.lake-choice-dependent { margin-left: 20px; }
.lake-choice-text { display: grid; min-width: 0; line-height: 1.4; }
.lake-choice-hint { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.lake-file-field { display: grid; gap: 4px; }
.lake-file-control { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; min-height: 28px; }
.lake-file-control .muted { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.lake-file-control [aria-disabled="true"] { opacity: .45; pointer-events: none; }
.lake-preview { display: grid; gap: 18px; }
.lake-manifest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 0; }
.lake-manifest > div { min-width: 0; }
.lake-manifest dt { color: var(--muted); font-size: 10px; }
.lake-manifest dd { margin: 1px 0 0; overflow-wrap: anywhere; }
.lake-warnings { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border)); border-radius: 6px; color: var(--warning); font-size: 12px; }
.lake-warnings ul { margin: 5px 0 0; padding-left: 18px; }
.lake-target { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.lake-target .input { width: 100%; }
.lake-result { display: grid; gap: 7px; }
.lake-success { margin-bottom: 5px; color: var(--positive); font-weight: 600; }
.lake-result-row { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; border-bottom: 1px solid var(--surface-border); }
.lake-result-row > :last-child { color: var(--muted); font-size: 12px; text-align: right; }
.empty { overflow: hidden; padding: 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.copy-field {
  display: flex;
  align-items: stretch;
  min-width: 0;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  background: var(--background);
}
.copy-field-value {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  padding: 10px 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}
.copy-field .btn {
  min-height: 0;
  padding: 8px 12px;
  border: 0;
  border-left: 1px solid var(--surface-border);
  border-radius: 0;
}
.copy-field .btn:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12px; }
.meta-line > :not(:first-child)::before { content: "·"; margin: 0 7px; color: var(--muted); }

.section-enter { animation: state-enter 180ms cubic-bezier(0.2, 0, 0, 1); }
.stack-row-enter { animation: fade-enter 180ms cubic-bezier(0.2, 0, 0, 1) both; animation-delay: var(--row-stagger, 0ms); }
.confirm-inline, .copy-field, .notice { animation: state-enter 160ms cubic-bezier(0.2, 0, 0, 1); }
.saved-state::after {
  content: attr(data-saved-state);
  animation: state-enter 160ms cubic-bezier(0.2, 0, 0, 1);
}
.saved-state.state-exit::after { animation: state-exit 160ms ease-in forwards; }
.chart-best-area { pointer-events: none; }
.chart-best-area-start { stop-color: var(--ink); stop-opacity: .1; }
.chart-best-area-end { stop-color: var(--ink); stop-opacity: 0; }
.chart-best-line.animate { stroke-dasharray: 1; animation: chart-draw 400ms ease-out; }
.chart-dot.animate { animation: fade-enter 160ms 400ms cubic-bezier(0.2, 0, 0, 1) both; }

@keyframes state-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@keyframes state-exit {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes fade-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes loading-line {
  from { background-position-x: -55%; }
  to { background-position-x: 155%; }
}
@keyframes chart-draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 9px;
    padding-right: 14px;
  }
  .crumb { max-width: 31vw; }
  .workspace { display: block; }
  .sidebar { padding: 12px 16px; border-right: 0; border-bottom: 1px dashed var(--border); overflow-x: auto; }
  #section-nav { position: static; display: flex; width: max-content; min-width: 100%; gap: 4px; }
  .nav-link { width: auto; white-space: nowrap; }
  .nav-link.active { border-left: 0; border-bottom: 1px solid var(--ink); padding-left: 8px; padding-bottom: 5px; }
  .nav-back { margin: 0 10px 0 0; padding: 0 10px 0 0; border-right: 1px solid var(--border); border-bottom: 0; }
  .nav-separator { width: 1px; height: 24px; margin: 3px 7px; }
  .content { padding: 28px 18px 60px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .section-head h2 { flex: none; }
  .section-head > :last-child:not(:first-child) { margin-left: 0; }
  .row { align-items: flex-start; flex-wrap: wrap; }
  .row .meta { margin-left: auto; }
  .row .actions { width: 100%; }
  .form { align-items: stretch; }
  .form label, .form .input, .form .dropdown { flex: 1 1 150px; }
  .lake-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .lake-dialog-body { max-height: calc(100vh - 146px); padding: 16px; }
  .lake-manifest { grid-template-columns: minmax(0, 1fr); }
  .lake-result-row { display: grid; gap: 2px; }
  .lake-result-row > :last-child { text-align: left; }
  .topbar-lake-action { width: 24px; padding: 0; justify-content: center; }
  .topbar-lake-action span { display: none; }
}

/* debug role switcher (temporary) */
.debug-role-login {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.debug-role-login .btn { margin-top: 0; font-size: 11px; }
.debug-role-switcher,
#debug-role-key-form {
  display: flex;
  align-items: center;
  gap: 6px;
}
.debug-role-switcher > .muted { font-size: 10px; }
#debug-role-marker { font-size: 9px; }
#debug-role {
  max-width: 102px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
}
#debug-role .dropdown-trigger { height: 26px; padding: 3px 5px; }
#debug-role:focus-within { border-color: var(--muted); }
#debug-role-forget {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
#debug-role-forget:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
#debug-role-forget:disabled { opacity: .45; cursor: default; }
#debug-role-key {
  width: 138px;
  height: 28px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: none;
  color: var(--ink);
  font-size: 11px;
}
#debug-role-key:focus { border-color: var(--muted); }
#debug-role-key::placeholder { color: var(--muted); opacity: .75; }
#debug-role-key-form .btn { min-height: 28px; padding: 3px 8px; font-size: 11px; }
@media (max-width: 720px) {
  .debug-role-switcher > .muted { display: none; }
  #debug-role-key { width: 112px; }
}

@media (max-width: 600px) {
  .idea-row { flex-direction: column; gap: 4px; }
  .idea-row > .main, .idea-row > .meta-line { width: 100%; }
  .idea-row > .meta-line { justify-content: flex-start; text-align: left; }
  .radar-filter-head { align-items: stretch; flex-wrap: wrap; }
  .radar-filter-head > :first-child { flex: 1 0 100%; }
  .radar-filter-head > .ideas-view-switch { margin-left: 0; }
  .radar-filter-head > .radar-filter-controls { flex: 1 0 100%; flex-direction: column; margin-left: 0; }
  .radar-filter-controls .filter-input, .radar-filter-controls .field-dropdown { width: 100%; flex: none; }
  .radar-filter-bar { gap: 8px; }
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 56px;
    gap: 7px;
    padding: 0 10px;
  }
  .brand { font-size: 12px; }
  .theme-toggle { width: 22px; height: 22px; }
  .project-context { overflow: hidden; }
  .crumb { flex: 1 1 0; max-width: none; overflow: hidden; }
  .crumb .dropdown-trigger { padding-inline: 2px; }
  .account { min-width: 0; gap: 6px; }
  .account-dropdown { max-width: 92px; }
  .debug-role-switcher { position: relative; gap: 3px; }
  #debug-role { max-width: 76px; }
  #debug-role .dropdown-trigger { padding-inline: 4px; }
  #debug-role-forget { font-size: 14px; }
  #debug-role-key-form:not([hidden]) {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
  }
  #debug-role-key { width: min(138px, 42vw); }
  .sidebar { position: relative; padding: 10px 0 10px 10px; overflow: hidden; }
  .sidebar::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    background: linear-gradient(to right, transparent, var(--background));
  }
  #section-nav {
    width: 100%;
    min-width: 0;
    padding-right: 28px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #section-nav::-webkit-scrollbar { display: none; }
  .content { padding-top: 24px; }
}

.lang-switch { display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; border: 0; background: none; color: var(--muted); font-size: 11px; letter-spacing: .04em; cursor: pointer; }
.lang-track { position: relative; width: 26px; height: 14px; border: 1px solid var(--border); border-radius: 7px; transition: border-color 200ms cubic-bezier(0.2, 0, 0, 1); }
.lang-thumb { position: absolute; top: 2px; left: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); transition: transform 200ms cubic-bezier(0.2, 0, 0, 1), background-color 200ms cubic-bezier(0.2, 0, 0, 1); }
.lang-switch[aria-checked="true"] .lang-thumb { transform: translateX(12px); }
.lang-ru, .lang-en { transition: color 200ms cubic-bezier(0.2, 0, 0, 1); }
.lang-switch[aria-checked="false"] .lang-ru, .lang-switch[aria-checked="true"] .lang-en { color: var(--ink); }
.lang-switch:hover .lang-track { border-color: var(--muted); }
.lang-switch:focus-visible { outline: 1px solid var(--muted); outline-offset: 3px; }

.theme-transition, .theme-transition *, .theme-transition *::before, .theme-transition *::after {
  transition-property: color, background-color, border-color, fill, stroke;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
  .topbar.loading::after { background: var(--muted); }
}

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.segmented button { padding: 7px 14px; border: 0; border-right: 1px solid var(--border); background: none; color: var(--muted); font: inherit; cursor: pointer; transition: color 120ms, background-color 120ms; }
.segmented button:last-child { border-right: 0; }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--border); color: var(--ink); }
.segmented button:focus-visible { outline: 1px solid var(--muted); outline-offset: -2px; }
.seed-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 18px; }
.seed-panel[hidden] { display: none; }
.seed-panel > .segmented { justify-self: start; }
.seed-task {
  width: 100%;
  min-height: 74px;
  padding: 9px 10px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: none;
  color: var(--ink);
  font: inherit;
}
.seed-task:focus { border-color: var(--muted); }
.seed-task::placeholder { color: var(--muted); opacity: .75; }
.seed-mode { min-width: 0; }
.seed-mode > .muted { margin: 0; font-size: 12px; }
.seed-mode .copy-field { margin-top: 10px; }
.seed-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.seed-candidates { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; margin-top: 12px; }
.seed-candidate {
  position: relative;
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px 10px 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--ink);
  text-align: left;
}
.seed-candidate::before { content: "○"; position: absolute; top: 10px; left: 12px; color: var(--muted); }
.seed-candidate[aria-checked="true"]::before { content: "●"; color: var(--positive); }
.seed-candidate strong { font-weight: 500; }
.seed-candidate span { font-size: 12px; line-height: 1.4; }
.seed-duplicate { margin: 0; font-size: 12px; }

.ideas-view-switch { flex: 0 0 auto; }
.ideas-view-switch button { padding: 4px 9px; font-size: 11px; }
.ideas-toolbar .radar-filter-bar { margin-bottom: 6px; }
.graph-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.graph-filter-bar[hidden] { display: none !important; }
.graph-filter-section { display: flex; flex: 1 1 190px; align-items: center; gap: 7px; min-width: 0; }
.graph-filter-edge-section { flex-basis: 270px; }
.graph-filter-label { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.graph-filter-group { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 2px; min-width: 0; }
.graph-filter-group button {
  display: grid;
  flex: 1 1 28px;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
.graph-filter-group button:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.graph-filter-group button[aria-pressed="true"] { border-color: var(--muted); background: var(--border); color: var(--ink); }
.graph-filter-delivered { display: flex; flex: 1 1 250px; align-items: center; justify-content: flex-end; gap: 7px; min-width: 0; color: var(--muted); font-size: 10px; }
.graph-filter-number { width: 54px; min-width: 0; padding: 4px 5px; border: 1px solid var(--border); border-radius: 3px; background: var(--surface); color: var(--ink); font: inherit; }
.graph-filter-range { flex: 0 1 120px; min-width: 70px; max-width: 120px; accent-color: var(--muted); }
.idea-graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  min-height: 24px;
  margin-bottom: 6px;
  visibility: hidden;
}
.idea-graph-toolbar.is-visible { visibility: visible; }
.idea-graph-toolbar-row { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 10px; min-width: 0; max-width: 100%; }
.idea-graph-toolbar-row .btn { flex: 0 1 auto; max-width: 100%; padding: 3px 7px; white-space: normal; }
.idea-graph-count { flex: 0 1 auto; min-width: 0; font-size: 10px; text-align: right; }
.ideas-results { min-width: 0; }
.idea-row > .main > .meta-line { max-width: 90ch; }
.ideas-result-enter { animation: fade-enter 150ms cubic-bezier(0.2, 0, 0, 1); }
.idea-graph-view {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 420px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: 6px;
  background: transparent;
}
.idea-graph-view[hidden] { display: none !important; }
.idea-graph-scroll {
  width: 100%;
  height: 420px;
  overflow: hidden;
  touch-action: none;
}
.idea-graph-svg { display: block; width: 100%; height: 100%; background: transparent; cursor: grab; user-select: none; }
.idea-graph-svg.is-panning { cursor: grabbing; }
.idea-graph-canvas { display: block; width: 100%; height: 100%; background: transparent; cursor: grab; user-select: none; }
.idea-graph-canvas.is-panning { cursor: grabbing; }
.idea-graph-canvas.is-over-node { cursor: pointer; }
.idea-graph-edge {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
  opacity: .65;
  pointer-events: none;
}
.idea-graph-edge.strong { stroke: var(--muted); opacity: .8; }
.idea-graph-node { transition: opacity 120ms; }
.idea-graph-node > :not(text):not(title) { fill: var(--muted); stroke: var(--ink); stroke-width: 1; }
.idea-graph-node.type-idea.effect-helpful > circle { fill: var(--positive); }
.idea-graph-node.type-idea.effect-neutral > circle { fill: var(--warning); }
.idea-graph-node.type-idea.effect-harmful > circle { fill: var(--negative); }
.idea-graph-node.type-idea.effect-none > circle,
.idea-graph-node.type-idea.effect- > circle { fill: var(--muted); }
.idea-graph-node text {
  display: none;
  fill: var(--ink);
  font-size: 10px;
  paint-order: stroke;
  pointer-events: none;
  stroke: var(--surface);
  stroke-linejoin: round;
  stroke-width: 3px;
}
.idea-graph-node.show-label > text, .idea-graph-node:hover > text { display: block; }
.idea-graph-node.clickable { cursor: pointer; }
.idea-graph-node.is-orphan { opacity: .32; }
.idea-graph-svg.has-focus .idea-graph-node:not(.is-active):not(.is-neighbor),
.idea-graph-svg.has-focus .idea-graph-edge:not(.is-active) { opacity: .12; }
.idea-graph-svg.has-focus .idea-graph-node.is-active > :not(text):not(title) { stroke-width: 2.5; }
.idea-graph-svg.has-focus .idea-graph-edge.is-active { stroke: var(--ink); stroke-width: 1.5; opacity: .9; }
.idea-graph-detail-host { position: absolute; z-index: 2; inset: 8px 8px 8px auto; width: min(320px, calc(100% - 16px)); }
.idea-graph-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-height: 100%;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  background: var(--surface);
}
.idea-graph-detail-head { display: flex; align-items: flex-start; gap: 12px; }
.idea-graph-detail-head strong { min-width: 0; flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.idea-graph-detail-close { padding: 0 3px; border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; }
.idea-graph-detail-close:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.idea-graph-focus-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.idea-graph-focus-controls .btn[aria-pressed="true"] { border-color: var(--muted); background: var(--border); color: var(--ink); }
.idea-graph-detail-content { display: grid; gap: 12px; min-width: 0; }
.idea-graph-detail-content .btn { justify-self: start; }
.idea-graph-effect { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.idea-graph-relations { display: grid; gap: 4px; }
.idea-graph-detail-link { display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 5px 0; border: 0; background: none; text-align: left; }
.idea-graph-detail-link.clickable-row { padding-right: 22px; }
.idea-graph-detail-link > :first-child { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idea-graph-detail-link > :last-child { flex: 0 0 auto; font-size: 10px; }

.row > div:first-child { min-width: 0; }
.workspace, .content, .panel, .panel-head, .radar-filter-head { min-width: 0; }
.content, .panel { max-width: 100%; }
.panel { overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .graph-filter-bar { align-items: stretch; }
  .graph-filter-section, .graph-filter-edge-section, .graph-filter-delivered { flex-basis: 100%; width: 100%; max-width: 100%; }
  .graph-filter-delivered { justify-content: flex-start; flex-wrap: wrap; }
  .graph-filter-delivered > span { flex: 1 1 auto; }
  .graph-filter-range { flex: 1 1 100px; max-width: none; }
  .idea-graph-view { width: 100%; max-width: 100%; min-height: 360px; }
  .idea-graph-scroll { height: 360px; }
  .idea-graph-detail-host { position: static; width: 100%; }
  .idea-graph-detail { max-height: none; border-width: 1px 0 0; border-radius: 0 0 6px 6px; }
}

.onboarding {
  width: min(100%, 620px);
  margin: clamp(56px, 10vh, 112px) auto 0;
}
.onboarding-step { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.onboarding-progress {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
}
.onboarding-step h2 {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.025em;
}
.onboarding-step > .muted { font-size: 13px; }
.onboarding-action { min-height: 58px; padding-top: 14px; }
.onboarding-invite { position: relative; }
.onboarding-invite .onboarding-pulse {
  position: absolute;
  top: -4px;
  right: 0;
}
.onboarding-pulse {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive);
  animation: onboarding-pulse 2200ms ease-in-out infinite;
}
.onboarding-action .copy-field { margin-top: 0; }
.onboarding-success { color: var(--positive); font-size: 14px; }
.onboarding-run-ready { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.onboarding-footer { padding-top: 30px; }
.onboarding-skip {
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 11px;
}
.onboarding-skip:hover { border-color: var(--muted); background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }

@keyframes onboarding-pulse {
  0%, 100% { opacity: .3; transform: scale(.82); }
  50% { opacity: .9; transform: scale(1); }
}

@media (max-width: 720px) {
  .onboarding { margin-top: 28px; }
  .onboarding-run-ready { align-items: flex-start; flex-direction: column; }
}

.onboarding-mode .workspace { grid-template-columns: minmax(0, 1fr); }
.onboarding-mode .sidebar { display: none; }

.choice-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.choice-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}
.choice-card:hover { border-color: var(--muted); }
.choice-card[aria-pressed="true"] { border-color: var(--ink); }
.choice-card:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.choice-card:disabled { cursor: wait; opacity: .65; }
.choice-card-title { font-size: 14px; font-weight: 600; }
.choice-card .muted { font-size: 12px; line-height: 1.45; }

@media (max-width: 600px) {
  .choice-cards { grid-template-columns: minmax(0, 1fr); }
  .overview-rows .row { flex-direction: column; align-items: stretch; gap: 4px; }
  .overview-rows .row > .main, .overview-rows .row > .meta, .overview-rows .row > .actions { width: 100%; }
  .overview-rows .row > .main { flex: none; }
  .overview-rows .row > .meta { justify-items: start; margin-left: 0; text-align: left; }
}

.task-stack > .task-group { min-width: 0; border-bottom: 1px solid var(--surface-border); }
.task-stack > .task-group:last-child { border-bottom: 0; }
.task-row { width: 100%; min-width: 0; }
.task-title, .task-variant-key {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-variants {
  min-width: 0;
  margin: 0 0 10px 18px;
  padding-left: 16px;
  border-left: 1px solid var(--surface-border);
}
.task-variant { min-width: 0; min-height: 48px; padding: 8px 0; }
.task-variant + .task-variant { border-top: 1px dashed var(--surface-border); }

@media (max-width: 720px) {
  .task-variants { margin-left: 8px; padding-left: 10px; }
}
