:root {
  color-scheme: dark;
  --bg: #090d12;
  --bg-2: #0d131b;
  --rail: #111821;
  --panel: rgba(24, 31, 42, 0.86);
  --panel-2: rgba(18, 25, 34, 0.96);
  --panel-3: #151d28;
  --line: rgba(150, 167, 190, 0.18);
  --line-strong: rgba(159, 120, 255, 0.52);
  --ink: #eef3fb;
  --muted: #9aa6b8;
  --quiet: #647084;
  --purple: #8f65ff;
  --purple-2: #5a37b8;
  --cyan: #3fd7f2;
  --green: #55d887;
  --amber: #f2b84b;
  --red: #ef5f67;
  --blue: #6ba6ff;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 35% 0%, rgba(143, 101, 255, 0.16), transparent 34%),
    radial-gradient(circle at 100% 18%, rgba(63, 215, 242, 0.08), transparent 24%),
    linear-gradient(135deg, #080b10 0%, #111923 50%, #080b10 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
}

.sidebar {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13, 20, 29, 0.98), rgba(10, 15, 21, 0.98));
  color: var(--ink);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  padding: 7px;
  background: linear-gradient(135deg, #f4efff, #261b4f);
  box-shadow: 0 0 0 1px rgba(143, 101, 255, 0.35), 0 0 28px rgba(143, 101, 255, 0.18);
}

.brand-name {
  font-weight: 780;
  line-height: 1.1;
}

.brand-mode {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
  text-transform: uppercase;
}

.nav-tabs {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.nav-tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  color: #d7deea;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav-tab:hover {
  border-color: rgba(143, 101, 255, 0.44);
  background: rgba(143, 101, 255, 0.1);
}

.nav-tab.is-active {
  background: linear-gradient(90deg, rgba(143, 101, 255, 0.28), rgba(143, 101, 255, 0.09));
  border-color: rgba(143, 101, 255, 0.58);
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--purple);
}

.sidebar-note {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.note-label {
  display: block;
  color: var(--green);
  font-weight: 760;
  margin-bottom: 4px;
}

.main {
  min-width: 0;
  padding: 24px 28px 34px;
}

.topbar {
  height: 58px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 780;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.6vw, 2.15rem);
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  margin-bottom: 14px;
}

h3 {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.topbar-status,
.status-row,
.filter-row,
.command-row,
.section-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.74rem;
  font-weight: 780;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-ok {
  color: #9ff0bc;
  border-color: rgba(85, 216, 135, 0.35);
  background: rgba(85, 216, 135, 0.11);
}

.status-warn {
  color: #ffd37d;
  border-color: rgba(242, 184, 75, 0.38);
  background: rgba(242, 184, 75, 0.12);
}

.status-danger {
  color: #ff9aa0;
  border-color: rgba(239, 95, 103, 0.36);
  background: rgba(239, 95, 103, 0.1);
}

.status-info {
  color: #9ddff0;
  border-color: rgba(63, 215, 242, 0.32);
  background: rgba(63, 215, 242, 0.09);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.grid,
.workbench-layout {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.65fr);
}

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

.panel,
.table-wrap,
.detail-drawer {
  background: linear-gradient(180deg, rgba(25, 33, 45, 0.92), rgba(16, 23, 33, 0.94));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.inspector {
  background: linear-gradient(180deg, rgba(22, 31, 42, 0.98), rgba(12, 18, 26, 0.98));
}

.panel-subtitle {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.ledger-layout,
.release-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 375px;
  gap: 12px;
}

.ledger-main {
  min-width: 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.025);
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover td,
.is-selected-row td {
  background: linear-gradient(90deg, rgba(143, 101, 255, 0.18), rgba(63, 215, 242, 0.04));
}

.project-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 760;
}

.project-glyph {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  color: #120d1f;
  background: var(--purple);
  font-size: 0.82rem;
  font-weight: 850;
}

.character-cell,
.inspector-hero {
  display: flex;
  align-items: center;
  gap: 10px;
}

.character-cell img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  object-position: left top;
  border-radius: 5px;
  border: 1px solid var(--line);
}

.inspector-hero {
  align-items: flex-start;
  margin-bottom: 14px;
}

.inspector-hero img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  object-position: left top;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #101722;
}

.subtext {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 3px;
}

