/* Tallyrate · loan pricing request (concept, fictional data) */

:root {
  /* Brand blue #395c83 (hue 212°) plus lighter/darker shades */
  --brand: #395c83;          /* title bar, panel rule, open bars, primary button: white text 6.9:1 */
  --brand-hover: #2b4664;
  --accent: #395c83;         /* links, outlines, markers: 6.9:1 on white */
  --accent-dark: #22374e;    /* text on light tint */
  --accent-tint: #e6edf5;    /* table headers, chips, closed bars, hover */
  --on-brand: #ffffff;

  --page: #f4f6fa;
  --surface: #ffffff;
  --line: #d8dee8;
  --line-strong: #b8c2d1;
  --hl: #f4f6fa;

  --ink: #0f172a;
  --text: #243044;
  --muted: #5b6679;
  --faint: #8a94a6;
  --disabled-bg: #e3e8ef;

  --success: #15803d;
  --success-tint: #e8f3ec;
  --warning: #c2410c;
  --warning-tint: #fbeee6;
  --danger: #b91c1c;

  --safe-top: env(safe-area-inset-top, 0px);
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-padding-top: 16px; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
}

p, h1, h2, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; }
.muted { color: var(--muted); }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Title bar ---------- */
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 16px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 12px;
}
.titlebar__app { display: flex; align-items: center; gap: 8px; }
.titlebar__glyph { width: 11px; height: 10px; background: var(--on-brand); }
.titlebar__controls { display: flex; align-items: center; gap: 14px; }
.wc { position: relative; width: 11px; height: 11px; color: var(--on-brand); }
.wc--min::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; border-top: 1.5px solid currentColor; }
.wc--max { border: 1.5px solid currentColor; }
.wc--close::before, .wc--close::after {
  content: ""; position: absolute; left: -1px; right: -1px; top: 5px; border-top: 1.5px solid currentColor;
}
.wc--close::before { transform: rotate(45deg); }
.wc--close::after { transform: rotate(-45deg); }

/* ---------- Ticket strip ---------- */
.ticketbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  min-height: 33px;
  padding: 8px 16px;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--line);
  font-size: 12px;
}
.ticketbar__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
.meta { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.vdiv { width: 1px; height: 15px; background: var(--line-strong); flex-shrink: 0; }
.pill-id { padding: 1px 12px; background: var(--disabled-bg); color: var(--ink); }
.pill-status { padding: 1px 12px; background: var(--success); color: #fff; }

/* ---------- Section links ---------- */
.sectionnav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  padding: 8px 16px;
  background: var(--surface);
  font-size: 12px;
  white-space: nowrap;
}
.sectionnav__links { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.sectionnav__links a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Content ---------- */
.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
}
.panel {
  padding: 20px 24px 24px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 3px 0 var(--brand);
}
.panel__title { margin-bottom: 16px; font-size: 16px; font-weight: 600; }
.chip {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-tint);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 500;
}

/* Submissions & approvals: current request */
.acc { box-shadow: inset 0 0 0 1px var(--line); padding-bottom: 20px; }
.acc__head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 16px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
}
.caret { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor; }

