:root {
  --font-display: "Roboto", system-ui, sans-serif;
  --font-body: "Roboto", system-ui, sans-serif;
  --font-mono: "Roboto Mono", "Fira Mono", monospace;

  --navy-900: #0d1220;
  --navy-800: #15215a;
  --navy-700: #28324b;
  --navy-600: #3a4560;
  --navy-500: #566080;
  --navy-400: #7080a0;
  --navy-300: #96a6be;
  --navy-200: #bfcadc;
  --navy-100: #dde3ee;
  --navy-50: #f0f2f7;

  --neutral-bg: #f3f3ef;
  --neutral-card: rgba(254, 254, 252, 0.96);
  --neutral-card-strong: #fffefc;
  --neutral-200: #e8e8e4;

  --cyan-500: oklch(0.65 0.17 222);
  --cyan-600: oklch(0.58 0.17 222);
  --cyan-100: oklch(0.93 0.05 222);
  --teal-500: oklch(0.53 0.09 192);
  --teal-100: oklch(0.91 0.03 192);
  --amber-500: oklch(0.82 0.16 86);
  --amber-100: oklch(0.96 0.04 86);
  --red-500: oklch(0.48 0.22 25);
  --red-100: oklch(0.93 0.04 25);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;

  --shadow-sm: 0 1px 3px rgba(21, 33, 90, 0.08);
  --shadow-md: 0 4px 12px rgba(21, 33, 90, 0.1);
  --shadow-lg: 0 8px 24px rgba(21, 33, 90, 0.12);
}

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

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(61, 149, 224, 0.14), transparent 26%),
    radial-gradient(circle at right 10%, rgba(27, 158, 140, 0.1), transparent 22%),
    linear-gradient(180deg, #f7f8fb 0%, var(--neutral-bg) 48%, #eef1f6 100%);
  color: var(--navy-700);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--navy-50);
  color: var(--navy-700);
  padding: 0.14rem 0.38rem;
  border: 1px solid var(--navy-100);
  border-radius: 6px;
}

.topbar {
  background: var(--navy-800);
  box-shadow: var(--shadow-md);
}

.topbar-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.topbar-logo {
  height: 20px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: oklch(0.72 0.16 222);
  box-shadow: 0 0 8px oklch(0.72 0.16 222);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: #c8d0e0;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.topnav-link.is-active {
  color: oklch(0.72 0.16 222);
  border-bottom: 2px solid oklch(0.72 0.16 222);
  border-radius: 0;
}

.topbar-meta {
  margin-left: auto;
  color: var(--navy-300);
  font-family: var(--font-mono);
  font-size: 11px;
}

.topbar-logout {
  margin: 0 0 0 auto;
}

.logout-button {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--navy-500);
  border-radius: var(--radius-sm);
  color: var(--navy-200);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--navy-300);
  color: white;
  box-shadow: none;
  transform: none;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
  overflow-x: clip;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.95fr);
  gap: 20px;
}

.panel,
.metric {
  background: var(--neutral-card);
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.eyebrow,
.section-kicker,
.stat-label,
.field span {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow,
.section-kicker {
  color: var(--navy-400);
  margin: 0 0 10px;
}

.panel h2,
.detail-header h3,
.config-card-head h3 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--navy-800);
  letter-spacing: -0.02em;
}

.section-header p,
.message,
.metric span,
.info-list dt,
.config-editor-head p,
.detail-header p {
  color: var(--navy-500);
}

.panel,
.metric {
  padding: 24px;
}

.stat-label {
  color: var(--navy-400);
}

.stat-value {
  margin: 8px 0 10px;
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--navy-800);
  line-height: 1;
}

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

.section-header.compact {
  margin-top: 8px;
}

.section-header h2 {
  margin-top: -2px;
}

.sim-form,
.metrics {
  display: grid;
  gap: 18px;
}

.form-grid,
.config-grid {
  display: grid;
  gap: 16px;
}

.form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.form-grid-2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#year-field-wrap {
  max-width: 50%;
}

