/* Verdana fallback for Android/Linux: DejaVu Sans subset (Latin + site symbols), fonts/LICENSE */
@font-face {
  font-family: "DejaVu Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local("DejaVu Sans"), local("DejaVuSans"), url("./fonts/DejaVuSans-subset.woff2") format("woff2");
}

@font-face {
  font-family: "DejaVu Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local("DejaVu Sans Bold"), local("DejaVuSans-Bold"), url("./fonts/DejaVuSans-Bold-subset.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --outer-bg: #dce3ec;
  --shell-bg: #ffffff;
  --shell-border: #8fa3b8;
  --title-top: #3a6ea5;
  --title-bot: #1f4673;
  --title-fg: #ffffff;
  --title-sub: #c9ddf2;
  --panel-head-top: #f2f6fb;
  --panel-head-bot: #d5e2f0;
  --panel-head-fg: #1b3d68;
  --panel-border: #b3c4d6;
  --filter-bg: #f6f8fb;
  --fg: #1a1a1a;
  --muted: #5a6776;
  --zebra: #f5f8fc;
  --row-hover: #fff9d6;
  --cell-border: #d5dfe9;
  --th-top: #f7f9fc;
  --th-bot: #dde6f0;
  --btn-top: #ffffff;
  --btn-bot: #d8e2ec;
  --btn-border: #7f95ad;
  --btn-fg: #182b42;
  --btn-shine: rgba(255, 255, 255, 0.5);
  --thumb-shine: rgba(255, 255, 255, 0.7);
  --link: #1c4e8a;
  --grid-line: #e7edf4;
}

[data-theme="dark"] {
  color-scheme: dark;
  --outer-bg: #161b22;
  --shell-bg: #1f2630;
  --shell-border: #3a495c;
  --title-top: #26486e;
  --title-bot: #162d47;
  --title-fg: #eef4fb;
  --title-sub: #a9c3df;
  --panel-head-top: #2a3545;
  --panel-head-bot: #212a37;
  --panel-head-fg: #c9def5;
  --panel-border: #39485b;
  --filter-bg: #242d3a;
  --fg: #e6ecf2;
  --muted: #98a8ba;
  --zebra: #232b36;
  --row-hover: #333b2a;
  --cell-border: #323e4e;
  --th-top: #2b3646;
  --th-bot: #212a37;
  --btn-top: #374659;
  --btn-bot: #263241;
  --btn-border: #4e627a;
  --btn-fg: #e8eff7;
  --btn-shine: rgba(255, 255, 255, 0.08);
  --thumb-shine: rgba(255, 255, 255, 0.1);
  --link: #7cb5f5;
  --grid-line: #2c3746;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 20px 14px 48px;
  background: var(--outer-bg);
  color: var(--fg);
  font: 14.5px/1.45 Verdana, "DejaVu Sans", Tahoma, Arial, sans-serif;
}

a {
  color: var(--link);
}

.shell {
  max-width: 1152px;
  margin: 0 auto;
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.16);
}

/* 2003 glossy steel-blue top header */
.titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 17px;
  background: linear-gradient(to bottom, var(--title-top), var(--title-bot));
  color: var(--title-fg);
  border-bottom: 1px solid #163252;
}

.titlebar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.titlebar-left h1 {
  margin: 0;
  font-size: 19px;
  font-weight: bold;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.titlebar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stamp {
  font-size: 12px;
  color: var(--title-sub);
  white-space: nowrap;
}

/* Classic 2003 beveled buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: bold 13px/1.2 Tahoma, Verdana, "DejaVu Sans", Arial, sans-serif;
  color: var(--btn-fg);
  background: linear-gradient(to bottom, var(--btn-top), var(--btn-bot));
  border: 1px solid var(--btn-border);
  border-radius: 3px;
  padding: 5px 9px 5px 7px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--btn-shine);
  white-space: nowrap;
}

.ico {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  display: block;
}

[data-theme="dark"] #themeIconMoon,
:root:not([data-theme="dark"]) #themeIconSun {
  display: none;
}

.btn:hover {
  filter: brightness(1.04);
}

.btn:active {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-sm {
  padding: 4px 8px;
}

.btn-link {
  text-decoration: none;
}

.star-count {
  margin-left: 2px;
  padding-left: 7px;
  border-left: 1px solid var(--btn-border);
  font-variant-numeric: tabular-nums;
}

.workspace {
  padding: 14px 17px 20px;
  display: grid;
  gap: 17px;
}

/* Filter toolbar */
.filter-bar {
  display: grid;
  /* The first filter holds two selects plus its value, so it gets more room. */
  grid-template-columns: minmax(0, 1.45fr) repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 14px 22px;
  padding: 11px 14px;
  background: var(--filter-bg);
}

.filter-item {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: bold;
  color: var(--panel-head-fg);
}

.filter-val {
  color: var(--fg);
  font-size: 13.5px;
  white-space: nowrap;
  background: var(--shell-bg);
  border: 1px solid var(--panel-border);
  border-radius: 2px;
  padding: 1px 6px;
}

.bench-pick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.select {
  font: 12.5px/1.2 Tahoma, Verdana, "DejaVu Sans", Arial, sans-serif;
  color: var(--fg);
  background: var(--shell-bg);
  border-top: 1px solid var(--shell-border);
  border-left: 1px solid var(--shell-border);
  border-right: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  padding: 2px 4px;
  max-width: 190px;
  cursor: pointer;
}

.row-link {
  color: inherit;
  text-decoration: none;
}

.row-link:hover {
  color: var(--link);
  text-decoration: underline;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]:focus {
  outline: 1px dotted var(--muted);
  outline-offset: 2px;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  background: var(--outer-bg);
  border-top: 1px solid var(--shell-border);
  border-left: 1px solid var(--shell-border);
  border-right: 1px solid var(--btn-top);
  border-bottom: 1px solid var(--btn-top);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 22px;
  margin-top: -8px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--btn-top), var(--btn-bot));
  border: 1px solid var(--btn-border);
  box-shadow: inset 0 1px 0 var(--thumb-shine), 0 1px 1px rgba(0, 0, 0, 0.25);
}

