:root {
  color-scheme: dark;
  --bg: #0b0e11;
  --panel: #141a20;
  --panel-strong: #171f27;
  --border: #27313b;
  --text: #eef3f8;
  --muted: #9baabc;
  --accent: #d3b363;
  --teal: #75d6b4;
  --warn-color: #e4bd65;
  --err-color: #ee8d8d;
  --shadow: 0 18px 52px rgba(0,0,0,0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
html { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; }
.layout { width: min(1440px, 100%); margin: 0 auto; padding: clamp(14px, 2vw, 24px); overflow-x: hidden; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(16px, 2vw, 22px);
  backdrop-filter: blur(18px);
  min-width: 0;
}
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 4px 2px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.hero,
.hero > div {
  min-width: 0;
  max-width: 100%;
}
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 46px); letter-spacing: 0; line-height: 1.04; }
.hero p:last-child { max-width: 760px; }
.hero.compact h1 { font-size: clamp(24px, 3vw, 34px); }
.hero.compact { align-items: center; margin-bottom: 14px; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 0; font-size: 12px; margin: 0 0 8px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grid { display: grid; gap: 22px; margin-bottom: 22px; }
.grid.two { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; min-width: 0; }
h2 { margin: 0; font-size: 18px; letter-spacing: 0; line-height: 1.2; }
.row { display: grid; gap: 8px; margin: 13px 0; }
.row.inline { display: block; }
label { color: var(--muted); font-size: 13px; }
input, textarea, select {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: rgba(0,0,0,0.24);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 12px 14px;
  outline: none;
  font: inherit;
}
.small-input { max-width: 120px; padding: 9px 10px; font-size: 13px; }
textarea { resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.actions.wrap { flex-wrap: wrap; }
.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text);
  background: rgba(255,255,255,0.10);
  border-radius: 8px;
  padding: 10px 15px;
  text-decoration: none;
  font: inherit;
  transition: transform 120ms ease, background 120ms ease;
  min-width: 0;
}
.button:hover, button:hover { transform: translateY(-1px); background: rgba(255,255,255,0.15); }
.button.primary { background: rgba(216, 197, 141, 0.20); border-color: rgba(239, 218, 158, 0.42); }
.button.ghost { background: transparent; }
.button.danger { background: rgba(188, 76, 76, 0.16); border-color: rgba(239, 142, 142, 0.38); }
.button.small, button.small { padding: 7px 11px; font-size: 12px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick button { font-size: 12px; padding: 7px 10px; max-width: 100%; white-space: normal; text-align: left; }
.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-ok { color: #d9f8df; border-color: rgba(139, 220, 199, 0.42); background: rgba(139, 220, 199, 0.12); }
.target-chip {
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  padding: 13px;
  line-height: 1.55;
  margin-bottom: 13px;
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
}
.target-chip.local { box-shadow: inset 0 0 30px rgba(90, 150, 255, 0.18); }
.target-chip.remote { box-shadow: inset 0 0 30px rgba(95, 255, 188, 0.14); }
.target-chip.cloud { box-shadow: inset 0 0 30px rgba(198, 128, 255, 0.16); }
.target-chip.warning { box-shadow: inset 0 0 30px rgba(255, 188, 77, 0.18); }
.answer, .json {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,0.26);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 14px;
  min-height: 120px;
  max-width: 100%;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}
.json { min-height: 80px; max-height: 300px; overflow: auto; }
.node-list, .policy-list, .agent-list, .continuity-list, .backup-list, .queue-list, .automation-alert-list, .energy-list, .device-list, .approval-list, .budget-list, .ledger-list, .scorecard-list, .cache-list, .audit-list, .registrar-wall-list { display: grid; gap: 10px; }
.node, .policy, .agent, .continuity, .backup, .queue, .automation-alert, .energy, .device, .approval, .budget, .ledger, .scorecard, .cache, .audit {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.18);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}
.node strong, .policy strong, .agent strong, .continuity strong, .backup strong, .queue strong, .automation-alert strong, .energy strong, .device strong, .approval strong, .budget strong, .ledger strong, .scorecard strong, .cache strong, .audit strong { display: block; margin-bottom: 4px; }
.ok { color: #b9ffd9; }
.warn { color: #ffd89b; }
.err { color: #ffadad; }
.registrar-device-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.registrar-device-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.registrar-device-form input {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  background: rgba(0,0,0,0.22);
  color: var(--text);
  padding: 0 10px;
}
.registrar-wall-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(0,0,0,0.18);
}
.registrar-wall-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}
.registrar-wall-main h3 {
  margin: 0 0 4px;
  font-size: 17px;
  line-height: 1.2;
}
.registrar-wall-main a,
.registrar-wall-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.registrar-wall-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}

