/* BidVariance app styles. Same visual language as the public site (site.css):
   light enterprise instrument — paper ground, ink type, hairline rules, one
   navy accent, tabular numerals. Tokens mirror site.css :root; the app is a
   standalone page so they are restated here rather than shared. */

@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 100 700;
  font-display: swap;
  src: url("/assets/fonts/ibmplexsans-var.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibmplexmono-400.woff2") format("woff2");
}
:root {
  --bg: #f6f5f1;
  --bg-accent: #efede7;
  --bg-raised: #ffffff;
  --panel: #ffffff;
  --ink: #191b1f;
  --ink-2: #3f434a;
  --muted: #565b62;
  --subtle: #71767d;
  --accent: #1f4e79;
  --accent-strong: #163a5c;
  --accent-wash: #e9eef4;
  --btn: #191b1f;
  --btn-hover: #000000;
  --signal: #1e6e54;
  --line: #e0ddd4;
  --line-strong: #c8c5bb;
  --ok: #1e6e54;
  --warn: #8a6512;
  --bad: #a83b2f;
  --radius: 6px;
  --hdr: 3.6rem;
  --mono-num: tabular-nums;
  --mono: "IBM Plex Sans", system-ui, sans-serif;
  --mono-disp: "IBM Plex Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  font-family:
    "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 2px;
}

::selection {
  background: #1f4e79;
  color: #ffffff;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.tint {
  color: var(--accent);
}
.strong {
  font-weight: 600;
}

/* ---------- shell: sidebar via grid areas (no DOM/JS change) ---------- */

#app-root {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header header"
    "nav main"
    "footer footer";
  min-height: 100vh;
}

.app-header {
  grid-area: header;
}

.app-nav {
  grid-area: nav;
}

.app-content {
  grid-area: main;
}

.app-footer {
  grid-area: footer;
}

/* ---------- header / topbar ---------- */

.app-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  min-height: var(--hdr);
  padding: 0.55rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}
.brand-mark {
  display: inline-flex;
  width: 22px;
  height: 22px;
}
.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.project-name {
  min-width: 14rem;
  max-width: 22rem;
  flex: 1 1 14rem;
}

.save-state {
  font-size: 0.8rem;
  color: var(--subtle);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.license-badge {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--panel);
  color: var(--muted);
}
.license-badge.ok {
  color: var(--signal);
  border-color: #b7d2c6;
  background: var(--bg-raised);
}

/* ---------- sidebar nav ---------- */

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 0.6rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: var(--hdr);
  align-self: start;
  max-height: calc(100vh - var(--hdr));
  min-height: calc(100vh - var(--hdr));
  overflow-y: auto;
  overflow-x: hidden;
}

.tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: 4px;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  padding: 0.48rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover {
  color: var(--ink);
  background: var(--bg-accent);
}
.tab.active {
  color: var(--accent);
  background: var(--accent-wash);
  border-color: #ccd8e4;
  border-left: 1px solid var(--line);
  font-weight: 500;
}

/* sidebar tab icons (decorative, label spans set in app.js) */
.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.tab .svg-icon {
  color: var(--subtle);
  flex: none;
}
.tab.active .svg-icon,
.tab:hover .svg-icon {
  color: var(--accent);
}

.app-nav .status {
  margin-top: auto;
  padding: 0.7rem 0.5rem 0.2rem;
  border-top: 1px solid var(--line);
}

.app-content {
  max-width: 76rem;
  margin: 0 auto;
  width: 100%;
  min-width: 0; /* let wide children (tables, canvases) shrink into scroll/auto containers */
  padding: 1.9rem 1.7rem 4rem;
}

.app-footer {
  border-top: 1px solid var(--line);
  padding: 1rem 1.2rem 1.4rem;
  text-align: center;
  background: var(--bg);
}
.app-footer a {
  color: var(--accent);
}

/* ---------- screens ---------- */

.screen-section h2 {
  font-size: 1.32rem;
  letter-spacing: -0.018em;
  margin: 1.5rem 0 0.35rem;
  font-weight: 600;
}
.screen-section h2:first-child {
  margin-top: 0;
}
.screen-section h3 {
  font-size: 1.02rem;
  margin: 1.5rem 0 0.5rem;
  font-weight: 600;
}
.screen-lede {
  color: var(--muted);
  max-width: 68ch;
  margin: 0 0 1.4rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.9rem 1.1rem;
  margin-bottom: 1.2rem;
}

