/* run 2026-05-14-console-dark-default-001: dark is now the default
 * palette. `:root` carries the dark values directly so any page that
 * forgets to set data-theme still renders correctly. light remains
 * supported as an explicit opt-in via body[data-theme="light"].
 *
 * Contrast tuning vs. previous dark override:
 *   --muted bumped from #8d949a (~3.7:1 on --bg) to #b3bbc1 (~6.8:1)
 *   --panel bumped from #21262a to #232a2e for slightly more lift
 *   --btn-bg new var so buttons/inputs no longer use literal #ffffff
 *   --green/--blue/--amber/--red brightened for dark-bg legibility
 */
:root {
  --bg: #181c1f;
  --ink: #ebe7da;
  --muted: #b3bbc1;
  --line: #3a4145;
  --panel: #232a2e;
  --btn-bg: #2b3338;
  --btn-bg-hover: #353e44;
  --rail: #0d1518;
  --rail-ink: #f4f1e8;
  --green: #2eb27a;
  --blue: #4d8fd6;
  --amber: #d29447;
  --red: #d96565;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  font-family: Inter, "Microsoft JhengHei", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

body[data-theme="light"] {
  --bg: #f5f2ea;
  --ink: #1f2528;
  --muted: #667075;
  --line: #d7d0c2;
  --panel: #fffdf7;
  --btn-bg: #ffffff;
  --btn-bg-hover: #f0ece2;
  --rail: #17252a;
  --rail-ink: #f4f1e8;
  --green: #147b55;
  --blue: #255a8f;
  --amber: #a86413;
  --red: #9b2c2c;
  --shadow: 0 16px 40px rgba(24, 31, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--btn-bg);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  background: var(--btn-bg-hover);
  border-color: var(--ink);
}

button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.primary {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

button.danger {
  color: #ffffff;
  background: var(--red);
  border-color: var(--red);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: var(--btn-bg);
  color: var(--ink);
}

input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}

/* Checkbox / radio — keep native sizing, just tint with accent. */
input[type="checkbox"],
input[type="radio"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  accent-color: var(--st-info, #00d4ff);
  margin: 0 4px 0 0;
  vertical-align: middle;
  flex-shrink: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

.rail {
  background: var(--rail);
  color: var(--rail-ink);
  padding: 18px 14px;
}

.brand {
  height: 44px;
  display: flex;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  width: 100%;
  margin-top: 8px;
  text-align: left;
  background: transparent;
  border-color: transparent;
  color: var(--rail-ink);
}

.nav.active,
.nav:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.14);
}

.rail-group-label {
  margin-top: 14px;
  margin-bottom: 2px;
  padding: 2px 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
  text-transform: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 8px;
}
.rail-group-label:first-of-type {
  margin-top: 6px;
  border-top: 0;
  padding-top: 4px;
}

.workspace {
  padding: 24px;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

h3 {
  font-size: 16px;
}

.actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grid {
  display: grid;
  gap: 16px;
}

.two {
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.task-grid {
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
}

.panel,
.model-card,
.task-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  min-width: 0;
}

.terminal {
  width: 100%;
  min-height: 340px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-radius: 7px;
  background: #111719;
  color: #e6efe9;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal.small {
  min-height: 130px;
  margin-top: 12px;
}

.terminal.log {
  min-height: 620px;
}

dl {
  margin: 0;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px 12px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.model-list {
  display: grid;
  gap: 20px;
}

.model-section {
  display: grid;
  gap: 10px;
}

.model-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.model-section-head span {
  color: var(--muted);
}

.model-list-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.model-card {
  min-height: 230px;
  padding: 15px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--muted);
  background: #f0ece2;
}

.pill.ok {
  color: #ffffff;
  background: var(--green);
}

.pill.warn {
  color: #ffffff;
  background: var(--amber);
}

.pill.bad {
  color: #ffffff;
  background: var(--red);
}

.notes {
  color: var(--muted);
  line-height: 1.4;
}

.task-zh {
  color: var(--ink);
  line-height: 1.45;
}

.task-zh strong {
  color: var(--green);
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-item {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.task-item.active {
  outline: 2px solid var(--blue);
}

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.service {
  min-height: 150px;
  display: grid;
  align-content: space-between;
}

.service a,
.service span {
  color: var(--muted);
}

.service-registry-panel {
  margin-bottom: 16px;
}

.registry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.registry-head span {
  color: var(--muted);
}

.service-registry {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.registry-group {
  display: grid;
  gap: 8px;
}

.registry-group h3 {
  text-transform: uppercase;
  color: var(--muted);
  font-size: 13px;
}

.registry-table {
  display: grid;
  gap: 6px;
}

.registry-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.1fr) 120px 150px minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.registry-row code {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.row-actions.compact {
  justify-content: flex-end;
}

.chat-panel {
  margin-top: 16px;
}

.chat-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1.2fr) 90px;
  gap: 10px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }

  .brand {
    min-width: 110px;
  }

  .nav {
    width: auto;
    min-width: 92px;
    text-align: center;
  }

  .two,
  .three,
  .task-grid,
  .chat-grid,
  .registry-row {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

a.nav {
  display: block;
  text-decoration: none;
  line-height: 30px;
}

.multi-ai-workspace {
  display: grid;
  gap: 18px;
}

.multi-ai-subtitle {
  margin-top: 6px;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.5;
}

.multi-ai-banner {
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fffdf7;
  color: var(--ink);
}

.multi-ai-banner.is-ok {
  border-color: var(--green);
  background: #ecf6f0;
  color: #0f5a3d;
}

.multi-ai-banner.is-warn {
  border-color: var(--amber);
  background: #faf2e3;
  color: #6b3d05;
}

.multi-ai-banner.is-bad {
  border-color: var(--red);
  background: #f8e6e6;
  color: #6a1f1f;
}

.multi-ai-models h2 {
  margin-bottom: 12px;
}

.multi-ai-model-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.multi-ai-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  padding: 14px;
  display: grid;
  gap: 10px;
  min-height: 200px;
}

.multi-ai-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.multi-ai-card header h3 {
  margin: 0;
  font-size: 17px;
}

.multi-ai-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: 96px 1fr;
  row-gap: 6px;
  column-gap: 10px;
  font-size: 13px;
}

.multi-ai-card dt {
  color: var(--muted);
}

.multi-ai-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.multi-ai-card-note {
  color: var(--muted);
  margin: 0;
  min-height: 18px;
  font-size: 12px;
  line-height: 1.4;
}

.multi-ai-question textarea {
  width: 100%;
  min-height: 140px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  font: inherit;
  background: var(--btn-bg);
  color: var(--ink);
  resize: vertical;
}

.multi-ai-hint {
  color: var(--muted);
  line-height: 1.5;
  margin: 6px 0 4px;
}

.multi-ai-question-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.multi-ai-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.multi-ai-always-on {
  background: linear-gradient(180deg, rgba(20, 123, 85, 0.06), transparent);
  border-left: 3px solid var(--green);
}

.multi-ai-always-on-badge {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.multi-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 5px;
  border: 1px solid var(--line);
  font-size: 12px;
  background: var(--panel);
}

.multi-ai-badge.is-ok {
  border-color: var(--green);
  color: var(--green);
}

.multi-ai-badge.is-bad {
  border-color: var(--red);
  color: var(--red);
}

.multi-ai-proposal {
  margin: 6px 0 10px;
  padding: 10px 12px;
  border: 2px solid rgba(37, 90, 143, 0.35);
  border-radius: 7px;
  background: rgba(37, 90, 143, 0.04);
}

.multi-ai-proposal summary {
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}

.multi-ai-proposal textarea {
  width: 100%;
  min-height: 110px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--panel);
  color: var(--ink);
  resize: vertical;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel);
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

.multi-ai-context {
  margin: 4px 0 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.multi-ai-context summary {
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.multi-ai-context-list {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.multi-ai-context-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  font-size: 13px;
}

.multi-ai-context-item.is-missing {
  opacity: 0.55;
}

.multi-ai-context-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.multi-ai-context-missing {
  color: #b34d00 !important;
}

.multi-ai-context-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.multi-ai-preview {
  display: grid;
  gap: 8px;
}

.multi-ai-integrated {
  display: grid;
  gap: 10px;
}

.multi-ai-integrated-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.multi-ai-integrated-head h2 {
  margin: 0 0 4px;
}

.multi-ai-integrated-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.multi-ai-integrated-body {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  background: #fafafa;
  color: var(--ink);
  resize: vertical;
}

.multi-ai-integrated-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.multi-ai-progress {
  display: grid;
  gap: 12px;
}

.multi-ai-agent-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.multi-ai-agent-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.multi-ai-agent-tile header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.multi-ai-agent-tile strong {
  font-size: 13px;
}

.multi-ai-agent-tile small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-all;
}

.multi-ai-agent-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
}

.multi-ai-agent-timer.is-warn { color: var(--amber); }
.multi-ai-agent-timer.is-late { color: var(--red); font-weight: 600; }

.multi-ai-agent-stream {
  margin-top: 4px;
  padding: 6px 8px;
  border-top: 1px dashed var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink);
  max-height: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  background: rgba(0,0,0,0.02);
}

