:root {
  color-scheme: light;
  --ink: #1d1a17;
  --sidebar: #241f1b;
  --sidebar-soft: #312b26;
  --cream: #f4efe7;
  --paper: #fbf7f2;
  --card: #fffdfb;
  --line: #e5dcd1;
  --muted: #746b62;
  --faint: #a3988c;
  --accent: #1c6b55;
  --accent-ink: #f3faf7;
  --danger: #8e3030;
  --danger-soft: #f8e8e4;
  --warn: #8a5712;
  --warn-soft: #f8edd9;
  --info-soft: #e7f0ea;
  --gold: #e4b15d;
  --shadow: 0 28px 70px rgba(48, 32, 16, 0.2);
  font-family: Figtree, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
}
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.topbar-nav-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.topbar-nav-btn:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}
.topbar-nav-btn.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand .kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.brand h1 {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.topbar-status .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1c6b55;
  box-shadow: 0 0 6px rgba(28, 107, 85, 0.5);
}
.topbar .sub { color: var(--muted); font-size: 13px; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #cbbfb2;
}
.chip:hover { border-color: var(--gold); color: #f6f0e8; }
.chip.is-on {
  background: var(--gold);
  border-color: var(--gold);
  color: #1d1a17;
}

.chat {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), transparent 160px),
    var(--cream);
  color: var(--ink);
}

.term-resize {
  height: 6px;
  flex: none;
  cursor: row-resize;
  background: var(--line);
}
.term-resize:hover, .term-resize:focus { background: var(--accent); outline: none; }
.app.dock-closed .term-resize { display: none; }

