/* ─── Fonts ─── */
@font-face {
  font-family: "PP Telegraf";
  src: url("https://pub-0bbb92cb8b864441b9e912d6aa6abc2c.r2.dev/assets/fonts/PPTelegraf-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("https://pub-0bbb92cb8b864441b9e912d6aa6abc2c.r2.dev/assets/fonts/DMSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("https://pub-0bbb92cb8b864441b9e912d6aa6abc2c.r2.dev/assets/fonts/DMMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ─── Layout-fit ─── */
/* Composition-layer values only: page width, top-bar height, section padding.
   Every design token (colour, type, weight, radius, shadow, motion) resolves
   from design-system/tokens.css, which loads ahead of this sheet. */
:root {
  --topbar-h: 44px;
  --inner-w: min(1120px, calc(100% - 48px));
  --section-pad-y: 96px;
}

/* ─── Reset ─── */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  font-weight: var(--fw-regular);
  background: var(--tf-offwhite);
  color: var(--tf-offblack);
}

.proposal-app [hidden] {
  display: none !important;
}

h1,
h2,
h3,
.cover-title,
.site-name,
.section-heading,
.hw-name {
  font-family: "PP Telegraf", system-ui, sans-serif;
  font-weight: var(--fw-regular);
}

p,
label,
li,
.section-kicker,
.cover-kicker,
.kpi-title,
.sites-header-label,
.site-contact,
.tariff-explainer,
.toggle-option,
.toggle-lock-label,
.survey-label,
.gantt-task-label,
.gantt-week-label,
.next-col h4,
.supplier-explainer,
.supplier-tariff-name,
.sites-table thead th {
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, sans-serif;
}

.kpi-value,
.site-savings-cell,
.site-payback-cell,
.site-meta,
.supplier-rates-grid .rate-value {
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

a {
  color: var(--tf-blue-03);
}

/* ─── App shell ─── */
.proposal-app {
  height: 100%;
  overflow: hidden;
  background: var(--tf-offwhite);
}

/* ─── Topbar ─── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: rgba(244, 244, 242, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--tf-border);
  z-index: 20;
  display: grid;
  grid-template-columns: auto auto auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}

.topbar-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: block;
  flex-shrink: 0;
  object-fit: cover;
}

.brand-name {
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--tf-offblack);
  border-radius: 999px;
  background: var(--tf-offblack);
  min-height: 36px;
  padding: 6px 18px;
  font: inherit;
  font-size: var(--text-base);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--tf-offwhite);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease-out, color 120ms ease-out, border-color 120ms ease-out;
}

.back-link:hover,
.back-link:focus-visible {
  background: var(--tf-yellow);
  color: var(--tf-offblack);
  border-color: var(--tf-yellow);
}

.back-link:focus-visible {
  outline: 2px solid var(--tf-offblack);
  outline-offset: 2px;
}

.topbar-client {
  font-size: var(--text-sm);
  color: var(--tf-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-preview-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--tf-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  padding: 2px;
}

.preview-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 72px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  color: var(--tf-muted);
}

.preview-link.active {
  background: var(--tf-offblack);
  color: #fff;
}

/* ─── Site switcher (S1 persistent header) ─── */
.site-switcher {
  position: relative;
  display: inline-flex;
}

.site-switcher__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--tf-border-strong);
  border-radius: var(--r-pill);
  background: var(--tf-white);
  min-height: 36px;
  padding: 6px 14px;
  font: inherit;
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  color: var(--tf-offblack);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 120ms ease-out, background-color 120ms ease-out;
}

.site-switcher__trigger:hover,
.site-switcher__trigger:focus-visible {
  border-color: var(--tf-offblack);
}

.site-switcher__trigger:focus-visible {
  outline: 2px solid var(--tf-offblack);
  outline-offset: 2px;
}

.site-switcher__chevron {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 120ms ease-out;
}

.site-switcher__trigger[aria-expanded="true"] .site-switcher__chevron {
  transform: rotate(180deg);
}

.site-switcher__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  max-width: 340px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--tf-white);
  border: 1px solid var(--tf-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 30;
}

.site-switcher__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.site-switcher__item:hover,
.site-switcher__item:focus-visible,
.site-switcher__item--current {
  background: var(--tf-offwhite);
}

.site-switcher__item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.site-switcher__item-name {
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  color: var(--tf-offblack);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-switcher__item-mpan {
  font-size: var(--text-xs);
  color: var(--tf-muted);
  font-variant-numeric: tabular-nums;
}

/* ─── Progress dots ─── */
.progress-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tf-khaki);
  transition: background 200ms ease, transform 200ms ease;
}

.progress-dot.active {
  background: var(--tf-offblack);
  transform: scale(1.3);
}

/* ─── Panel stack ─── */
.panel-stack {
  position: relative;
  height: calc(100% - var(--topbar-h));
  margin-top: var(--topbar-h);
  overflow: hidden;
}

.panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.panel.is-active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* ─── Loading ─── */
.loading-panel {
  padding: 24px;
  background: var(--tf-offwhite);
}

