:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ice-blue: #aed5f5;
  --azure-blue: #367adf;
  --fresh-sky: #4face5;
  --french-blue: #394988;
  --charcoal-blue: #353a4c;
  --midnight: #070b16;
  --surface: rgba(18, 28, 55, .8);
  --surface-strong: rgba(25, 37, 75, .92);
  --line: rgba(174, 213, 245, .15);
  --text: #f4f8ff;
  --muted: #a9b7cf;
  --safe: #7ee2be;
  --warning: #ffd083;
  --danger: #ff9da8;
  --shadow: 0 24px 65px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { background: var(--midnight); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 2%, rgba(54, 122, 223, .23), transparent 26rem),
    radial-gradient(circle at 86% 12%, rgba(79, 172, 229, .16), transparent 24rem),
    radial-gradient(circle at 52% 102%, rgba(57, 73, 136, .32), transparent 40rem),
    var(--midnight);
}
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: .36;
  background-image: linear-gradient(rgba(174, 213, 245, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(174, 213, 245, .025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black, transparent 78%);
}
button, textarea { font: inherit; }
button { cursor: pointer; }

.intro-stage {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  overflow: hidden;
  place-items: end center;
  isolation: isolate;
  background: var(--midnight);
  transition: opacity .42s ease, visibility .42s ease;
}
.intro-stage[data-dismissed="true"] { visibility: hidden; opacity: 0; }
.intro-video { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.intro-scrim {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 11, 22, .26), rgba(7, 11, 22, .18) 42%, rgba(7, 11, 22, .94)), linear-gradient(90deg, rgba(7, 11, 22, .52), transparent 50%, rgba(7, 11, 22, .48));
}
.intro-copy { width: min(760px, calc(100% - 40px)); padding: 0 0 clamp(42px, 8vh, 92px); text-align: center; text-wrap: balance; }
.intro-copy .eyebrow { color: var(--fresh-sky); }
.intro-copy h1 { max-width: 15ch; margin: 0 auto 15px; font-size: clamp(2.1rem, 5vw, 4.4rem); line-height: .98; letter-spacing: -.057em; }
.intro-copy p:not(.eyebrow) { margin: 0 auto 26px; color: var(--ice-blue); font-size: clamp(.95rem, 2vw, 1.12rem); }
.intro-enter { border: 1px solid rgba(174, 213, 245, .5); border-radius: 999px; padding: 12px 17px; color: var(--text); background: rgba(7, 11, 22, .45); box-shadow: 0 12px 32px rgba(0, 0, 0, .24), inset 0 1px rgba(255,255,255,.12); backdrop-filter: blur(12px); transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.intro-enter:hover { border-color: var(--fresh-sky); background: rgba(54, 122, 223, .24); transform: translateY(-2px); }
.intro-enter span { margin-left: 5px; color: var(--fresh-sky); }

.topbar, .layout, footer { position: relative; width: min(1240px, calc(100% - 40px)); margin-inline: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px 0 23px; }
.product-mark { display: flex; align-items: center; gap: 13px; }
.product-mark-icon { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(79, 172, 229, .6); border-radius: 12px; color: var(--ice-blue); background: linear-gradient(145deg, rgba(79, 172, 229, .3), rgba(57, 73, 136, .48)); box-shadow: 0 0 34px rgba(54, 122, 223, .22); font-size: 1.55rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(1.2rem, 2.5vw, 1.55rem); letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 1.08rem; letter-spacing: -.027em; }
.eyebrow, .kicker, .label { margin-bottom: 7px; color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow { color: var(--fresh-sky); }
.subtitle { margin: 0; color: var(--muted); font-size: .79rem; }
.status-cluster { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.status, .severity, .counter, .live-dot, .nav-pill { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; font-size: .69rem; font-weight: 750; white-space: nowrap; }
.status-safe { color: var(--safe); background: rgba(126, 226, 190, .075); }
.status-warn { color: var(--warning); background: rgba(255, 208, 131, .07); }
.status-ready { color: var(--ice-blue); background: rgba(79, 172, 229, .105); }
.severity { color: var(--danger); background: rgba(255, 157, 168, .08); }
.counter { color: var(--warning); background: rgba(255, 208, 131, .07); }
.live-dot { color: var(--safe); padding: 5px 8px; }
.nav-pill { color: var(--muted); text-decoration: none; background: rgba(255,255,255,.025); transition: border-color .15s ease, color .15s ease, transform .15s ease; }
.nav-pill:hover { border-color: rgba(174, 213, 245, .44); color: var(--text); transform: translateY(-1px); }
.nav-pill.active { border-color: rgba(79, 172, 229, .48); color: var(--ice-blue); background: rgba(54, 122, 223, .16); }

.layout { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(310px, .92fr); gap: 15px; }
.workspace-intro { display: flex; grid-column: 1 / -1; align-items: end; justify-content: space-between; gap: 28px; padding: 20px 2px 10px; }
.workspace-intro h2 { max-width: 690px; font-size: clamp(1.28rem, 2vw, 1.75rem); line-height: 1.13; text-wrap: balance; }
.workspace-intro > p { max-width: 390px; margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.55; }
.panel { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 19px; padding: 21px; background: linear-gradient(135deg, var(--surface-strong), var(--surface)); box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.04); backdrop-filter: blur(18px); }
.panel::after { position: absolute; top: 0; right: 16px; left: 16px; height: 1px; content: ""; background: linear-gradient(90deg, transparent, rgba(174, 213, 245, .28), transparent); }
.case-panel { grid-row: span 2; }
.history-panel { grid-column: 1 / -1; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.panel-heading.compact { margin-bottom: 14px; }
.case-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0 0 17px; }
.case-grid > div { border: 1px solid rgba(174, 213, 245, .1); border-radius: 12px; padding: 11px; background: rgba(7, 11, 22, .18); }
dt { margin-bottom: 4px; color: var(--muted); font-size: .7rem; }
dd { margin: 0; color: var(--ice-blue); font-size: .88rem; font-weight: 720; }
.context-box, .draft-box, .empty-card { border: 1px solid rgba(174, 213, 245, .11); border-radius: 13px; padding: 14px; color: var(--ice-blue); background: rgba(7, 11, 22, .27); line-height: 1.55; }
.context-box p:last-child { margin-bottom: 0; }
.shared-state { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.shared-state p { margin-bottom: 0; color: var(--muted); font-size: .78rem; }
.shared-state .label { margin-bottom: 4px; color: var(--fresh-sky); }
#work-plan { margin: 0; padding-left: 1.2rem; color: var(--ice-blue); }
#work-plan li { padding: 6px 0 6px 3px; line-height: 1.4; }
.empty-state, .empty-text { color: var(--muted) !important; }
.empty-text { font-style: italic; }
.microcopy { margin: 9px 0 0; color: var(--muted); font-size: .71rem; line-height: 1.45; }
.capability-copy { margin: -4px 0 12px; }

.trinidad-boundary { transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.trinidad-boundary.trinidad-pulse {
  border-color: rgba(126, 226, 190, .62);
  box-shadow: var(--shadow), 0 0 0 3px rgba(126, 226, 190, .09), 0 0 42px rgba(79, 172, 229, .16);
  animation: trinidad-attention 1.1s ease-out 1;
}
@keyframes trinidad-attention {
  0% { transform: scale(.992); }
  45% { transform: scale(1.006); }
  100% { transform: scale(1); }
}

.approval-list { display: grid; gap: 10px; }
.approval-card { border: 1px solid rgba(255, 208, 131, .28); border-radius: 14px; padding: 14px; background: linear-gradient(135deg, rgba(255, 208, 131, .075), rgba(57, 73, 136, .13)); }
.approval-card[data-status="approved"] { border-color: rgba(126, 226, 190, .3); background: rgba(126, 226, 190, .065); }
.approval-card[data-status="rejected"] { border-color: rgba(255, 157, 168, .26); opacity: .78; }
.approval-card[data-status="executed"] { border-color: rgba(79, 172, 229, .3); background: rgba(79, 172, 229, .08); }
.approval-card h3 { margin: 0 0 7px; font-size: .92rem; }
.approval-card p { margin: 0 0 11px; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.approval-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.approval-state { color: var(--ice-blue); font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.button-row { display: flex; gap: 8px; }
button:not(.intro-enter) { border: 1px solid rgba(174, 213, 245, .2); border-radius: 9px; padding: 8px 11px; color: var(--text); background: rgba(255,255,255,.045); font-size: .74rem; font-weight: 800; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
button:not(.intro-enter):hover { border-color: rgba(79, 172, 229, .58); background: rgba(54, 122, 223, .16); transform: translateY(-1px); }
button.approve { color: var(--safe); }
button.reject { color: var(--danger); }
button:disabled { cursor: default; opacity: .45; transform: none !important; }
.field-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .76rem; font-weight: 800; }
textarea { width: 100%; min-height: 150px; resize: vertical; border: 1px solid rgba(174, 213, 245, .15); border-radius: 13px; outline: none; padding: 13px; color: var(--text); background: rgba(7, 11, 22, .35); line-height: 1.5; }
textarea:focus { border-color: var(--fresh-sky); box-shadow: 0 0 0 3px rgba(79, 172, 229, .12); }
.form-actions { margin-top: 10px; }
.capability-tree { max-height: 470px; margin: 0; overflow: auto; border: 1px solid rgba(174, 213, 245, .1); border-radius: 13px; padding: 14px; color: var(--ice-blue); background: rgba(4, 7, 15, .5); font: 500 .72rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.history-item { display: grid; grid-template-columns: 84px 1fr; gap: 13px; padding: 11px 0; border-top: 1px solid var(--line); }
.history-item:first-child { border-top: 0; }
.history-time { color: var(--fresh-sky); font-size: .75rem; font-variant-numeric: tabular-nums; }
.history-text { color: var(--ice-blue); font-size: .82rem; }
footer { padding: 22px 0 42px; color: var(--muted); font-size: .73rem; }
footer p { margin: 0; }
@media (max-width: 840px) { .topbar { align-items: flex-start; flex-direction: column; } .status-cluster { justify-content: flex-start; } .layout { grid-template-columns: 1fr; } .workspace-intro { align-items: flex-start; flex-direction: column; gap: 10px; } .case-panel, .history-panel { grid-row: auto; grid-column: auto; } }
@media (max-width: 560px) { .topbar, .layout, footer { width: min(100% - 28px, 1240px); } .topbar { padding-top: 20px; } .case-grid { grid-template-columns: 1fr; } .panel { border-radius: 16px; padding: 17px; } .history-item { grid-template-columns: 68px 1fr; } .intro-copy { width: min(100% - 28px, 760px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
