:root {
  --ink: #111230;
  --ink-soft: #3f405a;
  --muted: #696a7f;
  --line: #dddde6;
  --canvas: #f6f6f8;
  --surface: #ffffff;
  --orange: #e83d05;
  --orange-dark: #bd3000;
  --gold: #f4cf26;
  --blue: #285fae;
  --green: #146c35;
  --red: #b42318;
  --home: #326cbc;
  --ev: #f06421;
  --grid: #6d7280;
  --shadow: 0 16px 42px rgba(17, 18, 48, 0.08);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(
      circle at 72% 0%,
      rgba(244, 207, 38, 0.13),
      transparent 28rem
    ),
    var(--canvas);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(40, 95, 174, 0.42);
  outline-offset: 3px;
}

.topbar,
main,
footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding-block: 14px;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand-product {
  padding-left: 9px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-weight: 650;
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 25px;
  height: 25px;
  padding: 4px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffc934, var(--orange));
  box-shadow: 0 6px 14px rgba(232, 61, 5, 0.2);
}

.brand-mark span {
  display: block;
  width: 4px;
  border-radius: 4px;
  background: white;
  transform: skewY(-18deg);
}

.brand-mark span:nth-child(1) {
  height: 7px;
}

.brand-mark span:nth-child(2) {
  height: 14px;
}

.brand-mark span:nth-child(3) {
  height: 10px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.badge,
.status-badge,
.snapshot-label,
.evidence-count,
.detail-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}

.badge-synthetic {
  border: 1px solid #dac059;
  background: #fff8d7;
  color: #715700;
}

.model-path {
  overflow: hidden;
  max-width: 220px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  border: 1px solid transparent;
  text-transform: capitalize;
}

.status-initial,
.status-waiting {
  border-color: var(--line);
  background: #f1f1f5;
  color: #505164;
}

.status-queued,
.status-running {
  border-color: #b9cceb;
  background: #edf4ff;
  color: #174f9b;
}

.status-completed,
.status-approved {
  border-color: #a9d5b9;
  background: #edf9f1;
  color: var(--green);
}

.status-failed,
.status-rejected,
.status-stale {
  border-color: #e7b4af;
  background: #fff0ef;
  color: var(--red);
}

.status-pending {
  border-color: #dfc461;
  background: #fff8d9;
  color: #715700;
}

.text-button {
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #55566a;
  font-size: 11px;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.text-button:not(:disabled):hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

.error-banner {
  margin: 4px 0 14px;
  padding: 12px 15px;
  border: 1px solid #e7b4af;
  border-radius: 12px;
  background: #fff0ef;
  color: #8f1f16;
  font-size: 12px;
  font-weight: 700;
}

.demo-shell {
  display: grid;
  gap: 14px;
}

.decision-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(340px, 0.84fr);
  align-items: stretch;
  gap: 14px;
}

.summary-card,
.proposal-card,
.evidence-section,
.detail-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-card,
.proposal-card {
  padding: 22px;
}

.summary-meta,
.card-heading,
.section-heading,
.allocation-heading,
.summary-actions,
.proposal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0;
  color: var(--orange-dark);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.snapshot-label {
  min-height: 25px;
  border: 1px solid #b9cceb;
  background: #edf4ff;
  color: #174f9b;
}

.snapshot-label.historical {
  border-color: #dfc461;
  background: #fff8d9;
  color: #715700;
}

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

h1 {
  max-width: 770px;
  margin: 16px 0 10px;
  font-size: clamp(32px, 3.6vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.047em;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.allocation {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafafd;
}

.allocation-heading {
  margin-bottom: 9px;
}

.allocation-heading div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.allocation-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.allocation-heading strong {
  font-size: 16px;
}

.allocation-bar {
  display: flex;
  overflow: hidden;
  width: 100%;
  height: 18px;
  border: 2px solid white;
  border-radius: 7px;
  background: #e6e6ec;
  box-shadow: 0 0 0 1px var(--line);
}

.allocation-segment {
  flex-basis: 0;
  min-width: 2px;
}

.allocation-segment + .allocation-segment {
  border-left: 2px solid white;
}

.segment-home,
.legend-home {
  background: var(--home);
}

.segment-ev,
.legend-ev {
  background: var(--ev);
}

.segment-grid,
.legend-grid {
  background: var(--grid);
}

.allocation-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 9px;
}

.allocation-legend div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
}