.skeleton-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.skeleton-block {
  border-radius: 10px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, #e6e7e2 20%, #f0f1ed 40%, #e6e7e2 60%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}

.skeleton-block.hero  { height: 180px; }
.skeleton-block.card  { height: 110px; }
.skeleton-block.list  { height: 88px; }

@keyframes shimmer {
  0%   { background-position: 180% 0; }
  100% { background-position: -40% 0; }
}

/* ─── Full-height sections ─── */
.portfolio-panel,
.detail-panel {
  background: var(--tf-offwhite);
}

.fp-section {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.fp-inner {
  width: var(--inner-w);
  margin: 0 auto;
  padding: var(--section-pad-y) 0;
}

/* fp-inner that also grows to fill flex parent */
.fp-inner--flex {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ─── Section typography ─── */
.section-kicker {
  margin: 0 0 12px;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 5px;
  background: var(--tf-yellow);
  color: var(--tf-offblack);
  font-size: var(--text-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-kicker--light {
  background: var(--tf-yellow);
  color: var(--tf-offblack);
}

.section-heading {
  margin: 0 0 48px;
  font-size: clamp(36px, 5vw, 62px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: var(--fw-regular);
}

.section-heading--light {
  color: var(--tf-offwhite);
}

/* ─── Cover section ─── */
.cover-section {
  background: radial-gradient(circle at 20% 90%, rgba(102, 130, 186, 0.14), transparent 40%),
    var(--tf-offblack);
  justify-content: center;
}

.cover-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 72px 28px 28px;
  position: relative;
}

.cover-content {
  width: min(780px, 100%);
  text-align: center;
  color: #f0f0ee;
}

.cover-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 0 auto 16px;
  padding: 6px 10px;
  border-radius: 5px;
  background: var(--tf-yellow);
  color: var(--tf-offblack);
  font-size: var(--text-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.cover-title {
  margin: 0;
  font-size: clamp(36px, 8vw, 72px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-weight: var(--fw-regular);
}

.cover-rule {
  width: min(200px, 40vw);
  height: 3px;
  margin: 22px auto;
  background: var(--tf-yellow);
}

.cover-client {
  font-size: clamp(24px, 4vw, 40px);
  margin: 0;
  color: var(--tf-khaki);
  font-weight: var(--fw-regular);
}

.cover-wordmark {
  position: absolute;
  top: 40px;
  right: 44px;
  width: clamp(140px, 16vw, 220px);
  max-width: 34%;
  height: auto;
}

.cover-meta {
  margin-top: 14px;
  font-size: var(--text-md);
  color: rgba(244, 244, 242, 0.6);
}

.cover-chevron {
  position: absolute;
  bottom: 28px;
  left: 50%;
  width: 18px;
  height: 18px;
  border-right: 2px solid var(--tf-yellow);
  border-bottom: 2px solid var(--tf-yellow);
  transform: translateX(-50%) rotate(45deg);
  opacity: 0.7;
  animation: nudge 1.6s ease-in-out infinite;
}

@keyframes nudge {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(45deg); }
  50%       { transform: translateX(-50%) translateY(7px) rotate(45deg); }
}

/* ─── Buttons ─── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 160px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--tf-border);
  background: transparent;
  color: var(--tf-offblack);
  font: inherit;
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.button.primary {
  background: var(--tf-yellow);
  border-color: var(--tf-yellow);
  color: var(--tf-offblack);
}

.button.primary:hover {
  background: #c8ec00;
  border-color: #c8ec00;
}

.button.ghost {
  margin-top: 32px;
  background: transparent;
  border: 1px solid var(--tf-yellow);
  color: #fff;
}

.button.ghost:hover {
  background: var(--tf-yellow);
  color: var(--tf-offblack);
}

/* ─── Exec Summary section ─── */
.exec-section .fp-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.exec-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 40px;
}

.exec-kpi-item {
  padding-right: 32px;
  border-right: 1px solid var(--tf-border);
  margin-right: 32px;
}

.exec-kpi-item:last-child {
  border-right: none;
  margin-right: 0;
  padding-right: 0;
}

.kpi-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-regular);
  color: var(--tf-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 10px;
}

.kpi-logo {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: cover;
  display: block;
  margin: 0 0 10px;
}

.kpi-value {
  margin: 0;
  font-size: clamp(26px, 3.2vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-weight: var(--fw-regular);
}

.exec-address {
  display: none;
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.5;
}

/* ─── Hardware section / carousel ─── */
.hardware-section .fp-inner,
.tariff-fp-section .fp-inner {
  min-height: 100dvh;
}

.carousel-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.carousel-track {
  flex: 1;
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

/* ─── Hardware carousel item ─── */
.hw-item {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
  padding: 40px 0;
}

.hw-name {
  margin: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.03;
  letter-spacing: -0.025em;
  font-weight: var(--fw-regular);
}

.hw-rule {
  width: 100px;
  height: 3px;
  background: var(--tf-yellow);
  margin: 20px 0;
}

.hw-benefit {
  font-size: var(--text-xl);
  line-height: 1.45;
  margin: 0 0 28px;
}

.hw-media {
  background: var(--tf-khaki);
  border-radius: 12px;
  min-height: 340px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hw-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-placeholder {
  text-align: center;
  color: var(--tf-muted);
  padding: 24px;
  font-size: var(--text-base);
}

/* ─── Tariff carousel item ─── */
.tariff-item {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0;
}

.supplier-tariff-item {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0;
}

.supplier-tariff-card {
  max-width: 920px;
  border: 1px solid var(--tf-border);
  border-radius: 14px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.4);
}

.supplier-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.supplier-name {
  margin: 0;
  font-size: clamp(24px, 3.8vw, 38px);
  font-weight: var(--fw-regular);
  letter-spacing: -0.02em;
}

.supplier-tariff-name {
  margin: 4px 0 0;
  color: var(--tf-muted);
  font-size: var(--text-md);
}

.supplier-rates-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 28px;
}

.supplier-rates-grid li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--tf-border);
  padding-bottom: 10px;
  font-size: var(--text-md);
}

.supplier-rates-grid .rate-label {
  color: var(--tf-muted);
}

.supplier-rates-grid .rate-value {
  font-weight: var(--fw-semibold);
}

.supplier-explainer {
  margin: 18px 0 0;
  color: var(--tf-muted);
  line-height: 1.5;
}

/* ─── Carousel navigation ─── */
.carousel-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  padding-bottom: 8px;
}

.carousel-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--tf-border);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: var(--text-md);
  color: var(--tf-offblack);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  flex-shrink: 0;
}

