/* Prediction Studio: valuation workpaper.
   Columnar-pad ground, green ledger rules instead of boxes, one graphite ink,
   color only as pencil marks (red, ledger green, blue). */

:root {
  --pad: #eef3ee;
  --pad-deep: #e3ebe4;
  --sheet: #f8faf6;
  --field: #ffffff;
  --rule: #c7d8ca;
  --rule-strong: #93b29b;
  --ink: #1d292b;
  --ink-2: #435356;
  --ink-3: #5e6e70;
  --green: #1d5c46;
  --green-hover: #154836;
  --green-wash: #dcebe0;
  --red: #b3302a;
  --red-wash: #f6e1dd;
  --blue: #2a5aa6;
  --blue-wash: #dfe7f4;
  --ochre: #9a6516;
  --focus: #2a5aa6;
  --radius: 4px;
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --schedule-width: clamp(360px, 30vw, 440px);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--green-wash);
  color: var(--ink);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--green);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted,
.field-note {
  color: var(--ink-3);
}

.field-note {
  font-size: 0.8125rem;
  line-height: 1.4;
}

.field-note:empty {
  display: none;
}

/* ---------- Controls ---------- */

label {
  display: grid;
  gap: 4px;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 500;
}

input,
select,
button {
  font: inherit;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--ink);
  padding: 6px 9px;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

input:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled) {
  border-color: var(--ink-3);
}

input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--blue-wash);
}

input:disabled,
select:disabled,
input[readonly] {
  background: var(--pad-deep);
  color: var(--ink-3);
  border-color: var(--rule);
  cursor: not-allowed;
}

input[readonly] {
  cursor: default;
}

input::placeholder {
  color: #7d8b8d;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--green);
  flex: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
}

a.btn {
  text-decoration: none;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--green-hover);
}

.btn-secondary {
  background: var(--field);
  border-color: var(--rule-strong);
  color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--ink-3);
  background: var(--pad);
}

.btn-quiet {
  min-height: 30px;
  padding: 4px 8px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
}

.btn-quiet:hover:not(:disabled) {
  color: var(--ink);
  background: var(--pad-deep);
}

.btn-danger {
  background: var(--field);
  border-color: var(--rule-strong);
  color: var(--red);
}

.btn-danger:hover:not(:disabled),
.btn-danger.is-confirming {
  border-color: var(--red);
  background: var(--red-wash);
}

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 34px;
  padding: 0;
  flex: none;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.secure-mode-btn[aria-pressed="true"] {
  color: var(--red);
  background: var(--red-wash);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field-group {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.field-group > legend {
  float: left;
  width: 100%;
  margin-bottom: 2px;
  padding: 0;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 600;
}

.field-group > legend + * {
  clear: both;
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row,
.choice-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.check-row input,
.choice-row input {
  margin-top: 2px;
}

.choice-text {
  display: grid;
  gap: 1px;
}

.choice-text small {
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 400;
}

.check-row.is-disabled,
.choice-row.is-disabled,
label.is-disabled {
  color: var(--ink-3);
  cursor: not-allowed;
}

.check-row.is-disabled .choice-text small,
.choice-row.is-disabled .choice-text small {
  color: var(--red);
}

.inline-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-left: 25px;
}

.inline-field input {
  width: 84px;
}

.segmented {
  display: flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--field);
  overflow: hidden;
}

.seg-btn,
.metric-tab {
  flex: 1 1 0;
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  border-left: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 180ms var(--ease), color 180ms var(--ease);
}

.seg-btn:first-child,
.metric-tab:first-child {
  border-left: 0;
}

.seg-btn:hover,
.metric-tab:hover {
  background: var(--pad);
  color: var(--ink);
}

.seg-btn.is-active,
.metric-tab.is-active {
  background: var(--green-wash);
  color: var(--green);
  font-weight: 600;
}

.seg-btn:focus-visible,
.metric-tab:focus-visible {
  outline-offset: -2px;
}

.segmented-small .metric-tab {
  min-height: 28px;
  font-size: 0.75rem;
}

.source-switch {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--field);
  overflow: hidden;
}

.source-switch label {
  display: block;
  position: relative;
  border-left: 1px solid var(--rule);
  cursor: pointer;
}

.source-switch label:first-child {
  border-left: 0;
}

.source-switch input {
  position: absolute;
  opacity: 0;
}