input[type="range"]::-webkit-slider-thumb:hover {
  filter: brightness(1.05);
}

input[type="range"]::-moz-range-track {
  height: 7px;
  background: var(--outer-bg);
  border-top: 1px solid var(--shell-border);
  border-left: 1px solid var(--shell-border);
  border-right: 1px solid var(--btn-top);
  border-bottom: 1px solid var(--btn-top);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--btn-top), var(--btn-bot));
  border: 1px solid var(--btn-border);
  box-shadow: inset 0 1px 0 var(--thumb-shine), 0 1px 1px rgba(0, 0, 0, 0.25);
}

/* Classic 2003 recessed square checkboxes */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin: 0;
  vertical-align: middle;
  background: #ffffff;
  border: 1px solid var(--btn-border);
  border-radius: 2px;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
}

input[type="checkbox"]:hover {
  border-color: var(--title-top);
}

input[type="checkbox"]:focus-visible {
  outline: 1px dotted var(--muted);
  outline-offset: 2px;
}

input[type="checkbox"]:checked {
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6.2 4.8 8.9 9.8 3.1' fill='none' stroke='%231f4673' stroke-width='2' stroke-linecap='square' stroke-linejoin='miter'/%3E%3C/svg%3E") center / 11px 11px no-repeat;
}

[data-theme="dark"] input[type="checkbox"] {
  background-color: #181f28;
  border-color: #536882;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] input[type="checkbox"]:hover {
  border-color: var(--link);
}

[data-theme="dark"] input[type="checkbox"]:checked {
  background: #181f28 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6.2 4.8 8.9 9.8 3.1' fill='none' stroke='%237cb5f5' stroke-width='2' stroke-linecap='square' stroke-linejoin='miter'/%3E%3C/svg%3E") center / 11px 11px no-repeat;
}

.filter-actions {
  display: flex;
  align-items: center;
  padding-left: 14px;
  border-left: 1px solid var(--panel-border);
}

.extra-criteria {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 22px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}

.extra-criterion {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.extra-criterion-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: bold;
  color: var(--panel-head-fg);
  min-width: 0;
}

.extra-criterion-head .select {
  max-width: 155px;
  min-width: 0;
}

.extra-criterion-head strong {
  color: var(--fg);
  font-size: 14.5px;
  white-space: nowrap;
}

.extra-criterion-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.remove-btn {
  font: bold 11px/1 Tahoma, Verdana, "DejaVu Sans", Arial, sans-serif;
  color: var(--btn-fg);
  background: linear-gradient(to bottom, var(--btn-top), var(--btn-bot));
  border: 1px solid var(--btn-border);
  border-radius: 2px;
  padding: 2px 5px;
  cursor: pointer;
}

.remove-btn:hover {
  filter: brightness(1.05);
}

.est-star {
  font-weight: bold;
  cursor: help;
}

.tier-glyph,
.est-tier {
  font-family: "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", sans-serif;
  font-weight: normal;
  margin-left: 2px;
}

.rel-glyph {
  margin-left: 3px;
  cursor: help;
}

.rel-legend {
  display: grid;
  gap: 3px;
  line-height: 1.4;
}

.method-table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
  font-size: 12px;
}

.method-table th,
.method-table td {
  text-align: left;
  padding: 2px 6px;
  border-bottom: 1px solid var(--cell-border);
}

.method-table td:not(:first-child),
.method-table th:not(:first-child) {
  white-space: nowrap;
}

.footnote {
  margin: -6px 2px 0;
  font-size: 12px;
  color: var(--muted);
}

.extrap-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  font-size: 12px;
  line-height: 1.35;
  color: #222;
  background: #ffffcc;
  border-bottom: 1px solid #c9c37a;
}

.extrap-banner[hidden] {
  display: none;
}

[data-theme="dark"] .extrap-banner {
  color: #e6dfb8;
  background: #2b291a;
  border-bottom: 1px solid #595331;
}

.infobar-ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}

.infobar-text {
  flex: 1 1 auto;
}

.infobar-link {
  flex-shrink: 0;
  padding: 0;
  border: 0;
  background: none;
  font: 12px/1.2 Tahoma, Verdana, "DejaVu Sans", Arial, sans-serif;
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
}

.infobar-link:hover {
  filter: brightness(1.1);
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  background: var(--filter-bg);
  border-top: 1px solid var(--panel-border);
}

.panel-foot[hidden] {
  display: none;
}

.bar-fill.is-extrapolated {
  opacity: 0.45;
}

.bar-row.is-extrapolated > .bar-label .bar-model,
.bar-row.is-extrapolated > .bar-track-wrap .bar-val,
.bar-row.is-extrapolated > .bar-track-wrap .bar-note {
  font-style: italic;
  font-weight: normal;
  color: var(--muted);
}

.bar-row.is-extrapolated > .bar-label .plan-text {
  font-style: italic;
}

tr.is-extrapolated td,
.pm-cell.is-extrapolated {
  font-style: italic;
  color: var(--muted);
}

tr.is-extrapolated .model,
tr.is-extrapolated .real-cell,
.pm-cell.is-extrapolated .pm-cost {
  font-weight: normal;
}

.settings-body {
  display: grid;
  gap: 14px;
}

.settings-section {
  display: grid;
  gap: 8px;
}

.settings-section + .settings-section {
  padding-top: 12px;
  border-top: 1px solid var(--cell-border);
}