.carousel-btn:hover:not(:disabled) {
  background: var(--tf-offblack);
  color: var(--tf-offwhite);
  border-color: var(--tf-offblack);
}

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

.carousel-dot-list {
  display: flex;
  gap: 8px;
  align-items: center;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: var(--tf-khaki);
  cursor: pointer;
  padding: 0;
  transition: background 150ms ease, transform 150ms ease;
}

.carousel-dot.active {
  background: var(--tf-offblack);
  transform: scale(1.25);
}

/* ─── Spec list (in hardware items) ─── */
.spec-list {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.spec-list li {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px;
  font-size: var(--text-md);
  padding-bottom: 0;
}

.spec-list li:last-child {
  padding-bottom: 0;
}

.spec-label {
  color: var(--tf-muted);
}

/* ─── Tariff explainer + accordion ─── */
.tariff-explainer {
  margin: 0 0 14px;
  line-height: 1.5;
  font-size: var(--text-md);
  color: var(--tf-muted);
}

.tariff-accordion {
  margin-bottom: 12px;
}

.tariff-accordion[hidden] {
  display: none;
}

.tariff-accordion summary {
  cursor: pointer;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: var(--fw-semibold);
  font-size: var(--text-base);
  color: var(--tf-muted);
}

.tariff-accordion summary::before {
  content: "▸";
  font-size: var(--text-sm);
  color: var(--tf-muted);
  transition: transform 150ms ease;
}

.tariff-accordion[open] summary::before {
  transform: rotate(90deg);
}

.tariff-accordion p {
  margin: 10px 0 0;
  color: var(--tf-muted);
  font-size: var(--text-base);
  line-height: 1.5;
}

/* ─── Sites table section ─── */
.sites-section .fp-inner {
  display: flex;
  flex-direction: column;
}

.sites-table-wrap {
  position: relative;
  max-height: 55dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--tf-khaki) transparent;
}

.sites-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.sites-table col.sites-col-site {
  width: 36%;
}

.sites-table col.sites-col-savings {
  width: 18%;
}

.sites-table col.sites-col-payback {
  width: 18%;
}

.sites-table col.sites-col-status {
  width: 22%;
}

.sites-table col.sites-col-action {
  width: 6%;
}

.sites-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--tf-offwhite);
  text-align: left;
  padding: 0 20px 14px;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tf-muted);
  border-bottom: 1px solid var(--tf-border);
  white-space: nowrap;
}

.sites-table tbody td {
  padding: 16px 20px;
  vertical-align: middle;
  font-size: var(--text-md);
}

.sites-table thead th:first-child,
.sites-table tbody td:first-child {
  padding-left: 24px;
}

.sites-table thead th:last-child,
.sites-table tbody td:last-child {
  padding-right: 24px;
}

.sites-table tbody tr {
  cursor: pointer;
  transition: background 100ms ease;
}

.sites-table tbody tr:hover {
  background: rgba(46, 46, 46, 0.06);
}

/* Sites section header */
.sites-header {
  margin-bottom: 28px;
}

.sites-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sites-header-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tf-muted);
}

.sites-header-name {
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: var(--fw-semibold);
  line-height: 1.15;
  margin: 0;
  color: var(--tf-offblack);
}

/* Table cells */
.site-name-cell {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
}