.detail-drawer {
  padding: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.metric-grid div {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
  min-width: 0;
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.metric-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.metric-grid.cards {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.path-list,
.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.path-list li {
  min-width: 0;
}

.path-list strong {
  display: block;
  margin-bottom: 4px;
}

.command-box code,
#wizard-json,
#wizard-command {
  display: block;
  overflow-x: auto;
  color: #e8f1e5;
  background: #08100c;
  border: 1px solid rgba(85, 216, 135, 0.12);
  border-radius: 7px;
  padding: 10px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.path-list code {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  color: #e8f1e5;
  background: #08100c;
  border: 1px solid rgba(85, 216, 135, 0.12);
  border-radius: 7px;
  padding: 10px;
  font-size: 0.78rem;
  line-height: 1.38;
}

.toolbar-row {
  margin-bottom: 14px;
}

.project-switcher {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.86rem;
}

.project-switcher label {
  color: var(--ink);
  font-weight: 760;
}

.project-switcher select,
.filter-row input,
.wizard-form input,
.wizard-form select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(6, 10, 15, 0.74);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

.filter-row input {
  width: min(360px, 100%);
}

.snapshot-notice {
  color: var(--amber);
}

.stage-rail {
  display: grid;
  grid-template-columns: repeat(9, minmax(92px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding: 8px 0 12px;
}

.stage {
  min-height: 68px;
  border: 1px solid var(--line);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 10px 100%, 0 50%);
  background: linear-gradient(180deg, rgba(23, 31, 43, 0.95), rgba(9, 14, 20, 0.94));
  padding: 10px 14px;
}

.stage:has(.status-ok),
.stage:has(.status-warn) {
  border-color: rgba(143, 101, 255, 0.42);
}

.stage-name {
  display: block;
  font-weight: 780;
  margin-bottom: 7px;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.stage-meta {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.artifact-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
  min-height: 106px;
}

.artifact-card code {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  word-break: break-word;
}

.revision-packet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 14px 0;
}

.gate-box {
  border: 1px solid rgba(242, 184, 75, 0.32);
  border-radius: 7px;
  background: rgba(242, 184, 75, 0.08);
  color: #ffe1a0;
  padding: 12px;
  margin-bottom: 14px;
}

.gate-box p {
  margin: 6px 0 0;
  color: var(--muted);
}

.wizard-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.wizard-progress span {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 34px;
  display: grid;
  place-items: center;
  background: rgba(143, 101, 255, 0.11);
  color: #d7c9ff;
  font-size: 0.78rem;
  font-weight: 780;
}

.wizard-form {
  display: grid;
  gap: 12px;
}

.wizard-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.animation-table {
  min-width: 680px;
}

.review-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 12px;
}

.review-stage {
  min-height: 430px;
}

.clip-rail {
  align-self: start;
}

.receipt-panel,
.comparison-panel,
.command-panel {
  grid-column: span 1;
}

.command-panel {
  grid-column: 1 / -1;
}

.strip {
  min-height: 146px;
  display: grid;
  grid-template-columns: repeat(8, minmax(44px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.frame-cell,
.media-preview {
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.055) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.055) 75%),
    #111722;
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.frame-cell {
  border-radius: 6px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--quiet);
  font-size: 0.75rem;
  min-height: 116px;
}

.media-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 190px;
  display: grid;
  place-items: center;
  overflow: auto;
}

.media-preview img {
  max-width: 100%;
  image-rendering: auto;
  display: block;
}

.media-preview.is-wide {
  max-height: 390px;
}

.media-preview.is-stage {
  margin: 14px 0;
  max-height: 280px;
}

.links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.links-row a {
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: var(--cyan);
  background: rgba(255, 255, 255, 0.04);
}

.clip-list {
  display: grid;
  gap: 8px;
}

.clip-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  min-height: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  cursor: pointer;
}

.clip-button.is-active {
  border-color: var(--purple);
  box-shadow: inset 0 0 0 1px rgba(143, 101, 255, 0.55), 0 0 26px rgba(143, 101, 255, 0.14);
  background: linear-gradient(90deg, rgba(143, 101, 255, 0.18), rgba(143, 101, 255, 0.05));
}

.checklist {
  display: grid;
  gap: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.check-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.release-checks {
  grid-row: span 2;
}

.release-command {
  min-width: 0;
}

.release-boundary,
.release-media {
  grid-column: 2;
}

.handoff-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.note-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.note-list li + li {
  margin-top: 6px;
}

.command-box {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.command-row {
  justify-content: space-between;
}

.command-row h3 {
  margin-bottom: 0;
}

.action-stack {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.button {
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 38px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  cursor: pointer;
}

.button:hover {
  border-color: var(--purple);
}

.button.is-warning {
  border-color: rgba(242, 184, 75, 0.5);
  color: #ffd37d;
}

.button.is-danger {
  border-color: rgba(239, 95, 103, 0.5);
  color: #ff9aa0;
}

@media (max-width: 1180px) {
  .ledger-layout,
  .release-layout,
  .review-layout {
    grid-template-columns: 1fr;
  }

  .release-boundary,
  .release-media,
  .command-panel {
    grid-column: 1;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar {
    position: static;
    padding: 14px;
    max-width: 100vw;
    overflow: hidden;
  }

  .nav-tabs {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 2px;
  }

  .nav-tab {
    flex: 0 0 112px;
  }

  .sidebar-note {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .grid.two,
  .grid.three,
  .metric-grid.cards,
  .revision-packet-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    display: grid;
    padding-bottom: 14px;
  }
}

@media (max-width: 640px) {
  .nav-tabs {
    margin-inline: -4px;
    padding-inline: 4px;
  }

  .brand {
    align-items: flex-start;
  }

  .strip {
    grid-template-columns: repeat(3, minmax(58px, 1fr));
  }

  .wizard-progress {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