.settings-heading {
  font-size: 13px;
  font-weight: bold;
  color: var(--panel-head-fg);
}

.settings-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.settings-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
}

.settings-check input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.settings-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.effort-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.effort-pick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--muted);
}

.settings-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 4px;
}

.meta-cell {
  font-size: 12.5px;
  line-height: 1.3;
  white-space: nowrap;
}

.settings-criteria-list {
  display: grid;
  gap: 6px;
}

.settings-crit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: var(--filter-bg);
  border: 1px solid var(--cell-border);
  font-size: 12.5px;
}

.dialog-titlebar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 7px 10px;
  background: var(--filter-bg);
  border-bottom: 1px solid var(--cell-border);
}

.toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.toolbar-check input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

tr.group-row {
  background: linear-gradient(to bottom, var(--panel-head-top), var(--panel-head-bot));
  cursor: pointer;
}

tr.group-row:hover {
  filter: brightness(1.03);
}

tr.group-row td {
  padding: 6px 10px;
  font-weight: bold;
  font-size: 13px;
  color: var(--panel-head-fg);
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
}

tr.group-row:first-child td {
  border-top: 0;
}

.group-caret {
  display: inline-block;
  width: 14px;
  user-select: none;
}

tr.grouped-item td:first-child {
  padding-left: 24px;
}

.search-input {
  width: min(300px, 100%);
  font: 13px/1.2 Tahoma, Verdana, "DejaVu Sans", Arial, sans-serif;
  color: var(--fg);
  background: var(--shell-bg);
  border-top: 1px solid var(--shell-border);
  border-left: 1px solid var(--shell-border);
  border-right: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  padding: 4px 7px;
}

.search-input::placeholder {
  color: var(--muted);
}

.num,
.num-col {
  font-variant-numeric: tabular-nums;
}

/* Boxed 2003 SaaS panels */
.panel {
  border: 1px solid var(--panel-border);
  background: var(--shell-bg);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 7px 12px;
  background: linear-gradient(to bottom, var(--panel-head-top), var(--panel-head-bot));
  border-bottom: 1px solid var(--panel-border);
}

.panel-title-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-sm {
  font-size: 12px;
  padding: 1px 4px;
}

.panel-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: bold;
  color: var(--panel-head-fg);
}

.head-checks {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.head-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: normal;
  color: var(--panel-head-fg);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.head-check input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

summary.panel-toggle {
  cursor: pointer;
  list-style: none;
  border-bottom: 0;
}

summary.panel-toggle::-webkit-details-marker {
  display: none;
}

summary.panel-toggle h2::before {
  content: "▸ ";
}

details[open] > summary.panel-toggle {
  border-bottom: 1px solid var(--panel-border);
}

details[open] > summary.panel-toggle h2::before {
  content: "▾ ";
}

.panel-body {
  padding: 0;
}

/* 2003 glossy horizontal bar chart */
.bar-chart {
  display: grid;
}

.bar-row {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  align-items: center;
  row-gap: 4px;
  column-gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--grid-line);
}

.bar-row:nth-child(even) {
  background: var(--zebra);
}

.bar-row:last-child {
  border-bottom: 0;
}

.bar-row:hover:not(:has(.plan-drawer:hover)) {
  background: var(--row-hover);
}

.bar-label {
  min-width: 0;
}

/* Model names wrap instead of being cut off ("…non-reasoni…") */
.bar-model {
  font-size: 14.5px;
  font-weight: bold;
  white-space: normal;
  overflow-wrap: break-word;
}

.bar-plan {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}

.bar-plan .plan-text {
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-exp-btn {
  flex-shrink: 0;
  font: bold 10.5px/1 Tahoma, Verdana, "DejaVu Sans", Arial, sans-serif;
  color: var(--btn-fg);
  background: linear-gradient(to bottom, var(--btn-top), var(--btn-bot));
  border: 1px solid var(--btn-border);
  border-radius: 2px;
  padding: 2px 5px;
  cursor: pointer;
}

.plan-exp-btn:hover {
  filter: brightness(1.05);
}

.plan-drawer {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: 1px;
  background: var(--shell-bg);
  border: 1px solid var(--panel-border);
}

.plan-matrix-wrap {
  overflow-x: auto;
}

/* Subsidy sources under the drawer matrix: collapsed by default, a second table in the matrix style */
.prov-details > summary {
  cursor: pointer;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: bold;
  color: var(--link);
  border-top: 1px solid var(--cell-border);
}

.prov-details[open] > summary {
  color: var(--panel-head-fg);
}

.prov-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  border-top: 2px solid var(--panel-border);
}

.prov-table th {
  text-align: left;
  font-size: 11px;
  padding: 4px 8px;
  color: var(--panel-head-fg);
  background: linear-gradient(to bottom, var(--th-top), var(--th-bot));
  border-bottom: 1px solid var(--cell-border);
  white-space: nowrap;
}

.prov-table td {
  padding: 4px 8px;
  vertical-align: top;
  border-bottom: 1px solid var(--grid-line);
}

.prov-table .prov-alt td {
  background: var(--zebra);
}

.prov-table .prov-step td {
  border-top: 0;
  padding-top: 0;
}

.prov-table .prov-model {
  color: var(--panel-head-fg);
  white-space: nowrap;
}

.prov-table .prov-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.prov-table .prov-src {
  width: 100%;
  color: var(--muted);
  overflow-wrap: break-word;
}

.prov-table .prov-arrow {
  margin-right: 5px;
  color: var(--muted);
}