.site-savings-cell {
  font-size: var(--text-2xl);
  font-weight: var(--fw-regular);
  white-space: nowrap;
}

.site-payback-cell {
  color: var(--tf-muted);
  font-size: var(--text-md);
  white-space: nowrap;
}

.site-savings-cell .kpi-tile__value,
.site-payback-cell .kpi-tile__value {
  font: inherit;
  letter-spacing: normal;
  color: inherit;
}

.site-savings-cell .kpi-tile__unit,
.site-payback-cell .kpi-tile__unit {
  font-size: var(--text-xs);
}

.site-status-cell {
  white-space: nowrap;
}

.site-arrow-cell {
  color: var(--tf-muted);
  font-size: var(--text-3xl);
  line-height: 1;
  text-align: left;
}

.site-name-text {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.12;
  max-width: 95%;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.site-view-button {
  display: inline-block;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--tf-offblack);
  font-size: var(--text-3xl);
  font-weight: var(--fw-regular);
  line-height: 1;
  white-space: nowrap;
}

.site-view-button:hover {
  background: transparent;
  color: var(--tf-offblack);
}

@media (max-width: 640px) {
  .sites-table col.sites-col-site {
    width: 44%;
  }

  .sites-table col.sites-col-savings {
    width: 24%;
  }

  .sites-table col.sites-col-payback,
  .sites-table thead th:nth-child(3),
  .site-payback-cell {
    display: none;
  }

  .sites-table col.sites-col-status {
    width: 24%;
  }

  .sites-table col.sites-col-action {
    width: 8%;
  }
}

.align-right {
  text-align: right !important;
}

.sites-table-fade {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: linear-gradient(to bottom, transparent, var(--tf-offwhite));
  pointer-events: none;
}

/* ─── Timeline / Gantt section ─── */
.dark-section {
  background: var(--tf-offblack);
  color: var(--tf-offwhite);
}

.gantt-wrap {
  margin-top: 0;
}

.gantt-header-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  margin-bottom: 4px;
}

.gantt-header-label {
  /* blank left cell */
}

.gantt-weeks-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.gantt-week-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(212, 215, 196, 0.7);
  padding: 0 4px 10px;
}

.gantt-task-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  min-height: 44px;
  border-top: 1px solid rgba(244, 244, 242, 0.08);
}

.gantt-task-row:first-of-type {
  border-top: none;
}

.gantt-task-label {
  font-size: var(--text-base);
  color: rgba(244, 244, 242, 0.75);
  padding-right: 20px;
  line-height: 1.35;
}

.gantt-track {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: center;
  height: 28px;
  gap: 3px;
}

.gantt-bar {
  height: 22px;
  background: var(--tf-yellow);
  border-radius: 4px;
}

/* Grid coordinates are read from data attributes rather than an inline style,
   so the bar carries no inline style and a strict style-src CSP holds. The
   ranges cover the bounded 7-week grid (start 1–7, end line 2–8). */
.gantt-bar[data-gc-start="1"] { grid-column-start: 1; }
.gantt-bar[data-gc-start="2"] { grid-column-start: 2; }
.gantt-bar[data-gc-start="3"] { grid-column-start: 3; }
.gantt-bar[data-gc-start="4"] { grid-column-start: 4; }
.gantt-bar[data-gc-start="5"] { grid-column-start: 5; }
.gantt-bar[data-gc-start="6"] { grid-column-start: 6; }
.gantt-bar[data-gc-start="7"] { grid-column-start: 7; }
.gantt-bar[data-gc-end="2"] { grid-column-end: 2; }
.gantt-bar[data-gc-end="3"] { grid-column-end: 3; }
.gantt-bar[data-gc-end="4"] { grid-column-end: 4; }
.gantt-bar[data-gc-end="5"] { grid-column-end: 5; }
.gantt-bar[data-gc-end="6"] { grid-column-end: 6; }
.gantt-bar[data-gc-end="7"] { grid-column-end: 7; }
.gantt-bar[data-gc-end="8"] { grid-column-end: 8; }

/* ─── Next Steps section ─── */
.next-steps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 56px;
  margin: 0 0 40px;
}

.next-col h4 {
  margin: 0 0 16px;
  font-weight: var(--fw-semibold);
  font-size: var(--text-md);
}

.next-steps-intro {
  margin: 0 0 24px;
  max-width: 980px;
  line-height: 1.55;
  color: var(--tf-muted);
}

.next-col ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.next-col li {
  line-height: 1.5;
  font-size: var(--text-md);
}

/* ─── InfoExplainer ─── */
/* margin-left lives on the wrapper, not on the icon, so the popup arrow
   stays centred over the icon regardless of the gap size. */
.info-explainer { align-items: center; vertical-align: middle; margin-left: 4px; }
/* Generic icon — for KPI tile, config indicator, and other consumers */
.info-explainer__icon {
  display: inline-grid; place-items: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(46,46,46,0.10); color: var(--tf-muted);
  font-family: var(--font-display); font-size: var(--text-3xs); font-weight: var(--fw-medium);
  font-style: italic; line-height: 1; cursor: help;
  flex-shrink: 0;
}