.multi-ai-elapsed {
  margin-left: 10px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--muted);
}

.multi-ai-answer-cards {
  display: grid;
  gap: 10px;
}

.multi-ai-answer-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 10px 12px;
}

.multi-ai-answer-card header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.multi-ai-answer-meta {
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
}

.multi-ai-answer-body {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  background: rgba(0,0,0,0.02);
  padding: 8px 10px;
  border-radius: 5px;
  margin: 0;
  max-height: 360px;
  overflow: auto;
}

.multi-ai-copy-one {
  font-size: 11.5px;
  min-height: 28px;
  padding: 0 9px;
}

.multi-ai-diff {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.multi-ai-diff h3 {
  grid-column: 1 / -1;
  margin: 4px 0;
  font-size: 14px;
}

.multi-ai-diff-col {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.02);
}

.multi-ai-diff-col h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}

.multi-ai-diff-col ul {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.5;
}

.multi-ai-fixit-btn {
  font-size: 11.5px;
  min-height: 28px;
  margin-top: 6px;
  background: rgba(168, 100, 19, 0.12);
  border-color: var(--amber);
  color: var(--amber);
}

.multi-ai-fix-msg {
  color: var(--amber);
  font-size: 12px;
}

.multi-ai-integrated-head select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

@media (max-width: 720px) {
  .multi-ai-agent-strip {
    grid-template-columns: 1fr;
  }
}

.multi-ai-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.multi-ai-job-id {
  font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
  margin-right: 8px;
}

.multi-ai-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #ece6d7;
  overflow: hidden;
}

.multi-ai-progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
  transition: width 250ms ease;
}

.multi-ai-progress-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.multi-ai-progress-steps li {
  display: grid;
  grid-template-columns: 80px 1fr 2fr;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 4px 0;
  font-size: 13px;
}

.multi-ai-progress-steps small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.multi-ai-history-list {
  display: grid;
  gap: 10px;
}

.multi-ai-history-empty {
  color: var(--muted);
}

.multi-ai-history-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
  background: #fffdf7;
}

.multi-ai-history-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.multi-ai-history-item footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.multi-ai-report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.multi-ai-report-body {
  min-height: 320px;
  max-height: 60vh;
  overflow: auto;
  margin-top: 10px;
}

/* Embedded mode: when this page is loaded inside an iframe (e.g. the console
   embeds /local-loop, /multi-ai, /knowledge-map in its content frame), hide
   the inner rail so only the outer console rail is shown — 統一外層導航。 */
html.is-embedded .shell {
  grid-template-columns: 1fr;
}
html.is-embedded .rail {
  display: none;
}

/* In-page view tabs (e.g. index.html overview/models/services/automation/tasks).
   Horizontal tab bar above the active view, distinct from the outer rail. */