.auth-card {
  max-width: 560px;
  margin: 12vh auto 0;
  background: #141a20;
  backdrop-filter: none;
}
.ops-shell {
  display: grid;
  min-height: calc(100vh - 48px);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  overflow: hidden;
  background: #0f1317;
  box-shadow: 0 20px 70px rgba(0,0,0,0.35);
}
.ops-shell[hidden] { display: none; }
.ops-topbar {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 64px;
  padding: 0 18px;
  border-bottom: 1px solid #26303a;
  background: #141a20;
}
.ops-brand strong,
.ops-brand span {
  display: block;
  min-width: 0;
}
.ops-brand strong { font-size: 16px; }
.ops-brand span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ops-search {
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #2e3a45;
  border-radius: 7px;
  background: #0f1317;
  color: #8190a2;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-top-actions,
.ops-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.ops-body {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 680px;
}
.ops-sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 14px;
  border-right: 1px solid #26303a;
  background: #11171d;
}
.ops-nav {
  display: grid;
  gap: 6px;
}
.ops-nav-button {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  color: #a9b8c9;
  border-color: transparent;
  text-align: left;
}
.ops-nav-button:hover { background: #1a222b; transform: none; }
.ops-nav-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #15120a;
  font-weight: 800;
}
.ops-nav-button.active span { color: #15120a; }
.ops-nav-button span {
  color: #8797aa;
  font-size: 11px;
}
.ops-sidebar-panel {
  border: 1px solid #27313b;
  background: #0f1419;
  border-radius: 8px;
  padding: 12px;
}
.ops-sidebar-panel h2 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.ops-readiness {
  display: grid;
  gap: 8px;
}
.ops-readiness div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.ops-readiness span { color: var(--muted); }
.ops-side-actions {
  display: grid;
  gap: 8px;
}
.ops-main {
  min-width: 0;
  padding: 18px;
}
.ops-section {
  display: none;
  gap: 16px;
}
.ops-section.active { display: grid; }
.ops-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.ops-page-head h2 {
  font-size: 22px;
  margin-bottom: 4px;
}
.core-panel { min-width: 0; }
.core-summary-card {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(0, 1.35fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid #27313b;
  border-radius: 8px;
  background: #141a20;
}
.core-summary-copy {
  min-width: 0;
}
.core-summary-copy h3 {
  margin: 0 0 7px;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}
.core-summary-copy p:last-child {
  margin: 0;
  line-height: 1.45;
}
.core-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.core-stat-grid div {
  min-width: 0;
  border: 1px solid #27313b;
  border-radius: 8px;
  background: #10161c;
  padding: 11px;
}
.core-stat-grid span,
.core-stat-grid strong,
.core-stat-grid small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}
.core-stat-grid span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.core-stat-grid strong {
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.2;
}
.core-stat-grid small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}
.core-policy-line {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.core-policy-line span {
  min-width: 0;
  border: 1px solid rgba(211, 179, 99, 0.26);
  border-radius: 8px;
  padding: 7px 10px;
  color: #d8c58d;
  background: rgba(211, 179, 99, 0.08);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.ops-metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.ops-metric {
  min-height: 88px;
  border: 1px solid #27313b;
  background: #141a20;
  border-radius: 8px;
  padding: 12px;
}
.ops-metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.ops-metric strong {
  display: block;
  margin-top: 7px;
  font-size: 23px;
  line-height: 1.1;
}
.ops-metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
}
.ops-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
  align-items: start;
}
.ops-shell .card,
.ops-shell .panel {
  background: #141a20;
  border: 1px solid #27313b;
  box-shadow: none;
  backdrop-filter: none;
}
.ops-shell .panel { border-radius: 8px; }
.ops-readiness-panel { padding: clamp(16px, 2vw, 22px); }
.priority-panel { min-height: 420px; }
.priority-table {
  display: grid;
  border: 1px solid #27313b;
  border-radius: 8px;
  overflow: hidden;
}
.priority-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 98px 80px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #222b34;
  background: #141a20;
}
.priority-row:last-child { border-bottom: 0; }
.priority-row.header {
  color: #7f90a3;
  background: #10161c;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.priority-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.priority-title strong,
.priority-title span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.priority-title span {
  color: var(--muted);
  font-size: 12px;
}
.priority-status {
  font-size: 12px;
  color: var(--muted);
}
.ask-drawer {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 10px;
}
.ask-drawer .target-chip {
  margin-top: 14px;
}
.ask-drawer .answer {
  min-height: 150px;
}
.compact-quick button {
  flex: 1 1 130px;
}

.readiness-card { padding-bottom: 14px; }
.readiness-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.readiness-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  min-height: 86px;
  padding: 11px;
  text-align: left;
  background: rgba(0,0,0,0.18);
}
.readiness-step-index {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(216, 197, 141, 0.18);
  color: #f3ddb0;
  font-size: 12px;
  font-weight: 700;
}
.readiness-step strong,
.readiness-step span,
.readiness-step small {
  display: block;
  min-width: 0;
}
.readiness-step strong { margin-bottom: 4px; }
.readiness-step span span { color: var(--text); font-size: 12px; line-height: 1.35; }
.readiness-step small { color: var(--muted); margin-top: 5px; line-height: 1.35; }

/* Art panel */
.art-body {
  overflow: hidden;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 18%, rgba(216, 197, 141, 0.10), transparent 28%),
    linear-gradient(180deg, #101114 0%, #07080a 100%);
}
.wall-kiosk {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
.wall-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
}
.wall-stage {
  display: grid;
  width: 100vw;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}