#year-field-wrap.is-hidden {
  display: none;
}

.field {
  display: grid;
  gap: 8px;
}

.field-file {
  grid-column: span 3;
}

.field-hint {
  font-size: 12px;
  line-height: 1.4;
}

.upload-status {
  padding: 10px 12px;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-md);
  background: rgba(247, 249, 252, 0.9);
  color: var(--navy-500);
}

.upload-status[data-tone="info"] {
  border-color: rgba(61, 149, 224, 0.2);
  background: rgba(240, 247, 255, 0.9);
  color: var(--navy-600);
}

.upload-status[data-tone="success"] {
  border-color: rgba(42, 128, 116, 0.18);
  background: rgba(235, 247, 244, 0.95);
  color: var(--teal-500);
}

.upload-status[data-tone="error"] {
  border-color: rgba(166, 69, 50, 0.16);
  background: var(--red-100);
  color: var(--red-500);
}

.upload-mapping {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-lg);
  background: rgba(250, 251, 253, 0.96);
}

.upload-mapping-copy {
  margin: 0 0 12px;
  color: var(--navy-600);
  font-size: 13px;
}

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

.upload-preview-wrap {
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-md);
  background: white;
}

.upload-preview {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
}

.upload-preview th,
.upload-preview td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--navy-100);
  text-align: left;
  white-space: nowrap;
}

.upload-preview th {
  position: static;
  background: #f7f9fc;
  color: var(--navy-500);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-preview td {
  color: var(--navy-700);
  font-size: 12px;
}

.error-text {
  color: var(--red-500);
}

.field-company-name {
  transition: opacity 0.15s ease;
}

.field-company-name.is-muted span,
.field-company-name.is-muted .field-hint {
  color: var(--navy-400);
}

.field-company-name.is-muted input {
  background: #f2f4f8;
  color: var(--navy-400);
  border-color: var(--navy-100);
}

.customer-settings-panel {
  padding: 18px 20px;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(248, 250, 254, 0.95), rgba(255, 255, 255, 0.96));
}

.customer-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-checkbox {
  align-content: start;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy-700);
  font-weight: 500;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
}

.customer-subsidy-field.is-hidden {
  display: none;
}

.site-battery-panel {
  padding: 18px 20px;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(246, 249, 253, 0.95), rgba(255, 255, 255, 0.98));
}

.site-battery-panel.is-hidden {
  display: none;
}

.site-battery-copy {
  margin: 0;
  color: var(--navy-500);
}

.site-battery-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.site-battery-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--navy-100);
  border-radius: 999px;
  background: white;
  color: var(--navy-700);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── Existing battery column tint ──────────────────────────────────── */
.config-column-head[data-is-existing] {
  background: rgba(13, 148, 136, 0.07);
  border-bottom: 2px solid rgba(13, 148, 136, 0.25);
}

.matrix-cell[data-is-existing] {
  background: rgba(13, 148, 136, 0.03);
}

.config-column-existing-badge {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.13);
  color: #0d9488;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Dataset toggle section ──────────────────────────────────────── */
.dataset-toggle-section {
  padding: 18px 20px;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(246, 249, 253, 0.95), rgba(255, 255, 255, 0.98));
}

.dataset-toggle-section.is-hidden {
  display: none;
}

.dataset-toggle-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.radio-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy-700);
  font-weight: 500;
  cursor: pointer;
}

.radio-row input[type="radio"] {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  accent-color: var(--teal-500, #0d9488);
  cursor: pointer;
}

/* ── Muted field (location new-name field when an existing is selected) ── */
.field.is-muted {
  transition: opacity 0.15s ease;
}

.field.is-muted span,
.field.is-muted .field-hint {
  color: var(--navy-400);
}

.field.is-muted input,
.field.is-muted select {
  background: #f2f4f8;
  color: var(--navy-400);
  border-color: var(--navy-100);
}

.config-editor {
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(240, 244, 251, 0.56), rgba(255, 255, 255, 0.62));
  padding: 16px 18px;
  overflow: visible;
  min-width: 0;
}