.source-switch span {
  display: block;
  padding: 7px 4px;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: center;
  transition: background 180ms var(--ease), color 180ms var(--ease);
}

.source-switch label:hover span {
  background: var(--pad);
  color: var(--ink);
}

.source-switch input:checked + span {
  background: var(--green-wash);
  color: var(--green);
  font-weight: 600;
}

.source-switch input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

/* ---------- Auth gate ---------- */

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--pad);
}

.auth-sheet {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  background: var(--sheet);
  border-top: 3px double var(--rule-strong);
  border-bottom: 3px double var(--rule-strong);
}

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

.auth-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.auth-brand h1 {
  font-size: 1.4375rem;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-message {
  color: var(--red);
  font-size: 0.8125rem;
  min-height: 1em;
}

/* ---------- App shell ---------- */

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

.schedules {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--pad);
  border-right: 1px solid var(--rule-strong);
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}

.workspace-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 8px;
  padding: 12px 16px;
  background: var(--pad);
  border-bottom: 3px double var(--rule-strong);
}

.workspace-brand {
  display: flex;
  white-space: nowrap;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 700;
}

.workspace-brand img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.workspace-actions {
  display: flex;
  gap: 2px;
}

.assumptions {
  display: contents;
}

/* ---------- Schedules ---------- */

.schedule {
  border-bottom: 1px solid var(--rule-strong);
}

.schedule > summary {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  column-gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  transition: background 180ms var(--ease);
}

.schedule > summary::-webkit-details-marker {
  display: none;
}

.schedule > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 180ms var(--ease);
  grid-column: 3;
  grid-row: 1;
}

.schedule:not([open]) > summary::after {
  transform: rotate(-45deg);
}

.schedule > summary:hover {
  background: var(--pad-deep);
}

.schedule > summary:focus-visible {
  outline-offset: -2px;
}

.schedule-index {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--field);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 700;
  grid-row: 1 / span 2;
}

.pencil-ring {
  position: absolute;
  inset: -9px -11px;
  width: calc(100% + 22px);
  height: calc(100% + 18px);
  overflow: visible;
  pointer-events: none;
}

.pencil-pass {
  fill: none;
  stroke: var(--red);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-dasharray: 170;
  stroke-dashoffset: 170;
  transition: stroke-dashoffset 460ms var(--ease);
}

.pencil-pass-light {
  stroke-width: 0.9;
  opacity: 0.55;
  transition-delay: 60ms;
}

.schedule.is-traced .pencil-pass {
  stroke-dashoffset: 0;
}

.schedule.is-traced > summary {
  background: var(--red-wash);
}

.schedule-title {
  font-size: 0.9375rem;
  font-weight: 600;
}

.schedule-summary {
  grid-column: 2;
  color: var(--ink-3);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-summary:empty {
  display: none;
}

.schedule-body {
  display: grid;
  gap: 12px;
  padding: 2px 16px 18px 54px;
}

.source-pane {
  display: grid;
  gap: 10px;
}

.saved-setup-row,
.project-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.saved-setup-row label,
.project-row label {
  flex: 1 1 auto;
  min-width: 0;
}

.readonly-assumption input {
  font-weight: 600;
}

/* App Store summary */

.app-store-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr);
  align-items: start;
  gap: 10px 28px;
}

.sheet-notes {
  display: grid;
  gap: 4px;
  margin-top: -16px;
}

.source-notes {
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.source-notes:empty {
  display: none;
}

.exhibit-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-strong);
}

.exhibit .exhibit-head h2 {
  padding-bottom: 0;
  border-bottom: 0;
}

.exhibit-head .segmented {
  width: 240px;
}

.app-store-main {
  display: grid;
  gap: 10px;
}

.app-store-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-store-icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 9px;
  border: 1px solid var(--rule);
  object-fit: cover;
}

.app-store-icon-fallback {
  display: grid;
  place-items: center;
  background: var(--field);
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 700;
}

.app-store-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.app-store-subtitle {
  color: var(--ink-3);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.app-store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.app-store-link {
  min-height: 30px;
  font-size: 0.8125rem;
  text-decoration: none;
}

.app-store-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  column-gap: 12px;
  gap: 0;
  border-top: 1px solid var(--rule);
}

.app-store-fact {
  display: grid;
  gap: 1px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
}

.app-store-fact span {
  color: var(--ink-3);
  font-size: 0.75rem;
}