.terminal {
  flex: none;
  height: var(--dock-height, 220px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #f6f0e8;
  border-top: 1px solid #3a332e;
}
.app.dock-closed .terminal { height: 44px; }
.app.dock-closed .term-body,
.app.dock-closed .overrides,
.app.dock-closed .table-note { display: none; }

.term-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  flex: none;
  background: var(--sidebar-soft);
}
.term-tabs { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.term-kicker {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.terminal .count { color: #cbbfb2; font-size: 12px; }
.term-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px;
}
.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.term-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.term-card strong { display: block; font-size: 13px; }
.term-card .meta, .terminal .empty-note {
  color: #b4a79a;
  font-size: 12px;
  line-height: 1.4;
}
.term-card code, .terminal code {
  font-size: 11px;
  color: #e4d5c3;
  word-break: break-word;
}

.search {
  flex: 1;
  max-width: 280px;
  margin-left: auto;
  background: #1b1714;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0 10px;
}
.search input {
  width: 100%;
  background: transparent;
  border: 0;
  color: #f6f0e8;
  padding: 8px 0;
  outline: none;
}
.search input::placeholder { color: #8d8278; }

.icon-btn { padding: 6px 10px; font-size: 12px; }
.terminal .ghost {
  border-color: rgba(255, 255, 255, 0.16);
  color: #f6f0e8;
}

.table-panel {
  flex: 1.4;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 0;
}
.table-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.table-head h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 26px;
  font-weight: 650;
}
.count { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.user-table th {
  position: sticky;
  top: 0;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b4a79a;
  background: var(--sidebar);
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.user-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
  color: #f6f0e8;
}
.user-table tr.is-fresh { background: rgba(228, 177, 93, 0.16); }
.who {
  display: flex;
  gap: 10px;
  align-items: center;
}
.who .meta { color: #b4a79a; font-size: 12px; }
.status {
  text-transform: capitalize;
  font-weight: 600;
  font-size: 12px;
}
.status-active { color: var(--accent); }
.status-inactive { color: var(--warn); }
.status-offboarded { color: var(--danger); }

.access-panel {
  flex: 0.7;
  min-height: 140px;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.access {
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 16px;
  align-content: start;
}
.access-col { min-width: 0; }
.access .section-label { grid-column: 1 / -1; padding: 4px 0; color: var(--muted); }
.access-item {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.access-item strong { display: block; font-size: 13px; }
.access-item .meta, .empty-note, .audit-item span, .foot {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.access-item code {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  word-break: break-word;
}
.section-label {
  padding: 8px 0 4px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex: none;
}
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  background: #efe7dc;
}
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.danger { color: var(--danger); background: var(--danger-soft); }
.pill.gold { color: #1d1a17; background: var(--gold); }

.override {
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--warn-soft);
}
.override p { font-size: 13px; line-height: 1.4; }
.override .meta { color: var(--warn); }
.override button, .ghost, .primary, .danger {
  border-radius: 999px;
  border: 0;
  padding: 8px 12px;
  font-weight: 600;
}
.ghost {
  background: transparent;
}
.override button {
  border-color: var(--line);
  color: var(--ink);
}
.recent { overflow: auto; }
.audit-item {
  padding: 10px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
.audit-item p { font-size: 13px; line-height: 1.4; }
.foot { padding: 0; color: var(--muted); font-size: 12px; }

.chat-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px 8px;
}
.chat-bar h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 20px;
  font-weight: 650;
}
.chat-bar .sub { color: var(--muted); }
.chat-bar .sub, .source, .hint, .flag span, .composer .hint {
  color: var(--muted);
  font-size: 13px;
}
.banner {
  margin: 8px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.log {
  flex: 1;
  overflow: auto;
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bubble {
  max-width: min(680px, 100%);
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 14px;
}
.bubble.has-ui {
  width: min(600px, 100%);
  max-width: 100%;
  padding: 12px 18px 13px;
  background: #ffffff;
  border: 1.5px solid var(--line);
  box-shadow: 0 10px 30px rgba(40, 24, 12, 0.05), 0 1px 3px rgba(40, 24, 12, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.bubble.has-ui.is-preview,
.bubble.has-ui.is-staged {
  border-color: rgba(228, 177, 93, 0.65);
  box-shadow: 0 14px 38px rgba(40, 24, 12, 0.09), 0 0 0 1px rgba(228, 177, 93, 0.35);
}
.bubble.has-ui.is-deploying {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(28, 107, 85, 0.35), 0 18px 44px rgba(28, 107, 85, 0.15);
  transform: scale(1.008);
}
.bubble-prose {
  margin-bottom: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}
.bubble-prose p { margin: 0 0 6px; }
.bubble-prose p:last-child { margin-bottom: 0; }
.bubble.user {
  align-self: flex-end;
  background: #241f1b;
  color: #f7f2eb;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}
.bubble.assistant, .bubble.pending, .bubble.error {
  align-self: flex-start;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 16px rgba(48, 32, 16, 0.03);
}
.bubble-list {
  margin: 10px 0 4px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1.5;
}
.bubble-list li {
  margin: 0;
}
.bubble-p {
  margin: 0 0 8px;
  line-height: 1.5;
}
.bubble-p:last-child {
  margin-bottom: 0;
}
.bubble strong {
  font-weight: 650;
  color: var(--ink);
}
.bubble.user strong {
  color: #ffffff;
}
.bubble code {
  font-family: monospace;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 5px;
  border-radius: 4px;
}

.bubble-prompt-chip {
  display: inline-flex;
  align-items: center;
  background: rgba(28, 107, 85, 0.08);
  color: #155241;
  border: 1px solid rgba(28, 107, 85, 0.22);
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s ease;
  margin: 0 2px;
  text-decoration: none;
  font-family: inherit;
  vertical-align: baseline;
}
.bubble-prompt-chip:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(28, 107, 85, 0.25);
}

.welcome-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
}
.btn-welcome-explainer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-welcome-explainer:hover {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.source.is-saved {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  background: var(--info-soft);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(28, 107, 85, 0.2);
}
.source-check {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.ui-card-superseded {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}
.superseded-badge {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}
.superseded-title {
  font-weight: 550;
  color: var(--ink);
}
.bubble.error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.bubble.pending { color: var(--muted); }
.trace { margin-top: 12px; display: grid; gap: 8px; }
.trace-top, .flag, .modal-head, .field, .composer, .modal-foot {
  display: flex;
  gap: 8px;
}
.trace-top, .modal-head, .modal-foot { align-items: center; justify-content: space-between; }
.flag { align-items: center; font-size: 12px; }
.flag .name { width: 132px; color: var(--muted); }
.track {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: #efe7dc;
  overflow: hidden;
}
.fill { display: block; height: 100%; background: var(--accent); }
.fill.hot { background: var(--danger); }
.risk, .adjusted {
  font-size: 12px;
  font-weight: 650;
  border-radius: 999px;
  padding: 4px 8px;
}
.risk-low { background: var(--info-soft); color: var(--accent); }
.risk-medium { background: var(--warn-soft); color: var(--warn); }
.risk-high, .risk-critical { background: var(--danger-soft); color: var(--danger); }
.adjusted { color: var(--muted); font-weight: 500; padding: 0; }

.composer {
  align-items: stretch;
  padding: 10px 20px 14px;
  flex-direction: column;
}
.composer-box {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 6px 8px 6px 16px;
  box-shadow: 0 4px 20px rgba(48, 32, 16, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.composer-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28, 107, 85, 0.12);
}
textarea {
  flex: 1;
  border: 0;
  resize: none;
  outline: none;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.45;
  background: transparent;
  max-height: 120px;
}
.composer-box button.send {
  flex: none;
  background: var(--accent);
  color: #ffffff;
  border: 0;
  border-radius: 12px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s ease;
}
.composer-box button.send:hover:not(:disabled) {
  background: #155241;
  transform: translateY(-1px);
}
.primary, .danger {
  color: white;
}
.primary { background: var(--accent); }
.danger { background: var(--danger); }
.primary:disabled, .danger:disabled, .ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.prompts {
  width: 100%;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 2px 2px;
  scrollbar-width: thin;
}
.prompts button {
  flex: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 6px 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.prompts button:hover {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ui-form {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--ink);
}

/* Card topbar: integrates live status, reflex chips, shortcut, and dismiss */
.card-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}
.card-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.card-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.card-preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2.5px 8px;
  border-radius: 999px;
  background: rgba(228, 177, 93, 0.18);
  border: 1px solid rgba(228, 177, 93, 0.45);
  font-size: 11px;
  font-weight: 700;
  color: #9a5312;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.preview-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(28, 107, 85, 0.5);
  animation: reflexPulse 1.2s ease-out infinite;
}
.preview-ms {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10.5px;
  opacity: 0.85;
  padding-left: 2px;
}
.card-kind-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2.5px 8px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.card-done-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2.5px 8px;
  border-radius: 6px;
  background: var(--info-soft);
  border: 1px solid rgba(28, 107, 85, 0.22);
}
.card-done-pill .done-check {
  font-size: 12px;
  font-weight: 800;
}
.card-key-hint {
  font-size: 11.5px;
  font-weight: 550;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.card-key-hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
}
.card-close-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.card-close-btn:hover {
  background: var(--paper);
  color: var(--ink);
}

/* ---- Card Loader running into the staged card ---- */
.card-loader-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 1px 0 3px;
  padding: 6px 11px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fffcf5 0%, #fbf5e8 100%);
  border: 1px solid rgba(228, 177, 93, 0.4);
}
.card-loader-container.is-deploying {
  background: var(--info-soft);
  border-color: rgba(28, 107, 85, 0.35);
  transition: all 0.2s ease;
}
.card-loader-bar {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(228, 177, 93, 0.25);
  overflow: hidden;
}
.card-loader-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 45%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #e4b15d, var(--accent), #e4b15d, transparent);
  animation: cardLoaderRun 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.card-loader-fill.is-deploying {
  width: 100% !important;
  animation: none !important;
  background: var(--accent) !important;
  box-shadow: 0 0 12px rgba(28, 107, 85, 0.75);
  transition: width 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes cardLoaderRun {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}
.card-loader-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.card-loader-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9a5312;
}
.card-loader-container.is-deploying .card-loader-status {
  color: var(--accent);
}
.pulse-bolt {
  font-size: 11px;
  display: inline-block;
  animation: reflexPulse 1.2s ease infinite;
}
.card-loader-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #9a5312;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.card-loader-hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid rgba(228, 177, 93, 0.55);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
  color: #9a5312;
}

/* Staged fields preview */
.staged-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}
.staged-field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.staged-field-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.staged-field-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
}
.staged-field-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9a5312;
  background: rgba(228, 177, 93, 0.2);
  border: 1px solid rgba(228, 177, 93, 0.4);
  padding: 1.5px 6px;
  border-radius: 4px;
}
.staged-field-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px dashed rgba(228, 177, 93, 0.65);
  background: linear-gradient(90deg, #fffcf5 0%, #fef5e7 50%, #fffcf5 100%);
  background-size: 200% 100%;
  animation: stagedFieldShimmer 2.8s ease infinite;
}
.staged-field-box.is-shimmer {
  border-style: solid;
  border-color: var(--line);
  background: linear-gradient(90deg, #fbf9f6 0%, #f1ebdf 50%, #fbf9f6 100%);
  background-size: 200% 100%;
  animation: stagedFieldShimmer 2.2s ease infinite;
}
@keyframes stagedFieldShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.staged-field-val {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}
.staged-field-prior {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.prior-arrow {
  font-size: 13px;
  color: var(--faint);
}

/* Staged foot actions */
.modal-foot.is-staged {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.btn-deploy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #ffffff;
  border: 0;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(28, 107, 85, 0.25);
}
.btn-deploy:hover {
  background: #155241;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(28, 107, 85, 0.35);
}

/* Card title */
.card-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.card-title {
  font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}

/* Rich entity card: seamless profile section integrated into the card */
.entity-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 0 7px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.entity-card .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}
.entity-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.entity-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.entity-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.entity-role-pill {
  font-size: 11px;
  font-weight: 650;
  padding: 1.5px 8px;
  border-radius: 999px;
  background: rgba(28, 107, 85, 0.08);
  color: var(--accent);
  border: 1px solid rgba(28, 107, 85, 0.2);
}
.entity-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card notices & warnings */
.card-notices {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.card-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.4;
}
.card-notice .notice-icon {
  flex: none;
  font-size: 13px;
  margin-top: 1px;
}
.card-notice.info {
  background: var(--info-soft);
  color: var(--accent);
  border: 1px solid rgba(28, 107, 85, 0.18);
}
.card-notice.warning {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(138, 87, 18, 0.22);
}
.card-notice.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(142, 48, 48, 0.22);
}

/* Form fields layout */
.fields {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}
.field > span, .checks legend {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -0.005em;
  text-transform: none;
}
.select-wrap {
  position: relative;
  width: 100%;
}
.field-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 34px 8px 12px;
  font-size: 14.5px;
  font-weight: 550;
  font-family: inherit;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.field-select:hover {
  border-color: #cfc5b8;
}
.field-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28, 107, 85, 0.12);
}
.select-caret {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  font-size: 11px;
}
.field-input, .field-textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 14px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  transition: all 0.15s ease;
}
.field-textarea {
  min-height: 52px;
  resize: vertical;
}
.field-input:focus, .field-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28, 107, 85, 0.12);
}