/* Document-state classes — structural hooks only. Final palette pending design
   sign-off (Mixed treatment, Contracted colour) and the --document-*-bg/-fg
   token pairs. Neutral placeholder so the badges remain legible meanwhile. */
.status-badge--document-indicative,
.status-badge--document-mixed,
.status-badge--document-aligned,
.status-badge--document-contracted {
  background: var(--status-not-yet-bg);
  color: var(--status-not-yet-fg);
}

/* ─── CaveatIcon ─── */
.caveat-icon { vertical-align: middle; }

/* ─── B3 — Portfolio-level critical callout ─── */
.b3-callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.b3-callout--critical {
  background: var(--status-tier2-failed-bg);
  color: var(--status-tier2-failed-fg);
}
.b3-callout__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: inherit;
}
.b3-callout__icon::before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask-image: url('/icons/caveat-error.svg');
  mask-image: url('/icons/caveat-error.svg');
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}
.b3-callout__body { flex: 1; min-width: 0; }
.b3-callout__title {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  margin: 0 0 3px;
  line-height: 1.3;
}
.b3-callout__desc {
  font-size: var(--text-sm);
  margin: 0;
  line-height: 1.5;
}

/* ─── B3 — REFINED (table layout, 3+ sites) ─── */
.b3__table {
  width: 100%; border-collapse: separate;
  /* 4px vertical row-gap at the table level — true transparent gap,
     not a paper-coloured border on td (which inflated row height). */
  border-spacing: 0 4px;
  table-layout: fixed;
  font-size: var(--text-base);
}
.b3__table thead th {
  text-align: left; padding: 12px 16px;
  font-size: var(--text-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--tf-muted);
  border-bottom: 1px solid var(--tf-border-strong);
  white-space: nowrap;
}
.b3__th-num { text-align: right !important; }
.b3__th-num--left { text-align: left !important; }
.b3__th-savings { text-align: left !important; }
.b3__th-site    { width: 30%; }
.b3__th-config  { width: 13%; }
.b3__th-savings { width: 13%; }
.b3__col-payback { width: 9%; }
.b3__col-capex   { width: 12%; }
.b3__th-status  { width: 19%; }
.b3__th-action  { width: 4%; }
.b3__table thead th.b3__th-savings { padding-right: 24px; }
.b3__sort-arrow {
  color: var(--tf-offblack);
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}
.b3__row {
  background: #fff;
  cursor: pointer; transition: background var(--dur-quick) var(--ease-out);
}
.b3__row td { padding: 18px 16px; vertical-align: middle; }
.b3__row td:first-child { border-top-left-radius: var(--r-md); border-bottom-left-radius: var(--r-md); }
.b3__row td:last-child  { border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.b3__cell-site { max-width: 320px; }
.b3__site-name { font-size: var(--text-lg); font-weight: var(--fw-semibold); margin-bottom: 4px; line-height: 1.2; }
.b3__site-meta { font-size: var(--text-sm); color: var(--tf-muted); line-height: 1.4; }
.b3__cell-num { text-align: right; }
.b3__cell-capex-left { text-align: left; padding-left: 56px !important; }
.b3__col-capex { padding-left: 56px !important; }
.b3__cell-savings-left { text-align: left; }
.b3__cell-savings { font-size: var(--text-lg); }
.b3__cell-suffix { font-size: var(--text-xs); color: var(--tf-muted); margin-left: 2px; }
.b3__cell-muted { color: var(--tf-muted); }
.b3__cell-action { color: var(--tf-grey-03); font-size: var(--text-2xl); padding-right: 8px !important; padding-left: 0 !important; }
.b3__row--excluded td { opacity: 0.5; }
.b3__row--excluded td.b3__cell-status { opacity: 1; }
.b3__cell-status { vertical-align: middle; padding-left: 32px !important; }
.b3__th-status  { padding-left: 32px !important; }
.b3__cell-status-inner { display: inline-flex; align-items: center; gap: 10px; vertical-align: middle; padding-right: 8px; }

/* ─── B3 utility classes ─── */
.eyebrow { font-size: var(--text-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); color: var(--tf-muted); }
.mono    { font-family: var(--font-mono); }
.tnum    { font-variant-numeric: tabular-nums; }

/* ─── B3 — MOBILE (<768px) ─── */
@media (max-width: 767px) {

  /* Tighter section gutter */
  #section-sites .fp-inner { padding: 24px 16px; }

  /* Disable internal scroll on the wrap; page scrolls naturally on touch.
     Also frees tooltips from horizontal/vertical clipping. */
  .sites-table-wrap {
    max-height: none;
    overflow: visible;
  }
  .sites-table-fade { display: none; }

  /* Reflow the <table> as a card list (CSS-only — DOM stays the same). */
  .b3__table       { display: block; }
  .b3__table thead { display: none; }
  .b3__table tbody { display: block; }

  /* Each <tr> becomes a card with internal CSS Grid.
     Arrow is absolutely-positioned in the corner so it doesn't claim
     a grid track and force the column widths wider than needed. */
  .b3__row {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "site    site"
      "config  config"
      "savings payback"
      "capex   status";
    column-gap: 12px;
    row-gap: 10px;
    align-items: start;
    padding: 18px 18px 20px;
    background: #fff;
    border: 1px solid var(--tf-border);
    border-radius: var(--r-md);
    margin-bottom: 12px;
    min-width: 0;
  }
  /* Cancel desktop hover affordances (inset shadow + per-cell split outline).
     On mobile each td is its own grid cell, so the split outline shows as
     horizontal lines through the middle of the card. */
  .b3__row:hover { box-shadow: none; }
  .b3__table .b3__row:hover td,
  .b3__table .b3__row:hover td:first-child,
  .b3__table .b3__row:hover td:last-child { box-shadow: none; }

  /* On mobile the card chrome (white bg, border) becomes the dominant frame.
     Fade it alongside the td contents so excluded cards visually recede;
     status td keeps full opacity from base rule. */
  .b3__row--excluded {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(46, 46, 46, 0.07);
  }

  /* Strip table-cell defaults; assign grid areas.
     Selector `.b3__table tbody td` matches legacy `.sites-table tbody td`
     specificity (0,0,2,1) and wins by source order. */
  .b3__table tbody td {
    display: block;
    padding: 0;
    border: none;
    border-radius: 0;
    vertical-align: baseline;
    font-size: inherit;
  }
  /* Override legacy first/last-child horizontal paddings */
  .b3__table tbody td:first-child,
  .b3__table tbody td:last-child {
    padding-left: 0;
    padding-right: 0;
  }
  .b3__cell-site         { grid-area: site; min-width: 0; padding-right: 24px !important; }
  .b3__cell-config       { grid-area: config; }
  .b3__cell-savings-left { grid-area: savings; }
  .b3__cell-num          { grid-area: payback; text-align: left !important; }
  .b3__cell-capex-left   { grid-area: capex; padding-left: 0 !important; }
  .b3__col-capex         { padding-left: 0 !important; } /* override desktop !important */
  .b3__cell-status       { grid-area: status; padding-left: 0 !important; }
  .b3__cell-status-inner { padding-right: 0; }
  .b3__cell-action {
    position: absolute;
    top: 18px;
    right: 18px;
    padding: 0 !important;
    font-size: var(--text-xl);
    line-height: 1;
  }

  .b3__site-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--text-base);
  }

  /* KPI values: scaled down to fit narrower card cells */
  .b3__cell-savings { font-size: var(--text-base); }

  /* ─── B3 two-sites — stacked with 2×2 metrics ─── */
  .b3-two__row {
    position: relative;
    grid-template-columns: 1fr;
    grid-template-areas:
      "identity"
      "metrics";
    padding: 20px 20px 22px;
    gap: 20px;
  }
  .b3-two__main    { grid-area: identity; min-width: 0; padding-right: 28px; }
  .b3-two__metrics {
    grid-area: metrics;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 20px;
  }
  /* Chev pulled out of grid flow so it doesn't claim a column. */
  .b3-two__chev {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: var(--text-2xl);
    line-height: 1;
  }

  /* Two-site name also truncates */
  .b3-two__name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--text-2xl);
  }
  .b3-two__m-value--lead { font-size: clamp(22px, 5.5vw, 28px); }
}