.app-store-fact strong {
  font-size: 0.8125rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.app-store-fact-link:hover strong {
  color: var(--green);
  text-decoration: underline;
}

/* Training window */

.training-chart {
  height: 300px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
  touch-action: none;
}

.training-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.training-hit-area,
.training-marker-hit {
  fill: transparent;
  cursor: ew-resize;
}

.training-marker-line {
  stroke: var(--green);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 5 4;
}

.training-marker-label rect {
  fill: var(--field);
  stroke: var(--rule-strong);
}

.training-marker-label text {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

.training-marker-label text + text {
  fill: var(--ink-3);
  font-weight: 500;
}

.chart-note {
  fill: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
}

.training-spike-marker rect {
  fill: none;
  stroke: var(--red);
  stroke-width: 1.6;
  stroke-dasharray: 3 2;
}

.training-spike-marker path,
.training-spike-legend path {
  fill: var(--red);
}

.training-spike-legend text {
  fill: var(--red);
  font-size: 12px;
  font-weight: 600;
}

.training-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-top: 1px solid var(--rule);
}

.training-summary div {
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
}

.training-summary dt {
  color: var(--ink-3);
  font-size: 0.75rem;
}

.training-summary dd {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ---------- Sheet ---------- */

.sheet {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 28px;
  padding: 28px clamp(20px, 3vw, 44px) 56px;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 3px double var(--rule-strong);
}

.sheet-heading {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.sheet-head h1 {
  font-size: 1.75rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.basis-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.basis-item {
  white-space: nowrap;
}

.basis-item b {
  color: var(--red);
  font-size: 0.6875rem;
  font-weight: 700;
}

.basis-sep {
  color: var(--rule-strong);
}

.export-btn {
  flex: none;
}

.status {
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.status-ok {
  color: var(--ink-2);
}

.status-error {
  color: var(--red);
  font-weight: 600;
}

/* Conclusion */

.conclusion:empty {
  display: none;
}

.conclusion {
  display: grid;
  gap: 20px;
}

.valuation {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.valuation-case {
  margin-bottom: -6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.valuation-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 600;
  grid-column: 1 / -1;
}

.valuation-figure {
  justify-self: start;
  padding-bottom: 2px;
  border-bottom: 3px double var(--ink);
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.valuation-figure.is-unavailable {
  border-bottom-color: var(--red);
  color: var(--ink-3);
  font-size: 1.75rem;
}

.valuation-range {
  display: flex;
  gap: 28px;
  padding-top: 4px;
}

.range-item {
  display: grid;
  gap: 1px;
}

.range-item span {
  font-size: 0.75rem;
  font-weight: 600;
}

.range-item strong {
  font-size: 1.1875rem;
  font-weight: 600;
}

.valuation-note {
  color: var(--ink-3);
  font-size: 0.8125rem;
  grid-column: 1 / -1;
}

.valuation-note.is-warning {
  color: var(--red);
  font-weight: 600;
}

.tone-pessimistic {
  color: var(--red);
}

.tone-optimal {
  color: var(--green);
}

.tone-optimistic {
  color: var(--blue);
}

.trace-ref {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--red);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: help;
}

.trace-ref svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trace-ref:hover,
.trace-ref:focus-visible {
  background: var(--red-wash);
}

.ledger {
  width: 100%;
  border-collapse: collapse;
}

.ledger th,
.ledger td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: right;
  white-space: nowrap;
}

.ledger th:first-child,
.ledger td:first-child {
  padding-left: 0;
  text-align: left;
  white-space: normal;
}

.ledger thead th {
  border-bottom: 1px solid var(--rule-strong);
  font-size: 0.75rem;
  font-weight: 600;
}

.ledger tbody th {
  font-size: 0.875rem;
  font-weight: 500;
}

.ledger td {
  font-size: 1rem;
  font-weight: 600;
}

.ledger td,
.ledger thead th + th {
  border-left: 1px solid var(--rule);
}

.ledger td.is-empty {
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-weight: 500;
}

.ledger .row-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
}

/* Duration breakdown */

.duration-breakdown {
  display: grid;
  gap: 12px;
}

.duration-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.duration-heading h2 {
  font-size: 1.1875rem;
}

.duration-heading .muted {
  font-size: 0.8125rem;
}

.duration-total {
  display: grid;
  justify-items: end;
  gap: 1px;
  text-align: right;
}

.duration-total span {
  color: var(--ink-3);
  font-size: 0.75rem;
}

.duration-total strong {
  font-size: 1.1875rem;
}

.duration-total small {
  color: var(--ink-3);
  font-size: 0.75rem;
}

.duration-segments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  border-top: 1px solid var(--rule-strong);
}

.duration-segment {
  display: grid;
  gap: 8px;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--rule);
}

.duration-segment + .duration-segment {
  padding-left: 16px;
  border-left: 1px solid var(--rule);
}

.duration-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.duration-name::before {
  content: "";
  width: 14px;
  height: 2px;
  background: var(--segment-color, var(--green));
}

.duration-meta {
  color: var(--ink-3);
  font-size: 0.75rem;
}

.duration-segment dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 0;
}

.duration-segment dt {
  color: var(--ink-3);
  font-size: 0.75rem;
}

.duration-segment dd {
  margin: 0;
  font-weight: 600;
}

/* Exhibits */

.exhibits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 28px;
}