.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
  padding: 6px;
  background: var(--panel, #f5f7fb);
  border: 1px solid var(--border, #d3d8e0);
  border-radius: 10px;
}

.view-tabs .view-tab {
  width: auto;
  margin: 0;
  padding: 8px 16px;
  border-radius: 8px;
  text-align: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink, #2a2f3a);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.view-tabs .view-tab:hover {
  background: rgba(0, 0, 0, 0.04);
}

.view-tabs .view-tab.active {
  background: var(--accent, #2c5e8a);
  border-color: var(--accent, #2c5e8a);
  color: #fff;
}

/* ---------------------------------------------------------------
   Round-2 design tokens — additive scale used across new pages
   and new components. Existing rules above keep their own values.
   --------------------------------------------------------------- */
:root {
  /* Spacing scale (px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Border-radius scale */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-pill: 999px;

  /* Font sizes */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 15px;
  --fs-xl: 18px;
  --fs-2xl: 22px;

  /* Shadow tokens (additional) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.22);

  /* Status palette (semantic) */
  --st-ok: #22c55e;
  --st-warn: #f59e0b;
  --st-error: #ef4444;
  --st-info: #00d4ff;
  --st-pending: #00d4ff;
  --st-off: #64748b;
  --st-unknown: #94a3b8;

  /* Z-layer */
  --z-toast: 9000;
  --z-cmd-palette: 9500;
  --z-modal: 9700;
  --z-tooltip: 8500;

  /* Animation */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur-base: 220ms;
  --dur-slow: 360ms;
}

/* Empty-state component — used across new pages. */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted, #94a3b8);
}
.empty-state .empty-icon { font-size: 32px; opacity: 0.6; margin-bottom: 8px; }
.empty-state .empty-title { font-size: 14px; color: var(--ink, #cbd5e1); margin: 6px 0 2px; }
.empty-state .empty-hint { font-size: 12px; color: var(--muted, #94a3b8); }
.empty-state .empty-cta { margin-top: 14px; }

/* Breadcrumb — used in topbar across pages. */
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted, #94a3b8);
  flex-wrap: wrap;
}
.breadcrumb a, .breadcrumb button {
  color: var(--muted, #94a3b8);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  min-height: auto;
  font-size: 12px;
}
.breadcrumb a:hover, .breadcrumb button:hover { color: var(--ink, #e2e8f0); background: rgba(148,163,184,0.08); }
.breadcrumb .sep { color: rgba(148,163,184,0.4); user-select: none; padding: 0 2px; }
.breadcrumb .current { color: var(--ink, #e2e8f0); font-weight: 500; padding: 2px 4px; }


/* 2026-05-14 consolidation — tab-container pages (/tasks, /testing,
 * /services, /config, /insights, /toolbox). Each renders a tab bar over a
 * filling iframe that displays one of the legacy embedded pages.
 */
.tc-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.tc-hero h1 {
  font-size: var(--fs-2xl, 22px);
  font-weight: 700;
}
.tc-hero p.sub {
  color: var(--muted);
  font-size: var(--fs-md, 13px);
  margin-top: 4px;
}
.tc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 8px);
}
.tc-tabs button {
  width: auto;
  margin: 0;
  padding: 8px 16px;
  border-radius: var(--radius-md, 6px);
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  min-height: 36px;
}
.tc-tabs button:hover { background: rgba(148,163,184,0.10); }
.tc-tabs button.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.tc-tabs button.active:hover { background: var(--blue); }
.tc-frame-wrap {
  position: relative;
  height: calc(100vh - 170px);
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 8px);
  background: var(--panel);
  overflow: hidden;
}
.tc-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ============================================================================
 * 2026-05-14 UI polish — global topbar + status-badge + embedded-mode cleanup
 * ============================================================================ */

/* Sticky thin status bar (rendered by /topbar.js). */
.lc-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--rail);
  color: var(--rail-ink);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: var(--fs-sm, 12px);
  height: 36px;
  overflow: hidden;
  white-space: nowrap;
}

body.has-lc-topbar .shell {
  /* Use min-height instead of fixed so existing pages don't break. */
  min-height: calc(100vh - 36px);
}

.lc-topbar .lc-tb-brand {
  font-size: 16px;
  opacity: 0.9;
}
.lc-topbar .lc-tb-build {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  opacity: 0.75;
  padding: 2px 6px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-sm, 4px);
}
.lc-topbar .lc-tb-divider {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.12);
}
.lc-topbar .lc-tb-score {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-md, 6px);
}
.lc-topbar .lc-tb-score[data-overall="green"] { color: var(--st-ok, #22c55e); }
.lc-topbar .lc-tb-score[data-overall="yellow"] { color: var(--st-warn, #f59e0b); }
.lc-topbar .lc-tb-score[data-overall="red"]   { color: var(--st-error, #ef4444); }
.lc-topbar .lc-tb-headline {
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  opacity: 0.92;
  max-width: 45vw;
}
.lc-topbar .lc-tb-spacer { flex: 1 1 auto; }
.lc-topbar .lc-tb-btn {
  background: transparent;
  color: var(--rail-ink);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md, 6px);
  padding: 3px 10px;
  font-size: 12px;
  min-height: auto;
  height: 26px;
  line-height: 1;
}
.lc-topbar .lc-tb-btn:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
}

/* Reusable status badge (pill) — also rendered into the topbar for pipeline_class. */
.lc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs, 11px);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill, 999px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.10);
  color: var(--rail-ink, #fff);
}
.lc-status-badge[data-state="idle"]      { background: rgba(100,116,139,0.30); color: #cbd5e1; }
.lc-status-badge[data-state="active"]    { background: rgba(34,197,94,0.25);   color: #4ade80; }
.lc-status-badge[data-state="blocked"]   { background: rgba(239,68,68,0.25);   color: #fca5a5; }
.lc-status-badge[data-state="stale"]     { background: rgba(245,158,11,0.25);  color: #fcd34d; }
.lc-status-badge[data-state="terminal"]  { background: rgba(34,197,94,0.20);   color: #6ee7b7; }
.lc-status-badge[data-state="pass"]      { background: rgba(34,197,94,0.25);   color: #4ade80; }
.lc-status-badge[data-state="fail"],
.lc-status-badge[data-state="failed"]    { background: rgba(239,68,68,0.25);   color: #fca5a5; }
.lc-status-badge[data-state="unknown"]   { background: rgba(148,163,184,0.18); color: #94a3b8; }

/* ============================================================================
 * Embedded-mode cleanup (2026-05-14 wave 2)
 *
 * When a legacy page is loaded inside a tab-container iframe, all of its
 * own chrome (sidebar / health card / brand / hero / footer) is redundant
 * with the outer container's chrome and needs to vanish so only the actual
 * page content shows.
 *
 * Three groups of layouts to flatten:
 *   - standard `.shell + .rail`  (most pages)
 *   - console.html's `.console-shell + .console-rail`
 *   - owner-home's `.ph-shell .rail`
 *
 * Plus topbar/lc-topbar gets hidden since the outer page already has one.
 * ============================================================================ */
html.is-embedded body.has-lc-topbar #lcTopbar,
html.is-embedded .lc-topbar { display: none !important; }
html.is-embedded body.has-lc-topbar .shell { min-height: 100vh; }

/* 1) Hide every kind of inner sidebar/rail. */
html.is-embedded .rail,
html.is-embedded .console-rail,
html.is-embedded aside[class*="rail"],
html.is-embedded aside[class*="sidebar"] {
  display: none !important;
}

/* 2) Collapse all known shell grids to a single content column. */
html.is-embedded .shell,
html.is-embedded .console-shell,
html.is-embedded .ph-shell {
  grid-template-columns: 1fr !important;
  display: block !important;
}

/* 3) Hide redundant page-level decorations.
 *   - .console-brand / .console-quick-actions / .console-health-card / .console-section:
 *     these live INSIDE .console-rail (already hidden above) so this is belt-and-braces.
 *   - .ll-hero: duplicate hero on /local-loop when embedded in /testing
 *   - .ph-hero: owner-home's hero block
 *   - .obs-hero: observatory's hero block
 *   - <footer.ll-foot> + brand footers: noise when embedded
 */
html.is-embedded .console-brand,
html.is-embedded .console-quick-actions,
html.is-embedded .console-health-card,
html.is-embedded .console-section,
html.is-embedded .ll-hero,
html.is-embedded .ph-hero,
html.is-embedded .obs-hero,
html.is-embedded .ll-foot,
html.is-embedded .console-footer {
  display: none !important;
}

/* 4) Tighten content padding when embedded so it fills the iframe. */
html.is-embedded .workspace,
html.is-embedded .ll-workspace,
html.is-embedded .console-main,
html.is-embedded .ph-main {
  padding-top: 12px;
}

/* ============================================================================
 * 2026-05-14 UI polish wave 2 — shimmer + modal
 * ============================================================================ */

/* Skeleton shimmer for topbar fields while loading. Apply via .lc-shimmer. */
@keyframes lc-shimmer-pulse {
  0% { background-position: -200px 0; opacity: 0.5; }
  100% { background-position: 200px 0; opacity: 1; }
}
.lc-shimmer {
  position: relative;
  color: transparent !important;
  background: linear-gradient(90deg, rgba(148,163,184,0.08) 0%, rgba(148,163,184,0.20) 50%, rgba(148,163,184,0.08) 100%);
  background-size: 400px 100%;
  animation: lc-shimmer-pulse 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm, 4px);
}
.lc-shimmer * { visibility: hidden; }

/* Modal — neutral overlay used by suppressions modal + future ones. */
.lc-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 9700);
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.lc-modal.is-open { display: flex; }
.lc-modal-card {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl, 12px);
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.lc-modal-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.lc-modal-head .lc-modal-sub {
  flex: 1;
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  opacity: 0.6;
}
.lc-modal-head .lc-modal-x {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 4px);
  color: var(--muted);
  width: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 14px;
}
.lc-modal-head .lc-modal-x:hover {
  background: var(--btn-bg-hover);
  color: var(--ink);
}
.lc-modal-body { padding: 14px 18px 18px; }
.lc-modal-help { color: var(--muted); font-size: 12px; margin-bottom: 12px; line-height: 1.5; }
.lc-modal-help code { background: rgba(148,163,184,0.10); padding: 1px 5px; border-radius: 3px; font-size: 11px; }
.lc-modal-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-md, 6px); margin-bottom: 12px; }
.lc-modal-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }
.lc-sup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.lc-sup-row:last-child { border-bottom: 0; }
.lc-sup-row code {
  flex: 1;
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--ink);
  word-break: break-all;
}
.lc-sup-del {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--red, #d96565);
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: var(--radius-sm, 4px);
}
.lc-sup-del:hover { background: rgba(239,68,68,0.10); border-color: var(--red); }
.lc-modal-add { display: flex; gap: 8px; }
.lc-modal-add input {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
}
.lc-modal-add input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.lc-modal-add button {
  background: var(--blue);
  color: white;
  border: 0;
  padding: 0 16px;
  border-radius: var(--radius-md, 6px);
}
.lc-modal-add button:hover { filter: brightness(1.1); }

/* ============================================================================
 * 2026-05-14 services native page — service cards / sections / status dots
 * ============================================================================ */

.svc-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 8px);
  padding: 16px;
  margin-bottom: 16px;
}
.svc-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.svc-section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.svc-section-head .svc-meta {
  flex: 1;
  font-size: 11px;
  color: var(--muted);
}
.svc-refresh-btn {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: var(--radius-sm, 4px);
  font-size: 12px;
}
.svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.svc-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  grid-column: 1 / -1;
}
.svc-card {
  background: var(--btn-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.svc-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.svc-card .svc-name {
  flex: 1;
  font-weight: 500;
  color: var(--ink);
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.svc-card .svc-state {
  font-size: 11px;
  color: var(--muted);
  padding: 1px 6px;
  background: rgba(148,163,184,0.10);
  border-radius: var(--radius-pill, 999px);
}
.svc-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
.svc-card-meta code {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 10px;
}
.svc-card-actions {
  display: flex;
  gap: 6px;
}
.svc-card-actions button {
  flex: 1;
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: var(--radius-sm, 4px);
}
.svc-btn-restart:hover { background: rgba(245,158,11,0.18); border-color: var(--amber); color: var(--amber); }

/* Status dot (small inline indicator). */
.svc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.svc-dot-ok   { background: var(--st-ok, #22c55e); box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.svc-dot-bad  { background: var(--st-error, #ef4444); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.svc-dot-warn { background: var(--st-warn, #f59e0b); }
.svc-dot-off  { background: var(--st-off, #64748b); }

/* Resident models split. */
.svc-models-wrap {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .svc-models-wrap { grid-template-columns: 1fr; }
}
.svc-models-block h3 {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}
.svc-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  overflow: hidden;
}
.svc-model-row {
  display: grid;
  grid-template-columns: 12px 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.svc-model-row:last-child { border-bottom: 0; }
.svc-model-name {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--ink);
}
.svc-model-size, .svc-model-modified {
  font-size: 11px;
  color: var(--muted);
}
.svc-model-unload {
  min-height: 24px;
  padding: 0 8px;
  font-size: 10px;
  border-radius: var(--radius-sm, 4px);
}
.svc-model-unload:hover {
  background: rgba(239,68,68,0.12);
  color: var(--red);
  border-color: var(--red);
}

/* External link cards. */
.svc-link-card {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--btn-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  transition: background 120ms, border-color 120ms;
}
.svc-link-card:hover {
  background: var(--btn-bg-hover);
  border-color: var(--blue);
}
.svc-link-card .svc-icon { font-size: 16px; }
.svc-link-card .svc-label { font-weight: 500; }
.svc-link-card .svc-port {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
}
/* ============================================================================
 * 2026-05-14 UI polish wave 3 — design polish across the whole console
 * ============================================================================ */

/* ---------- 1. Custom scrollbar ------------------------------------------ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }
body[data-theme="light"] *::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); }
body[data-theme="light"] *::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.32); }

/* ---------- 2. Consistent focus ring ------------------------------------- */
:focus-visible {
  outline: 2px solid var(--st-info, #00d4ff);
  outline-offset: 2px;
  border-radius: 3px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--st-info, #00d4ff);
  outline-offset: 2px;
}

/* ---------- 3. Smooth transitions globally ------------------------------- */
button,
a.nav, button.console-nav,
.lc-tb-btn, .lc-tb-score, .lc-status-badge,
.svc-card, .svc-link-card,
.tc-tabs button, .view-tabs .view-tab {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 120ms ease;
}
.svc-link-card:hover { transform: translateY(-1px); }

/* ---------- 4. Sidebar polish (left active bar + spacing) ---------------- */
.rail {
  padding: 14px 10px;
  position: relative;
}
.brand {
  padding: 0 10px;
  margin-bottom: 6px;
  font-size: 14px;
}
.nav {
  position: relative;
  padding: 9px 12px 9px 18px;
  margin-top: 2px;
  font-size: 13px;
  border-radius: var(--radius-md, 6px);
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.nav::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%) scaleY(0.3);
  width: 3px;
  height: 60%;
  background: var(--st-info, #00d4ff);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 180ms ease, transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.nav.active {
  background: rgba(0,212,255,0.10);
  border-color: transparent;
  color: var(--rail-ink);
  font-weight: 500;
}
.nav.active::before {
  opacity: 1;
  transform: translateY(-50%) scaleY(1);
}
.nav:hover:not(.active) {
  background: rgba(255,255,255,0.06);
}

/* ---------- 5. Topbar: relative-time + smooth state transitions ---------- */
.lc-topbar .lc-tb-time {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  opacity: 0.55;
  padding: 0 4px;
}
.lc-status-badge { transition: background 240ms ease, color 240ms ease; }
.lc-topbar .lc-tb-score { transition: color 240ms ease; }
.lc-tb-btn.is-refreshing { animation: lc-spin 800ms linear infinite; }
@keyframes lc-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---------- 6. Button loading state + spinner ---------------------------- */
.lc-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: lc-spin 700ms linear infinite;
  vertical-align: middle;
  margin-right: 6px;
  opacity: 0.7;
}
.lc-btn-loading,
button.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.65;
}
.lc-btn-loading::before,
button.is-loading::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: lc-spin 700ms linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* ---------- 7. Responsive sidebar (auto-collapse < 1100px) --------------- */
@media (max-width: 1100px) {
  .shell:not(.rail-forced-open) {
    grid-template-columns: 56px 1fr;
  }
  .shell:not(.rail-forced-open) .rail {
    padding: 14px 6px;
    overflow: hidden;
  }
  .shell:not(.rail-forced-open) .brand {
    font-size: 10px;
    text-align: center;
    padding: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .shell:not(.rail-forced-open) .nav {
    padding: 9px 4px;
    font-size: 11px;
    text-align: center;
    line-height: 1.15;
  }
}
.lc-tb-rail-toggle {
  display: none;
  background: transparent;
  color: var(--rail-ink);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md, 6px);
  padding: 3px 9px;
  font-size: 14px;
  height: 26px;
  line-height: 1;
  min-height: auto;
  margin-right: 4px;
}
@media (max-width: 1100px) {
  .lc-tb-rail-toggle { display: inline-flex; align-items: center; }
}

/* ---------- 8. Page entrance fade-in ------------------------------------- */
body { animation: lc-fade-in 220ms ease-out; }
@keyframes lc-fade-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
html.is-embedded body { animation: none; }

/* ---------- Universal card pattern (.lc-card) --------------------------- */
.lc-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 8px);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.05));
  transition: box-shadow 180ms ease, border-color 180ms ease;
}
.lc-card:hover { box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.12)); border-color: var(--muted); }
.lc-card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.lc-card-head h3 { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0; }
.lc-card-head .lc-card-sub { font-size: 11px; color: var(--muted); flex: 1; }

/* ---------- .lc-dot status indicator ------------------------------------ */
.lc-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background-color 240ms ease, box-shadow 240ms ease;
}
.lc-dot[data-state="ok"]   { background: var(--st-ok, #22c55e); box-shadow: 0 0 6px rgba(34,197,94,0.55); }
.lc-dot[data-state="warn"] { background: var(--st-warn, #f59e0b); box-shadow: 0 0 6px rgba(245,158,11,0.40); }
.lc-dot[data-state="bad"]  { background: var(--st-error, #ef4444); box-shadow: 0 0 6px rgba(239,68,68,0.50); }
.lc-dot[data-state="off"]  { background: var(--st-off, #64748b); }

/* ---------- Container header polish + active pulse ---------------------- */
.tc-hero { padding-bottom: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tc-hero h1 { letter-spacing: -0.01em; }
.tc-hero p.sub { line-height: 1.5; }

.lc-status-badge[data-state="active"] { animation: lc-pulse-active 2.6s ease-in-out infinite; }
@keyframes lc-pulse-active {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.0); }
  50%      { box-shadow: 0 0 0 4px rgba(34,197,94,0.18); }
}
/* ============================================================================
 * 2026-05-14 native /testing page — live monitor + library + detail + lightbox
 * ============================================================================ */

.test-pane { margin-top: 12px; }
.test-pane[hidden] { display: none; }

/* TAB 1: control iframe (re-uses .tc-frame-wrap from app.css) */
#testPane-control .tc-frame-wrap {
  height: calc(100vh - 200px);
  min-height: 540px;
}

/* ---------------- TAB 2: live monitor ------------------------------------ */
.test-live-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  margin-bottom: 12px;
  font-size: 12px;
}
.test-live-run { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: 11px; color: var(--muted); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-live-iter, .test-live-findings { font-weight: 600; color: var(--ink); }
.test-live-elapsed { color: var(--muted); font-size: 11px; }
.test-live-tip { color: var(--muted); font-size: 10px; }

.test-live-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: stretch;
}
@media (max-width: 1100px) {
  .test-live-body { grid-template-columns: 1fr; }
}
.test-live-screen {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 8px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}
.test-live-screen-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,0.02);
}
.test-live-screen-img {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1117;
  position: relative;
  overflow: auto;
  padding: 12px;
}
.test-live-screen-img img {
  max-width: 100%;
  max-height: 600px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  cursor: zoom-in;
  display: block;
}
.test-live-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 40px;
}

.test-live-events {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 8px);
  padding: 12px;
}
.test-live-events h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}
.test-live-events-list {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--ink);
  max-height: 540px;
  overflow-y: auto;
}