.field {
  display: grid;
  gap: 0.3rem;
}
.field-label {
  font-size: 0.82rem;
  color: var(--ink-2);
  font-weight: 500;
}
.field-hint {
  font-size: 0.76rem;
  color: var(--subtle);
}

.input {
  background: var(--bg-raised);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.48rem 0.65rem;
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.12s ease;
}
.input:hover {
  border-color: #a5a29a;
}
.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
.input.num {
  text-align: right;
  font-variant-numeric: var(--mono-num);
}
textarea.input {
  width: 100%;
  resize: vertical;
}
select.input {
  width: auto;
}

.btn {
  appearance: none;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.48rem 0.9rem;
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    background 0.12s ease,
    color 0.12s ease;
}
.btn:hover {
  border-color: #a5a29a;
  background: var(--bg);
}
.btn.primary {
  background: var(--btn);
  border-color: var(--btn);
  color: #f6f5f1;
  font-weight: 500;
}
.btn.primary:hover {
  background: var(--btn-hover);
  border-color: var(--btn-hover);
  color: #ffffff;
}
.btn.icon {
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
}
.btn.icon.danger {
  color: var(--bad);
}
.btn.icon.danger:hover {
  border-color: var(--bad);
  background: #faf1ef;
}
.btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ---------- tables ---------- */

.grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.grid-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.grid-table td {
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.grid-table tr:last-child td {
  border-bottom: none;
}
.grid-table tbody tr:hover td {
  background: rgba(25, 27, 31, 0.025);
}
.grid-table .num {
  text-align: right;
  font-variant-numeric: var(--mono-num);
}
.grid-table tr.highlight td {
  background: var(--accent-wash);
}

.table-scroll {
  overflow-x: auto;
  margin: 0 -0.2rem;
  padding: 0 0.2rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c8c5bb transparent;
}
.table-scroll::-webkit-scrollbar {
  height: 10px;
}
.table-scroll::-webkit-scrollbar-thumb {
  background: #c8c5bb;
  border-radius: 6px;
  border: 2px solid var(--bg);
  background-clip: content-box;
}
.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}
/* Width rules target the data rows only; the expandable detail row has a
   single colspan td and must not be sized as if it were column 1. */
.work-table tr:not(.risk-detail-row) td:nth-child(1) {
  width: 4.4rem;
}
.work-table tr:not(.risk-detail-row) td:nth-child(3),
.work-table tr:not(.risk-detail-row) td:nth-child(4),
.work-table tr:not(.risk-detail-row) td:nth-child(5),
.work-table tr:not(.risk-detail-row) td:nth-child(6),
.work-table tr:not(.risk-detail-row) td:nth-child(7) {
  width: 5.5rem;
}
.work-table tr:not(.risk-detail-row) td:nth-child(9),
.work-table tr:not(.risk-detail-row) td:nth-child(10),
.work-table tr:not(.risk-detail-row) td:nth-child(11) {
  width: 2.5rem;
  text-align: center;
}

/* Task index cell: order number + stacked reorder arrows. */
.task-index {
  white-space: nowrap;
  vertical-align: middle !important;
}
.task-num {
  display: inline-block;
  min-width: 1.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--subtle);
  font-variant-numeric: var(--mono-num);
  text-align: right;
  margin-right: 0.2rem;
}
.task-reorder {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  vertical-align: middle;
}
.reorder-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 3px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--subtle);
  line-height: 0;
  cursor: pointer;
  transition:
    color 0.12s ease,
    border-color 0.12s ease;
}
.reorder-btn:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}
.reorder-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.task-action {
  text-align: center;
}

.risk-table .input,
.work-table .input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.dep-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--bg-accent);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.78rem;
  padding: 0.1rem 0.28rem 0.1rem 0.5rem;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}
.chip-x {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--subtle);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.05rem 0.25rem;
}
.chip-x:hover {
  color: var(--bad);
}