.exhibit {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.exhibit h2 {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-strong);
  font-size: 1.0625rem;
}

.chart {
  height: 300px;
  min-width: 0;
}

.chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-grid {
  stroke: var(--rule);
}

.chart-axis {
  stroke: var(--rule-strong);
}

.chart-tick {
  fill: var(--ink-3);
  font-size: 11px;
}

.chart-legend {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

.chart-empty {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 120px;
  padding: 16px;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-align: center;
}

.table-wrap {
  max-height: 420px;
  overflow: auto;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  /* Edge shading shows there is more table to scroll to on narrow screens. */
  background:
    linear-gradient(to right, var(--sheet) 30%, rgba(248, 250, 246, 0)) left center / 28px 100% no-repeat local,
    linear-gradient(to left, var(--sheet) 30%, rgba(248, 250, 246, 0)) right center / 28px 100% no-repeat local,
    linear-gradient(to right, rgba(29, 41, 43, 0.14), rgba(29, 41, 43, 0)) left center / 10px 100% no-repeat scroll,
    linear-gradient(to left, rgba(29, 41, 43, 0.14), rgba(29, 41, 43, 0)) right center / 10px 100% no-repeat scroll;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap th,
.table-wrap td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  white-space: nowrap;
  font-size: 0.8125rem;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  background: var(--sheet);
  box-shadow: inset 0 -1px 0 var(--rule-strong);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 600;
}

.table-wrap tbody tr:hover {
  background: rgba(220, 235, 224, 0.5);
}


.num,
.table-wrap td.num,
.table-wrap th.num {
  text-align: right;
}

.table-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink-2);
  font-size: 0.6875rem;
  font-weight: 600;
}

/* Loading overlay */

.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(29, 41, 43, 0.28);
}

.app-loading-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(420px, 100%);
  padding: 18px 20px;
  background: var(--sheet);
  border-top: 3px double var(--rule-strong);
  border-bottom: 3px double var(--rule-strong);
  box-shadow: 0 10px 24px rgba(29, 41, 43, 0.14);
}

.app-loading-card p {
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.app-loading-spinner {
  width: 22px;
  height: 22px;
  flex: none;
  border: 2px solid var(--rule);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Responsive ---------- */

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

  .schedules {
    position: static;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 3px double var(--rule-strong);
  }

  .schedule-body {
    padding-left: 16px;
  }

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

@media (max-width: 560px) {
  .valuation-range {
    gap: 18px;
  }

  .sheet {
    padding: 20px 16px 40px;
  }

  .sheet-head {
    flex-direction: column;
  }

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

  .valuation-figure {
    font-size: 2.25rem;
  }

  .ledger th,
  .ledger td {
    padding: 8px 6px;
  }

  .ledger td {
    font-size: 0.875rem;
  }

  .source-switch {
    grid-template-columns: 1fr 1fr;
  }

  .app-store-summary {
    grid-template-columns: 1fr;
  }

  .app-store-facts {
    grid-template-columns: 1fr 1fr;
  }

  .exhibit-head {
    flex-wrap: wrap;
  }

  .source-switch label:nth-child(3) {
    border-left: 0;
  }

  .source-switch label:nth-child(n + 3) {
    border-top: 1px solid var(--rule);
  }

  .training-summary {
    grid-template-columns: 1fr 1fr;
  }

  .duration-segment + .duration-segment {
    padding-left: 0;
    border-left: 0;
  }

  .chart {
    height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