.config-editor summary {
  cursor: pointer;
  color: var(--navy-700);
  font-weight: 700;
}

.config-editor-head {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
}

.config-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.preset-picker {
  position: relative;
  z-index: 24;
}

.preset-toggle {
  min-width: 160px;
}

.preset-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 48px));
  padding: 14px;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 32;
}

.preset-picker:hover .preset-popover,
.preset-picker:focus-within .preset-popover,
.preset-picker.is-open .preset-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.preset-popover-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.preset-popover-head strong {
  color: var(--navy-800);
  font-size: 14px;
}

.preset-popover-head span {
  color: var(--navy-500);
  font-size: 12px;
}

.preset-list {
  display: grid;
  gap: 10px;
}

.preset-item {
  position: relative;
}

.preset-option {
  width: 100%;
  justify-content: space-between;
  align-items: center;
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: #f9fbfe;
  border-color: var(--navy-100);
  color: var(--navy-700);
  box-shadow: none;
  text-align: left;
  transform: none;
}

.preset-option:hover,
.preset-option:focus-visible {
  background: white;
  color: var(--navy-800);
  box-shadow: none;
  transform: none;
}

.preset-option-name {
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
}

.preset-option-meta {
  color: var(--navy-500);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.preset-hovercard {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  width: min(320px, calc(100vw - 72px));
  padding: 14px;
  border: 1px solid rgba(61, 149, 224, 0.18);
  border-radius: var(--radius-lg);
  background: rgba(250, 252, 255, 0.98);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 33;
}

.preset-item:hover .preset-hovercard,
.preset-item:focus-within .preset-hovercard {
  opacity: 1;
  transform: translateY(0);
}

/* After adding a preset, force the picker shut even while the pointer still
   rests on it — otherwise the popover and its hover preview linger over the
   comparison table below. Cleared again when the pointer re-enters (see
   openPresetPicker), so normal hover/focus behaviour is unaffected. */
.preset-picker.is-dismissed .preset-popover,
.preset-picker.is-dismissed .preset-hovercard {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.preset-hovercard-title {
  margin-bottom: 10px;
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
}

.preset-hovercard-grid {
  display: grid;
  gap: 8px;
}

.preset-hovercard-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--navy-100);
}

.preset-hovercard-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.preset-hovercard-row span {
  color: var(--navy-500);
  font-size: 12px;
}

.preset-hovercard-row strong {
  color: var(--navy-800);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
}

.config-matrix-wrap {
  margin-top: 18px;
  overflow-x: auto;
  width: 100%;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-lg);
  background: var(--neutral-card-strong);
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.config-source-panel {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-lg);
  background: rgba(250, 251, 253, 0.96);
}

.config-source-panel summary {
  cursor: pointer;
  color: var(--navy-700);
  font-weight: 700;
}

.config-source-panel p {
  margin: 12px 0 0;
  color: var(--navy-500);
}

.config-source-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.config-source-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-md);
  background: white;
}

.config-source-item strong {
  color: var(--navy-800);
}

.config-source-item span {
  color: var(--navy-500);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
}

.config-matrix {
  min-width: 0;
  width: max-content;
}

.config-matrix th,
.config-matrix td {
  vertical-align: top;
  padding: 8px 10px;
}

.config-matrix thead th {
  top: 0;
  position: sticky;
  z-index: 2;
}

.matrix-stub {
  min-width: 128px;
  max-width: 128px;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #f7f9fc;
}

.config-matrix tbody .matrix-stub {
  background: rgba(247, 249, 252, 0.98);
}

.matrix-field-label {
  color: var(--navy-700);
  font-size: 12px;
  font-weight: 700;
}

.matrix-field-unit {
  margin-top: 1px;
  color: var(--navy-400);
  font-family: var(--font-mono);
  font-size: 10px;
}

.config-column-head {
  min-width: 148px;
}