.allocation-legend i {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.allocation-legend strong {
  margin-left: auto;
  color: var(--ink);
  font-size: 11px;
}

.summary-actions {
  justify-content: flex-start;
  margin-top: 15px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 800;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.button-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 8px 18px rgba(232, 61, 5, 0.18);
}

.button-primary:not(:disabled):hover {
  background: var(--orange-dark);
}

.button-secondary {
  border-color: #cfd0da;
  background: white;
  color: var(--ink-soft);
}

.button-secondary:not(:disabled):hover {
  border-color: #a7a8b7;
  background: #f7f7fa;
}

.button-full {
  width: 100%;
}

.card-heading {
  align-items: flex-start;
  margin-bottom: 17px;
}

.card-heading .eyebrow,
.section-heading .eyebrow {
  margin-bottom: 5px;
}

.proposal-diff {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid #f0c4b5;
  border-radius: 13px;
  background: #fff8f4;
}

.proposal-diff div {
  min-width: 0;
  text-align: center;
}

.proposal-diff span,
.proposal-diff strong,
.proposal-diff small {
  display: block;
}

.proposal-diff span,
.proposal-diff small {
  color: var(--muted);
  font-size: 10px;
}

.proposal-diff strong {
  margin-block: 3px;
  font-size: 19px;
  letter-spacing: -0.025em;
}

.diff-arrow {
  color: var(--orange) !important;
  font-size: 20px !important;
}

.proposal-rationale {
  min-height: 38px;
  margin: 13px 0 6px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.45;
}

.proposal-base {
  overflow: hidden;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-gate {
  min-height: 39px;
  margin-bottom: 13px;
  padding: 9px 10px;
  border-radius: 9px;
  background: #f4f4f7;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.4;
}

.proposal-actions .button {
  flex: 1;
}

.evidence-section {
  padding: 17px 20px 19px;
}

.section-heading {
  margin-bottom: 12px;
}

.evidence-count,
.detail-count {
  min-height: 25px;
  border: 1px solid var(--line);
  background: #f4f4f7;
  color: var(--muted);
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.evidence-item {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  gap: 9px;
  min-width: 0;
  padding: 11px;
  border: 1px solid #cfe1d5;
  border-radius: 11px;
  background: #f5fbf7;
}

.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: #dcefe3;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.evidence-item h3 {
  margin-bottom: 3px;
  font-size: 11px;
  line-height: 1.25;
}

.evidence-item p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.evidence-item.evidence-unverified {
  border-color: #e7b4af;
  background: #fff7f6;
}

.evidence-unverified .check {
  background: #f9dfdc;
  color: var(--red);
}

.details-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-card {
  overflow: hidden;
  box-shadow: none;
}

.detail-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 57px;
  padding: 11px 15px;
  cursor: pointer;
  list-style: none;
}

.detail-card summary::-webkit-details-marker {
  display: none;
}

.detail-card summary::after {
  color: var(--muted);
  content: "+";
  font-size: 17px;
  font-weight: 600;
}

.detail-card[open] summary::after {
  content: "−";
}

.detail-card summary > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.detail-card summary strong {
  font-size: 11px;
}

.detail-card summary small {
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-card summary .detail-count {
  margin-left: auto;
}

.detail-card[open] summary {
  border-bottom: 1px solid var(--line);
}

.detail-intro {
  margin: 0;
  padding: 12px 15px 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.45;
}

.tool-trace {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 12px 15px 15px;
  list-style: none;
}

.trace-item {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafafd;
}

.trace-heading {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.trace-heading strong {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-sequence {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 7px;
  background: #e8f0fb;
  color: #174f9b;
  font-size: 9px;
  font-weight: 850;
}

.trace-status {
  color: var(--green);
  font-size: 8px;
  font-weight: 800;
}

.trace-failed .trace-sequence {
  background: #f9dfdc;
  color: var(--red);
}

.trace-failed .trace-status {
  color: var(--red);
}

.trace-output {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 3px 8px;
  margin: 7px 0 0 30px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 8px;
}

.trace-output dt,
.trace-output dd {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-output dt {
  font-weight: 700;
}

.audit-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 12px 15px 15px;
}

.audit-item {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafafd;
}

.audit-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.audit-heading strong {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.audit-actor {
  color: var(--orange-dark);
  font-size: 7px;
  font-weight: 850;
  text-transform: uppercase;
}

.audit-item p {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 8px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.audit-item time {
  color: var(--muted);
  font-size: 8px;
}

.disclosure-panel {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid #dfc461;
  border-radius: 11px;
  background: #fff9dc;
  color: #5e4a00;
  font-size: 9px;
  line-height: 1.4;
}

.disclosure-panel strong {
  flex: 0 0 auto;
  color: #4f3e00;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 25px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.footer-link {
  color: var(--ink-soft);
  text-underline-offset: 3px;
}

.footer-link:hover {
  color: var(--orange-dark);
}

.access-dialog {
  width: min(430px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: white;
  box-shadow: 0 30px 90px rgba(17, 18, 48, 0.3);
}

.access-dialog::backdrop {
  background: rgba(17, 18, 48, 0.45);
  backdrop-filter: blur(7px);
}

.access-dialog form {
  padding: 27px;
}

.dialog-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 34px;
  font-size: 14px;
  font-weight: 800;
}

.access-dialog h2 {
  margin: 6px 0 9px;
  font-size: 27px;
  letter-spacing: -0.035em;
}

.access-dialog p:not(.eyebrow) {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.access-dialog label {
  display: block;
  margin: 17px 0 6px;
  font-size: 11px;
  font-weight: 800;
}

.access-dialog input {
  width: 100%;
  height: 48px;
  margin-bottom: 12px;
  padding: 0 13px;
  border: 1px solid #c8c9d4;
  border-radius: 10px;
}

.access-dialog small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.field-error {
  margin: 0 0 11px !important;
  color: var(--red) !important;
  font-size: 10px !important;
  font-weight: 750;
}

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

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

@media (max-width: 680px) {
  .topbar,
  main,
  footer {
    width: min(100% - 28px, 1180px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topbar-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
  }

  .summary-card,
  .proposal-card,
  .evidence-section {
    padding: 17px;
  }

  .summary-meta,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  h1 {
    font-size: clamp(30px, 10vw, 40px);
  }

  .allocation-heading {
    align-items: flex-start;
  }

  .allocation-heading > span {
    text-align: right;
  }

  .allocation-legend {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .allocation-legend strong {
    margin-left: 0;
  }

  .summary-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 2px;
  }

  .evidence-grid,
  .details-section {
    grid-template-columns: 1fr;
  }

  .audit-list {
    grid-template-columns: 1fr;
  }

  .disclosure-panel,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 380px) {
  .brand-product {
    padding-left: 0;
    border-left: 0;
  }

  .proposal-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
