:root {
  color-scheme: light;
  --ink: #14212c;
  --muted: #61717f;
  --faint: #8a98a5;
  --line: #d9e1e7;
  --panel: #ffffff;
  --panel-soft: #f7fafb;
  --navy: #0d2636;
  --navy-2: #123449;
  --blue: #1463b8;
  --teal: #1f9aa7;
  --teal-soft: #e7f6f7;
  --green: #177a4d;
  --green-soft: #e6f4ee;
  --amber: #a86f12;
  --amber-soft: #fff3d8;
  --red: #b93636;
  --red-soft: #fdeaea;
  --shadow: 0 18px 50px rgba(13, 38, 54, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #edf2f5;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body.drawer-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.brand-name {
  font-weight: 760;
  line-height: 1.15;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.engine-pill {
  margin-left: auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
}

.content-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 0;
}

.side-panel {
  background: var(--navy);
  color: #ffffff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.side-block {
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.side-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.side-panel .eyebrow {
  color: #75d6df;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.15;
}

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

h3 {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.2;
}

.side-stats {
  margin: 20px 0 0;
  display: grid;
  gap: 12px;
}

.side-stats div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.side-stats dt,
.side-rule span {
  color: rgba(255, 255, 255, 0.68);
}

.side-stats dd {
  margin: 0;
  font-weight: 800;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  font-weight: 800;
  white-space: nowrap;
}

.button.primary {
  background: var(--blue);
  color: #ffffff;
}

.button.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--navy);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.side-rule {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.side-rule strong {
  text-align: right;
}

.main-panel {
  min-width: 0;
  padding: 24px;
  overflow: auto;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(500px, 1.1fr) minmax(420px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-heading {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-heading.compact {
  min-height: 60px;
}

.is-hidden {
  display: none !important;
}

.revision-chip,
.decision-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: #126972;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.revision-chip.is-warning,
.decision-badge.is-warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.revision-chip.is-blocked,
.decision-badge.is-blocked {
  background: var(--red-soft);
  color: var(--red);
}

.form-panel {
  overflow: hidden;
}

.form-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-child {
  border-bottom: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title span {
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

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

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

.field-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.secondary-field-row {
  margin-top: 12px;
  align-items: end;
}

.basis-note {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field > span,
.check-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.field input,
.field select {
  height: 40px;
  padding: 0 11px;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.35;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 154, 167, 0.15);
}

.field.is-disabled {
  opacity: 0.58;
}

.field.is-disabled select,
.check-field.is-disabled {
  cursor: not-allowed;
}

.check-field.is-disabled {
  opacity: 0.58;
}

.check-field.is-disabled input {
  cursor: not-allowed;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.segmented.two-option {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.segmented button.is-active {
  color: var(--navy);
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(13, 38, 54, 0.12);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.check-field {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.hazardous-detail-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.decision-stack {
  display: grid;
  gap: 20px;
}

.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.recommendation-item {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.recommendation-item:nth-child(2n),
.recommendation-item.wide {
  border-right: 0;
}

.recommendation-item.wide {
  grid-column: 1 / -1;
}

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

.recommendation-item strong {
  font-size: 19px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.utilization-block {
  padding: 18px;
}

.utilization-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.utilization-header span {
  color: var(--muted);
  font-weight: 750;
}

.utilization-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #e1e8ed;
  overflow: hidden;
}

.target-band {
  position: absolute;
  left: 35%;
  width: 40%;
  height: 100%;
  background: rgba(31, 154, 167, 0.26);
}

.utilization-fill {
  position: relative;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
}

.utilization-fill.is-warning {
  background: var(--amber);
}

.utilization-fill.is-blocked {
  background: var(--red);
}

.utilization-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.utilization-scale span {
  width: 28px;
  text-align: center;
}

.utilization-scale span:first-child {
  text-align: left;
}

.utilization-scale span:last-child {
  text-align: right;
}

.approval-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.approval-grid strong {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.approval-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.approval-grid div {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.approval-grid div:last-child {
  border-right: 0;
}

.approval-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 16px;
}

.risk-panel {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.risk-heading {
  display: grid;
  gap: 4px;
}

.risk-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.risk-heading strong {
  line-height: 1.25;
}

.risk-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.override-fields {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.review-launch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.review-launch-button {
  position: relative;
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px 68px 14px 16px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: inherit;
  background: #ffffff;
  text-align: left;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.review-launch-button:last-child {
  border-right: 0;
}

.review-launch-button:hover,
.review-launch-button:focus-visible {
  background: var(--panel-soft);
  box-shadow: inset 0 0 0 2px rgba(20, 99, 184, 0.16);
  outline: none;
}

.review-launch-button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.review-launch-button strong {
  line-height: 1.25;
}

.review-launch-button em {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(20, 99, 184, 0.22);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.review-grid div {
  min-height: 46px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.review-grid div:nth-child(2n) {
  border-right: 0;
}

.review-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.review-grid strong {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.trace-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.trace-list li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.trace-list .trace-group {
  display: block;
  padding: 10px 18px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.trace-list li:last-child {
  border-bottom: 0;
}

.trace-code {
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.trace-title {
  font-weight: 800;
}

.trace-detail {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(13, 38, 54, 0.36);
}

.offcanvas {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(560px, 100vw);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -24px 0 60px rgba(13, 38, 54, 0.24);
}

.offcanvas-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.offcanvas-body {
  min-height: 0;
  overflow: auto;
}

.icon-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--navy);
  background: #ffffff;
  font-weight: 800;
}

.drawer-review-grid {
  border-top: 0;
}

.drawer-trace-list {
  border-top: 0;
}

@media (max-width: 1180px) {
  .content-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    display: none;
  }

  .workspace-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 14px;
    gap: 12px;
  }

  .brand {
    min-width: 0;
    width: 100%;
  }

  .engine-pill {
    margin-left: 0;
  }

  .main-panel {
    padding: 12px;
  }

  .field-grid.two,
  .field-grid.three,
  .field-grid.four,
  .check-grid,
  .recommendation-grid,
  .review-launch-grid,
  .review-grid,
  .approval-grid {
    grid-template-columns: 1fr;
  }

  .recommendation-item,
  .review-launch-button,
  .review-grid div,
  .approval-grid div {
    border-right: 0;
  }

  .approval-actions {
    flex-direction: column-reverse;
  }

  .approval-actions .button {
    width: 100%;
    white-space: normal;
  }

  .trace-list li {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

}