/* ─── Site detail panel ─── */
.detail-panel {
  background: var(--tf-offwhite);
}

.site-header-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 40px;
}

.site-name {
  margin: 0 0 10px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: var(--fw-regular);
}

.site-meta {
  margin: 0 0 8px;
  color: var(--tf-muted);
  font-size: var(--text-base);
}

.site-contact {
  margin: 0;
  font-size: var(--text-base);
}

/* Site header badges row — qualification pill + per-proposal document mirror.
   Inline-flex so the two pills sit next to each other with a comfortable gap;
   wraps on narrow viewports. */
.site-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.site-badges:empty { display: none; }

.site-meta-rail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 4px;
  padding-top: 4px;
}

.site-meta-rail-label {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--tf-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-meta-rail-value {
  margin: 0 0 6px;
  font-size: var(--text-base);
  color: var(--tf-offblack);
}

/* Site financial KPI strip */
.site-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding-top: 32px;
}

.site-kpi-item {
  padding-right: 0;
  margin-right: 0;
}

/* ─── KpiTile (shared component) ─── */
.kpi-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kpi-tile__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-tile__label {
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tf-muted);
  margin: 0;
}

.kpi-tile__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: var(--text-3xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  background: rgba(46, 46, 46, 0.06);
  color: var(--tf-muted);
}

.kpi-tile__value {
  margin: 0;
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: var(--fw-regular);
  letter-spacing: -0.02em;
  line-height: 1.04;
  color: var(--tf-offblack);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "ss01" 1;
}