.field-static {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-static .field-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-static .static-value {
  padding: 7px 12px;
  background: #fbf9f6;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ink);
}

/* Multiselect / Checkboxes */
.checks {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checks-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.check-pill:has(input:checked) {
  background: var(--info-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Authenticator code for break-glass */
.authenticator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ink);
  color: #f6f0e8;
  border-radius: 12px;
  padding: 10px 14px;
}
.authenticator strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.18em;
  font-size: 18px;
}
.field-code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 16px !important;
  letter-spacing: 0.15em;
}

.form-error {
  min-height: 0;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
}

/* Card footer actions */
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.ui-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #ffffff;
  border: 0;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(28, 107, 85, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: #155241;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(28, 107, 85, 0.35);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-ghost:hover {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--danger);
  color: #ffffff;
  border: 0;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-danger:hover:not(:disabled) {
  background: #752626;
  transform: translateY(-1px);
}
.btn-kbd {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.card-committed-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 650;
}
.card-committed-foot .committed-check {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  flex: none;
}

.field-select:disabled, .field-input:disabled, .field-textarea:disabled {
  background: var(--paper);
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  opacity: 0.85;
  cursor: default;
  border-color: var(--line);
}

/* Cinematic commit animations */
.fly-card {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  width: 244px;
  pointer-events: none;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fffdfb, #f5eee2);
  border: 1px solid var(--line);
  box-shadow: 0 26px 60px rgba(48, 32, 16, 0.35), 0 0 0 1px rgba(228, 177, 93, 0.35);
  will-change: transform, opacity;
}
.fly-card.fly-edit {
  background: linear-gradient(180deg, #2b2521, #1d1915);
  border-color: rgba(228, 177, 93, 0.5);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(228, 177, 93, 0.6), 0 0 46px rgba(228, 177, 93, 0.45);
}
.fly-card .avatar { width: 40px; height: 40px; font-size: 13px; }
.fly-card-glyph {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1d1a17;
  background: var(--gold);
}
.fly-card.fly-edit .fly-card-glyph { color: #1d1a17; }
.fly-card-info { min-width: 0; }
.fly-card-info strong { display: block; font-size: 14px; color: var(--ink); }
.fly-card.fly-edit .fly-card-info strong { color: #f6f0e8; }
.fly-card-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fly-card.fly-edit .fly-card-meta { color: #b4a79a; }
.fly-card .status { font-size: 11px; }

.cinema-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, transparent 26%, rgba(18, 12, 6, 0.58) 100%);
}

/* Live preview banner: a full card held open in the chat as the operator types. */
.ui-form:has(.preview-flag) {
  border-color: rgba(228, 177, 93, 0.55);
  box-shadow: 0 0 0 1px rgba(228, 177, 93, 0.3), 0 18px 44px rgba(48, 32, 16, 0.14);
}
.preview-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -2px 0 12px;
  padding: 7px 11px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fffaf0, #f8efdd);
  border: 1px solid rgba(228, 177, 93, 0.4);
  font-size: 11px;
  font-weight: 650;
  color: #a56a12;
}
.preview-flag-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(28, 107, 85, 0.5);
  animation: reflexPulse 1.1s ease-out infinite;
}
@keyframes reflexPulse {
  0% { box-shadow: 0 0 0 0 rgba(28, 107, 85, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(28, 107, 85, 0); }
  100% { box-shadow: 0 0 0 0 rgba(28, 107, 85, 0); }
}
.preview-flag-text {
  letter-spacing: 0.02em;
}
.preview-flag-hint {
  margin-left: auto;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* ---- Reflex: live compliance signal chips ---- */
.reflex-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.card-topbar .reflex-signals {
  margin: 0;
  display: inline-flex;
}
.reflex-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}
.reflex-chip-k {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.reflex-intent { background: var(--info-soft); border-color: rgba(28, 107, 85, 0.2); }
.reflex-risk.risk-low { background: var(--info-soft); color: var(--accent); border-color: rgba(28, 107, 85, 0.25); }
.reflex-risk.risk-medium { background: var(--warn-soft); color: var(--warn); border-color: rgba(138, 87, 18, 0.28); }
.reflex-risk.risk-high, .reflex-risk.risk-critical { background: var(--danger-soft); color: var(--danger); border-color: rgba(142, 48, 48, 0.3); }
.reflex-flag.is-on {
  background: #fbeee0;
  color: #a15617;
  border-color: rgba(228, 177, 93, 0.5);
}
.reflex-flag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 rgba(228, 177, 93, 0.6);
  animation: reflexPulse 1.4s ease-out infinite;
}

/* ---- Reflex: latency HUD (bottom-right) ---- */
.reflex-hud {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(29, 26, 23, 0.9);
  color: #f3ede3;
  font-family: "SFMono-Regular", ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(24, 16, 8, 0.28);
  pointer-events: none;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}
.reflex-hud-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4f8f7c;
  flex: none;
}
.reflex-hud.is-live .reflex-hud-dot { background: var(--gold); }
.reflex-hud.risk-high .reflex-hud-dot,
.reflex-hud.risk-critical .reflex-hud-dot { background: #e07a6b; }
.reflex-hud.flash {
  box-shadow: 0 0 0 3px rgba(228, 177, 93, 0.35), 0 10px 30px rgba(24, 16, 8, 0.28);
  animation: hudFlash 0.42s ease;
}
@keyframes hudFlash {
  0% { transform: translateY(2px) scale(0.98); }
  40% { transform: translateY(0) scale(1.015); }
  100% { transform: translateY(0) scale(1); }
}

/* ---- Reflex: "/" command palette ---- */
.prompt-palette-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-weight: 650 !important;
  color: var(--accent) !important;
  border-color: rgba(28, 107, 85, 0.3) !important;
  background: var(--info-soft) !important;
}
.prompt-palette-kbd {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 5px;
  background: #ffffff;
  border: 1px solid rgba(28, 107, 85, 0.35);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  line-height: 1;
}
.reflex-palette {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
}
.reflex-palette.is-open {
  display: block;
}
.reflex-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 16, 8, 0.4);
  backdrop-filter: blur(2px);
}
.reflex-palette-panel {
  position: absolute;
  top: 14vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 92vw);
  max-height: 68vh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 40px 90px rgba(24, 16, 8, 0.4);
  overflow: hidden;
  animation: paletteIn 0.16s ease;
}
@keyframes paletteIn {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.reflex-palette-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.reflex-palette-kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: var(--ink);
}
.reflex-palette-input {
  margin: 0 12px 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: var(--paper);
}
.reflex-palette-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28, 107, 85, 0.12);
}
.reflex-palette-list {
  overflow: auto;
  padding: 4px 8px 8px;
  min-height: 0;
}
.reflex-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.reflex-palette-item.is-active,
.reflex-palette-item:hover {
  background: var(--info-soft);
}
.reflex-palette-icon {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 15px;
}
.reflex-palette-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.reflex-palette-label {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
}
.reflex-palette-ex {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reflex-palette-cat {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.reflex-palette-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.reflex-palette-foot {
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.02em;
}

.user-table tr.row-land { animation: rowLand 1.1s ease; }
@keyframes rowLand {
  0% { box-shadow: inset 0 0 0 2px transparent; background: transparent; }
  28% { box-shadow: inset 0 0 0 2px var(--gold); background: rgba(228, 177, 93, 0.42); }
  100% { box-shadow: inset 0 0 0 2px transparent; background: rgba(228, 177, 93, 0.16); }
}
.bubble.chat-land { animation: chatLand 1s ease; }
@keyframes chatLand {
  0% { box-shadow: 0 0 0 0 rgba(228, 177, 93, 0); }
  25% { box-shadow: 0 0 0 4px rgba(228, 177, 93, 0.55), 0 0 30px rgba(228, 177, 93, 0.5); transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0 rgba(228, 177, 93, 0); transform: scale(1); }
}
.ui-form.form-intake { animation: formIntake 1.05s ease; }
@keyframes formIntake {
  0% { box-shadow: 0 0 0 0 rgba(228, 177, 93, 0); }
  20% { box-shadow: 0 0 0 3px rgba(228, 177, 93, 0.5), 0 0 34px rgba(228, 177, 93, 0.45); }
  55% { box-shadow: 0 0 0 3px rgba(228, 177, 93, 0.5), 0 0 34px rgba(228, 177, 93, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(228, 177, 93, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .fly-card, .cinema-backdrop { display: none !important; }
  .user-table tr.row-land, .bubble.chat-land, .ui-form.form-intake { animation: none; }
  .preview-flag-dot, .reflex-flag-dot, .reflex-hud.flash, .reflex-palette-panel { animation: none; }
}

@media (max-width: 720px) {
  .brand h1 { font-size: 24px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .chat-bar, .log, .composer, .banner { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 560px) {
  .ui-form h3 { font-size: 22px; }
  .search { max-width: none; }
}

/* ============================================================================
 * Interactive Demo Tour & Showcase HUD
 * ============================================================================ */

.btn-demo-tour {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #1c6b55 0%, #155241 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(28, 107, 85, 0.22);
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn-demo-tour:hover {
  background: linear-gradient(135deg, #238469 0%, #1c6b55 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(28, 107, 85, 0.35);
}
.btn-demo-tour .demo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
  animation: demoDotPulse 1.8s infinite;
}
@keyframes demoDotPulse {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.3); }
}

.demo-hud {
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 8px 16px 12px;
  padding: 12px 16px 10px;
  background: #241f1b;
  color: #fbf7f2;
  border-radius: 12px;
  border: 1px solid rgba(228, 177, 93, 0.35);
  box-shadow: 0 12px 32px rgba(18, 12, 6, 0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: hudSlideDown 0.35s ease;
}
@keyframes hudSlideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
.demo-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.demo-hud-tags {
  display: flex;
  align-items: center;
  gap: 8px;
}
.demo-hud-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--gold);
  color: #1d1a17;
  padding: 2px 7px;
  border-radius: 4px;
}
.demo-hud-step {
  font-size: 11px;
  font-weight: 600;
  color: #cbbfb2;
}
.demo-hud-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #e4b15d;
}
.demo-hud-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.demo-hud-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5dcd1;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
  cursor: pointer;
}
.demo-hud-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.demo-hud-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.demo-hud-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.demo-hud-title {
  font-size: 14px;
  font-weight: 650;
  color: #f6f0e8;
}
.demo-hud-desc {
  font-size: 12px;
  color: #b4a79a;
  line-height: 1.4;
}
.demo-hud-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}
.demo-hud-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #1c6b55);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.demo-highlight {
  outline: 2px solid var(--gold) !important;
  box-shadow: 0 0 14px rgba(228, 177, 93, 0.6) !important;
  border-color: var(--gold) !important;
  transition: outline 0.3s ease, box-shadow 0.3s ease;
}

.demo-complete-card {
  margin: 16px;
  padding: 20px;
  background: #241f1b;
  color: #f6f0e8;
  border-radius: 12px;
  border: 1px solid var(--gold);
  text-align: center;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}
.demo-complete-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--gold);
}
.demo-complete-card p {
  color: #cbbfb2;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ============================================================================
 * Explainer View & Architecture Page
 * ============================================================================ */

.explainer-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at top right, rgba(228, 177, 93, 0.08), transparent 50%),
    linear-gradient(180deg, #fdfbf7 0%, var(--cream) 100%);
  color: var(--ink);
  padding: 48px 32px 100px;
}