.config-column-head.is-changed {
  background: linear-gradient(180deg, rgba(192, 232, 255, 0.96), rgba(247, 249, 252, 0.98));
  box-shadow: inset 0 0 0 1px rgba(61, 149, 224, 0.18);
}

.config-column-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.config-column-index {
  color: var(--navy-400);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.config-column-name {
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.matrix-cell {
  min-width: 148px;
}

.config-matrix thead th:last-child,
.config-matrix tbody td:last-child {
  border-right: 1px solid var(--navy-100);
}

.matrix-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px;
  border-radius: 8px;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.matrix-input-wrap input {
  min-width: 0;
  font-size: 13px;
  padding: 5px 8px;
}

.matrix-input-wrap.is-changed {
  background: rgba(61, 149, 224, 0.1);
  box-shadow: 0 0 0 1px rgba(61, 149, 224, 0.2), 0 0 16px rgba(61, 149, 224, 0.12);
}

.matrix-input-wrap.is-changed input {
  border-color: rgba(61, 149, 224, 0.44);
  background: #fafdff;
}

.matrix-input-unit {
  color: var(--navy-400);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.config-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--navy-200);
  border-radius: var(--radius-md);
  background: var(--neutral-card-strong);
  color: var(--navy-700);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder {
  color: var(--navy-300);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--cyan-500);
  box-shadow: 0 0 0 3px var(--cyan-100);
}

input[readonly] {
  background: #f4f6fa;
  color: var(--navy-500);
  border-color: var(--navy-100);
  cursor: default;
}

button {
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  padding: 11px 18px;
  background: var(--cyan-500);
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  background: var(--cyan-600);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  background: var(--navy-200);
  color: var(--navy-500);
  box-shadow: none;
  transform: none;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
}

.remove-config {
  background: transparent;
  border-color: var(--navy-200);
  color: var(--navy-700);
  width: 24px;
  height: 24px;
  font-size: 1rem;
}

.remove-config:hover {
  background: var(--red-100);
  border-color: rgba(179, 77, 58, 0.22);
  color: var(--red-500);
}

.add-config {
  background: var(--cyan-500);
}

.secondary-button {
  background: white;
  border-color: var(--navy-200);
  color: var(--navy-700);
  box-shadow: none;
}

.secondary-button:hover {
  background: var(--navy-50);
  color: var(--navy-800);
}

.actions {
  display: flex;
  justify-content: flex-end;
}

.results-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  background: var(--cyan-500);
  color: white;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.button-link:hover {
  background: var(--cyan-600);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.message.error {
  background: var(--red-100);
  color: var(--red-500);
  border: 1px solid rgba(166, 69, 50, 0.16);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.message.is-success {
  background: var(--teal-100);
  color: var(--teal-500);
  border: 1px solid rgba(42, 128, 116, 0.16);
}

.progress-panel {
  padding: 20px;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(240, 247, 255, 0.85), rgba(255, 255, 255, 0.94));
}

.progress-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.progress-panel-head h3 {
  margin: 0;
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.progress-percentage {
  color: var(--cyan-600);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(191, 202, 220, 0.55);
  border: 1px solid rgba(191, 202, 220, 0.82);
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan-500), var(--teal-500));
  transition: width 0.35s ease;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  align-items: center;
}

.progress-copy strong {
  color: var(--navy-800);
}

.progress-copy span {
  color: var(--navy-500);
  font-family: var(--font-mono);
  font-size: 12px;
}

.progress-panel[data-status="error"] .progress-fill {
  background: linear-gradient(90deg, #cf6a4e, #d78955);
}

.metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric {
  background: linear-gradient(180deg, rgba(240, 244, 251, 0.7), rgba(255, 255, 255, 0.82));
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
}

.info-list {
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--navy-100);
}

.info-list dd,
.info-list dt {
  margin: 0;
}

.info-list dd {
  color: var(--navy-700);
  font-family: var(--font-mono);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-xl);
  background: var(--neutral-card-strong);
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  background: var(--neutral-card-strong);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--navy-100);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9fc;
  color: var(--navy-400);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: var(--navy-700);
  font-size: 14px;
}