.kpi-tile__unit {
  font-size: 0.42em;
  color: var(--tf-muted);
  font-weight: var(--fw-regular);
  margin-left: 2px;
  letter-spacing: 0;
  font-variant-numeric: normal;
  font-feature-settings: normal;
}


/* ─── Detail toggles (tariff mode + capex option) ─── */
.detail-toggles {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.tariff-toggle[hidden] { display: none; }

.tariff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--tf-border);
  border-radius: 999px;
  padding: 3px;
  background: transparent;
}

.toggle-option {
  border: none;
  border-radius: 999px;
  padding: 7px 20px;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  background: transparent;
  color: var(--tf-muted);
  transition: background 120ms ease, color 120ms ease;
  white-space: nowrap;
}

.toggle-option--active {
  background: var(--tf-yellow);
  color: var(--tf-offblack);
}

.toggle-option:not(.toggle-option--active):hover {
  color: var(--tf-offblack);
}

.toggle--locked .toggle-option {
  pointer-events: none;
}

.toggle-option--locked-inactive {
  opacity: 0.6;
}

.toggle-lock-label {
  font-size: var(--text-sm);
  color: var(--tf-muted);
}

/* ─── Survey row ─── */
.survey-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 0;
}

.survey-label {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--tf-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

/* ─── Lightbox ─── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(46, 46, 46, 0.92);
}

.lightbox-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(900px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  gap: 16px;
}

.lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(244, 244, 242, 0.3);
  background: transparent;
  color: var(--tf-offwhite);
  font-size: var(--text-2xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.lightbox-close:hover {
  background: rgba(244, 244, 242, 0.15);
}

.lightbox-media {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: calc(100vh - 160px);
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-pdf-link {
  color: var(--tf-offwhite);
  font-size: var(--text-md);
  border-bottom: 1px dotted rgba(244, 244, 242, 0.5);
  text-decoration: none;
  padding: 40px;
}

.lightbox-footer {
  display: flex;
  align-items: center;
  gap: 20px;
}

.lightbox-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(244, 244, 242, 0.3);
  background: transparent;
  color: var(--tf-offwhite);
  font-size: var(--text-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-btn:hover:not(:disabled) {
  background: rgba(244, 244, 242, 0.15);
}

.lightbox-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.lightbox-counter {
  color: rgba(244, 244, 242, 0.7);
  font-size: var(--text-base);
  min-width: 48px;
  text-align: center;
}

/* ─── S2 + S3 paired layout ─── */
.s2s3-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

/* Mobile: S3 above S2 (Q27) */
@media (max-width: 767px) {
  .s2s3-pair {
    grid-template-columns: 1fr;
  }
  .s2s3-pair__card--s2 { order: 2; }
  .s2s3-pair__card--s3 { order: 1; }
}

.s2s3-pair__card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Equal height: each direct child fills its card slot */
.s2s3-pair__card > * { flex: 1; }

/* S3 has an extra wrapper div (#s3-tariff-card) — propagate the flex chain */
#s3-tariff-card { display: flex; flex-direction: column; }

/* Articles fill their respective wrappers */
.s2-ed--v3, .s3-ed { flex: 1; }

@media (max-width: 479px) {
  .s2-ed--v3 .card__foot,
  .s3-ed .card__foot {
    flex-direction: column;
  }
  .s2-ed--v3 .card__foot .btn,
  .s3-ed .card__foot .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ─── Hardware block: site detail ─── */
.hw-site-block {
  margin-top: 0;
  padding-top: 0;
}

/* Switch to .hw-site-block--twothirds to use the narrower layout */
.hw-site-block--full       { width: 100%; }
.hw-site-block--twothirds  { width: 66.667%; }

.hw-site-block-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.hw-site-specs .spec-list {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.hw-site-subheading {
  margin: 0 0 16px;
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tf-muted);
}

.spec-list li {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  align-items: start;
}

.hw-site-image {
  border-radius: 6px;
  overflow: hidden;
  background: var(--tf-offwhite);
}

.hw-site-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.chart-mode-label {
  margin: -20px 0 20px;
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--tf-offblack);
}

/* ─── Utilities ─── */
.muted {
  color: var(--tf-muted);
}

.muted-link {
  color: var(--tf-muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--tf-muted);
  font-size: var(--text-base);
}

/* ─── Error panel ─── */
.error-panel {
  background: var(--tf-offwhite);
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-card {
  width: min(680px, calc(100% - 40px));
  margin: 28px auto;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--tf-status-red-fg);
  background: var(--tf-status-red-bg);
  color: var(--tf-status-red-fg);
  font-size: var(--text-md);
}

/* ─── Responsive — tablet ─── */
@media (max-width: 960px) {
  :root {
    --section-pad-y: 72px;
  }

  .topbar {
    grid-template-columns: auto auto auto 1fr auto;
  }

  .progress-dots {
    display: none;
  }

  .exec-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 0;
  }

  .exec-kpi-item {
    padding-right: 24px;
    margin-right: 24px;
  }

  .exec-kpi-item:nth-child(2),
  .exec-kpi-item:nth-child(4) {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
  }

  .hw-item {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .supplier-rates-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hw-media {
    min-height: 240px;
  }

  .site-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .detail-toggles {
    gap: 20px;
  }

  .next-steps-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .gantt-task-label {
    font-size: var(--text-sm);
  }

  .gantt-header-row,
  .gantt-task-row {
    grid-template-columns: 160px 1fr;
  }
}

/* ─── Responsive — mobile ─── */
@media (max-width: 640px) {
  :root {
    --section-pad-y: 56px;
  }

  .topbar {
    gap: 8px;
    padding: 0 10px;
  }

  .brand-name {
    display: none;
  }

  .cover-wordmark {
    top: 24px;
    right: 24px;
    width: 120px;
    max-width: 44%;
  }

  .local-preview-toggle {
    display: none;
  }

  .back-link {
    padding: 6px 14px;
    min-height: 34px;
    font-size: var(--text-base);
  }

  .site-switcher__trigger {
    padding: 6px 12px;
    min-height: 34px;
  }

  /* The trigger sits mid-header, so a trigger-anchored menu would run off the
     right edge on a narrow screen. Pin it to the viewport instead. */
  .site-switcher__menu {
    position: fixed;
    top: calc(var(--topbar-h) + 6px);
    left: 10px;
    right: 10px;
    min-width: 0;
    max-width: none;
  }

  .fp-inner {
    --inner-w: calc(100% - 32px);
  }

  .exec-kpi-strip {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .exec-kpi-item {
    border-right: none;
    border-bottom: 1px solid var(--tf-border);
    margin-right: 0;
    padding-right: 0;
    padding-bottom: 20px;
  }

  .exec-kpi-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .site-header-grid {
    grid-template-columns: 1fr;
  }

  .site-meta-rail {
    align-items: flex-start;
    text-align: left;
  }

  .site-kpi-strip {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .detail-toggles {
    flex-direction: column;
    gap: 10px;
  }

  .spec-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .gantt-header-row,
  .gantt-task-row {
    grid-template-columns: 120px 1fr;
  }

  .gantt-task-label {
    font-size: var(--text-xs);
  }

  .gantt-week-label {
    font-size: var(--text-3xs);
  }
}

/* ─── Savings chart ─── */
.site-chart-section {
  background: var(--tf-offwhite);
}

.chart-outer {
  background: var(--tf-offblack);
  border-radius: 8px;
  padding: 40px;
  max-width: 100%;
  box-sizing: border-box;
}

.chart-outer canvas {
  display: block;
  width: 100%;
}

@media (max-width: 900px) {
  .chart-outer {
    max-width: 100%;
    padding: 24px;
  }
}

/* ─── Detail panel: remove forced full-height, reduce padding ─── */
#detail-panel .fp-section {
  min-height: unset;
  justify-content: flex-start;
}

#detail-panel .fp-inner {
  padding-top: 64px;
  padding-bottom: 64px;
}

#section-site-summary > .fp-inner {
  padding-top: 40px;
}