.wall-state-age { color: var(--accent); }
.wall-offline .wall-shell {
  background: linear-gradient(180deg, rgba(255, 70, 70, 0.08), transparent 34%);
}
.art-frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: 0;
  background: rgba(255,255,255,0.05);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
  overflow: hidden;
}
.art-frame.is-transitioning > .art-canvas {
  animation: artNewStateFade var(--art-transition-ms, 4000ms) ease both;
}
.art-canvas {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,0.15), transparent 20%),
    radial-gradient(circle at 50% 80%, rgba(255,255,255,0.08), transparent 24%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.015));
  transition: background 400ms ease, filter 400ms ease, opacity 400ms ease;
}
.art-transition-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  animation: artCrossfade var(--art-transition-ms, 4000ms) ease forwards;
}
.art-canvas::before,
.art-canvas::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.14), transparent, rgba(255,255,255,0.08), transparent);
  animation: spin 12s linear infinite;
  opacity: 0.45;
}
.art-canvas::after {
  inset: -45%;
  animation-duration: 23s;
  animation-direction: reverse;
  opacity: 0.25;
}
.art-label {
  position: absolute;
  left: clamp(20px, 4vw, 56px);
  bottom: clamp(20px, 4vh, 56px);
  width: min(520px, calc(100vw - 40px));
  box-sizing: border-box;
  border-radius: 8px;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 22px;
  backdrop-filter: blur(12px);
  z-index: 2;
}
.art-label h1,
.art-label h2 { margin: 0 0 6px; font-size: 38px; line-height: 1.02; }
.art-label p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
.art-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.art-metrics div {
  min-width: 0;
  border-top: 1px solid rgba(255,255,255,0.13);
  padding-top: 10px;
}
.art-metrics span,
.art-metrics strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}
.art-metrics span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.art-metrics strong {
  margin-top: 4px;
  font-size: 16px;
}
.art-frame.local > .art-canvas {
  background:
    repeating-linear-gradient(118deg, rgba(86, 165, 255, 0.42) 0 2px, transparent 2px 18px),
    radial-gradient(circle at 30% 24%, rgba(79, 156, 255, 0.38), transparent 28%),
    linear-gradient(180deg, #081735, #0b2448 54%, #06101f);
}
.art-frame.local > .art-canvas::before { background: repeating-linear-gradient(96deg, transparent 0 18px, rgba(146, 205, 255, 0.26) 18px 21px); animation: drift 7s linear infinite; }
.art-frame.local > .art-canvas::after { background: radial-gradient(circle at 70% 52%, rgba(64, 145, 255, 0.28), transparent 31%); }
.art-frame.remote > .art-canvas {
  background:
    radial-gradient(circle at 22% 22%, rgba(117, 255, 181, 0.95) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 30%, rgba(117, 255, 181, 0.72) 0 2px, transparent 3px),
    radial-gradient(circle at 38% 62%, rgba(117, 255, 181, 0.78) 0 2px, transparent 3px),
    radial-gradient(circle at 68% 76%, rgba(117, 255, 181, 0.82) 0 2px, transparent 3px),
    linear-gradient(180deg, #061f1b, #08291f 55%, #041512);
}
.art-frame.remote > .art-canvas::before { background: linear-gradient(32deg, transparent 19%, rgba(117, 255, 181, 0.26) 20%, transparent 21%, transparent 49%, rgba(117, 255, 181, 0.22) 50%, transparent 51%); animation: pulse 3.8s ease-in-out infinite; }
.art-frame.remote > .art-canvas::after { background: radial-gradient(circle at 48% 45%, rgba(69, 255, 172, 0.18), transparent 35%); }
.art-frame.cloud > .art-canvas {
  background:
    radial-gradient(circle at 50% 42%, rgba(194, 106, 255, 0.72), transparent 28%),
    radial-gradient(circle at 50% 42%, rgba(116, 56, 255, 0.36), transparent 46%),
    linear-gradient(180deg, #180825, #2a0b43 60%, #10051c);
}
.art-frame.cloud > .art-canvas::before { background: radial-gradient(circle, transparent 34%, rgba(218, 161, 255, 0.33) 35%, transparent 48%); animation: pulse 2.4s ease-in-out infinite; }
.art-frame.cloud > .art-canvas::after { background: conic-gradient(from 0deg, transparent, rgba(198, 128, 255, 0.28), transparent); }
.art-frame.backup > .art-canvas {
  background:
    repeating-linear-gradient(180deg, rgba(220, 232, 244, 0.36) 0 3px, transparent 3px 22px),
    linear-gradient(180deg, #111923, #202b35 60%, #091018);
}
.art-frame.backup > .art-canvas::before { background: repeating-linear-gradient(170deg, transparent 0 24px, rgba(238, 247, 255, 0.38) 24px 27px); animation: rain 1.9s linear infinite; }
.art-frame.backup > .art-canvas::after { background: radial-gradient(circle at 52% 72%, rgba(229, 216, 167, 0.20), transparent 34%); }
.art-frame.restore > .art-canvas {
  background:
    conic-gradient(from 24deg at 50% 48%, rgba(255, 222, 127, 0.72), rgba(255, 255, 255, 0.18), rgba(158, 112, 28, 0.48), rgba(255, 244, 201, 0.66)),
    linear-gradient(180deg, #1e1706, #32270b);
}
.art-frame.restore > .art-canvas::before { background: conic-gradient(from 0deg, transparent, rgba(255, 239, 186, 0.42), transparent 38%); animation: spin 8s linear infinite; }
.art-frame.restore > .art-canvas::after { background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.23), transparent 33%); }
.art-frame.approval {
  box-shadow: 0 40px 140px rgba(0,0,0,0.5), 0 0 0 2px rgba(255, 184, 77, 0.74), 0 0 44px rgba(255, 184, 77, 0.28);
}
.art-frame.approval > .art-canvas {
  background:
    linear-gradient(90deg, rgba(255, 184, 77, 0.36), transparent 14%, transparent 86%, rgba(255, 184, 77, 0.36)),
    linear-gradient(180deg, #241504, #3a2407 62%, #130c03);
}
.art-frame.approval > .art-canvas::before { background: conic-gradient(from 0deg, rgba(255, 184, 77, 0.16), transparent, rgba(255, 184, 77, 0.18)); animation: pulse 2.8s ease-in-out infinite; }
.art-frame.energy > .art-canvas {
  background:
    repeating-linear-gradient(14deg, rgba(255, 206, 75, 0.40) 0 3px, transparent 3px 24px),
    linear-gradient(180deg, #231a04, #3b2c08 58%, #111005);
}
.art-frame.energy > .art-canvas::before { background: radial-gradient(ellipse at 50% 50%, rgba(255, 217, 92, 0.36), transparent 46%); animation: drift 5.6s linear infinite; }
.art-frame.privacy > .art-canvas {
  background:
    linear-gradient(120deg, transparent 18%, rgba(148, 229, 208, 0.28) 19%, transparent 21%, transparent 78%, rgba(148, 229, 208, 0.22) 80%, transparent 82%),
    radial-gradient(circle at 50% 38%, rgba(122, 218, 195, 0.30), transparent 29%),
    linear-gradient(180deg, #071d1a, #0c2b26 58%, #04110f);
}
.art-frame.privacy > .art-canvas::before { background: conic-gradient(from 45deg, transparent, rgba(172, 255, 232, 0.24), transparent 31%); animation: spin 14s linear infinite; }
.art-frame.privacy > .art-canvas::after { background: radial-gradient(circle at 50% 50%, transparent 34%, rgba(172, 255, 232, 0.34) 35%, transparent 42%); }
.art-frame.outage {
  box-shadow: 0 40px 140px rgba(0,0,0,0.5), 0 0 0 2px rgba(204, 143, 55, 0.45), 0 0 40px rgba(204, 143, 55, 0.20);
}
.art-frame.outage > .art-canvas {
  background:
    linear-gradient(180deg, rgba(214, 143, 47, 0.22), transparent 38%),
    radial-gradient(circle at 50% 56%, rgba(213, 139, 35, 0.18), transparent 32%),
    linear-gradient(180deg, #150f07, #211407 62%, #080604);
  filter: saturate(0.72) brightness(0.86);
}
.art-frame.outage > .art-canvas::before { background: radial-gradient(ellipse at 50% 52%, rgba(225, 155, 61, 0.24), transparent 44%); animation: pulse 4.6s ease-in-out infinite; }
.art-frame.denied {
  box-shadow: 0 40px 140px rgba(0,0,0,0.5), 0 0 0 2px rgba(255, 70, 70, 0.55), 0 0 55px rgba(255, 70, 70, 0.35);
}
.art-frame.denied > .art-canvas {
  background:
    linear-gradient(90deg, rgba(255, 65, 65, 0.48), transparent 16%, transparent 84%, rgba(255, 65, 65, 0.48)),
    radial-gradient(circle at 50% 45%, rgba(255, 80, 80, 0.23), transparent 32%),
    linear-gradient(180deg, #2b0508, #170306);
}
.art-frame.denied > .art-canvas::before { background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(255, 90, 90, 0.30) 14px 17px); animation: pulse 1.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { to { transform: translate3d(28px, -18px, 0); } }
@keyframes pulse { 0%, 100% { opacity: 0.24; transform: scale(0.96); } 50% { opacity: 0.64; transform: scale(1.04); } }
@keyframes rain { to { transform: translate3d(-18px, 42px, 0); } }
@keyframes artCrossfade {
  from { opacity: 1; filter: blur(0); transform: scale(1); }
  to { opacity: 0; filter: blur(10px); transform: scale(1.012); }
}
@keyframes artNewStateFade {
  from { opacity: 0.72; filter: blur(6px) saturate(0.9); transform: scale(1.006); }
  to { opacity: 1; filter: blur(0) saturate(1); transform: scale(1); }
}

@media (orientation: portrait) {
  .wall-shell {
    width: 100vw;
    padding: 0;
  }
  .art-frame {
    width: 100vw;
    height: 100vh;
    max-height: none;
  }
  .art-label {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    padding: 14px;
  }
  .art-label h1,
  .art-label h2 {
    font-size: 28px;
  }
  .art-label p {
    font-size: 13px;
  }
  .art-metrics {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
  }
}

@media (max-width: 1000px) {
  .grid.two, .grid.three, .readiness-steps { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-actions { justify-content: flex-start; }
  .ops-topbar,
  .ops-body,
  .core-summary-card,
  .ops-workspace {
    grid-template-columns: 1fr;
  }
  .ops-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.12);
  }
  .ops-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .ops-nav-button {
    height: auto;
    min-height: 42px;
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
  }
  .ops-metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .core-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .registrar-wall-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .registrar-device-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .ask-drawer {
    position: static;
  }
}

@media (max-width: 520px) {
  .layout { width: min(100%, 390px); margin: 0; padding: 12px; }
  .card { padding: 16px; }
  .hero h1 { font-size: 27px; overflow-wrap: anywhere; }
  .hero p:last-child { overflow-wrap: anywhere; }
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .hero-actions .button,
  .hero-actions .pill {
    width: 100%;
  }
  .card-header .pill {
    flex: 1 1 100%;
    width: 100%;
  }
  .actions { flex-wrap: wrap; }
  .button, button { padding: 9px 12px; white-space: normal; }
  input, textarea, select { font-size: 16px; }
  .ops-main,
  .ops-sidebar {
    padding: 12px;
  }
  .ops-nav {
    grid-template-columns: 1fr 1fr;
  }
  .ops-metric-strip,
  .core-stat-grid,
  .registrar-wall-main,
  .registrar-wall-meta,
  .priority-row {
    grid-template-columns: 1fr;
  }
  .priority-row.header {
    display: none;
  }
  .ops-page-head {
    display: grid;
  }
}

/* Chat user app */
.chat-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: #0b0e11;
}

.chat-app {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12px;
}

.chat-auth-card h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.chat-status,
.chat-error {
  margin-top: 12px;
  color: var(--err-color);
  overflow-wrap: anywhere;
}

.chat-shell {
  --chat-rail-width: 260px;
  --context-edge-width: 42px;
  --context-drawer-width: min(380px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: var(--chat-rail-width) 8px minmax(0, 1fr) var(--context-edge-width);
  grid-template-rows: minmax(0, 1fr);
  min-height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  min-height: calc(100dvh - 24px);
  max-height: calc(100dvh - 24px);
  border: 1px solid #27313b;
  border-radius: 8px;
  overflow: hidden;
  background: #0f1317;
  box-shadow: 0 20px 70px rgba(0,0,0,0.35);
}

.chat-shell[hidden] {
  display: none;
}

.chat-rail,
.context-panel,
.conversation-panel {
  min-width: 0;
  min-height: 0;
}

.chat-rail {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-right: 1px solid #26303a;
  background: #11171d;
}

.chat-rail-resizer {
  position: relative;
  min-width: 8px;
  min-height: 0;
  border: 0;
  border-right: 1px solid #26303a;
  border-radius: 0;
  background: #0f1317;
  cursor: col-resize;
  touch-action: none;
}

.chat-rail-resizer:hover,
.chat-rail-resizer:focus-visible,
.chat-rail-resizer.is-dragging {
  background: #161d24;
}

.chat-rail-resizer::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255,255,255,0.24);
  transform: translate(-50%, -50%);
}

.chat-rail-is-resizing {
  cursor: col-resize;
  user-select: none;
}

.chat-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.chat-brand > div {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-brand strong,
.chat-brand span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.chat-brand strong {
  font-size: 16px;
}

.chat-brand-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.chat-brand-title-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-brand-status {
  min-width: 72px;
  min-height: 26px;
  justify-content: center;
  padding: 5px 10px;
  flex: 0 0 auto;
  font-size: 11px;
}

.chat-brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.chat-brand .chat-brand-status {
  display: inline-flex;
  min-width: 72px;
  margin-top: 0;
  color: #d9f8df;
}

.chat-profile-line {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  margin-top: 4px;
}

.chat-profile-line span,
.chat-profile-line a {
  margin-top: 0;
}

.account-menu {
  position: relative;
  min-width: 0;
  width: 100%;
}

.account-menu-button {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 3px 7px 3px 3px;
  border-radius: 8px;
  border-color: rgba(211, 179, 99, 0.20);
  background: rgba(245, 240, 230, 0.03);
  color: var(--muted);
  text-align: left;
}

.account-menu-button:hover,
.account-menu-button:focus-visible,
.account-menu.is-open .account-menu-button {
  background: rgba(211, 179, 99, 0.12);
  border-color: rgba(240, 216, 137, 0.44);
  color: var(--text);
  transform: none;
}

.chat-brand .profile-avatar {
  width: 20px;
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 20px;
  border: 1px solid rgba(211, 179, 99, 0.34);
  border-radius: 999px;
  background: rgba(211, 179, 99, 0.14);
  color: #f1d98e;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

#profile-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chevron-icon {
  width: 14px;
  height: 14px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-menu.is-open .account-chevron-icon {
  transform: rotate(180deg);
}

.account-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 35;
  display: grid;
  gap: 4px;
  width: min(240px, calc(100vw - 28px));
  padding: 6px;
  border: 1px solid rgba(240, 216, 137, 0.28);
  border-radius: 8px;
  background: #181511;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

.account-menu-note,
.account-menu-item {
  display: flex;
  align-items: center;
  min-height: 34px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.account-menu-note {
  color: #7e7463;
  cursor: default;
}

.account-menu-item:hover,
.account-menu-item:focus-visible {
  background: rgba(211, 179, 99, 0.13);
  color: var(--text);
  transform: none;
}

.thread-list {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: auto;
}

.thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
}

.thread-row.active {
  background: rgba(211, 179, 99, 0.16);
  border-color: rgba(211, 179, 99, 0.38);
}

.thread-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 9px 10px;
  border-color: transparent;
  background: transparent;
  text-align: left;
}

.thread-item:hover {
  transform: none;
  background: #1a222b;
}

.thread-item.active {
  background: transparent;
  border-color: transparent;
}

.icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

.button.small.icon-button,
button.small.icon-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}

.trash-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thread-delete-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 12px;
  opacity: 0.76;
}

.thread-delete-button:hover {
  opacity: 1;
}

.thread-item strong,
.thread-item span {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-item span {
  color: var(--muted);
  font-size: 12px;
}

.conversation-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #0f1317;
}

.conversation-topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid #26303a;
  background: #141a20;
}

.conversation-topbar h1 {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-list {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.chat-empty {
  display: grid;
  gap: 7px;
  width: min(520px, 100%);
  margin: clamp(18px, 5vh, 48px) auto 0;
  color: var(--muted);
  text-align: center;
}

.chat-empty strong {
  color: var(--text);
  font-size: 18px;
}

.chat-message {
  width: min(760px, 86%);
  display: grid;
  gap: 7px;
  padding: 12px 14px;
  border: 1px solid #27313b;
  border-radius: 8px;
  background: #141a20;
}

.chat-message.user {
  justify-self: end;
  background: rgba(211, 179, 99, 0.13);
  border-color: rgba(211, 179, 99, 0.32);
}

.chat-message.assistant {
  justify-self: start;
}

.chat-message p {
  margin: 0;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--muted);
  font-size: 14px;
}

.thinking-wheel {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid rgba(135, 215, 179, 0.2);
  border-top-color: rgba(135, 215, 179, 0.9);
  border-radius: 50%;
  animation: thinkingWheel 720ms linear infinite;
}

@keyframes thinkingWheel {
  to {
    transform: rotate(360deg);
  }
}

.chat-message small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.calendar-draft-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(211, 179, 99, 0.34);
  border-radius: 8px;
  background: rgba(211, 179, 99, 0.08);
}

.calendar-draft-card strong,
.calendar-draft-card span {
  overflow-wrap: anywhere;
}

.calendar-draft-conflict {
  border-color: rgba(255, 184, 77, 0.68);
  background: rgba(255, 184, 77, 0.11);
}

.calendar-conflict-copy {
  color: #f0c879 !important;
}

.calendar-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.message-meta strong {
  color: var(--text);
}

.chat-composer {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid #26303a;
  background: #141a20;
}

.composer-footer {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.composer-meta {
  display: grid;
  justify-items: start;
  gap: 8px;
  min-width: 0;
}

.composer-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.cloud-override-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cloud-override-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.cloud-toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid #465463;
  border-radius: 999px;
  background: #26303a;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cloud-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d8dde2;
  transition: transform 0.15s ease, background 0.15s ease;
}

.cloud-override-control.cloud-on {
  background: transparent;
}

.cloud-override-control.cloud-on .cloud-toggle-track {
  border-color: #d3b363;
  background: #d3b363;
}

.cloud-override-control.cloud-on .cloud-toggle-thumb {
  transform: translateX(19px);
  background: #11171d;
}

.cloud-override-copy {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.cloud-override-copy strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.1;
}

.cloud-override-copy small {
  color: var(--muted);
  line-height: 1.25;
}

.cloud-privacy-note {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.cloud-privacy-note strong {
  color: var(--chat-local);
  font-weight: 680;
}

.chat-composer textarea {
  min-height: 132px;
  max-height: 160px;
  resize: vertical;
}

.chat-composer button {
  min-height: 54px;
}

.context-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border-left: 1px solid #26303a;
  background: #11171d;
  overflow: auto;
}

.context-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #27313b;
  border-radius: 8px;
  background: #141a20;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-head h2,
.context-section h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: 0;
}

.section-head h2 {
  font-size: 15px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.context-section h3 {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.context-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.context-item,
.empty-state {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(0,0,0,0.18);
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.context-item {
  display: grid;
  gap: 5px;
}

.context-item strong,
.context-item span,
.context-item small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.context-item span,
.context-item small {
  color: var(--muted);
  line-height: 1.35;
}

.catalog-item,
.prompt-item,
.schedule-item,
.integration-item,
.personal-memory-item,
.managed-memory-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.catalog-item strong,
.catalog-item span,
.prompt-item strong,
.prompt-item span,
.prompt-item small,
.schedule-item strong,
.schedule-item span,
.schedule-item small,
.integration-item strong,
.integration-item span,
.integration-item small,
.personal-memory-item strong,
.personal-memory-item span,
.personal-memory-item small,
.managed-memory-item strong,
.managed-memory-item span,
.managed-memory-item small {
  grid-column: 1;
}

.catalog-item button,
.prompt-item button,
.schedule-item button,
.integration-item button,
.personal-memory-item button,
.managed-memory-item button {
  grid-column: 2;
  grid-row: 1 / span 4;
  min-width: 76px;
}

.prompt-actions,
.memory-actions {
  grid-column: 2;
  grid-row: 1 / span 4;
  display: grid;
  gap: 6px;
  justify-items: end;
  align-content: start;
}

.prompt-actions button,
.memory-actions button {
  grid-column: auto;
  grid-row: auto;
}

.personal-memory-item {
  align-items: start;
}

.global-memory-item {
  grid-template-columns: minmax(0, 1fr);
}

.global-memory-item.managed-memory-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.integration-actions {
  grid-column: 2;
  grid-row: 1 / span 4;
  display: grid;
  gap: 6px;
  justify-items: end;
}

.integration-actions button {
  grid-column: auto;
  grid-row: auto;
}

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

.sandbox-runtime {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

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

.schedule-run-status {
  color: var(--text);
}

.memory-actions .delete-icon-button {
  width: 30px;
  min-width: 30px;
  border-color: rgba(248, 113, 113, 0.38);
  color: #fca5a5;
  opacity: 1;
}

.memory-actions .delete-icon-button:hover {
  border-color: rgba(248, 113, 113, 0.58);
  background: rgba(248, 113, 113, 0.12);
}

.compact-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 8px;
}

.stacked-form {
  display: grid;
  gap: 8px;
}

.compact-form input,
.stacked-form input,
.stacked-form textarea {
  padding: 9px 10px;
  font-size: 13px;
}

@media (max-width: 1120px) {
  .chat-shell {
    grid-template-columns: var(--chat-rail-width) 8px minmax(0, 1fr) var(--context-edge-width);
    grid-template-rows: minmax(0, calc(100vh - 24px)) auto;
    grid-template-rows: minmax(0, calc(100dvh - 24px)) auto;
    max-height: none;
    overflow: visible;
  }

  .chat-rail,
  .conversation-panel {
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
  }

  .context-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-left: 0;
    border-top: 1px solid #26303a;
  }
}

@media (max-width: 760px) {
  .chat-app {
    padding: 0;
  }

  .chat-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 100vh) auto auto;
    grid-template-rows: minmax(0, 100dvh) auto auto;
    min-height: 100vh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .chat-rail-resizer {
    display: none;
  }

  .conversation-panel {
    order: 1;
    min-height: 0;
    height: 100vh;
    height: 100dvh;
  }

  .chat-rail {
    order: 2;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid #26303a;
  }

  .thread-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 70vw);
    overflow-x: auto;
  }

  .conversation-topbar {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .message-list {
    min-height: 0;
    padding: 14px;
  }

  .chat-message {
    width: 94%;
  }

  .context-panel {
    order: 3;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .chat-composer {
    grid-template-columns: 1fr;
  }

  .chat-composer button {
    min-height: 42px;
  }

  .catalog-item,
  .schedule-item,
  .compact-form {
    grid-template-columns: 1fr;
  }

  .catalog-item button,
  .schedule-item button {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }
}

/* Premium chat redesign */
.chat-body {
  --chat-bg: #0d0c0a;
  --chat-rail: #15130f;
  --chat-surface: #1b1812;
  --chat-surface-raised: #231f17;
  --chat-line: #3a3428;
  --chat-line-soft: rgba(222, 203, 160, 0.13);
  --chat-text: #f5f0e6;
  --chat-muted: #afa594;
  --chat-subtle: #7e7463;
  --chat-accent: #d7bd78;
  --chat-accent-strong: #f0d889;
  --chat-local: #87d7b3;
  --chat-warn: #e5b96d;
  --chat-error: #ef8c84;
  background: var(--chat-bg);
  color: var(--chat-text);
  font-family: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

.chat-body :focus-visible {
  outline: 2px solid var(--chat-accent-strong);
  outline-offset: 2px;
}

.chat-body .button,
.chat-body button,
.chat-body input,
.chat-body textarea,
.chat-body select {
  border-radius: 8px;
}

.chat-body .button,
.chat-body button {
  min-height: 36px;
}

.chat-body input,
.chat-body textarea,
.chat-body select {
  background: #12100c;
  border-color: #4b4232;
  color: var(--chat-text);
}

.chat-body input::placeholder,
.chat-body textarea::placeholder {
  color: #766d5e;
}

.chat-workspace {
  --chat-rail-width: 248px;
  --context-edge-width: 42px;
  --context-drawer-width: min(380px, calc(100vw - 48px));
  grid-template-columns: var(--chat-rail-width) 8px minmax(0, 1fr) var(--context-edge-width);
  border-color: var(--chat-line);
  background: var(--chat-bg);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.38);
}

.chat-rail,
.context-panel {
  background: var(--chat-rail);
}

.chat-rail-resizer {
  background: #100f0c;
  border-right-color: var(--chat-line);
}

.chat-rail-resizer:hover,
.chat-rail-resizer:focus-visible,
.chat-rail-resizer.is-dragging {
  background: var(--chat-surface);
}

.chat-rail-resizer::before {
  background: rgba(215, 189, 120, 0.42);
}

.conversation-panel {
  background: #100f0c;
}

.chat-brand strong,
.conversation-topbar h1 {
  color: var(--chat-text);
  font-weight: 680;
}

.chat-brand span,
.context-item span,
.context-item small,
.empty-state {
  color: var(--chat-muted);
}

.conversation-topbar,
.chat-composer {
  min-width: 0;
  max-width: 100%;
  background: var(--chat-surface);
  border-color: var(--chat-line);
}

.conversation-topbar {
  min-height: 64px;
}

.message-list {
  padding: 20px;
  background: #100f0c;
}

.chat-empty {
  text-align: left;
  margin: clamp(22px, 8vh, 72px) auto 0;
  padding: 0 16px;
}

.chat-empty strong {
  font-size: 20px;
  font-weight: 670;
}

.chat-message {
  width: min(780px, 88%);
  border-color: var(--chat-line);
  background: var(--chat-surface);
  box-shadow: none;
}

.chat-message.assistant {
  border-left-color: rgba(135, 215, 179, 0.4);
}

.chat-message.user {
  background: rgba(215, 189, 120, 0.12);
  border-color: rgba(215, 189, 120, 0.36);
}

.message-meta {
  color: var(--chat-subtle);
}

.message-meta strong {
  color: var(--chat-text);
}

.thinking-indicator {
  color: var(--chat-muted);
}

.chat-composer {
  min-width: 0;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 14px 16px;
}

.composer-label,
.field-label {
  color: var(--chat-muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
}

.composer-label {
  grid-column: 1 / -1;
  margin-bottom: -4px;
}

.chat-composer textarea {
  grid-column: 1 / -1;
  min-height: 132px;
}

.composer-footer {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  min-width: 0;
}

.composer-meta {
  display: grid;
  justify-items: start;
  gap: 8px;
  min-width: 0;
}

.composer-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.cloud-override-control {
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.cloud-override-control.cloud-on {
  background: transparent;
}

.cloud-override-control.cloud-on .cloud-toggle-track {
  background: var(--chat-accent);
  border-color: var(--chat-accent);
}

.chat-brand-status {
  border-color: rgba(135, 215, 179, 0.42);
  background: rgba(135, 215, 179, 0.10);
  color: #d9f8df;
}

#send-message-button {
  min-width: 132px;
  min-height: 64px;
  padding-inline: 24px;
  font-size: 18px;
}

.chat-body .button.primary {
  background: rgba(215, 189, 120, 0.18);
  border-color: rgba(240, 216, 137, 0.48);
  color: #fff4cd;
}

.chat-body .button.ghost {
  border-color: rgba(245, 240, 230, 0.13);
  color: var(--chat-muted);
}

.thread-row {
  border-radius: 8px;
}

.thread-row.active {
  background: rgba(215, 189, 120, 0.13);
  border-color: rgba(215, 189, 120, 0.34);
}

.thread-item {
  min-height: 50px;
}

.thread-item:hover {
  background: rgba(245, 240, 230, 0.06);
}

.context-panel {
  border-left-color: var(--chat-line);
}

.context-section {
  border-color: var(--chat-line);
  background: var(--chat-surface);
}

.context-section:not(.active) {
  display: none;
}

.context-item,
.empty-state {
  border-color: var(--chat-line-soft);
  background: #12100d;
}

.catalog-item,
.schedule-item,
.integration-item {
  gap: 6px 10px;
}

.compact-form,
.stacked-form {
  align-items: end;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) 72px;
}

.compact-form .field-label {
  grid-column: 1 / -1;
}

.stacked-form .field-label {
  margin-bottom: -4px;
}

.context-overlay {
  display: none;
}

.context-drawer-edges {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 24;
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  width: var(--context-edge-width);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--chat-line);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #14110d;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.24);
  transition: right 180ms ease;
  pointer-events: auto;
}

.context-drawer-open .context-drawer-edges {
  right: calc(12px + var(--context-drawer-width));
  border-radius: 8px 0 0 8px;
}

.context-drawer-edge {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--chat-line);
  background: #14110d;
  color: var(--chat-muted);
  cursor: grab;
  touch-action: pan-y;
  box-shadow: none;
}

.context-drawer-edge:last-child {
  border-bottom: 0;
}

.context-drawer-edge span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}