.prov-table .prov-date {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.prov-table th.prov-sub {
  padding-top: 6px;
  border-top: 1px solid var(--cell-border);
}

.prov-table .prov-date-inline {
  display: none;
}

@media (max-width: 600px) {
  /* Bundled credits stay in the drawer, table and popups; the bar row keeps fee · harness · limits */
  .bar-meta .credits-note {
    display: none;
  }
  .prov-table .prov-date,
  .prov-table thead th:last-child {
    display: none;
  }
  .prov-table .prov-date-inline {
    display: block;
    font-size: 11px;
  }
  .prov-table td,
  .prov-table th {
    padding-left: 6px;
    padding-right: 6px;
  }
}

.nowrap {
  white-space: nowrap;
}

.plan-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto;
}

.plan-matrix th {
  font-size: 11px;
  padding: 4px 8px;
  cursor: default;
}

.plan-matrix td {
  padding: 5px 8px;
  vertical-align: middle;
}

.plan-matrix .pm-model {
  font-weight: bold;
  white-space: nowrap;
}

.plan-matrix .pm-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plan-matrix .pm-cell.dim {
  opacity: 0.42;
}

.plan-matrix .pm-cell.empty-cell {
  color: var(--muted);
  opacity: 0.45;
}

.pm-cost {
  font-weight: bold;
  display: block;
  line-height: 1.2;
}

.pm-score {
  font-size: 11px;
  color: var(--muted);
  display: block;
  line-height: 1.2;
}

.bar-track-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  min-width: 0;
}

.bar-track-wrap .bar-note {
  flex-basis: 100%;
}

.bar-fill {
  /* Scale against the track minus room for the price beside it; the score sits on the line below. */
  width: calc(var(--bar-ratio, 0.68) * (100% - var(--bar-label-room, 100px))) !important;
  height: 19px;
  min-width: 5px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 2px;
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.32) 0%,
    rgba(255, 255, 255, 0.05) 55%,
    rgba(0, 0, 0, 0.14) 100%
  );
}

.bar-val {
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bar-note {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 2003 grid table */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 13px;
  font-weight: bold;
  color: var(--panel-head-fg);
  padding: 7px 10px;
  background: linear-gradient(to bottom, var(--th-top), var(--th-bot));
  border-bottom: 1px solid var(--panel-border);
  border-right: 1px solid var(--cell-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th.active.asc::after {
  content: " ▲";
  font-size: 11px;
}

th.active.desc::after {
  content: " ▼";
  font-size: 11px;
}

td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--cell-border);
  border-right: 1px solid var(--cell-border);
  vertical-align: middle;
}

tbody tr:nth-child(even) {
  background: var(--zebra);
}

tbody tr:hover {
  background: var(--row-hover);
}

.num-col {
  text-align: right;
  white-space: nowrap;
}

.model {
  font-weight: bold;
}

.plan {
  color: var(--muted);
  font-size: 12.5px;
}

.real-cell {
  font-weight: bold;
}

.empty {
  padding: 22px 0;
  color: var(--muted);
  text-align: center;
}

/* Classic 2003 modal dialog */
.dialog {
  width: min(564px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--shell-border);
  background: var(--shell-bg);
  color: var(--fg);
  box-shadow: 0 5px 22px rgba(0, 0, 0, 0.35);
}

.dialog::backdrop {
  background: rgba(15, 25, 40, 0.45);
}

.dialog-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: linear-gradient(to bottom, var(--title-top), var(--title-bot));
  color: var(--title-fg);
  border-bottom: 1px solid #163252;
}

.dialog-titlebar h2 {
  margin: 0;
  font-size: 15px;
  font-weight: bold;
}

.dialog-body {
  padding: 14px 17px;
  max-height: min(76vh, 620px);
  overflow-y: auto;
}

.dialog-body p {
  margin: 0 0 11px;
  font-size: 13.5px;
  line-height: 1.45;
}

.dialog-body p:last-child {
  margin-bottom: 0;
}

.dialog-note {
  color: var(--muted);
  font-size: 12.5px !important;
}

.method-body {
  display: grid;
  gap: 8px;
}

.method-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.method-formulas {
  padding: 7px 10px;
  background: var(--filter-bg);
  border: 1px solid var(--panel-border);
  font-size: 12.5px;
  line-height: 1.55;
}

.method-formulas code {
  font: bold 12.5px/1.4 Tahoma, Verdana, "DejaVu Sans", Arial, sans-serif;
  color: var(--panel-head-fg);
}

.method-markers {
  margin: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 6px 8px;
  font-size: 13px;
  line-height: 1.42;
}

.method-markers dt {
  font-family: "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", sans-serif;
  font-weight: bold;
  text-align: center;
  color: var(--panel-head-fg);
}

.method-markers dd {
  margin: 0;
}

.method-foot {
  padding-top: 10px;
  border-top: 1px solid var(--cell-border);
}