/* ─── Compact layout: side-by-side product + tariff cards ─── */
.compact-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.compact-card {
  border: 1px solid var(--tf-border);
  border-radius: 10px;
  padding: 32px;
  min-width: 0;
}

.compact-card--twothirds { flex: 2; }
.compact-card--onethird  { flex: 1; }

.compact-card .section-kicker {
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .compact-row {
    flex-direction: column;
  }
  .compact-card--twothirds,
  .compact-card--onethird {
    flex: unset;
    width: 100%;
  }
}

/* ─── Layer 2 review mount (?surface=<name>) — TODO: remove after review ───
   TEMPORARY review harness. Renders a Layer 2 surface full-viewport for
   visual review, with no host. Remove together with the review mount in
   app.js once the production host and trigger ship. */
.layer2-review {
  position: fixed;
  inset: 0;
  overflow: auto;
  z-index: 1000;
}

/* ─── Layer 2 host ───
   Full-screen takeover that opens a Layer 2 surface over the main flow. The
   host owns position, scroll, and the entry/exit animation; the dim backdrop
   and the panel come from the surface's own .tf-layer2-stage. */
.layer2-host {
  position: fixed;
  inset: 0;
  overflow: auto;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
.layer2-host[data-open] {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .layer2-host {
    transition: none;
  }
}

/* Temporary host demo trigger — TODO: remove after review (see app.js). */
.layer2-host-demo {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

/* ─── Layer 2 / page vocabulary — narrow-viewport fit ───
   The multi-column heads and content grids collapse to a single column on
   narrow viewports so nothing is squeezed below a readable width. */
@media (max-width: 640px) {
  .tf-layer2__head {
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
  }

  .tf-section__head {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .tf-display-head,
  .tf-twocol {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .tf-defs,
  .tf-defs--three,
  .tf-measures {
    grid-template-columns: 1fr;
  }
}