/* ---------------- TAB 3: library list ------------------------------------ */
.test-lib-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.test-lib-toolbar input {
  flex: 0 1 360px;
  min-height: 32px;
  font-size: 12px;
  padding: 0 10px;
}
#testLibMeta { color: var(--muted); font-size: 11px; }

.test-lib-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg, 8px); overflow: hidden; }

.test-lib-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.test-lib-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--line);
}
.test-lib-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.test-lib-table tbody tr:last-child td { border-bottom: 0; }
.test-lib-table tbody tr:hover { background: rgba(255,255,255,0.025); }

.lib-row-id {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--ink);
}
.lib-row-time { font-size: 11px; color: var(--ink); }
.lib-row-rel { font-size: 10px; color: var(--muted); }
.lib-no { color: var(--muted); }

/* ---------------- TAB 3: detail view ------------------------------------- */
.test-lib-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 8px);
  padding: 16px;
}
.test-lib-detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.test-lib-detail-head h2 {
  margin: 0;
  font-size: 16px;
  flex: 1;
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
}
.test-lib-summary {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 6px 12px;
  font-size: 12px;
  margin-bottom: 18px;
}
.test-lib-summary dt { color: var(--muted); font-size: 11px; }
.test-lib-summary dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.test-lib-summary code { font-size: 11px; }