tbody tr:hover {
  background: rgba(61, 149, 224, 0.04);
}

.table-link {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--cyan-600);
  font-family: var(--font-mono);
  font-size: 12px;
  box-shadow: none;
  transform: none;
}

.table-link:hover {
  background: transparent;
  box-shadow: none;
  color: var(--cyan-500);
}

.comparison-row.is-active {
  background: var(--cyan-100);
}

.scenario-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.scenario-pill {
  background: white;
  border-color: var(--navy-200);
  color: var(--navy-700);
  padding: 8px 14px;
  font-size: 13px;
  box-shadow: none;
}

.scenario-pill.is-active {
  background: var(--cyan-500);
  border-color: var(--cyan-500);
  color: white;
}

.scenario-detail {
  display: none;
}

.scenario-detail.is-active {
  display: block;
  animation: reveal 0.22s ease;
}

.detail-header {
  margin-bottom: 14px;
}

.detail-header h3 {
  margin-bottom: 4px;
}

.detail-header p {
  margin: 0;
}

.label-pill {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 500;
}

.label-pill-cat,
.label-pill-val {
  padding: 4px 9px;
}

.label-pill-cat {
  font-family: var(--font-mono);
}

.label-pill-cyan {
  border-color: oklch(0.82 0.09 222);
}

.label-pill-cyan .label-pill-cat {
  background: oklch(0.95 0.03 222);
  color: oklch(0.5 0.08 222);
}

.label-pill-cyan .label-pill-val {
  background: oklch(0.91 0.07 222);
  color: oklch(0.4 0.12 222);
}

.label-pill-teal {
  border-color: oklch(0.8 0.09 192);
}

.label-pill-teal .label-pill-cat {
  background: oklch(0.94 0.03 192);
  color: oklch(0.48 0.07 192);
}

.label-pill-teal .label-pill-val {
  background: oklch(0.9 0.07 192);
  color: oklch(0.38 0.1 192);
}

.label-pill-amber {
  border-color: oklch(0.85 0.1 86);
}

.label-pill-amber .label-pill-cat {
  background: oklch(0.96 0.03 86);
  color: oklch(0.52 0.08 86);
}

.label-pill-amber .label-pill-val {
  background: oklch(0.93 0.07 86);
  color: oklch(0.45 0.13 86);
}

.report-shell {
  display: grid;
  gap: 18px;
}

.report-page-body {
  background:
    radial-gradient(circle at top left, rgba(96, 178, 240, 0.34), transparent 22%),
    linear-gradient(180deg, #8dc0eb 0, #dcecf9 160px, #eef4f9 420px, #edf1f6 100%);
}

.report-filter-panel {
  display: grid;
  gap: 14px;
}

.report-section-panel,
.report-filter-panel,
.report-toc,
.report-tvt-panel {
  scroll-margin-top: 88px;
}

.report-overview {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
  background:
    linear-gradient(135deg, rgba(19, 20, 51, 0.98), rgba(34, 42, 84, 0.96)),
    #131433;
  color: white;
  border: 0;
  box-shadow: 0 16px 36px rgba(19, 20, 51, 0.22);
}


.report-toc {
  display: grid;
  gap: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(232, 241, 249, 0.98)),
    white;
}

.report-toc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.report-toc-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(21, 33, 90, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--navy-700);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(21, 33, 90, 0.06);
}

.report-toc-link:hover {
  border-color: rgba(21, 33, 90, 0.22);
  background: white;
}

.report-toc-link.is-active {
  background: #131433;
  border-color: #131433;
  color: white;
  box-shadow: 0 6px 16px rgba(19, 20, 51, 0.22);
}

.report-overview h1 {
  margin: 6px 0 12px;
  color: white;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 0.98;
}


.report-overview p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  max-width: 62ch;
}

.report-overview .section-kicker {
  color: rgba(255, 255, 255, 0.55);
}