.current { display: flex; align-items: flex-start; gap: clamp(32px, 8vw, 120px); padding: 16px 24px 0; }
.current__main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.sub-line { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tick {
  position: relative;
  width: 14px;
  height: 14px;
  background: var(--success);
}
.tick::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.current__details { display: flex; flex-wrap: wrap; gap: 16px 56px; padding-left: 22px; }
.current__col { display: flex; flex-direction: column; gap: 8px; }
.current__col--reason { width: 180px; }
.current__col--case { width: 300px; color: var(--text); }
.reason { display: flex; align-items: center; gap: 8px; color: var(--text); }
.reason__swatch { width: 11px; height: 11px; background: var(--line); flex-shrink: 0; }
.checkbox { width: 13px; height: 13px; box-shadow: inset 0 0 0 1px var(--line-strong); }

.approvals { flex: 0 0 360px; padding-left: 16px; border-left: 1px solid var(--line); }
.approvals__title { margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.route { display: flex; flex-direction: column; gap: 22px; }
.route__step { position: relative; display: flex; align-items: center; gap: 14px; color: var(--faint); }
.route__step--active { color: var(--ink); }
.route__step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 19px;
  height: 18px;
  border-left: 1px dashed var(--line-strong);
}
.route__marker { width: 15px; height: 15px; flex-shrink: 0; box-shadow: inset 0 0 0 2px var(--line-strong); }
.route__step--active .route__marker { box-shadow: inset 0 0 0 2px var(--accent); }
.approvals__rule { margin: 18px 0 14px; border-top: 1px solid var(--line); }
.factor { font-weight: 600; font-size: 12px; }

/* Prior approvals */
.panel__title--icon { display: flex; align-items: center; gap: 10px; }
.info {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  box-shadow: inset 0 0 0 1.5px var(--ink);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
}
.prior { margin: 0 24px 0 40px; padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
.prior__details { display: flex; align-items: flex-end; gap: 16px 56px; margin-top: 12px; padding-left: 22px; }
.prior__case { flex: 1 1 0; min-width: 0; color: var(--text); }
.prior__link { white-space: nowrap; }

/* Collapsible tickets */
.acc-list { display: flex; flex-direction: column; gap: 8px; }
.ticket { box-shadow: inset 0 0 0 1px var(--line); }
.ticket.is-open { padding-bottom: 16px; }
button.acc__head {
  width: 100%;
  border: 0;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.ticket:not(.is-open) > .acc__head {
  background: var(--accent-tint);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 500;
}
.ticket:not(.is-open) > .acc__head:hover { background: #d9e3ef; }
.ticket.is-open > .acc__head:hover { background: var(--brand-hover); }
.acc__head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.acc__head .caret { transition: transform 0.15s; }
.ticket:not(.is-open) .caret { transform: rotate(-90deg); }
.acc__count { margin-left: auto; font-size: 12px; font-weight: 400; opacity: 0.85; }

/* Summary tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; background: var(--page); box-shadow: inset 0 0 0 1px var(--line); }
.tile__label { color: var(--muted); font-size: 12px; }
.tile__value { margin-top: 6px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile__sub { color: var(--muted); font-size: 12px; }

/* ---------- Data grids ---------- */
.grid-scroll { overflow-x: auto; }
/* Divider between the label column and the facility columns, on every row */
#grid-facility > .col:first-child .cell,
#grid-proposed > .col:first-child .cell { box-shadow: inset -1px 0 0 var(--line-strong); }

.grid { display: flex; align-items: flex-start; }
.grid--min { min-width: 1100px; }
.col { display: flex; flex-direction: column; flex-shrink: 0; }
.col--flex { flex: 1 0 0; min-width: 0; }

.cell {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell span { overflow: hidden; text-overflow: ellipsis; }
.cell--label { color: var(--muted); }
.cell--head {
  height: 36px;
  background: var(--accent-tint);
  border-bottom: 0;
  color: var(--accent-dark);
  font-weight: 600;
}
.cell--group { height: 28px; border-bottom: 0; color: var(--ink); font-weight: 600; }
.cell--section {
  height: 28px;
  padding-top: 8px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.cell--num { justify-content: flex-end; padding: 0 10px; font-variant-numeric: tabular-nums; }
.cell--wrap { white-space: normal; line-height: 1.2; font-size: 12px; }
.cell--wrap span { text-align: right; }
.cell--r { box-shadow: inset -1px 0 0 var(--line); }
.cell--hl { background: var(--hl); }
.cell--bold { font-weight: 600; color: var(--ink); }
.cell--flag { color: var(--warning); font-weight: 600; }
.ic { width: 16px; height: 16px; flex-shrink: 0; }
.ic--sm { width: 12px; height: 12px; }

.group { display: flex; flex-direction: column; }
.group + .group { box-shadow: inset 1px 0 0 var(--line); }
.group__cols { display: flex; }

/* Attachments */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px;
  background: var(--page);
  border: 1px dashed var(--line-strong);
  color: var(--text);
}
.dropzone img { width: 16px; height: 16px; }

/* ---------- Action bar ---------- */
.actionbar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--line), 0 -4px 12px rgba(15, 23, 42, 0.06);
}
.actionbar__group { display: flex; align-items: center; gap: 12px; }

.btn {
  padding: 8px 16px;
  border: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: normal;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--outline { background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.btn--outline:hover:not(:disabled) { background: var(--accent-tint); }
.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn:disabled { background: var(--disabled-bg); color: var(--faint); box-shadow: none; cursor: not-allowed; }

/* =====================================================================
   View toggle (case-study control, sits above the app)
   ===================================================================== */
.viewbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  background: var(--ink);
  color: #cbd5e1;
  font-size: 12px;
}
.seg { display: inline-flex; padding: 2px; background: #1e293b; }
.seg__btn {
  padding: 6px 18px;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.seg__btn:hover { color: #fff; }
.seg__btn[aria-selected="true"] { background: var(--surface); color: var(--ink); }
.seg__btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.view[hidden] { display: none; }

/* =====================================================================
   Redesign view
   ===================================================================== */
.kpis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px 10px 0;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--line);
}
.kpis__items { display: flex; flex-wrap: wrap; row-gap: 8px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 0 24px; border-right: 1px solid var(--line); }
.kpi__k { color: var(--muted); font-size: 13px; }
.kpi__v { font-size: 14px; font-weight: 600; white-space: nowrap; }
.tag { display: inline-block; padding: 1px 10px; background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 600; }

.rd-tabs {
  position: sticky;
  top: var(--safe-top);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  padding: 0 16px;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--line);
}
.rd-tabs a {
  padding: 10px 16px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.rd-tabs a:hover { color: var(--ink); }
.rd-tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.rd { display: flex; flex-direction: column; gap: 20px; padding: 16px; background: var(--page); }
#view-redesign { scroll-padding-top: 48px; }
.rd-sec { display: flex; flex-direction: column; gap: 8px; min-width: 0; scroll-margin-top: 52px; }
.rd-h { font-size: 14px; font-weight: 600; }
.rd-card { padding: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line), inset 0 3px 0 var(--brand); }
.rd-scroll { overflow-x: auto; }
.rd-row { display: grid; grid-template-columns: minmax(360px, 452px) minmax(0, 1fr); gap: 16px; }
.rd-row .rd-card { flex: 1; }
.rd-sec--note, .rd-sec--approvals { align-self: stretch; }

/* Submitter's note */
.note { display: flex; gap: 16px; font-size: 12px; }
.note__who { flex: 0 0 128px; display: flex; flex-direction: column; gap: 2px; padding-right: 16px; border-right: 1px solid var(--line); }
.note__name { font-size: 14px; font-weight: 600; }
.note__rule { margin: 8px 0; border-top: 1px solid var(--line); }
.note__body { display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.note__k { font-weight: 600; color: var(--ink); }

/* Approval flow */
.flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; font-size: 12px; }
.flow__step { position: relative; display: flex; flex-direction: column; gap: 1px; padding-top: 34px; }
.flow__dot {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 21px;
  height: 21px;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--line-strong);
}
.flow__step.is-done .flow__dot { background: var(--brand); box-shadow: none; }
.flow__step.is-last-done .flow__dot::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.flow__step.is-current .flow__dot { box-shadow: inset 0 0 0 2px var(--brand); }
.flow__step:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 21px;
  right: -12px;
  border-top: 3px solid var(--brand);
}
.flow__step.is-current::before { border-top: 3px dashed var(--line-strong); }
.flow__role { color: var(--muted); font-weight: 500; }
.flow__who { font-weight: 600; }

/* Tables */
.rt { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.rt th, .rt td { height: 28px; padding: 4px 8px; border-bottom: 1px solid var(--line); color: var(--text); text-align: left; white-space: nowrap; }
.rt thead th { font-weight: 600; color: var(--ink); vertical-align: bottom; }
.rt thead tr:first-child th { border-bottom: 0; }
.rt thead tr.rt__sub th, .rt thead tr th.rt__bottom { border-bottom: 2px solid var(--line-strong); }
.rt tbody th { font-weight: 400; }
.rt .num { text-align: right; }
.rt .gs { box-shadow: inset 1px 0 0 var(--line); }
.rt__label { width: 160px; }
.rt__subtle { color: var(--muted); font-weight: 400; }
.rt__total th, .rt__total td { background: var(--hl); font-weight: 600; color: var(--ink); }
.rt tbody tr:hover td, .rt tbody tr:hover th { background: var(--hl); }

.rt--econ { min-width: 1180px; }
.delta { display: table-cell; }
.delta--down { color: var(--danger); }
.delta--up { color: var(--success); }
.tri { display: inline-block; width: 9px; height: 8px; margin-right: 10px; vertical-align: 0; }
.tri--down { transform: rotate(180deg); }

.rt--fac { min-width: 1500px; }
.rt--fac td { height: 40px; }
.rt--fac .gridcol { background: var(--hl); }
.rt__group { font-weight: 400 !important; color: var(--text) !important; }
.rt__check { width: 32px; }
.rt__status { text-align: center !important; }
.rt__status .ic { display: inline-block; }
.rt td.is-flag { color: var(--warning); font-weight: 600; }
.rt__empty { padding: 16px 8px; color: var(--muted); }
.rt input[type="checkbox"] { width: 14px; height: 14px; margin: 0; accent-color: var(--brand); }

.rt--rel { min-width: 1100px; }
.rt__editable th, .rt__editable td { background: var(--warning-tint); }
.edit { display: inline-block; width: 14px; height: 14px; margin-left: 10px; vertical-align: -2px; cursor: pointer; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.toolbar__right { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.icon-btn:hover { background: var(--accent-tint); }
.icon-btn img { width: 14px; height: 14px; }
.search { display: flex; align-items: center; gap: 6px; width: 180px; height: 28px; padding: 0 6px 0 8px; box-shadow: inset 0 0 0 1px var(--line-strong); }
.search:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }
.search img { width: 13px; height: 13px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 12px; color: var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear { display: grid; place-items: center; padding: 0; border: 0; background: transparent; cursor: pointer; }
.icon-btn:focus-visible, .search__clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.dropzone--tint { background: var(--accent-tint); border-color: var(--accent); border-style: dotted; }
.rd-hint { margin-top: 8px; font-size: 12px; }

.btn--danger { background: var(--surface); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.btn--danger:hover { background: #fdecec; }

/* Facility table: collapsible client information */
.rt--fac .ci-x, .rt--fac .fs-x { display: none; }
.rt--fac.is-ci-open .ci-x, .rt--fac.is-fs-open .fs-x { display: table-cell; }
.rt--fac.is-ci-open .ci-c, .rt--fac.is-fs-open .fs-c { display: none; }
.rt--fac.is-ci-open, .rt--fac.is-fs-open { min-width: 2300px; }
.rt--fac.is-ci-open.is-fs-open { min-width: 3000px; }
.ci-head { padding: 0 !important; }
.ci-toggle {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  height: 28px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ci-toggle:hover { background: var(--accent-tint); }
.ci-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ci-toggle__arrow {
  margin-left: auto;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 7px solid var(--accent);
  transition: transform 0.15s;
}
.is-ci-open .ci-toggle__arrow { transform: rotate(180deg); }

/* Approve sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.25);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.sheet-backdrop.is-open { opacity: 1; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.15), inset 0 3px 0 var(--brand);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}
.sheet.is-open { transform: translateY(0); visibility: visible; transition: transform 0.25s ease; }
.sheet__head { display: flex; align-items: center; gap: 10px; }
.sheet__icon { position: relative; flex-shrink: 0; width: 20px; height: 20px; background: var(--success); }
.sheet__icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.sheet__title { font-size: 14px; font-weight: 600; }
.sheet__close { margin-left: auto; }
.sheet__label { color: var(--muted); font-size: 12px; }
.sheet__input {
  width: 100%;
  min-height: 56px;
  padding: 8px;
  border: 0;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
}
.sheet__input::placeholder { color: var(--faint); }
.sheet__input:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--accent); }
.sheet__actions { display: flex; justify-content: flex-end; gap: 12px; }
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet.is-open, .sheet-backdrop { transition: none; }
}
.sheet__warn { flex-shrink: 0; width: 20px; height: 18px; }
.btn--danger-solid { background: var(--danger); color: #fff; }
.btn--danger-solid:hover:not(:disabled) { background: #991b1b; }
.pill-status--returned { background: var(--danger); }

/* =====================================================================
   Version 1 view (First Prototype)
   ===================================================================== */
.v1-layout { display: flex; align-items: stretch; background: var(--page); }
.v1-layout > .rd { flex: 1 1 auto; min-width: 0; }

/* Submitter's note accordion */
.v1-note { padding-bottom: 0; }
.v1-note__head { background: var(--accent-tint); color: var(--accent-dark); }
.v1-note:not(.is-open) .caret { transform: rotate(-90deg); }
.v1-note__body { padding: 16px; }

/* Ticket submission summary */
.v1-summary { display: flex; flex-direction: column; gap: 12px; }
.v1-summary__row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 0; font-size: 14px; }
.v1-summary__row .summary__item { display: flex; flex-direction: column; gap: 6px; padding: 0 16px; border-left: 1px solid var(--line); }
.v1-summary__row .summary__item:first-child { padding-left: 0; border-left: 0; }
.v1-summary__row .summary__label { color: var(--muted); }
.v1-summary__row .summary__value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Note + summary + tabs stick together as one white header strip */
.v1-sticky {
  position: sticky;
  top: calc(var(--safe-top) + var(--vb-h, 0px) + var(--v1head-h, 0px));
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: -16px -16px 0;
  padding: 12px 16px 0;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line), 0 4px 12px rgba(15, 23, 42, 0.05);
}
.v1-sticky .v1-note__head { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.v1-sticky .v1-note__head:hover { background: var(--hl); }
.v1-sticky .v1-summary { padding: 12px 16px; }
.v1-tabs { position: static; margin: 0 -16px; }
#view-version-1 .rd-sec, #v1-charts { scroll-margin-top: calc(var(--vb-h, 0px) + var(--v1head-h, 0px) + var(--v1-sticky-h, 260px) + 12px); }

/* Version 1: the whole top area stays pinned (switch strip, title bar, key facts, note, summary, tabs) */
body[data-view="version-1"] .viewbar { position: sticky; top: var(--safe-top); z-index: 31; }
#view-version-1 > header { position: sticky; top: calc(var(--safe-top) + var(--vb-h, 0px)); z-index: 30; }
#view-version-1 .v1-rail__panel { top: calc(var(--safe-top) + var(--vb-h, 0px) + var(--v1head-h, 0px)); }
.v1-status { white-space: nowrap; }
.v1-status .ic { display: inline-block; margin-right: 6px; vertical-align: -3px; }
.rt--v1 td { height: 32px; }

/* Charts */
.v1-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; scroll-margin-top: 52px; }
.v1-chart { position: relative; display: flex; flex-direction: column; gap: 10px; }
.v1-chart__title { font-size: 14px; font-weight: 600; }
.v1-chart__plot { position: relative; display: flex; flex-direction: column; gap: 8px; }
.v1-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.v1-legend span { display: inline-flex; align-items: center; gap: 6px; }
.v1-key { display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 1px; }
.v1-legend .v1-key { margin-right: 0; }
.v1-key--cur { background: #b8c2d1; }
.v1-key--prop { background: var(--brand); }

.v1-plot { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 4px 0 22px 96px; }
.v1-plot__grid { position: absolute; top: 0; bottom: 22px; left: 96px; right: 0; }
.v1-plot__grid span { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); }
.v1-plot__row { position: relative; display: flex; align-items: center; }
.v1-plot__label { position: absolute; left: -96px; width: 88px; color: var(--muted); font-size: 12px; line-height: 1.2; }
.v1-plot__bars { position: relative; display: flex; flex-direction: column; gap: 2px; width: 100%; }
.v1-bar { display: block; height: 12px; min-width: 2px; cursor: default; }
.v1-bar--cur { background: #b8c2d1; }
.v1-bar--prop { background: var(--brand); }
.v1-bar:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.v1-plot__axis { position: absolute; left: 96px; right: 0; bottom: 0; height: 16px; }
.v1-plot__axis span { position: absolute; transform: translateX(-50%); color: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.v1-plot__title { text-align: center; color: var(--muted); font-size: 12px; }
.v1-tip {
  position: absolute;
  z-index: 5;
  padding: 4px 8px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}
.v1-mini { margin-top: 4px; }
.v1-mini th .v1-key { vertical-align: 0; }

/* Approvals rail */
.v1-rail { position: relative; display: flex; flex-shrink: 0; background: var(--surface); box-shadow: inset 1px 0 0 var(--line); }
.v1-rail__toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 32px;
  padding: 12px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.v1-rail__toggle:hover { background: var(--accent-tint); }
.v1-rail__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.v1-rail__label { writing-mode: vertical-rl; }
.v1-rail.is-open .v1-rail__arrow { transform: rotate(180deg); }
.v1-rail__panel { position: sticky; top: 0; align-self: flex-start; width: 280px; padding: 16px; box-shadow: inset 1px 0 0 var(--line); }
.v1-steps { display: flex; flex-direction: column; gap: 18px; margin-top: 12px; font-size: 12px; }
.v1-steps li { position: relative; display: flex; gap: 12px; }
.v1-steps li:not(:last-child)::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: -16px; border-left: 2px solid var(--brand); }
.v1-steps li.is-current::after { border-left: 2px dashed var(--line-strong); }
.v1-steps__dot { flex-shrink: 0; width: 16px; height: 16px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line-strong); }
.v1-steps .is-done .v1-steps__dot { background: var(--brand); box-shadow: none; }
.v1-steps .is-current .v1-steps__dot { box-shadow: inset 0 0 0 2px var(--brand); }

/* The app is a desktop screen (1024px+). On narrower screens it scrolls sideways
   inside its own frame so the page itself never does. */
.frame { background: var(--page); }
@media (max-width: 1023px) {
  .frame { overflow-x: auto; }
  .stage { width: 1024px; }
}

/* Redesign: key-facts row stays pinned (the title bar above it scrolls away),
   with the section tabs pinned directly underneath. */
#view-redesign > header {
  position: sticky;
  top: calc(var(--safe-top) - 34px); /* 34px = title bar height */
  z-index: 30;
}
#view-redesign .rd-tabs { top: calc(var(--safe-top) + var(--rdhead-h, 94px) - 34px); }
#view-redesign .rd-sec { scroll-margin-top: calc(var(--rdhead-h, 94px) - 34px + 56px); }