.dep-picker {
  position: relative;
}
.dep-picker summary {
  cursor: pointer;
  list-style: none;
  color: var(--accent);
  font-size: 0.8rem;
  padding: 0.1rem 0.4rem;
  border: 1px dashed var(--line-strong);
  border-radius: 3px;
  user-select: none;
}
.dep-picker summary::-webkit-details-marker {
  display: none;
}
.dep-picker[open] .dep-list {
  position: absolute;
  z-index: 20;
  top: 1.7rem;
  left: 0;
  min-width: 14rem;
  max-height: 14rem;
  overflow: auto;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.5rem;
  display: grid;
  gap: 0.3rem;
  box-shadow: 0 8px 24px rgba(25, 27, 31, 0.12);
}
.dep-list label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.status {
  font-size: 0.85rem;
}
.status.ok {
  color: var(--ok);
}
.status.warn {
  color: var(--warn);
}
.status.bad {
  color: var(--bad);
}

.legend {
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.legend summary {
  cursor: pointer;
  color: var(--muted);
}
.legend dl {
  margin: 0.6rem 0 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
}
.legend dt {
  font-weight: 600;
  color: var(--ink);
}
.legend dd {
  margin: 0;
}

/* ---------- risks: expandable rows ---------- */

.risk-table .risk-toggle-cell {
  width: 2.2rem;
  text-align: center;
}
.risk-toggle {
  transition: transform 0.12s ease;
}
.risk-toggle .svg-icon {
  transition: transform 0.15s ease;
}
.risk-toggle.open .svg-icon {
  transform: rotate(-180deg);
}
.risk-toggle.open {
  border-color: var(--accent);
  color: var(--accent);
}
.risk-row td {
  vertical-align: middle;
}
.risk-scope {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.risk-expected {
  font-weight: 600;
  white-space: nowrap;
}
.risk-detail-row > td {
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.risk-detail {
  padding: 0.95rem 1rem 1.1rem;
  border-left: 1px solid var(--line);
}
.risk-detail-hint {
  color: var(--muted);
  font-size: 0.8rem;
  max-width: 72ch;
  margin: 0 0 0.9rem;
}
.risk-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem 1.4rem;
}
.risk-detail-h {
  margin: 0 0 0.45rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}
.risk-3col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem 0.7rem;
}
@media (max-width: 34rem) {
  .risk-3col {
    grid-template-columns: 1fr;
  }
}
.risk-detail-note {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
}

/* ---------- metrics / results ---------- */

.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0 1.4rem;
  margin: 0.8rem 0 1.2rem;
}

.metric {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.metric-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}
.metric-value {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  font-variant-numeric: var(--mono-num);
  color: var(--ink);
}
.metric-hint {
  font-size: 0.75rem;
  color: var(--muted);
}
.metric.ok .metric-value {
  color: var(--ok);
}
.metric.warn .metric-value {
  color: var(--warn);
}
.metric.bad .metric-value {
  color: var(--bad);
}

.sim-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.chart {
  width: 100%;
  height: 220px;
  display: block;
}
.sim-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}
.sim-charts figure {
  margin: 0;
}
.sim-charts figcaption {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

@media (max-width: 62rem) {
  .sim-charts {
    grid-template-columns: 1fr;
  }
}

.callout {
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--bg-accent);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.callout strong {
  color: var(--ink);
}
.callout.stale {
  border-color: #e3d5ae;
  border-left: 1px solid var(--line);
}

.validation ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}
.validation li {
  color: var(--bad);
  font-size: 0.88rem;
}

/* ---------- project screen: grouped deal panels ---------- */

/* Two equal panels replace the old auto-fit form grid, whose rows wrapped
   unevenly and left boxes misaligned at common widths. */
.deal-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 0 0 1.4rem;
}
.deal-panel {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem 1.2rem;
  min-width: 0;
}
.deal-panel .panel-h {
  margin: 0 0 0.15rem;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.deal-panel .panel-sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 0.85rem;
}
.deal-panel .panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.1rem;
}
@media (max-width: 62rem) {
  .deal-panels {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 30rem) {
  .deal-panel .panel-grid {
    grid-template-columns: 1fr;
  }
}

.notes-input {
  width: 100%;
  min-height: 4.2rem;
}

/* ---------- price lab ---------- */

.slider {
  width: 100%;
  height: 1.9rem;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  --fill-pct: 50%;
}
.slider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--fill-pct),
    var(--line-strong) var(--fill-pct),
    var(--line-strong) 100%
  );
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  margin-top: -5px;
  box-shadow: 0 1px 3px rgba(25, 27, 31, 0.25);
}
.slider::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: var(--line-strong);
}
.slider::-moz-range-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
}
.slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  box-shadow: 0 1px 3px rgba(25, 27, 31, 0.25);
}
.slider:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.apply-box {
  margin: 0.6rem 0 1rem;
  min-height: 2.2rem;
}