.report-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.report-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
}

.report-toolbar .field {
  min-width: 240px;
  flex: 1 1 240px;
}

.report-toolbar-options {
  margin-top: 12px;
}

.report-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--navy-700);
  cursor: pointer;
  user-select: none;
}

.report-toggle-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--teal-500);
}

.report-toolbar-note {
  margin: 0;
  color: var(--navy-500);
  font-size: 13px;
}

.report-message {
  margin-top: 4px;
}

.report-chart-note {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.4;
}

.report-chart-note-accent {
  color: #c1463a;
}

.report-chart-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.report-chart-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

.report-chart-card {
  background:
    linear-gradient(180deg, rgba(202, 227, 245, 0.88), rgba(244, 249, 253, 0.98) 90px, rgba(255, 255, 255, 0.98) 180px),
    white;
  border: 1px solid rgba(146, 181, 214, 0.64);
  border-radius: 24px;
  padding: 0;
  break-inside: avoid;
  overflow: hidden;
}

.report-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 24px 14px;
  margin-bottom: 0;
}

.report-chart-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.report-chart-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-chart-action-row .secondary-button {
  height: 40px;
}

.report-chart-head h3 {
  margin: 0 0 4px;
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 1.9rem;
}

.report-chart-head p {
  margin: 0;
  color: var(--navy-500);
  font-size: 13px;
  max-width: 52ch;
}

.report-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.report-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--navy-600);
  font-size: 12px;
  white-space: nowrap;
}

.report-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(21, 33, 90, 0.14);
}

.report-canvas-wrap {
  position: relative;
  min-height: 360px;
  margin: 0 24px;
  border: 1px solid rgba(175, 197, 220, 0.76);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(252, 253, 255, 1), rgba(247, 249, 253, 1)),
    white;
  overflow: hidden;
}

.report-selection-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  border: 1px dashed rgba(193, 70, 58, 0.65);
  background: rgba(193, 70, 58, 0.12);
  pointer-events: none;
}

.report-selection-overlay[hidden] {
  display: none;
}

.report-canvas {
  display: block;
  width: 100%;
  height: 360px;
  image-rendering: auto;
  cursor: crosshair;
}

.report-expand-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-800);
}

.report-icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.report-card-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
  padding: 14px 24px 16px;
  background: linear-gradient(180deg, rgba(17, 24, 64, 0.98), rgba(22, 29, 77, 1));
  color: white;
}

.report-card-brand,
.report-card-partner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.report-card-brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(135deg, #ffffff 0, #8dc0eb 100%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.report-card-logo {
  height: 11px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.report-card-footer-meta {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  text-align: center;
}

.report-card-footer-meta strong {
  max-width: 100%;
  overflow: hidden;
  color: white;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-card-footer-meta span {
  color: rgba(220, 229, 245, 0.76);
  font-family: var(--font-mono);
  font-size: 11px;
}

.report-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 196px;
  max-width: min(280px, calc(100% - 20px));
  padding: 10px 12px;
  border: 1px solid rgba(19, 20, 51, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 32px rgba(19, 20, 51, 0.16);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.report-tooltip[hidden] {
  display: none;
}

.report-tooltip-title {
  margin-bottom: 8px;
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
}

.report-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.report-tooltip-row + .report-tooltip-row {
  margin-top: 6px;
}

.report-tooltip-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--navy-600);
  font-size: 12px;
}

.report-tooltip-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(21, 33, 90, 0.12);
  flex: 0 0 auto;
}

.report-tooltip-value {
  color: var(--navy-800);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.report-empty {
  display: grid;
  place-items: center;
  min-height: 360px;
  color: var(--navy-400);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-empty[hidden] {
  display: none;
}

.report-tvt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* ── Add-chart bar ───────────────────────────────────────────────────── */
.chart-add-bar {
  margin-top: 20px;
  padding: 0 4px;
}

.chart-add-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  height: 38px;
  border-radius: 10px;
}

.chart-add-panel {
  margin-top: 12px;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(202, 227, 245, 0.5), rgba(244, 249, 253, 0.9));
  border: 1px solid rgba(146, 181, 214, 0.5);
  border-radius: 16px;
}

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