@media (max-width: 780px) {
  body {
    padding: 0;
  }
  .shell {
    border-left: 0;
    border-right: 0;
  }
  .titlebar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }
  .titlebar-left {
    justify-content: space-between;
    align-items: baseline;
  }
  .titlebar-left h1 {
    font-size: 17px;
  }
  .titlebar-right {
    display: flex;
    gap: 6px;
  }
  .titlebar-right .btn {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 12px;
    padding: 5px 7px 5px 6px;
    gap: 5px;
  }
  .workspace {
    padding: 10px 10px 16px;
    gap: 12px;
  }
  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
    padding: 10px 12px;
  }
  .filter-item {
    gap: 3px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--grid-line);
  }
  .filter-actions {
    border-left: 0;
    padding-left: 0;
    padding-top: 2px;
  }
  .extra-criteria {
    grid-column: 1;
    grid-template-columns: 1fr;
  }
  .settings-checks {
    grid-template-columns: 1fr;
  }
  .panel-head {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .panel-head-controls {
    width: 100%;
    justify-content: space-between;
  }
  .head-check {
    white-space: normal;
  }
  .bar-row {
    grid-template-columns: 200px minmax(0, 1fr);
    padding: 8px 10px;
  }
  .bar-model {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  .bar-fill {
    max-width: 52%;
  }
  .bar-note {
    font-size: 12px;
  }
  table:not(.plan-matrix) {
    font-size: 12.5px;
    table-layout: auto;
  }
  table:not(.plan-matrix) th,
  table:not(.plan-matrix) td {
    padding: 7px 6px;
  }
  /* Tablet: hide only the two least-used columns */
  table:not(.plan-matrix) .col-hide-md {
    display: none;
  }
  table:not(.plan-matrix) td:nth-child(1) .model,
  table:not(.plan-matrix) td:nth-child(1) .plan {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}

/* Methodology: wide enough to fit without scrolling on desktop; scroll only on short screens */
#methodDialog {
  width: min(1040px, calc(100vw - 28px));
}

/* Only the body scrolls: the dialog is a column capped by the viewport, the body takes what the title bar leaves.
   A body cap on its own (100vh - 60px) left the dialog itself 20px too tall at 864px, with a second scrollbar. */
.dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100dvh - 16px);
}
.dialog[open] > .dialog-titlebar {
  flex: 0 0 auto;
}
.dialog[open] > .dialog-body {
  flex: 1 1 auto;
  min-height: 0;
}
#methodDialog .method-body {
  max-height: none;
  padding-top: 10px;
  padding-bottom: 10px;
}

.bar-meta {
  display: none;
  font-size: 12px;
  color: var(--muted);
}

/* Shared mobile + tablet: bigger tap targets in the same bevelled style */
@media (max-width: 780px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .workspace > * {
    min-width: 0;
  }
  .titlebar-right .btn {
    flex: 0 1 auto;
  }
  .btn {
    min-height: 40px;
    padding: 8px 12px;
  }
  .dialog-titlebar .btn {
    min-height: 36px;
  }
  .select,
  .search-input {
    min-height: 36px;
    font-size: 16px;
  }
  .search-input {
    width: 100%;
  }
  .plan-exp-btn {
    min-width: 32px;
    min-height: 32px;
    font-size: 13px;
  }
  .head-check,
  .settings-check,
  .toolbar-check {
    min-height: 40px;
    align-items: center;
  }
  input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }
  input[type="range"] {
    height: 40px;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 30px;
    margin-top: -12px;
  }
  input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 30px;
  }
  #enableExtrapBtn,
  #disableExtrapBtn {
    display: inline-block;
    padding: 10px 0;
  }
  .bar-meta {
    display: block;
  }
  tr.group-row td {
    height: 44px;
  }
  /* Drawer: pinned model column + right-edge scroll shadow */
  .plan-matrix .pm-model {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--shell-bg);
    box-shadow: 1px 0 0 var(--cell-border);
  }
  .plan-matrix thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: linear-gradient(var(--th-top), var(--th-bot));
    box-shadow: 1px 0 0 var(--cell-border);
  }
  .plan-matrix-wrap {
    background:
      linear-gradient(to left, var(--shell-bg), var(--shell-bg)) right / 14px 100% no-repeat local,
      linear-gradient(to left, rgba(0, 0, 0, 0.16), transparent) right / 14px 100% no-repeat scroll,
      var(--shell-bg);
  }
  .plan-matrix th,
  .pm-score {
    font-size: 12px;
  }
}

/* Phone */
@media (max-width: 600px) {
  .filter-bar {
    grid-template-columns: 1fr;
  }
  .bar-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .titlebar-right .btn {
    flex: 1 1 auto;
  }
  .select {
    max-width: 100%;
  }
  .bench-pick {
    flex: 1 1 auto;
  }
  .bench-pick .select {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }
  .bench-pick #rankMode {
    flex: none;
    width: auto;
  }
  .extra-criterion-head .select {
    max-width: none;
    flex: 1 1 auto;
    min-width: 0;
  }
  table:not(.plan-matrix) .col-hide-sm {
    display: none;
  }
  .bar-fill {
    max-width: calc(100% - 150px);
  }
  .bar-val {
    flex: none;
  }
  .bar-note {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  table:not(.plan-matrix) th {
    white-space: normal;
    font-size: 12px;
    vertical-align: bottom;
  }
  table:not(.plan-matrix) td,
  table:not(.plan-matrix) th {
    padding-left: 5px;
    padding-right: 5px;
  }
  .effort-range {
    flex-wrap: nowrap;
  }
  .effort-range .select {
    flex: 1;
  }
}

.method-details {
  margin-top: 8px;
}
.method-details > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  color: var(--panel-head-fg);
  padding: 4px 0;
}
.method-details[open] > summary {
  margin-bottom: 6px;
}
.method-sources {
  font-size: 13px;
  margin: 2px 0 8px;
}

#methodDialog .method-body > * {
  min-width: 0;
}

@media (max-width: 600px) {
  #methodDialog .method-table td,
  #methodDialog .method-table th {
    white-space: normal;
  }
}

#methodDialog .method-levels td:nth-child(3) {
  white-space: normal;
}
#methodDialog .settings-section > p {
  margin: 4px 0 6px;
  font-size: 13px;
}

#methodDialog .method-metrics td:first-child {
  white-space: nowrap;
}
#methodDialog .method-metrics td:nth-child(2) {
  white-space: normal;
}
@media (max-width: 600px) {
  #methodDialog .method-metrics td:first-child {
    white-space: normal;
  }
}

/* Table toolbar extras: Sort (phones only) and paging */
.toolbar-sort,
.card-sub {
  display: none;
}

.table-more {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--filter-bg);
  border-top: 1px solid var(--cell-border);
}