/* ---------- decision ---------- */

.verdict {
  display: grid;
  gap: 0.2rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 1.1rem 1.2rem;
  margin: 0.4rem 0 1rem;
  background: var(--panel);
}
.verdict.ok {
  border-color: #b7d2c5;
  border-left: 1px solid var(--line);
  background: var(--bg-raised);
}
.verdict.warn {
  border-color: #e3d5ae;
  border-left: 1px solid var(--line);
  background: var(--bg-raised);
}
.verdict.bad {
  border-color: #e0c4bf;
  border-left: 1px solid var(--line);
  background: var(--bg-raised);
}
.verdict-label {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.verdict.ok .verdict-label {
  color: var(--ok);
}
.verdict.warn .verdict-label {
  color: var(--warn);
}
.verdict.bad .verdict-label {
  color: var(--bad);
}
.verdict-sub {
  color: var(--muted);
  font-size: 0.92rem;
}

.checks {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 1rem;
  display: grid;
  gap: 0.35rem;
}
.checks li {
  font-size: 0.92rem;
}
.checks li.ok {
  color: var(--ok);
}
.checks li.bad {
  color: var(--bad);
}

.plain-list {
  margin: 0.3rem 0 1rem;
  padding-left: 1.2rem;
  color: var(--muted);
}
.plain-list li {
  margin: 0.25rem 0;
}

.warn-box {
  border: 1px solid #e3d5ae;
  border-left: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.7rem 1rem;
  margin: 1rem 0;
  color: var(--ink-2);
  font-size: 0.9rem;
  background: var(--bg-raised);
}
.warn-box ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

/* ---------- icons ---------- */

.svg-icon {
  width: 1em;
  height: 1em;
  flex: none;
  display: inline-block;
  vertical-align: -0.12em;
}

/* Buttons that lead with an icon + label sit the two on one baseline. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.btn .svg-icon {
  color: var(--ink-2);
}
.btn.primary .svg-icon {
  color: inherit;
}
.btn.icon.danger .svg-icon {
  color: var(--bad);
}

/* Icon-lead section heading in Price Lab. */
h3.h3-ico {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
h3.h3-ico .svg-icon {
  color: var(--accent);
}

/* dependency summary link icon inherits its small accent color. */
.dep-picker summary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* icon-lead callouts (icon + text sit on one top-aligned row) */
.callout.lead-ico {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.callout.lead-ico .svg-icon {
  margin-top: 0.18em;
  color: var(--ink-2);
}
.callout.stale .svg-icon {
  color: var(--warn);
}

/* ---------- activation ---------- */

.activation-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 1.5rem;
}
.activation {
  width: 100%;
  max-width: 26rem;
}
.activation-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
}
.activation-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2rem 1.8rem;
  box-shadow:
    0 1px 3px rgba(25, 27, 31, 0.05),
    0 12px 32px rgba(25, 27, 31, 0.06);
}
.activation-card h1 {
  font-size: 1.3rem;
  margin: 0.5rem 0 0.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.activation-card .brand {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.activation-card form {
  display: grid;
  gap: 0.9rem;
  margin: 1.1rem 0 0.4rem;
}
.activation-card .input {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}
.activation-status {
  min-height: 1.4rem;
  font-size: 0.9rem;
  margin: 0.6rem 0;
}
.activation-status.ok {
  color: var(--ok);
}
.activation-status.bad {
  color: var(--bad);
}
.activation-status.muted {
  color: var(--muted);
}

/* ---------- figures & chart keys ---------- */

.chart-figure {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.85rem 1rem 0.9rem;
  min-width: 0;
}
.chart-figure figcaption {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.45rem;
}
.chart-canvas canvas {
  width: 100%;
}
.chart-note {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  max-width: 72ch;
  line-height: 1.45;
}
.chart-key {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: var(--mono-num);
  line-height: 1.5;
}

.chart-empty {
  display: grid;
  place-items: center;
  min-height: 6rem;
  color: var(--muted);
  font-size: 0.85rem;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  text-align: center;
  padding: 0 1rem;
  background: var(--bg);
}

.chart-legend {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0.5rem 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.35rem;
}
.legend-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.swatch {
  flex: none;
  align-self: center;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
}
.swatch.task {
  background: #2e5e8f;
}
.swatch.swatch-teal {
  background: #1e6e54;
}
.swatch.swatch-blue {
  background: #2e5e8f;
}
.swatch.risk {
  background: #8a6512;
}
.swatch.ok {
  background: #1e6e54;
}
.swatch.loss {
  background: #a83b2f;
}
.swatch.ink {
  background: #6e747b;
}
.swatch.neutral {
  background: #85898f;
}

.driver-chart,
.spread-chart {
  width: 100%;
  display: block;
}
.spread-figure {
  margin-top: 1.1rem;
}

/* ---------- probability meters ---------- */

.prob-meter-list {
  display: grid;
  gap: 0.85rem;
  margin: 0.4rem 0 1.2rem;
}
.prob-meter {
  display: grid;
  gap: 0.32rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.prob-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.prob-meter-label {
  font-size: 0.88rem;
  color: var(--ink);
}
.prob-meter-value {
  font-variant-numeric: var(--mono-num);
  font-weight: 600;
  font-size: 1rem;
}
.prob-meter-track {
  position: relative;
  height: 0.55rem;
  border-radius: 3px;
  background: var(--bg-accent);
  border: 1px solid var(--line);
}
.prob-meter-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 3px;
  background: var(--accent);
}
.prob-meter-fill.tone-ok {
  background: var(--ok);
}
.prob-meter-fill.tone-warn {
  background: var(--warn);
}
.prob-meter-fill.tone-bad {
  background: var(--bad);
}
.prob-meter-tick {
  position: absolute;
  top: -0.18rem;
  bottom: -0.18rem;
  width: 2px;
  border-radius: 1px;
  background: var(--ink);
}
.prob-meter-foot {
  color: var(--muted);
  font-size: 0.74rem;
}

/* ---------- run state (loading / in-flight indicators) -------------------- */

.run-panel {
  display: grid;
  gap: 0.7rem;
  border: 1px solid var(--line-strong);
  border-left: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 1rem 1.1rem 1.05rem;
  margin: 0.4rem 0 0.6rem;
}
.run-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.run-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.run-progress {
  height: 0.55rem;
  border-radius: 3px;
  background: var(--bg-accent);
  border: 1px solid var(--line);
  overflow: hidden;
}
.run-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.run-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: var(--mono-num);
}
.run-skeleton {
  display: grid;
  gap: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 0.9rem 1rem 1rem;
  animation: run-skeleton-pulse 1.6s ease-in-out infinite;
}
.run-skeleton-title {
  height: 0.7rem;
  max-width: 60%;
  border-radius: 2px;
  background: var(--bg-accent);
}
.run-skeleton-area {
  height: 9.5rem;
  border-radius: 4px;
  background: var(--bg-accent);
}
@keyframes run-skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.tab-run-dot,
.tab-run-pct {
  display: none;
}
.tab.tab-running .tab-run-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
  animation: run-dot-pulse 1.2s ease-in-out infinite;
}
.tab.tab-running .tab-run-pct {
  display: inline;
  margin-left: 0.35rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--accent);
}
@keyframes run-dot-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .run-progress-fill {
    transition: none;
  }
  .run-skeleton,
  .tab.tab-running .tab-run-dot {
    animation: none;
  }
}