.chart-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.chart-add-field {
  flex: 1;
  min-width: 180px;
  max-width: 260px;
}

.chart-add-confirm {
  flex-shrink: 0;
  height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  border: none;
  background: var(--navy-800, #24304a);
  color: white;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.chart-add-confirm:hover {
  background: var(--navy-600, #3d4f6e);
}

#month-chart-grid:not(:empty),
#week-chart-grid:not(:empty),
#soc-chart-grid:not(:empty) {
  margin-top: 24px;
}

#soc-static-grid {
  margin-top: 24px;
}

.report-remove-chart-button {
  color: var(--red, #c1463a) !important;
  border-color: rgba(193, 70, 58, 0.3) !important;
}

.report-remove-chart-button:hover {
  background: rgba(193, 70, 58, 0.08) !important;
}

.report-tvt-card {
  padding: 18px;
  border: 1px solid rgba(191, 202, 220, 0.9);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 253, 0.98));
}

.report-tvt-card h3 {
  margin: 0 0 12px;
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.report-tvt-kpi {
  display: block;
  margin-top: 6px;
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.report-tvt-sub {
  margin: 8px 0 0;
  color: var(--navy-500);
  font-size: 13px;
}

.report-tvt-rows {
  display: grid;
  gap: 10px;
}

.report-tvt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--navy-100);
}

.report-tvt-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.report-tvt-row span {
  color: var(--navy-500);
  font-size: 13px;
}

.report-tvt-row strong {
  color: var(--navy-800);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
}

.report-tvt-assumptions {
  display: grid;
  gap: 8px;
}

.report-tvt-assumption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.report-tvt-assumption span {
  color: var(--navy-500);
  font-size: 13px;
}

.report-tvt-assumption strong {
  color: var(--navy-800);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
}

.report-tvt-input {
  width: 112px;
  padding: 8px 10px;
  text-align: right;
}

.report-tvt-default {
  display: block;
  margin-top: 4px;
  color: var(--navy-400);
  font-size: 11px;
}

.report-tvt-save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--navy-200);
}

.report-tvt-save-btn {
  padding: 8px 18px;
  background: var(--teal-600, #158F84);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.report-tvt-save-btn:hover:not(:disabled) {
  opacity: 0.85;
}

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

.report-tvt-save-status {
  font-size: 12px;
  color: var(--teal-600, #158F84);
}

.report-missing {
  max-width: 760px;
  margin: 32px auto 0;
}

.report-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.report-modal[hidden] {
  display: none;
}

.report-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 26, 0.68);
  backdrop-filter: blur(6px);
}

.report-modal-card {
  position: absolute;
  inset: 2.5vh 2vw;
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 20px;
  background: white;
  box-shadow: 0 24px 60px rgba(8, 12, 26, 0.3);
}

.report-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.report-modal-chart {
  min-height: 0;
  overflow: auto;
}

.report-modal-chart .report-chart-card {
  height: 100%;
  margin: 0;
  box-shadow: none;
  border: 0;
  padding: 0;
}

.report-modal-chart .report-canvas-wrap,
.report-modal-chart .report-canvas {
  height: calc(100vh - 280px);
  min-height: 560px;
}

.report-battery-sidebar {
  position: fixed;
  top: 88px;
  /* Start 8px to the right of the container's right edge */
  left: calc(50% + 598px);
  width: 188px;
  z-index: 10;
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(244,249,253,0.98));
  border: 1px solid rgba(146,181,214,0.5);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 12px;
}

.report-battery-sidebar[hidden] {
  display: none;
}