.explainer-container {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.explainer-hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.explainer-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.explainer-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 38px;
  line-height: 1.15;
  font-weight: 650;
  color: var(--ink);
  margin: 0;
}
.explainer-lead {
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 820px;
  margin: 0;
}
.explainer-hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.btn-explainer-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(28, 107, 85, 0.25);
  transition: all 0.2s ease;
  cursor: pointer;
}
.btn-explainer-primary:hover {
  background: #238469;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(28, 107, 85, 0.35);
}

.btn-explainer-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #241f1b;
  color: #fbf7f2;
  border: 1px solid rgba(228, 177, 93, 0.35);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  cursor: pointer;
}
.btn-explainer-secondary:hover {
  background: #312b26;
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.explainer-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.section-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(28, 107, 85, 0.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
}
.section-header h3 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 24px;
  font-weight: 650;
  color: var(--ink);
  margin: 0;
}
.section-desc {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.explainer-grid {
  display: grid;
  gap: 16px;
}
.explainer-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}
.explainer-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 860px) {
  .explainer-grid.three-col, .explainer-grid.two-col {
    grid-template-columns: 1fr;
  }
}

.explainer-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.explainer-card .card-icon {
  font-size: 26px;
}
.explainer-card h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
}
.explainer-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

/* Question Cards */
.question-card {
  border-top: 3px solid var(--accent);
}
.question-card:nth-child(2) {
  border-top-color: var(--gold);
}
.question-card:nth-child(3) {
  border-top-color: #2b74a3;
}
.question-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pill-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(28, 107, 85, 0.12);
  color: var(--accent);
}
.pill-type.score-type {
  background: rgba(228, 177, 93, 0.2);
  color: #8a5712;
}
.pill-type.noul-type {
  background: rgba(43, 116, 163, 0.12);
  color: #1e5a80;
}
.explainer-bullets {
  margin: 4px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
}