/* ---------- print report ---------- */

.report-only {
  display: none;
}

@media print {
  @page {
    margin: 18mm 16mm;
  }

  body {
    background: #fff;
    color: #111;
  }
  #app-root,
  .activation-body {
    display: none !important;
  }
  .report-only {
    display: block;
  }

  .report {
    max-width: 100%;
  }
  .report-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #111;
    padding-bottom: 0.4rem;
    margin-bottom: 1rem;
  }
  .report-brand {
    font-weight: 700;
  }
  .report-brand .tint {
    color: #1f4e79;
  }
  .report-title {
    font-size: 0.85rem;
    color: #444;
  }
  .report h1 {
    font-size: 1.5rem;
    margin: 0 0 0.8rem;
  }
  .report h2 {
    font-size: 1rem;
    margin: 1.2rem 0 0.4rem;
  }
  .report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
  }
  .report-table th,
  .report-table td {
    border: 1px solid #ccc;
    padding: 0.35rem 0.55rem;
    text-align: left;
    vertical-align: top;
  }
  .report-table th[scope="row"] {
    width: 38%;
    background: #f4f4f4;
    font-weight: 600;
  }
  .report p {
    font-size: 0.88rem;
    line-height: 1.5;
  }
  .report ul {
    font-size: 0.88rem;
  }
  .report-disclaimer {
    font-size: 0.78rem !important;
    color: #444;
    border-top: 1px solid #ccc;
    padding-top: 0.5rem;
    margin-top: 1.2rem;
  }
  .report-foot {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.8rem;
  }
}