.test-lib-detail h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 16px 0 10px;
}

/* Snapshot gallery */
.test-lib-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.test-gallery-cell {
  display: block;
  background: #0d1117;
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  overflow: hidden;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease;
}
.test-gallery-cell:hover { transform: translateY(-2px); border-color: var(--blue); }
.test-gallery-cell img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.test-gallery-cap {
  display: block;
  padding: 6px 8px;
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Timeline */
.test-lib-timeline {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  max-height: 480px;
  overflow-y: auto;
  padding: 8px 0;
}
.test-tl-row {
  display: grid;
  grid-template-columns: 60px 80px 36px 1fr;
  gap: 10px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  align-items: baseline;
}
.test-tl-row:last-child { border-bottom: 0; }
.test-tl-ts { color: var(--muted); }
.test-tl-iter { font-size: 10px; color: var(--muted); }
.test-tl-content { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-tl-kind {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(148,163,184,0.15);
  color: var(--muted);
}
.test-tl-kind[data-kind="screenshot"] { background: rgba(77,143,214,0.20); color: var(--blue); }
.test-tl-kind[data-kind="finding"]    { background: rgba(245,158,11,0.20); color: var(--amber); }
.test-tl-kind[data-kind="reflect"]    { background: rgba(34,197,94,0.18);  color: var(--green); }
.test-tl-kind[data-kind="probe"]      { background: rgba(167,139,250,0.18); color: #a78bfa; }
.test-tl-kind[data-kind="plan"]       { background: rgba(125,211,252,0.18); color: #7dd3fc; }
.test-tl-kind[data-kind="act"]        { background: rgba(244,114,182,0.18); color: #f472b6; }
.test-tl-kind[data-kind="monitor"]    { background: rgba(148,163,184,0.18); color: #94a3b8; }

/* ---------------- Lightbox ------------------------------------------------ */
.test-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9800;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
.test-lightbox[hidden] { display: none; }
.test-lightbox img {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.test-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  color: #fff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-height: auto;
  padding: 0;
  font-size: 16px;
}
.test-lightbox-close:hover { background: rgba(255,255,255,0.20); }
.test-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  color: #fff;
  width: 44px;
  height: 64px;
  min-height: auto;
  padding: 0;
  font-size: 28px;
  border-radius: 8px;
}
.test-lightbox-prev { left: 16px; }
.test-lightbox-next { right: 16px; }
.test-lightbox-nav:hover { background: rgba(255,255,255,0.20); }
.test-lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ============================================================================
 * 2026-05-14 testing-page layout fix
 *
 *   • Control tab uses direct :5173 iframe (skip /local-loop wrapper) and
 *     stretches full-bleed to the workspace edges so the React app's status
 *     row isn't truncated and there's no big dark empty area below.
 *   • Live tab tightens spacing; empty state is friendlier.
 *   • Library detail view "view" gets a slightly more spacious feel.
 * ============================================================================ */

/* Override default tab pane spacing for the control tab so the iframe can
 * extend right to the workspace padding without extra top gap. */
.test-pane-control { margin-top: 4px; }

.test-control-frame-wrap {
  position: relative;
  /* Keep the embedded tester prominent; the shell chrome is intentionally tight. */
  height: calc(100vh - 164px);
  min-height: 680px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  overflow: hidden;
}
.test-control-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg);
}

/* Live tab — slight polish. */
.test-live-summary { padding: 8px 14px; }
.test-live-summary .test-live-run { max-width: 360px; }

/* Library — make detail view summary more compact + readable. */
.test-lib-summary { grid-template-columns: 90px 1fr; }
.test-lib-detail h3 { margin-top: 14px; }
.test-lib-gallery { gap: 10px; }
.test-gallery-cell img { height: 130px; }

/* If user is on a wide screen, give the gallery a bit more space per cell */
@media (min-width: 1400px) {
  .test-lib-gallery { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .test-gallery-cell img { height: 160px; }
}

/* Make the live tab events panel taller to match the screen pane */
.test-live-events-list { max-height: calc(100vh - 320px); }

/* Testing is an operator surface: reduce shell chrome and let the tester breathe. */
[data-page-title="測試"] { padding: 18px 18px 12px; }
[data-page-title="測試"] .tc-hero { padding-bottom: 0; margin-bottom: 8px; }
[data-page-title="測試"] .tc-tabs { margin-bottom: 8px; }
/* ============================================================================
 * 2026-05-14 native /insights page — history + tokens views
 * ============================================================================ */

.ins-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 8px);
  font-size: 12px;
}
.ins-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.ins-toolbar select {
  min-height: 30px;
  padding: 0 10px;
  background: var(--btn-bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  font-size: 12px;
}
.ins-toolbar button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.ins-summary {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
}
@media (max-width: 800px) {
  .ins-summary { grid-template-columns: repeat(2, 1fr); }
}
.ins-summary .lc-card {
  padding: 12px 14px;
  text-align: left;
}
.ins-stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.ins-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
}
.ins-stat-val .ins-stat-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 3px;
  font-family: inherit;
}

.ins-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 1100px) {
  .ins-2col { grid-template-columns: 1fr; }
}