.table-more-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Phone: full table as card rows, full-screen dialogs */
@media (max-width: 600px) {
  .table-toolbar {
    gap: 6px 10px;
  }
  .table-toolbar .search-input {
    flex: 1 1 100%;
    width: 100%;
  }
  .toolbar-sort {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 1 1 0;
    min-width: 0;
  }
  .toolbar-sort .select {
    flex: 1 1 auto;
    min-width: 0;
  }
  #tableSortDir {
    min-width: 40px;
    justify-content: center;
  }
  .table-wrap {
    overflow-x: visible;
  }
  .data-table,
  .data-table tbody {
    display: block;
  }
  .data-table tbody {
    padding: 5px 4px;
  }
  .data-table thead {
    display: none;
  }
  .data-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 8px;
    row-gap: 0;
    min-height: 60px;
    padding: 5px 8px;
    background: var(--shell-bg);
    border: 1px solid var(--cell-border);
    box-shadow: inset 0 1px 0 var(--btn-shine);
  }
  .data-table tbody tr + tr {
    margin-top: 5px;
  }
  .data-table tbody tr:nth-child(even) {
    background: var(--zebra);
  }
  .data-table tbody tr:hover {
    background: var(--row-hover);
  }
  .data-table tbody td,
  .data-table tbody tr.group-row td {
    padding: 0;
    height: auto;
    border: 0;
    font-size: 11px;
    line-height: 1.4;
    text-align: left;
  }
  .data-table tbody td[data-label] {
    display: inline-block;
    order: 4;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .data-table tbody td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--muted);
  }
  /* Line 1: model + glyph, Real cost */
  .data-table tbody td.name-cell {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    font-size: 13.5px;
    white-space: normal;
  }
  .data-table tbody td.real-cell {
    order: 2;
    flex: none;
    font-size: 14px;
    font-weight: bold;
  }
  .data-table tbody td.name-cell::before,
  .data-table tbody td.real-cell::before {
    content: none;
  }
  .data-table .name-cell .plan {
    display: none;
  }
  /* Line 2: plan · fee · score */
  .data-table tbody td.card-sub {
    order: 3;
    display: flex;
    flex: 1 1 100%;
    min-width: 0;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
  }
  .card-sub span {
    flex: none;
  }
  .card-sub span:first-child {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .card-sub span + span::before {
    content: "\00a0·\00a0";
  }
  /* Line 3: remaining label/value pairs */
  .data-table tbody td.score-cell,
  .data-table tbody td.fee-cell,
  .data-table tbody td.card-empty,
  .data-table tbody td.col-hide-md {
    display: none;
  }
  .data-table .meta-cell div {
    display: inline;
  }
  .data-table .meta-cell div + div::before {
    content: " · ";
  }
  .data-table tbody td.empty {
    flex: 1 1 100%;
    padding: 16px 0;
    text-align: center;
  }
  .data-table tbody tr.grouped-item {
    margin-left: 14px;
  }
  .data-table tbody tr.grouped-item td:first-child {
    padding-left: 0;
  }
  .data-table tbody tr.group-row {
    min-height: 44px;
    align-items: center;
    background: linear-gradient(to bottom, var(--panel-head-top), var(--panel-head-bot));
    border-color: var(--panel-border);
  }
  .data-table tbody tr.group-row td.name-cell,
  .data-table tbody tr.group-row td.real-cell {
    font-size: 13.5px;
  }
  .data-table tbody tr.group-row td.card-sub,
  .data-table tbody tr.group-row td[data-label] {
    font-weight: normal;
  }

  .dialog,
  #methodDialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    box-shadow: none;
  }
  .dialog-titlebar {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 48px;
    padding: 0 12px;
  }
  .dialog-body,
  #methodDialog .method-body {
    max-height: calc(100dvh - 48px);
    overscroll-behavior: contain;
  }
  .settings-head-row.effort-row {
    flex-wrap: wrap;
  }
  .effort-row .effort-range {
    flex: 1 1 100%;
    flex-wrap: nowrap;
  }
  .effort-row .effort-pick {
    flex: 1 1 0;
    min-width: 0;
  }
  .effort-row .effort-pick .select {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* Easter-egg undo cover (see the inline script in index.html and the egg code in app.js) */
html.egg-undo::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--egg-cover, var(--outer-bg));
  pointer-events: none;
  transition: opacity 0.7s ease;
}
html.egg-undo.egg-reveal::after {
  opacity: 0;
}

/* Phone and tablet bar rows: price beside the name, thin full-width bar, plan + score, then meta */
@media (max-width: 780px) {
  .bar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "model price"
      "track track"
      "plan  note"
      "meta  meta"
      "drawer drawer";
    column-gap: 10px;
    row-gap: 3px;
    padding: 9px 12px;
  }
  .bar-label,
  .bar-track-wrap {
    display: contents;
  }
  .bar-model {
    grid-area: model;
    align-self: center;
  }
  .bar-val {
    grid-area: price;
    align-self: center;
    justify-self: end;
    font-size: 15px;
  }
  .bar-row::before {
    content: "";
    grid-area: track;
    height: 10px;
    margin: 3px 0;
    border-radius: 5px;
    background: var(--grid-line);
  }
  .bar-fill {
    grid-area: track;
    justify-self: start;
    align-self: center;
    /* Desktop scales the longest bar to 68% to leave room for the label; here the bar has its own line. */
    width: calc(var(--bar-ratio, 0.68) * 100%) !important;
    height: 10px;
    min-width: 10px;
    max-width: 100%;
    border-radius: 5px;
    border: 0;
  }
  .bar-plan {
    grid-area: plan;
    min-width: 0;
    font-size: 12.5px;
  }
  .bar-note {
    grid-area: note;
    justify-self: end;
    align-self: center;
  }
  .bar-meta {
    grid-area: meta;
    font-size: 11.5px;
  }
  .bar-row > .plan-drawer {
    grid-area: drawer;
  }
  .plan-exp-btn {
    min-width: 26px;
    min-height: 22px;
    padding: 0 6px;
    font-size: 10px;
  }
  /* Keep the small look; extend the tap area to 32 × 32 with an invisible hit box. */
  .plan-exp-btn {
    position: relative;
  }
  .plan-exp-btn::after {
    content: "";
    position: absolute;
    inset: -5px -3px;
  }
  .head-checks {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  .head-check {
    min-height: 32px;
    gap: 8px;
  }
}

