:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #64706b;
  --line: #d9ded8;
  --paper: #f6f7f3;
  --panel: #ffffff;
  --field: #eef1eb;
  --forest: #173d32;
  --moss: #6f8f5a;
  --amber: #c78328;
  --red: #b64a3b;
  --blue: #356b8c;
  --shadow: 0 18px 45px rgba(23, 33, 29, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(23, 61, 50, 0.08), transparent 36%),
    repeating-linear-gradient(90deg, rgba(23, 33, 29, 0.035) 0 1px, transparent 1px 68px),
    var(--paper);
  color: var(--ink);
}

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

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background: var(--forest);
  color: #f9fbf5;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.09);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: rgba(249, 251, 245, 0.68);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  color: rgba(249, 251, 245, 0.74);
  background: transparent;
  text-align: left;
  padding: 11px 12px;
  cursor: pointer;
  text-decoration: none;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.rule-card {
  margin-top: auto;
  padding: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.rule-card span {
  color: rgba(249, 251, 245, 0.62);
  font-size: 12px;
  text-transform: uppercase;
}

.rule-card strong {
  display: block;
  margin-top: 8px;
}

.rule-card p {
  margin: 8px 0 0;
  color: rgba(249, 251, 245, 0.7);
  line-height: 1.45;
}

.rule-card small {
  display: block;
  margin-top: 12px;
  color: rgba(249, 251, 245, 0.58);
  line-height: 1.4;
}

.main {
  padding: 30px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.error-line {
  flex-basis: 100%;
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--red);
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--moss);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(34px, 5vw, 66px);
  line-height: 0.95;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.file-button,
.primary-button,
.ghost-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  padding: 11px 14px;
  cursor: pointer;
  min-height: 42px;
}

.file-button {
  position: relative;
  overflow: hidden;
  background: transparent;
  color: var(--ink);
}

.ghost-button {
  background: transparent;
  color: var(--ink);
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.ops-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.ops-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 14px;
}

.checkline input {
  width: 18px;
  height: 18px;
  accent-color: var(--forest);
}

.note-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  padding: 11px 12px;
}

.upload-list {
  min-height: 44px;
  margin: 0;
}

.mini-facts {
  display: grid;
  gap: 9px;
  margin: 0;
}

.mini-facts div {
  display: grid;
  gap: 3px;
}

.identity-panel {
  background: rgba(23, 61, 50, 0.06);
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 30px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 16px;
  align-items: start;
}

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

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

.panel-header.compact {
  align-items: start;
}

select {
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  padding: 9px 10px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f5f7f0;
}

.tracking {
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-eligible,
.status-likely_eligible {
  border-color: rgba(111, 143, 90, 0.34);
  background: rgba(111, 143, 90, 0.16);
  color: #315321;
}

.status-blocked {
  border-color: rgba(199, 131, 40, 0.4);
  background: rgba(199, 131, 40, 0.14);
  color: #805015;
}

.status-expired {
  border-color: rgba(182, 74, 59, 0.38);
  background: rgba(182, 74, 59, 0.13);
  color: #873429;
}

.detail-panel {
  position: sticky;
  top: 18px;
}

.detail-grid {
  display: grid;
  gap: 10px;
  padding: 18px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.detail-grid div {
  display: grid;
  gap: 4px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

dd {
  margin: 0;
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
}

.reason-block {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.workflow-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.workflow-actions button {
  min-width: 0;
  padding-inline: 8px;
}

ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

li {
  margin: 7px 0;
  color: var(--muted);
  line-height: 1.4;
}

textarea {
  width: 100%;
  min-height: 210px;
  border: 0;
  resize: vertical;
  padding: 16px;
  background: #101915;
  color: #d7eadc;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.carrier-smoke-page {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 30px;
}

.smoke-header,
.smoke-summary,
.carrier-smoke-grid,
.smoke-notes {
  margin-bottom: 24px;
}

.smoke-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.smoke-header h1 {
  max-width: 900px;
}

.smoke-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.carrier-smoke-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.carrier-smoke-card,
.smoke-notes {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.carrier-smoke-card .detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.carrier-smoke-card .detail-grid div {
  min-width: 0;
}

.status-pass {
  color: var(--forest);
  background: #dfead8;
}

.carrier-request-json,
#smokeJson {
  margin: 0;
  padding: 16px;
  overflow: auto;
  max-height: 340px;
  background: #101915;
  color: #d7eadc;
  font-size: 12px;
  line-height: 1.5;
}

.smoke-notes {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
}

.smoke-notes div {
  padding: 18px;
}

.smoke-notes p {
  color: var(--muted);
  line-height: 1.5;
}

.variation-lab {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 30px;
}

.variation-lab-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.variation-lab-header h1 {
  max-width: 980px;
}

.concept-disclosure {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.variation-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.variation-grid {
  display: grid;
  gap: 18px;
}

.variation-card {
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.variation-topline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
}

.variation-topline span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid currentColor;
}

.variation-preview-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 430px;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 29, 0.16);
}

.variation-preview-shell aside {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px;
}

.mini-logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 12px;
  border: 1px solid currentColor;
  font-weight: 900;
}

.variation-preview-shell aside strong,
.variation-preview-shell aside small {
  display: block;
}

.variation-preview-shell aside nav {
  display: grid;
  gap: 8px;
  margin-top: 30px;
}

.variation-preview-shell aside nav span {
  padding: 10px 12px;
}

.variation-preview-main {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.8fr);
  gap: 22px;
  align-items: center;
  padding: 32px;
  overflow: hidden;
}