.ins-bardrow {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}
.ins-bar-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
}
.ins-bar-label {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
}
.ins-bar-track {
  height: 14px;
  background: rgba(148,163,184,0.10);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.ins-bar-fill {
  display: block;
  height: 100%;
  background: var(--blue);
  transition: width 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
.ins-bar-fill.ok   { background: var(--st-ok, #22c55e); }
.ins-bar-fill.warn { background: var(--st-warn, #f59e0b); }
.ins-bar-fill.bad  { background: var(--st-error, #ef4444); }
.ins-bar-val {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
}
.ins-bar-val small { color: var(--muted); }
.ins-stat-ok   { color: var(--st-ok, #22c55e); }
.ins-stat-warn { color: var(--st-warn, #f59e0b); }
.ins-stat-bad  { color: var(--st-error, #ef4444); }

.ins-table { font-size: 12px; }
.ins-table .test-lib-table { border-radius: 0; }

.ins-help {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(148,163,184,0.05);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md, 6px);
  font-size: 12px;
  color: var(--muted);
}
.ins-help strong { color: var(--ink); display: block; margin-bottom: 6px; }
.ins-help p { margin: 4px 0; }
.ins-help ul { margin: 6px 0 0; padding-left: 20px; }
.ins-help li { margin: 3px 0; }
.ins-help code { background: rgba(148,163,184,0.10); padding: 1px 6px; border-radius: 3px; font-size: 11px; }
.ins-help a { color: var(--blue); }

/* iframe panes inside /insights */
#insightsPane-recent .tc-frame-wrap,
#insightsPane-audit  .tc-frame-wrap,
#insightsPane-logs   .tc-frame-wrap {
  height: calc(100vh - 200px);
  min-height: 540px;
}
/* ============================================================================
 * 2026-05-15 testing-loop polish batch 1 — 6 features wiring CSS
 * ============================================================================ */

/* Library filter row */
.test-lib-toolbar .test-lib-filter-lbl {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted);
}
.test-lib-toolbar .test-lib-filter-lbl select {
  min-height: 28px; padding: 0 8px;
  background: var(--btn-bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-md, 6px);
  font-size: 11px;
}
#testLibDiffBtn { padding: 0 12px; min-height: 28px; font-size: 12px; }
#testLibDiffBtn:not(:disabled) { background: var(--blue); color: white; border-color: var(--blue); }

/* Library row tags column */
.lib-tag {
  display: inline-block; padding: 1px 7px;
  background: rgba(0,212,255,0.10); color: var(--st-info, #00d4ff);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: var(--radius-pill, 999px);
  font-size: 10px; margin: 2px 3px 0 0; line-height: 1.6;
}
.lib-pin { display: inline-block; margin-right: 4px; font-size: 12px; }
.lib-tag-removable { padding-right: 4px; }
.lib-tag-x {
  background: transparent; color: inherit; border: 0;
  font-size: 12px; line-height: 1; padding: 0 0 0 3px;
  min-height: auto; cursor: pointer; opacity: 0.6;
}
.lib-tag-x:hover { opacity: 1; color: var(--red); }
.lib-row-check { margin: 0; }

/* Detail tokens panel */
.test-lib-tokens { margin-bottom: 14px; }
.test-lib-tokens .ins-summary { margin-bottom: 6px; }

/* Detail labels editor */
.test-lib-labels {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  padding: 12px;
  margin-bottom: 14px;
}
.test-lib-tagrow {
  min-height: 24px;
  margin-bottom: 8px;
  display: flex; flex-wrap: wrap;
  align-items: center;
}
.test-lib-empty-inline { padding: 0; font-style: italic; color: var(--muted); font-size: 11px; }
.test-lib-tagadd { display: flex; gap: 6px; margin-bottom: 8px; }
.test-lib-tagadd input {
  flex: 1; min-height: 30px; padding: 0 10px; font-size: 12px;
}
.test-lib-tagadd button {
  min-height: 30px; padding: 0 12px; font-size: 12px;
}
#testLibNote {
  width: 100%;
  background: var(--btn-bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-md, 6px);
  padding: 8px 10px; font-size: 12px; font-family: inherit;
  resize: vertical; min-height: 60px;
}
.test-lib-label-status {
  display: inline-block; margin-top: 4px;
  font-size: 11px; color: var(--st-ok);
}
#testLibPinBtn { padding: 0 10px; font-size: 14px; min-height: 28px; }

/* Snapshot animation player */
#testLibPlayBtn, #testLibPlayPauseBtn {
  margin-left: 10px; padding: 2px 10px; font-size: 11px;
  min-height: auto; height: 24px; vertical-align: middle;
}
#testLibPlayRange {
  display: inline-block; vertical-align: middle;
  width: 200px; margin: 0 8px; accent-color: var(--blue);
}
#testLibPlayMeta {
  font-size: 11px; color: var(--muted);
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
}
.test-gallery-cell.is-playing {
  outline: 3px solid var(--blue);
  outline-offset: -1px;
  transform: scale(1.02);
  transition: outline 200ms, transform 200ms;
  z-index: 1; position: relative;
}

/* Run-vs-run diff modal */
.test-diff-card { max-width: 1000px; width: 92vw; }
.test-diff-stats { margin-bottom: 14px; }
.test-diff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .test-diff-grid { grid-template-columns: 1fr; } }
.test-diff-col {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  padding: 10px 12px;
  max-height: 60vh; overflow-y: auto;
}
.test-diff-col h4 {
  margin: 0 0 8px;
  font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.test-diff-col .test-tl-row {
  grid-template-columns: 60px 1fr;
  padding: 6px 0;
}

/* Live event stream improvements (test-tl-row already styled in earlier waves) */
#testLiveEventsList .test-tl-row { padding: 4px 8px; }
#testLiveEventsList .test-tl-row:nth-child(odd) { background: rgba(255,255,255,0.02); }

/* ============================================================================
 * 2026-05-15 UI polish wave 3 — speed/intuition/feel batch
 * ============================================================================ */

/* Skeleton blocks for loading state (more useful than `lc-shimmer` which kills text) */
.lc-skel {
  display: inline-block;
  background: linear-gradient(90deg, rgba(148,163,184,0.06) 0%, rgba(148,163,184,0.22) 50%, rgba(148,163,184,0.06) 100%);
  background-size: 400px 100%;
  animation: lc-shimmer-pulse 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm, 4px);
  min-height: 1em;
  color: transparent;
}
.lc-skel-line { display: block; width: 100%; height: 12px; margin: 6px 0; }
.lc-skel-card {
  display: block; border-radius: 6px;
  padding: 14px 16px; margin-bottom: 8px;
}

/* Smooth content fade-in on first paint (paired with .lc-fadein-in via JS) */
@keyframes lc-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lc-fadein { animation: lc-fadein 0.18s ease-out both; }

/* Universal hover lift — applies to project cards, website tabs, etc. */
.lc-hover-lift {
  transition: transform 0.12s ease-out, border-color 0.12s ease-out, box-shadow 0.12s ease-out;
}
.lc-hover-lift:hover {
  transform: translateY(-1px);
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(0, 150, 255, 0.10);
}

/* Project cards (.pj-card) get hover lift + active glow */
.pj-card { transition: transform 0.12s ease-out, border-color 0.12s ease-out, background 0.15s ease-out; }
.pj-card:hover { transform: translateY(-1px); border-color: var(--blue); }
.pj-card.active {
  box-shadow: 0 0 0 2px var(--blue), 0 4px 14px rgba(0, 150, 255, 0.15);
}

/* Website tab + sub-tab buttons get the same treatment */
.ws-tab { transition: transform 0.12s ease-out, border-color 0.12s ease-out, background 0.12s ease-out; }
.ws-tab:not(.active):hover { transform: translateY(-1px); }

/* Stat cards (project overview, control center dashboard) — make numbers pop */
.pj-stat, [class*="hcProjects"], [class*="hcWebsites"], [class*="hcReports"] {
  transition: transform 0.12s ease-out, border-color 0.12s ease-out;
}
.pj-stat:hover { border-color: var(--blue); }

/* Button feel — universal */
button:not(:disabled):active { transform: translateY(1px); }

/* Toast position — consistent across pages */
.lc-toast-container {
  position: fixed; right: 16px; bottom: 16px; z-index: 99999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.lc-toast {
  pointer-events: auto;
  min-width: 240px; max-width: 380px;
  padding: 10px 14px;
  background: var(--btn-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 6px);
  font-size: 12px; color: var(--ink);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  animation: lc-toast-in 0.18s ease-out;
}
.lc-toast.success { border-left: 3px solid var(--st-ok, #00ff88); }
.lc-toast.error { border-left: 3px solid var(--st-bad, #ff4d4f); }
.lc-toast.info { border-left: 3px solid var(--blue); }
.lc-toast.warn { border-left: 3px solid var(--st-warn, #f0b400); }
@keyframes lc-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Bottom status strip — pinned across all pages via topbar/sidebar JS injection */
.lc-status-strip {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 28px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  background: rgba(15, 22, 36, 0.92);
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  z-index: 200;
  backdrop-filter: blur(6px);
}
.lc-status-strip .lc-strip-item {
  display: inline-flex; align-items: center; gap: 4px;
}
.lc-status-strip .lc-strip-sep { color: rgba(148, 163, 184, 0.3); }
.lc-status-strip a { color: var(--ink); text-decoration: none; }
.lc-status-strip a:hover { color: var(--blue); }
html.is-embedded .lc-status-strip { display: none; }

/* Shortcut overlay (? key) */
.lc-shortcuts-overlay {
  position: fixed; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100000;
  animation: lc-fadein 0.15s ease-out;
}
.lc-shortcuts-overlay.is-open { display: flex; }
.lc-shortcuts-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  width: 480px; max-width: 92vw;
}
.lc-shortcuts-card h2 { margin: 0 0 14px; font-size: 15px; }
.lc-shortcuts-card dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px; font-size: 12px; margin: 0; }
.lc-shortcuts-card kbd {
  background: var(--btn-bg); border: 1px solid var(--line);
  padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace; font-size: 11px;
}

/* 2026-05-18 shell speed polish: stabilize navigation paint and offscreen lists. */
.shell {
  contain: layout;
}

body.shell-page .shell {
  min-height: 0;
}

body.shell-page .shell > aside.rail {
  align-self: stretch;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.shell-page.has-lc-topbar .shell > aside.rail {
  max-height: calc(100vh - 36px);
}

.shell-main,
.main,
.content,
.page,
.panel,
.dashboard {
  min-width: 0;
}

aside.rail .nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.18;
  letter-spacing: 0;
  contain: layout paint;
}

aside.rail .nav[data-loading]::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.45);
}

.shell-overview,
.shell-route-status,
.shell-empty,
.shell-frame-stage {
  contain: layout paint style;
}

.shell-frame,
.shell-iframe {
  contain: layout paint style;
  background: var(--bg);
}

.shell-frame[data-shell-phase="hidden"],
.shell-iframe[data-shell-phase="hidden"] {
  pointer-events: none;
}

.pj-card,
.pj-project-card,
.pj-stat,
.ws-site-card,
.ws-tab,
.svc-card,
.svc-link-card,
.test-panel,
.test-card,
.test-shot-card,
.test-timeline-item,
.run-row,
.task-row,
.task-card,
.lc-card,
.lc-table-row {
  content-visibility: auto;
  contain-intrinsic-size: 1px 140px;
}

@media (max-width: 900px) {
  aside.rail .nav {
    min-height: 36px;
    padding-right: 10px;
  }
}

@media (max-width: 700px) {
  body.shell-page .shell:not(.rail-forced-open),
  body.shell-page .shell.rail-forced-open {
    grid-template-columns: 1fr;
    position: relative;
  }

  body.shell-page .shell:not(.rail-forced-open) > aside.rail {
    display: none;
  }

  body.shell-page .shell.rail-forced-open > aside.rail {
    display: block;
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(248px, 82vw);
    max-width: 82vw;
    box-shadow: 16px 0 32px rgba(0, 0, 0, 0.34);
  }

  body.shell-page .shell.rail-forced-open > .shell-main {
    width: 100%;
  }
}