/* Pipeline Diagram */
.pipeline-diagram {
  background: #241f1b;
  color: #fbf7f2;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(228, 177, 93, 0.3);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  overflow-x: auto;
}
@media (max-width: 900px) {
  .pipeline-diagram {
    flex-direction: column;
    align-items: stretch;
  }
  .pipeline-arrow {
    transform: rotate(90deg);
    margin: 4px auto;
  }
}
.pipeline-step {
  flex: 1;
  min-width: 170px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pipeline-step.is-highlight {
  background: rgba(28, 107, 85, 0.25);
  border-color: #1c6b55;
  box-shadow: 0 0 16px rgba(28, 107, 85, 0.3);
}
.pipeline-step-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cbbfb2;
}
.pipeline-step-badge.s1-badge {
  color: var(--gold);
}
.pipeline-step h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  color: #fff;
}
.pipeline-step p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: #b4a79a;
}
.pipeline-arrow {
  color: var(--gold);
  font-size: 18px;
  flex: none;
}
.pipeline-split {
  flex: 1.3;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pipeline-substep {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pipeline-substep h5 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 650;
  color: #fbf7f2;
}
.pipeline-substep p {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: #a3988c;
}
.badge-s1 {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(28, 107, 85, 0.3);
  color: #59d1a8;
}
.badge-s2 {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(228, 177, 93, 0.25);
  color: var(--gold);
}

/* Use Case List */
.use-case-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.use-case-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.2s ease;
}
.use-case-row:hover {
  border-color: rgba(28, 107, 85, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}
@media (max-width: 800px) {
  .use-case-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
.use-case-meta {
  flex: none;
  width: 170px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.use-case-category {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.use-case-badge {
  font-size: 11px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 8px;
  border-radius: 999px;
  align-self: flex-start;
}
.use-case-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.use-case-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}
.use-case-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.use-case-prompt {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.use-case-prompt .prompt-label {
  color: var(--faint);
  font-weight: 600;
}
.use-case-prompt .prompt-code {
  background: #f4efe7;
  color: #155241;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.use-case-action {
  flex: none;
}
.btn-try-use-case {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(28, 107, 85, 0.08);
  color: var(--accent);
  border: 1px solid rgba(28, 107, 85, 0.25);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn-try-use-case:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(28, 107, 85, 0.25);
}

/* Motion Cards */
.motion-card {
  border-left: 4px solid var(--accent);
}
.motion-card:nth-child(2) {
  border-left-color: var(--gold);
}
.motion-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.motion-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.motion-badge.up {
  background: rgba(28, 107, 85, 0.12);
  color: var(--accent);
}
.motion-badge.down {
  background: rgba(228, 177, 93, 0.2);
  color: #8a5712;
}

/* Schema Code Block */
.schema-code-block {
  background: #241f1b;
  color: #e5dcd1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  overflow-x: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Footer CTA */
.explainer-footer-cta {
  background: #241f1b;
  color: #fbf7f2;
  border-radius: 16px;
  padding: 32px 28px;
  text-align: center;
  border: 1px solid rgba(228, 177, 93, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.explainer-footer-cta h3 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 26px;
  font-weight: 650;
  color: #fff;
  margin: 0;
}
.explainer-footer-cta p {
  color: #b4a79a;
  font-size: 14px;
  margin: 0;
  max-width: 500px;
}
.footer-cta-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}