/* Tablet: Min/Top + benchmark + value need the full width; budget and max cost share the row below */
@media (min-width: 601px) and (max-width: 780px) {
  .filter-bar > .filter-item:first-child {
    grid-column: 1 / -1;
  }
}

/* Description and explainer text: shown only in the Shift x5 easter egg (html[data-slop]) */
.intro-text {
  display: none;
}

/* Two-option settings: radio pairs over a hidden select */
.pair-source {
  display: none;
}

.radio-pair {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.radio-opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin: 0;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--btn-border);
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
}

input[type="radio"]:checked::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--link);
}

input[type="radio"]:focus-visible {
  outline: 1px dotted var(--muted);
  outline-offset: 2px;
}

[data-theme="dark"] input[type="radio"] {
  background-color: #181f28;
  border-color: #536882;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] input[type="radio"]:checked::before {
  background: #7cb5f5;
}

/* Phones: the same radios as bevelled segmented buttons; the chosen side looks pressed */
@media (max-width: 600px) {
  .radio-pair {
    gap: 0;
    flex-wrap: nowrap;
  }
  .radio-opt {
    position: relative;
    min-height: 36px;
    padding: 0 12px;
    justify-content: center;
    font: bold 13px Tahoma, Verdana, "DejaVu Sans", Arial, sans-serif;
    color: var(--btn-fg);
    background: linear-gradient(to bottom, var(--btn-top), var(--btn-bot));
    border: 1px solid var(--btn-border);
    box-shadow: inset 0 1px 0 var(--btn-shine);
  }
  .radio-opt + .radio-opt {
    border-left: 0;
  }
  .radio-opt:first-child {
    border-radius: 3px 0 0 3px;
  }
  .radio-opt:last-child {
    border-radius: 0 3px 3px 0;
  }
  .radio-opt input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
  }
  .radio-opt:has(input:checked) {
    background: linear-gradient(to bottom, var(--btn-bot), var(--btn-top));
    box-shadow: inset 1px 2px 4px rgba(0, 0, 0, 0.35);
    color: var(--panel-head-fg);
    filter: brightness(0.88);
  }
  .radio-opt:has(input:focus-visible) {
    outline: 1px dotted var(--muted);
    outline-offset: -3px;
  }
}

/* "?" help tips next to setting labels: hover for the title, tap to show the text inline */
.settings-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.help-tip {
  width: 15px;
  height: 15px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--btn-border);
  background: linear-gradient(to bottom, var(--btn-top), var(--btn-bot));
  color: var(--btn-fg);
  font: bold 10px/13px Tahoma, Verdana, "DejaVu Sans", Arial, sans-serif;
  text-align: center;
  cursor: help;
}

.help-pop {
  flex-basis: 100%;
  max-width: 34em;
  margin-top: 2px;
  padding: 5px 7px;
  font-size: 12px;
  font-weight: normal;
  line-height: 1.4;
  color: var(--fg);
  background: #ffffe1;
  border: 1px solid #a09c80;
}

[data-theme="dark"] .help-pop {
  background: #2f2c1c;
  border-color: #6b6648;
}

@media (max-width: 780px) {
  .help-tip {
    position: relative;
  }
  .help-tip::after {
    content: "";
    position: absolute;
    inset: -9px;
  }
}

.rel-legend-hint {
  margin-top: 3px;
  font-style: italic;
}

.sub-derived {
  margin-left: 2px;
  font-weight: normal;
  color: var(--muted);
  cursor: help;
}

/* Drawer tables: hover lights every cell, including zebra cells and the sticky model column */
.plan-matrix tbody tr:hover > td,
.prov-table tbody tr:hover > td {
  background-color: var(--row-hover);
}

/* Range mode: "$0.313–0.509" needs about 125px beside the longest bar */
.bar-chart.range-view {
  --bar-label-room: 175px;
}

/* ?blackout: near-black dark theme; --outer-bg (#010101) is set from app.js */
html.blackout[data-theme="dark"] {
  --shell-bg: #09090a;
  --shell-border: #222226;
  --title-top: #17171a;
  --title-bot: #0c0c0e;
  --title-fg: #f0f0f3;
  --title-sub: #9a9aa3;
  --panel-head-top: #151518;
  --panel-head-bot: #0e0e10;
  --panel-head-fg: #d6d6dc;
  --panel-border: #232327;
  --filter-bg: #0d0d0f;
  --fg: #e8e8ec;
  --muted: #8d8d97;
  --zebra: #0e0e10;
  --row-hover: #1b1b1f;
  --cell-border: #1d1d21;
  --th-top: #151518;
  --th-bot: #0e0e10;
  --btn-top: #1d1d21;
  --btn-bot: #121215;
  --btn-border: #34343a;
  --btn-fg: #ececf0;
  --btn-shine: rgba(255, 255, 255, 0.05);
  --thumb-shine: rgba(255, 255, 255, 0.06);
  --grid-line: #19191c;
}