@media (max-width: 64rem) {
  #app-root {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "nav"
      "main"
      "footer";
  }
  .app-nav {
    flex-direction: row;
    align-items: center;
    position: static;
    max-height: none;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 0.45rem 0.8rem;
    scrollbar-width: thin;
  }
  .app-nav .status {
    margin-top: 0;
    padding: 0 0.4rem;
    border-top: none;
    white-space: nowrap;
  }
  .tab.active {
    border-left-color: var(--line-strong);
    border-bottom: 2px solid var(--accent);
  }
  .app-content {
    padding: 1.4rem 0.9rem 3rem;
  }
}

@media (max-width: 40rem) {
  .app-header {
    padding: 0.6rem 0.8rem;
  }
  .project-name {
    min-width: 10rem;
  }
  .legend dl {
    grid-template-columns: 1fr;
  }
}

/* --- scenario comparison (A/B) + new decision figures --------------------- */
.compare-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.compare-head h3 {
  margin: 0;
}
.compare-actions {
  display: flex;
  gap: 0.5rem;
}
.compare-table td.delta-good {
  color: var(--ok);
}
.compare-table td.delta-bad {
  color: var(--bad);
}
.compare-table td.delta-muted {
  color: var(--muted);
}

.client-fields {
  margin: 1.2rem 0 0.6rem;
}
.client-fields .form-grid {
  margin-top: 0.5rem;
}

.tornado-slot:empty {
  display: none;
}

.report-attribution {
  font-size: 1.02rem;
  margin: 0.2rem 0 0;
}
.report .muted.small {
  color: var(--muted);
  font-size: 0.78rem;
}

.keep-key-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.4rem 0 0.8rem;
  cursor: pointer;
}
.keep-key-row input[type="checkbox"] {
  margin-top: 0.18rem;
  accent-color: #1f4e79;
}

/* A quieter workspace: typography carries hierarchy; color carries meaning. */
.license-badge { font-size: 0.75rem; letter-spacing: 0.04em; }
.license-badge.ok { color: var(--accent); border-color: var(--line); }
.tab { min-height: 44px; border-left-width: 1px; }
.tab.active { background: var(--bg-raised); border-color: var(--line-strong); font-weight: 600; }
.metric-label, .risk-detail-h { font-size: 0.76rem; letter-spacing: 0.045em; }
.metric-value { font-size: 1.7rem; letter-spacing: -0.035em; }
.verdict-label { text-transform: none; letter-spacing: -0.02em; font-size: 1.6rem; }
.verdict { padding: 1.35rem; }
.callout { background: var(--bg-raised); }
.btn, .tab, .input { transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease; }
.btn { min-height: 38px; }
.assumption-review { margin: 1.5rem 0; }
.review-list { list-style: none; padding: 0; margin: 0; }
.review-item { display: flex; justify-content: space-between; align-items: start; gap: 1.2rem; padding: 0.85rem 0; border-top: 1px solid var(--line); }
.review-item p { margin: 0.3rem 0 0; max-width: 70ch; }
.review-action { flex: none; }
.quote-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.negotiation-note { padding: 1rem 0; border-top: 1px solid var(--line); color: var(--ink-2); }
@media (prefers-reduced-motion: no-preference) {
  .screen { animation: workspace-enter 180ms ease-out; }
  @keyframes workspace-enter { from { opacity: 0.65; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
}
@media (max-width: 40rem) {
  .review-item { flex-direction: column; gap: 0.65rem; }
  .app-header { position: static; }
  .header-actions { margin-left: 0; }
  .verdict { padding: 1rem; }
}

[hidden] { display: none !important; }

.schedule-lab { margin-block: 1.5rem; }
.schedule-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; margin-block: 1rem; }
.schedule-preset { display: grid; gap: 0.4rem; text-align: left; padding: 1rem; white-space: normal; }
.schedule-preset strong { font-size: 1.05rem; }
.schedule-preset span { font-size: 0.82rem; color: var(--muted); }
.evidence-preview { width: 100%; margin-top: 1rem; line-height: 1.65; resize: vertical; }
@media (max-width: 40rem) { .schedule-presets { grid-template-columns: 1fr; } }
.schedule-preset[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); }