.variation-copy h2 {
  max-width: 560px;
  font-size: clamp(34px, 5vw, 74px);
  line-height: 0.93;
}

.variation-copy p:not(.eyebrow) {
  max-width: 480px;
  color: var(--muted);
  line-height: 1.55;
}

.approval-widget {
  position: relative;
  min-height: 270px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 29, 0.16);
}

.approval-label,
.approval-widget small {
  display: block;
  position: relative;
  z-index: 2;
}

.concept-badge {
  position: relative;
  z-index: 2;
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 8px;
  border: 1px solid currentColor;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 900;
}

.approval-label {
  margin-bottom: 10px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.approval-amount {
  position: relative;
  z-index: 2;
  display: block;
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.95;
}

.approval-rail {
  position: relative;
  z-index: 2;
  height: 10px;
  margin: 24px 0;
  background: rgba(255, 255, 255, 0.34);
}

.approval-rail span {
  display: block;
  width: 0;
  height: 100%;
}

.approval-active .approval-rail span {
  animation: approval-fill 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.variation-signal .variation-preview-shell {
  background: #f7faf5;
}

.variation-signal aside {
  color: #eaf8f0;
  background: #123c31;
}

.variation-signal aside nav .active {
  background: rgba(34, 211, 238, 0.16);
  color: #b8f26a;
}

.variation-signal .variation-preview-main {
  background:
    linear-gradient(90deg, rgba(34, 211, 238, 0.1), transparent 42%),
    repeating-linear-gradient(90deg, rgba(18, 60, 49, 0.04) 0 1px, transparent 1px 70px),
    #f7faf5;
}

.signal-widget {
  color: #10231c;
  background: linear-gradient(135deg, rgba(184, 242, 106, 0.22), rgba(34, 211, 238, 0.16));
}

.signal-widget .approval-rail span {
  background: linear-gradient(90deg, #b8f26a, #22d3ee);
}

.approval-active .signal-widget::after {
  content: "";
  position: absolute;
  inset: -30% auto -30% -35%;
  width: 34%;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.45), transparent);
  transform: skewX(-16deg);
  animation: approval-scan 1.25s ease-out forwards;
}

.variation-night {
  background: #0f1617;
  border-color: #284143;
}

.variation-night .variation-topline,
.variation-night .variation-copy p:not(.eyebrow) {
  color: #9fb6b1;
}

.variation-night .variation-preview-shell {
  border-color: #284143;
  background: #0f1617;
}

.variation-night aside {
  color: #e9fff6;
  background: #081111;
}

.variation-night aside nav .active {
  color: #101915;
  background: #22d3ee;
}

.variation-night .variation-preview-main {
  color: #edfdf7;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.16), transparent 38%),
    linear-gradient(90deg, rgba(184, 242, 106, 0.08), transparent 55%),
    #0f1617;
}

.night-widget {
  color: #effff8;
  background: #101c1d;
  border-color: #2b5a5d;
}

.approval-bars {
  display: flex;
  gap: 8px;
  align-items: end;
  height: 70px;
  margin-bottom: 22px;
}

.approval-bars span {
  width: 18%;
  height: 24px;
  background: linear-gradient(180deg, #22d3ee, #b8f26a);
}

.approval-active .approval-bars span {
  animation: approval-bars 800ms ease-in-out infinite alternate;
}

.approval-bars span:nth-child(2) { animation-delay: 90ms; }
.approval-bars span:nth-child(3) { animation-delay: 160ms; }
.approval-bars span:nth-child(4) { animation-delay: 230ms; }
.approval-bars span:nth-child(5) { animation-delay: 300ms; }

.variation-vault .variation-preview-shell {
  background: #fbf8ef;
}

.variation-vault aside {
  color: #fff8e7;
  background: #203a2d;
}

.variation-vault aside nav .active {
  color: #fff8e7;
  background: #5b2449;
}

.variation-vault .variation-preview-main {
  background:
    linear-gradient(90deg, rgba(91, 36, 73, 0.1), transparent 38%),
    linear-gradient(180deg, rgba(198, 139, 44, 0.12), transparent 45%),
    #fbf8ef;
}

.vault-widget {
  color: #1c241d;
  background: #fffdf6;
  border-color: rgba(91, 36, 73, 0.3);
}

.approval-stamp {
  position: absolute;
  right: 18px;
  top: 20px;
  z-index: 1;
  padding: 8px 12px;
  border: 2px solid #5b2449;
  color: #5b2449;
  text-transform: uppercase;
  font-weight: 900;
  transform: rotate(-8deg) scale(0.84);
  opacity: 0.35;
}

.approval-active .approval-stamp {
  animation: stamp-pop 620ms cubic-bezier(0.2, 1.7, 0.35, 1) forwards;
}

.money-particle {
  position: absolute;
  left: 50%;
  top: 55%;
  z-index: 4;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  pointer-events: none;
  font-size: 11px;
  font-weight: 900;
  animation: money-burst 980ms ease-out var(--delay) forwards;
}

.particle-signal {
  color: #123c31;
  background: #b8f26a;
}

.particle-night {
  color: #081111;
  background: #22d3ee;
}

.particle-vault {
  color: #fff8e7;
  background: #5b2449;
}

@keyframes approval-fill {
  to { width: 100%; }
}

@keyframes approval-scan {
  to { transform: translateX(520%) skewX(-16deg); }
}

@keyframes approval-bars {
  from { height: 18px; opacity: 0.72; }
  to { height: 68px; opacity: 1; }
}

@keyframes stamp-pop {
  0% { opacity: 0.1; transform: rotate(-12deg) scale(1.4); }
  100% { opacity: 0.86; transform: rotate(-8deg) scale(1); }
}

@keyframes money-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1); }
}

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

  .sidebar {
    position: static;
  }

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

  .rule-card {
    margin-top: 0;
  }

  .metrics,
  .smoke-summary,
  .carrier-smoke-grid,
  .smoke-notes,
  .variation-preview-shell,
  .variation-preview-main,
  .ops-strip,
  .workbench {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

  .variation-preview-shell {
    min-height: 0;
  }

  .variation-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .main,
  .sidebar,
  .variation-lab,
  .carrier-smoke-page {
    padding: 18px;
  }

  .topbar,
  .smoke-header,
  .variation-lab-header,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .variation-preview-main,
  .variation-preview-shell aside {
    padding: 18px;
  }

  .approval-widget {
    min-height: 230px;
  }

  .metrics {
    gap: 8px;
  }

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

  .table-wrap {
    overflow-x: auto;
    max-width: calc(100vw - 36px);
  }

  table {
    min-width: 640px;
  }

  .carrier-smoke-card .detail-grid {
    grid-template-columns: 1fr;
  }

  .carrier-request-json,
  #smokeJson {
    max-width: calc(100vw - 36px);
  }
}