.report-battery-sidebar-title {
  margin: 0 0 10px;
  color: rgba(110,125,153,1);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-battery-sidebar-name {
  margin: 0 0 10px;
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-word;
}

.report-battery-sidebar-rows {
  display: grid;
  gap: 6px;
}

.report-battery-sidebar-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.report-battery-sidebar-row[hidden] {
  display: none;
}

.report-battery-sidebar-toggle {
  margin-top: 10px;
  padding: 0;
  background: none;
  border: none;
  color: var(--navy-500);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.report-battery-sidebar-toggle:hover {
  color: var(--navy-700);
}

.report-battery-sidebar-label {
  color: var(--navy-500);
  font-size: 11px;
}

.report-battery-sidebar-value {
  color: var(--navy-800);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* Hide when there's not enough room outside the 1180px container */
@media (max-width: 1600px) {
  .report-battery-sidebar {
    display: none;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 12mm;
  }

  body {
    background: white;
  }

  .topbar,
  .report-overview .report-actions-bar,
  .report-filter-panel,
  .results-actions,
  [data-remove-static-chart] {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .panel,
  .report-chart-card,
  .metric {
    box-shadow: none;
    border-color: #d7deea;
    background: white;
  }

  /* Keep dark footer background in print */
  .report-card-footer {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: linear-gradient(180deg, rgba(17, 24, 64, 0.98), rgba(22, 29, 77, 1));
  }

  /* TOC as a cover page before the charts */
  .report-toc {
    page-break-after: always;
    padding: 24px 32px;
  }

  .report-toc-links {
    display: grid;
    gap: 10px;
    margin-top: 8px;
  }

  .report-toc-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 18px;
    font-size: 14pt;
    border-radius: 8px;
    border: 1px solid #d7deea;
    background: white;
    color: #131433;
    box-shadow: none;
  }

  .report-toc-link.is-active {
    background: white;
    border-color: #d7deea;
    color: #131433;
  }

  .report-chart-card {
    min-height: calc(100vh - 24mm);
    page-break-after: always;
  }

  .report-chart-card:last-child {
    page-break-after: auto;
  }

  .report-canvas-wrap,
  .report-canvas {
    min-height: 0;
    height: 440px;
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1000px) {
  .results-grid,
  .form-grid,
  .form-grid.form-grid-2col,
  .customer-settings-grid,
  .metrics,
  .upload-mapping-grid {
    grid-template-columns: 1fr;
  }

  #year-field-wrap {
    max-width: 100%;
  }

  .field-file {
    grid-column: auto;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .config-editor-head,
  .config-editor-actions,
  .progress-panel-head,
  .progress-copy {
    flex-direction: column;
    align-items: flex-start;
  }

  .preset-popover {
    left: 0;
    right: auto;
  }

  .preset-hovercard {
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    width: min(320px, calc(100vw - 72px));
  }

  .topbar-inner {
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 0;
  }

  .topbar-meta {
    margin-left: 0;
    width: 100%;
  }

  .report-overview,
  .report-chart-head,
  .report-legend {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-actions-bar {
    justify-content: flex-start;
  }

  .report-tvt-grid {
    grid-template-columns: 1fr;
  }

  .report-card-footer {
    grid-template-columns: 1fr;
    justify-items: flex-start;
    text-align: left;
  }

  .report-card-footer-meta {
    justify-items: flex-start;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .page-shell,
  .topbar-inner {
    width: min(100% - 20px, 1180px);
  }

  .panel,
  .metric {
    padding: 18px;
  }

  .customer-settings-panel {
    padding: 16px;
  }

  .config-source-item {
    flex-direction: column;
  }

  th,
  td {
    padding: 10px 12px;
  }

  .preset-toggle,
  .add-config {
    width: 100%;
  }

  .preset-popover {
    width: min(100vw - 40px, 420px);
  }

  .preset-option {
    flex-direction: column;
    align-items: flex-start;
  }

  .preset-option-meta {
    white-space: normal;
  }

  .report-chart-card {
    padding: 16px;
  }

  .report-canvas-wrap,
  .report-canvas {
    height: 280px;
  }

  .report-modal-card {
    inset: 10px;
    padding: 16px;
  }

  .report-modal-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