/* ---------- activation page (v2): key form beside what each tier unlocks ---------- */
.activation-body { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--bg); }
.activation { display: grid; grid-template-columns: minmax(0, 27rem) minmax(0, 23rem); gap: 2rem; align-items: start; max-width: 54rem; width: 100%; margin: 0 auto; }
.activation-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.8rem 1.7rem 1.4rem; box-shadow: 0 1px 0 rgba(25, 27, 31, 0.04), 0 10px 26px -18px rgba(25, 27, 31, 0.35); }
.activation-brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; margin: 0 0 1.2rem; }
.activation-brand .brand-mark { width: 24px; height: 24px; display: inline-flex; }
.activation-brand .brand-mark svg { width: 100%; height: 100%; }
.activation-card h1 { font-size: 1.55rem; letter-spacing: -0.02em; margin: 0 0 0.4rem; }
.activation-lede { color: var(--muted); margin: 0 0 1.1rem; }
.activation-current { font-size: 0.9rem; padding: 0.6rem 0.75rem; background: var(--accent-wash); border-radius: 4px; margin: 0 0 1rem; }
.activation-reason { font-size: 0.9rem; padding: 0.7rem 0.8rem; border-left: 3px solid var(--bad); background: #fbf1ef; color: #6d2620; border-radius: 0 4px 4px 0; margin: 0 0 1rem; }
.activation-card form { display: grid; gap: 0.5rem; }
.key-row { display: flex; gap: 0.4rem; }
.key-input { flex: 1; min-width: 0; font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.02em; }
.key-input.key-ok { border-color: var(--signal); }
.activation-submit { justify-content: center; min-height: 44px; margin-top: 0.4rem; font-size: 1rem; position: relative; }
.activation-submit.is-busy .btn-label::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 0.5rem; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: act-spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes act-spin { to { transform: rotate(360deg); } }
#activation-form.is-verified .activation-submit { background: var(--signal); border-color: var(--signal); }
.activation-status { min-height: 1.4rem; margin: 0.8rem 0 0; font-size: 0.9rem; }
.activation-help { margin: 0.9rem 0 0.4rem; font-size: 0.88rem; }
.activation-help summary { cursor: pointer; color: var(--accent); }
.activation-help p { color: var(--muted); }
.activation-links { margin: 0.8rem 0 0.2rem; }
.activation-tiers h2 { font-size: 1rem; margin: 0.4rem 0 0.8rem; }
.tier-ladder { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; }
.tier-step { padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-size: 0.88rem; }
.tier-step p { margin: 0.35rem 0 0.5rem; color: var(--ink-2); }
.tier-step-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.tier-price { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.8rem; color: var(--muted); }
.tier-step a { font-size: 0.85rem; }
@media (max-width: 52rem) {
  .activation { grid-template-columns: minmax(0, 1fr); max-width: 30rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .activation-card { animation: act-in 360ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .activation-tiers { animation: act-in 360ms cubic-bezier(0.2, 0.7, 0.2, 1) 80ms both; }
  @keyframes act-in { from { opacity: 0; transform: translateY(8px); } }
}

/* Shown by js/boot-check.js when a workspace module did not arrive. */
.boot-failed { max-width: 34rem; margin: 3rem auto; padding: 1.4rem 1.5rem; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; }
.boot-failed p { color: var(--muted); }