.context-drawer-edge:hover,
.context-drawer-edge:focus-visible,
.context-drawer-edge.active,
.context-drawer-edge.is-dragging-context-edge {
  background: var(--chat-surface-raised);
  border-color: rgba(215, 189, 120, 0.46);
  color: var(--chat-text);
  transform: none;
}

.context-drawer-edge.is-dragging-context-edge {
  cursor: grabbing;
}

.context-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 23;
  width: var(--context-drawer-width);
  max-width: var(--context-drawer-width);
  border-left: 1px solid var(--chat-line);
  border-top: 1px solid var(--chat-line);
  border-radius: 8px;
  transform: translateX(calc(100% + 48px));
  transition: transform 180ms ease;
  box-shadow: -28px 0 70px rgba(0, 0, 0, 0.44);
}

.context-panel.is-open {
  transform: translateX(0);
}

.context-overlay:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: block;
  width: 100vw;
  height: 100dvh;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.42);
}

@media (max-width: 1120px) {
  .chat-workspace {
    grid-template-columns: var(--chat-rail-width) 8px minmax(0, 1fr) var(--context-edge-width);
  }

  .context-panel {
    align-content: start;
  }
}

@media (max-width: 760px) {
  body.chat-body,
  .chat-app {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .chat-workspace {
    --context-edge-width: 36px;
    --context-drawer-width: calc(100vw - var(--context-edge-width));
    width: 100%;
    max-width: 100vw;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 100dvh) auto;
    padding-right: var(--context-edge-width);
    overflow-x: hidden;
    overflow-y: visible;
  }

  .conversation-panel,
  .chat-rail {
    width: 100%;
    max-width: 100%;
  }

  .chat-rail {
    border-right: 0;
    border-top: 1px solid var(--chat-line);
  }

  .thread-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    max-height: 280px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .thread-row {
    width: 100%;
  }

  .chat-body .button,
  .chat-body button,
  .chat-body input,
  .chat-body textarea,
  .chat-body select {
    min-height: 44px;
  }

  .account-menu-panel {
    position: fixed;
    top: auto;
    right: calc(var(--context-edge-width) + 10px);
    bottom: 78px;
    left: 10px;
    width: auto;
  }

  .context-panel {
    display: grid;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 23;
    box-sizing: border-box;
    width: var(--context-drawer-width);
    max-width: var(--context-drawer-width);
    height: 100dvh;
    grid-template-columns: 1fr;
    border-left: 1px solid var(--chat-line);
    border-top: 0;
    border-radius: 8px 0 0 8px;
    transform: translateX(calc(100% + var(--context-edge-width)));
    transition: transform 180ms ease;
    box-shadow: -28px 0 70px rgba(0, 0, 0, 0.44);
  }

  .context-panel.is-open {
    display: grid;
    transform: translateX(0);
  }

  .context-drawer-edges {
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--context-edge-width);
    grid-template-rows: repeat(5, minmax(0, 1fr));
    transform: none;
    gap: 0;
    border-radius: 8px 0 0 8px;
  }

  .context-drawer-open .context-drawer-edges {
    right: var(--context-drawer-width);
  }

  .context-drawer-edge {
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
  }

  .context-drawer-edge span {
    font-size: 10px;
  }

  .context-overlay:not([hidden]) {
    background: rgba(0, 0, 0, 0.48);
  }
}

@media (max-width: 520px) {
  .chat-composer {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .composer-footer {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  #retry-message-button,
  #cancel-message-button,
  #send-message-button {
    grid-column: 1;
    width: 100%;
  }

  .chat-message {
    width: 100%;
  }

  .compact-form {
    grid-template-columns: 1fr;
  }

  .compact-form button,
  .stacked-form button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-body *,
  .chat-body *::before,
  .chat-body *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .thinking-wheel {
    border-top-color: rgba(135, 215, 179, 0.45);
  }
}