/* ?ultrablackout: pure black and white, no gradients, shadows or tints */
html.ultrablackout[data-theme="dark"] {
  --outer-bg: #000;
  --shell-bg: #000;
  --shell-border: #fff;
  --title-top: #000;
  --title-bot: #000;
  --title-fg: #fff;
  --title-sub: #fff;
  --panel-head-top: #000;
  --panel-head-bot: #000;
  --panel-head-fg: #fff;
  --panel-border: #fff;
  --filter-bg: #000;
  --fg: #fff;
  --muted: #fff;
  --zebra: #000;
  --row-hover: #000;
  --cell-border: #fff;
  --th-top: #000;
  --th-bot: #000;
  --btn-top: #000;
  --btn-bot: #000;
  --btn-border: #fff;
  --btn-fg: #fff;
  --btn-shine: transparent;
  --thumb-shine: transparent;
  --link: #fff;
  --grid-line: #fff;
}
html.ultrablackout[data-theme="dark"] *,
html.ultrablackout[data-theme="dark"] *::before,
html.ultrablackout[data-theme="dark"] *::after {
  background-image: none !important;
  background-color: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
  box-shadow: none !important;
  text-shadow: none !important;
  outline-color: #fff !important;
  accent-color: #fff;
  opacity: 1;
}
html.ultrablackout[data-theme="dark"] .bar-fill,
html.ultrablackout[data-theme="dark"] input[type="radio"]:checked::before,
html.ultrablackout[data-theme="dark"] .radio-opt input:checked + span {
  background-color: #fff !important;
  color: #000 !important;
}
/* Vendor thumb selectors in separate rules: one unknown selector drops a whole list */
html.ultrablackout[data-theme="dark"] input[type="range"]::-webkit-slider-thumb {
  background-color: #fff !important;
}
html.ultrablackout[data-theme="dark"] input[type="range"]::-moz-range-thumb {
  background-color: #fff !important;
}
html.ultrablackout[data-theme="dark"] tr:hover > td {
  text-decoration: underline;
}
html.ultrablackout[data-theme="dark"] input[type="checkbox"]:checked {
  background: #000 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6.2 4.8 8.9 9.8 3.1' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='square' stroke-linejoin='miter'/%3E%3C/svg%3E") center / 11px 11px no-repeat !important;
}

/* Contribute a measurement: label, value, options per row; the text to paste below */
#contributeDialog {
  width: min(760px, calc(100vw - 28px));
}

.contribute-body {
  display: grid;
  gap: 14px;
}

.contribute-body > * {
  min-width: 0;
}

.contribute-body .settings-head-row {
  flex-wrap: wrap;
}

#contributePlan {
  min-width: 0;
  max-width: 100%;
}

.contribute-billing {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.radio-opt.is-disabled {
  opacity: 0.5;
  cursor: default;
}

.radio-opt.is-disabled input[type="radio"] {
  cursor: default;
}

.contribute-text {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 240px;
  margin: 0;
  padding: 6px 8px;
  resize: vertical;
  font: 12px/1.45 "DejaVu Sans Mono", Consolas, Menlo, monospace;
  color: var(--fg);
  background: var(--shell-bg);
  border-top: 1px solid var(--shell-border);
  border-left: 1px solid var(--shell-border);
  border-right: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  white-space: pre;
  overflow: auto;
}

.contribute-text:focus-visible {
  outline: 1px dotted var(--muted);
  outline-offset: 1px;
}

.contribute-ends {
  font-size: 13px;
  font-weight: bold;
}

@media (max-width: 600px) {
  #contributeDialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    box-shadow: none;
  }
  #contributeDialog .settings-head-row > .radio-pair,
  #contributeDialog .settings-head-row > .select,
  #contributeDialog .settings-head-row > .combo {
    flex: 1 1 100%;
  }
  #contributeDialog .radio-opt {
    flex: 1 1 0;
    white-space: normal;
    text-align: center;
  }
  .contribute-text {
    min-height: 40dvh;
  }
  .combo-opt,
  .combo-empty {
    min-height: 36px;
    display: flex;
    align-items: center;
    font-size: 15px;
  }
  .contribute-nav .btn {
    min-width: 88px;
    justify-content: center;
  }
}

/* Contribute: the screens (choices; one step of "Steps to follow") */
.contribute-screen:not([hidden]) {
  display: grid;
  gap: 14px;
  min-width: 0;
}

#contributeModel {
  min-width: 0;
  max-width: 100%;
}

/* Plan picker: text input over a listbox */
.combo {
  position: relative;
  flex: 0 1 340px;
  min-width: 0;
}

.combo-input {
  width: 100%;
  box-sizing: border-box;
}

.combo-list {
  /* app.js sets position: fixed and the box from the input, so the dialog's scroll box can't clip it */
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: 100%;
  margin: 2px 0 0;
  padding: 2px 0;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--shell-bg);
  color: var(--fg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.combo-opt,
.combo-empty {
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-opt[aria-selected="true"] {
  font-weight: bold;
}

.combo-opt.is-active {
  background: var(--link);
  color: #fff;
}

.combo-empty {
  color: var(--muted);
  cursor: default;
}

html.ultrablackout[data-theme="dark"] .combo-opt.is-active {
  background-color: #fff !important;
  color: #000 !important;
}

html.ultrablackout[data-theme="dark"] .combo-list {
  border-color: #fff;
}

/* One step: title, commands each with Copy, a value, Back / Next */
.contribute-step-title {
  margin: 0;
  font-size: 15px;
  font-weight: bold;
  color: var(--panel-head-fg);
}

.contribute-step-title:focus {
  outline: none;
}

.contribute-step-title:focus-visible {
  outline: 1px dotted var(--muted);
  outline-offset: 2px;
}

.contribute-cmds {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.contribute-cmd {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.contribute-cmd-text {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  padding: 6px 8px;
  font: 12px/1.45 "DejaVu Sans Mono", Consolas, Menlo, monospace;
  color: var(--fg);
  background: var(--shell-bg);
  border-top: 1px solid var(--shell-border);
  border-left: 1px solid var(--shell-border);
  border-right: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.contribute-send {
  justify-self: start;
  text-decoration: none;
}

.contribute-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
