/* ============================================================
   Building Energy M&V Dashboard - Saber-Themed Skin
   Palette: best-iucrc.org / Blocksy
   Forest green primary + vibrant green accent
   ONLY visual: colors, widget shapes, fonts, headings.
   All class names match the original so app.js works unchanged.
   ============================================================ */

/* 0. CSS VARIABLES (Saber palette mapped to MV tokens)
   ------------------------------------------------------------ */
:root {
  /* --- Saber brand greens --- */
  --saber-primary:        #0C3D00;   /* deep forest */
  --saber-primary-light:  #126000;
  --saber-primary-lighter:#1c8000;
  --saber-primary-hover:  #092e00;
  --saber-accent:         #00964F;   /* vibrant green */
  --saber-accent-hover:   #007a3f;
  --saber-accent-light:   #e6f7ef;
  --saber-teal:           #327674;
  --saber-teal-hover:     #275f5e;
  --saber-teal-light:     #eaf4f4;

  /* Brand 50–900 scale (matches Saber tailwind brand) */
  --brand-50:  #f0f9f4;
  --brand-100: #d8f0e4;
  --brand-200: #b9deb8;
  --brand-300: #7cbf9e;
  --brand-400: #3da571;
  --brand-500: #00964F;
  --brand-600: #007a3f;
  --brand-700: #126000;
  --brand-800: #0C3D00;
  --brand-900: #082800;

  /* Backgrounds */
  --bg-body:    #f8faf8;
  --bg-sidebar: #0C3D00;          /* dark forest sidebar like Saber */
  --bg-card:    #ffffff;
  --bg-surface: #f2f6f2;
  --bg-input:   #ffffff;
  --bg-muted:   #f2f6f2;

  /* Borders */
  --border-default: #d4e4d4;
  --border-subtle:  #e2eee2;
  --border-input:   #d4e4d4;
  --border-strong:  #b0c8b0;

  /* Text */
  --text-primary:   #1a2e1a;
  --text-secondary: #4a5d4a;
  --text-muted:     #767171;

  /* Accents (alias to Saber greens for any code referencing them) */
  --accent-blue:    #00964F;       /* re-mapped: was blue, now Saber accent */
  --accent-teal:    #327674;
  --accent-warning: #96650C;
  --accent-danger:  #dc2626;
  --chart-blue:     #00964F;       /* re-mapped */

  /* Font */
  --font-family: 'Work Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-weight-regular:  400;
  --font-weight-medium:   500;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  /* Border Radius — Saber leans rounder */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;

  /* Shadows — green-tinted, softer */
  --shadow-sm: 0 1px 3px rgba(12, 61, 0, 0.06), 0 1px 2px -1px rgba(12, 61, 0, 0.05);
  --shadow-md: 0 4px 10px rgba(12, 61, 0, 0.08), 0 2px 4px -2px rgba(12, 61, 0, 0.05);
  --shadow-lg: 0 8px 40px rgba(12, 61, 0, 0.12);
  --shadow-sidebar: 2px 0 8px rgba(0, 0, 0, 0.15);

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow:   0.3s ease;

  /* Layout */
  --sidebar-width:     240px;
  --sidebar-collapsed: 56px;
}

/* 2. GLOBAL RESET
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: var(--font-weight-regular);
  line-height: 1.6;
  letter-spacing: 0em;
  color: var(--text-primary);
  background-color: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: auto;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--saber-accent);
  text-decoration: none;
}

a:hover {
  color: var(--saber-accent-hover);
  text-decoration: underline;
}

/* Saber heading style: semibold, tight tracking */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0;
  color: var(--saber-primary);
}

h1 { font-size: 1.5rem;  line-height: 1.3; }
h2 { font-size: 1.25rem; line-height: 1.4; }
h3 { font-size: 1.05rem; line-height: 1.4; }
h4 { font-size: 0.95rem; line-height: 1.4; }
h5 { font-size: 0.88rem; line-height: 1.4; }
h6 { font-size: 0.8rem;  line-height: 1.4; }

ul, ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* 3. APP LAYOUT — Saber: top header + stepper, no left sidebar
   ------------------------------------------------------------ */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* The "sidebar" element is repurposed as a TOP bar (logo + stepper) */
.sidebar {
  width: 100%;
  background: var(--bg-sidebar);
  border-right: none;
  display: grid;
  grid-template-columns: minmax(220px, auto) 1fr minmax(160px, auto);
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  left: 0;
  height: auto;
  min-height: 72px;
  padding: 14px 32px;
  z-index: 100;
  box-shadow: var(--shadow-sidebar);
  color: #ffffff;
}

.main-area {
  margin-left: 0;
  flex: 1;
  padding: 28px 36px 32px;
  min-height: calc(100vh - 72px);
  background: var(--bg-body);
  min-width: 0;
  overflow-x: auto;
}

/* 4. TOP BAR INTERNALS (brand + horizontal stepper + footer)
   ------------------------------------------------------------ */
.sidebar-brand {
  padding: 0;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  white-space: nowrap;
}

.brand-mark {
  font-size: 1.7rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.brand-tag {
  font-size: 0.72rem;
  color: var(--brand-200);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 4px;
  font-weight: var(--font-weight-semibold);
}

/* Horizontal stepper */
.sidebar-nav {
  flex: 1;
  padding: 0;
  overflow: visible;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}

/* Each step = circular number with label below */
.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--brand-200);
  min-height: 0;
  padding: 4px 6px;
  border-radius: 0;
  border: none;
  width: auto;
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  border-left: none;
}

.step-indicator:hover {
  background: transparent;
  color: #ffffff;
}

.step-indicator:hover .step-number {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.step-indicator.active {
  background: transparent;
  color: #ffffff;
  border-left: none;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
}

.step-indicator.active .step-number {
  background: var(--saber-accent);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 150, 79, 0.22);
}

.step-label {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  font-size: 0.74rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.02em;
  color: var(--brand-200);
}

.step-indicator.active .step-label {
  color: #ffffff;
}

/* Connector = horizontal line between circles, sits at circle midline */
.step-connector {
  flex: 1;
  height: 2px;
  min-width: 32px;
  max-width: 110px;
  margin: 19px 6px 0;   /* aligns to vertical center of 36px circle */
  border-left: none;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  align-self: flex-start;
}

.sidebar-footer {
  padding: 0;
  border-top: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.sidebar-footer p {
  margin: 0;
}

/* Prominent "New Project" CTA in the top-right of the header */
.header-new-project {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--saber-primary);
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease,
              box-shadow 0.15s ease;
}

.header-new-project i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--saber-accent);
  color: #fff;
  font-size: 0.7rem;
}

.header-new-project:hover {
  background: var(--saber-accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 150, 79, 0.35);
  transform: translateY(-1px);
}

.header-new-project:hover i {
  background: #fff;
  color: var(--saber-accent);
}

.header-new-project:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.header-new-project:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.header-version {
  margin: 0;
  font-size: 0.65rem;
  color: var(--brand-200);
  letter-spacing: 0.04em;
  opacity: 0.75;
}

/* 5. PAGE SECTIONS
   ------------------------------------------------------------ */
.page {
  display: none;
  animation: fadeIn 0.2s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 6. PAGE HEADER
   ------------------------------------------------------------ */
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--brand-100);
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.page-header-icon {
  color: var(--saber-accent);
  font-size: 1.2rem;
}

.btn-ghost {
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  color: var(--saber-primary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-ghost:hover {
  background: var(--brand-100);
  border-color: var(--brand-400);
  color: var(--saber-primary);
}

/* 7. CARDS
   ------------------------------------------------------------ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  border-bottom: 1px solid var(--brand-100);
  margin: 0;
  letter-spacing: -0.005em;
}

.card-title i {
  color: var(--saber-accent);
  font-size: 0.95rem;
}

.card-body {
  padding: 18px;
}

/* 8. FORM ELEMENTS
   ------------------------------------------------------------ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 18px;
}

.form-group {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 6px;
}

select,
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

select:focus,
input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--saber-accent);
  box-shadow: 0 0 0 3px rgba(0, 150, 79, 0.16);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230C3D00' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

select option {
  background: #ffffff;
  color: var(--text-primary);
}

.form-group-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.building-icon {
  font-size: 1.6rem;
  line-height: 1;
  filter: grayscale(100%) opacity(0.55);
  color: var(--text-muted);
}

.input-with-suffix {
  display: flex;
  align-items: center;
  position: relative;
}

.input-suffix {
  position: absolute;
  right: 12px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  pointer-events: none;
}

.input-with-suffix input {
  padding-right: 48px;
}

/* 9. UPLOAD ZONES
   ------------------------------------------------------------ */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px;
}

.upload-column {
  min-width: 0;
}

.upload-column h3 {
  font-size: 0.9rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-column h3 i {
  color: var(--saber-accent);
}

.upload-zone {
  border: 1.5px dashed var(--brand-300);
  border-radius: var(--radius-md);
  padding: 32px 18px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--brand-50);
}

.upload-zone:hover {
  border-color: var(--saber-accent);
  background: var(--saber-accent-light);
}

.upload-zone.drag-over {
  border-color: var(--saber-accent);
  background: var(--brand-100);
}

.upload-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.upload-icon {
  font-size: 1.6rem;
  color: var(--saber-accent);
}

.upload-zone p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin: 0;
}

.upload-zone input[type="file"] {
  display: none;
}

.weather-upload {
  margin: 0 18px 18px;
}

.upload-status {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.upload-status.status-loaded {
  color: var(--saber-accent);
  font-weight: var(--font-weight-semibold);
}

.upload-status.status-error {
  color: var(--accent-danger);
}

.noaa-controls {
  margin: 0 18px 10px;
  padding: 12px 14px;
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-sm);
  background: var(--brand-50);
}

.noaa-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.noaa-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.noaa-hint code {
  background: #ffffff;
  border: 1px solid var(--brand-200);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.8rem;
}

.upload-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.data-summary {
  font-size: 0.84rem;
  color: var(--text-secondary);
  padding: 8px 0;
}

.data-quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-accent);
  padding: 4px 10px;
  background: var(--saber-accent-light);
  border: 1px solid var(--brand-200);
  border-radius: 999px;
}

.data-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.table-responsive {
  overflow-x: auto;
  margin-top: 8px;
}

.data-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-preview-table th {
  background: var(--brand-50);
  color: var(--saber-primary);
  font-weight: var(--font-weight-semibold);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-preview-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

#tablePrePreview th,
#tablePrePreview td,
#tablePostPreview th,
#tablePostPreview td {
  white-space: nowrap;
}

#tablePrePreview td:last-child,
#tablePostPreview td:last-child {
  min-width: 118px;
  font-variant-numeric: tabular-nums;
}

.data-preview-table tr:hover td {
  background: var(--brand-50);
}

.table-editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 61, 0, 0.42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.table-editor-modal {
  width: min(1200px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.table-editor-header,
.table-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-default);
  background: var(--brand-50);
}

.table-editor-footer {
  border-bottom: none;
  border-top: 1px solid var(--border-default);
}

.table-editor-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--saber-primary);
}

.table-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  gap: 10px;
}

.table-editor-toolbar-left,
.table-editor-toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-editor-page-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 140px;
  text-align: center;
}

.table-editor-hint {
  padding: 0 16px 8px;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.table-editor-hint code {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: 4px;
  padding: 1px 5px;
}

.table-editor-grid-wrap {
  margin: 0 16px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  max-height: 56vh;
}

.table-editor-grid {
  font-size: 0.78rem;
}

.table-editor-grid th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-editor-grid .table-editor-rownum {
  width: 58px;
  text-align: center;
  color: var(--text-secondary);
}

.table-editor-grid .table-editor-cell {
  padding: 0;
}

.table-editor-grid .table-editor-cell.cell-selected {
  background: rgba(0, 150, 79, 0.12);
}

.table-editor-grid input {
  display: block;
  width: 100%;
  min-height: 36px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.2;
  padding: 3px 5px;
  border-radius: 4px;
}

.table-editor-grid input:focus {
  outline: none;
  border-color: var(--saber-accent);
  background: var(--saber-accent-light);
}

.sample-downloads {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--brand-100);
  background: var(--brand-50);
  flex-wrap: wrap;
}

.info-label {
  font-size: 0.82rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
}

/* 10. BUTTONS
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  letter-spacing: 0;
}

.btn-primary {
  background: var(--saber-accent);
  color: #ffffff;
  border-color: var(--saber-accent);
  box-shadow: 0 1px 2px rgba(12, 61, 0, 0.08);
}

.btn-primary:hover {
  background: var(--saber-accent-hover);
  border-color: var(--saber-accent-hover);
  box-shadow: 0 4px 10px rgba(0, 150, 79, 0.22);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--brand-300);
  border-color: var(--brand-300);
  box-shadow: none;
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-default);
  color: var(--saber-primary);
}

.btn-secondary:hover {
  border-color: var(--saber-accent);
  background: var(--brand-50);
  color: var(--saber-primary);
}

.btn-outline {
  background: #ffffff;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  padding: 7px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-outline:hover {
  border-color: var(--saber-accent);
  background: var(--brand-50);
  color: var(--saber-primary);
}

/* M&V Analysis — promoted button, sits beside Change Point Model tab */
#btnMVQuick.chart-tab-mv-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 170px;
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-sm);
  background: var(--saber-accent);
  border: 1px solid var(--saber-accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 150, 79, 0.22);
  margin-left: 8px;
  transition: all var(--transition-fast);
}

#btnMVQuick.chart-tab-mv-toggle i {
  font-size: 0.95rem;
}

#btnMVQuick.chart-tab-mv-toggle:hover {
  background: var(--saber-accent-hover);
  border-color: var(--saber-accent-hover);
  box-shadow: 0 4px 12px rgba(0, 150, 79, 0.32);
  transform: translateY(-1px);
}

#btnMVQuick.chart-tab-mv-toggle.is-active {
  background: var(--saber-primary);
  border-color: var(--saber-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(12, 61, 0, 0.28), inset 0 0 0 2px rgba(255,255,255,0.18);
}

#btnMVQuick.chart-tab-mv-toggle.is-active:hover {
  background: var(--saber-primary-hover);
  border-color: var(--saber-primary-hover);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-export {
  background: var(--saber-accent-light);
  border: 1px solid var(--brand-200);
  color: var(--saber-primary);
}

.btn-export:hover {
  background: var(--brand-100);
  border-color: var(--saber-accent);
}

/* 11. RADIO & CHECKBOX
   ------------------------------------------------------------ */
.radio-group {
  display: flex;
  gap: 12px;
  padding: 18px;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.radio-label:hover {
  border-color: var(--saber-accent);
  background: var(--saber-accent-light);
  color: var(--saber-primary);
}

.radio-label:has(input:checked) {
  border-color: var(--saber-accent);
  background: var(--saber-accent);
  color: #ffffff;
}

.radio-custom { display: none; }

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--saber-accent);
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.checkbox-label:hover {
  border-color: var(--saber-accent);
  color: var(--saber-primary);
}

.checkbox-label:has(input:checked) {
  border-color: var(--saber-accent);
  background: var(--saber-accent-light);
  color: var(--saber-primary);
}

.checkbox-custom { display: none; }

.checkbox-standalone {
  padding: 8px 0;
  background: transparent;
  border: none;
}

.checkbox-standalone:hover {
  background: transparent;
  border: none;
  color: var(--saber-primary);
}

/* 12. ANALYSIS TOOLBAR & LAYOUT
   ------------------------------------------------------------ */
.analysis-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-group label {
  font-size: 0.78rem;
  color: var(--saber-primary);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.toolbar-group select {
  padding: 7px 12px;
  font-size: 0.82rem;
  min-width: 110px;
}

.toolbar-group input[type="number"] {
  padding: 7px 12px;
  font-size: 0.82rem;
  width: 100px;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-label-left,
.toggle-label-right {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.toggle-slider {
  width: 40px;
  height: 22px;
  background: var(--brand-200);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition-normal);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-normal);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

input#toggleAnalysisMode { display: none; }

input#toggleAnalysisMode:checked + .toggle-slider {
  background: var(--saber-accent);
}

input#toggleAnalysisMode:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 18px;
  align-items: start;
}

.analysis-charts {
  min-width: 0;
  overflow: hidden;
}

.analysis-metrics {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.analysis-charts .card,
.analysis-metrics .card {
  margin-bottom: 0;
}

.chart-tab-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 2px;
}

.chart-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  background: #ffffff;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 0.84rem;
  font-weight: var(--font-weight-semibold);
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0;
  transition: all var(--transition-fast);
}

.chart-tab:hover {
  border-color: var(--saber-accent);
  color: var(--saber-primary);
  background: var(--brand-50);
}

.chart-tab.active {
  border-color: var(--saber-accent);
  background: var(--saber-accent);
  color: #ffffff;
}

/* 13. CHART CONTAINERS
   ------------------------------------------------------------ */
.chart-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.chart-container {
  min-height: 350px;
  padding: 12px 14px 14px;
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.chart-panel,
.mv-chart-stack,
.mv-chart-block {
  min-width: 0;
}

.chart-container .js-plotly-plot,
.chart-container .plot-container,
.chart-container .svg-container,
.chart-container .plotly-graph-div {
  width: 100% !important;
  max-width: 100% !important;
  min-height: inherit;
}

.chart-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.chart-grid-three {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 14px;
}

.chart-placeholder {
  min-height: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 18px;
}

#chartTempWrapper #chartBaseline {
  min-height: 420px !important;
}

#chartDDWrapper {
  display: grid;
  gap: 12px;
}

#chartDDWrapper #chartHDD,
#chartDDWrapper #chartCDD {
  min-height: 330px !important;
}

#chartMVBar,
#chartMVLine {
  min-height: 340px !important;
}

.mv-chart-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.mv-chart-utility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mv-chart-block {
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-md);
  background: var(--brand-50);
}

.mv-chart-block-primary {
  grid-column: 1 / -1;
}

.mv-chart-label {
  margin: 10px 14px 0;
  color: var(--saber-primary);
  font-size: 0.8rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mv-scope-note {
  margin: -2px 18px 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* 14. RESULTS TABS
   ------------------------------------------------------------ */
.results-tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--brand-100);
  padding: 0;
}

.results-tab {
  padding: 9px 14px;
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.results-tab:hover {
  color: var(--saber-primary);
}

.results-tab.active {
  color: var(--saber-primary);
  border-bottom-color: var(--saber-accent);
}

.results-panel {
  display: none;
  padding: 14px 0;
}

.results-panel.active {
  display: block;
}

/* 15. METRICS DISPLAY
   ------------------------------------------------------------ */
.metrics-table-unified {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.9rem;
}

.metrics-table-unified thead th {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border-default);
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  text-align: center;
  background: var(--brand-50);
}

.metrics-table-unified thead th:first-child {
  text-align: left;
  width: 34%;
}

.metrics-table-unified tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.metrics-table-unified tbody td:first-child {
  text-align: left;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

.metrics-table-unified tbody tr:last-child td {
  border-bottom: none;
}

.dd-calculations-card {
  overflow: visible;
}

.dd-calc-table tbody td:first-child {
  width: 50%;
}

.dd-calc-note {
  border-top: 1px solid var(--border-subtle);
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.prediction-savings-card {
  overflow: visible;
}

.mv-model-selector-panel {
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--brand-100);
  background: var(--brand-50);
}

.mv-model-selector-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.mv-model-selector-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mv-model-selector-field label {
  font-size: 0.76rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mv-model-selector-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-family: inherit;
}

.mv-model-selector-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.prediction-savings-card h4 {
  padding: 14px 18px 8px;
  font-size: 0.84rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mv-savings-detail {
  padding: 12px 18px 14px;
  border-top: 1px solid var(--brand-100);
}

.mv-savings-detail h5 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  margin-bottom: 8px;
}

.mv-savings-detail h5 i {
  color: var(--saber-accent);
}

.savings-row {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.savings-row span {
  font-variant-numeric: tabular-nums;
}

.savings-row .savings-highlight {
  color: var(--saber-accent);
  font-weight: var(--font-weight-semibold);
}

.mv-savings-total {
  border-top: 1px solid var(--border-default);
  background: var(--saber-accent-light);
}

.warning-list,
.drift-list {
  list-style: disc;
  margin: 10px 18px 14px 30px;
  padding: 0;
}

.warning-list li,
.drift-list li {
  margin-bottom: 6px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.metrics-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 14px 18px;
}

.metrics-col h4 {
  font-size: 0.74rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 0.86rem;
}

.metric-label {
  color: var(--text-secondary);
}

.metric-value {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
}

.metrics-info-row {
  display: flex;
  gap: 24px;
  padding: 10px 18px;
  border-top: 1px solid var(--brand-100);
}

.metric-item {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.86rem;
}

.metrics-info {
  padding: 10px 18px;
  font-size: 0.86rem;
  border-top: 1px solid var(--brand-100);
}

.metrics-subtitle {
  font-size: 0.74rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 18px 4px;
  margin: 0;
}

.dd-summary {
  border-top: 1px solid var(--brand-100);
  padding-top: 4px;
}

/* 16. SAVINGS / COMPARISON TABLES
   ------------------------------------------------------------ */
.savings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.savings-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.74rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-default);
  background: var(--brand-50);
}

.savings-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.savings-table .row-label {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.savings-table .row-label i {
  color: var(--saber-accent);
  font-size: 0.88rem;
}

.savings-table .totals-row td {
  font-weight: var(--font-weight-semibold);
  border-top: 1px solid var(--border-default);
  border-bottom: none;
  background: var(--saber-accent-light);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.comparison-table th {
  background: var(--brand-50);
  color: var(--saber-primary);
  font-weight: var(--font-weight-semibold);
  padding: 8px 12px;
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-default);
}

.comparison-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

#outlierReviewWarning {
  color: #9a3412;
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.45;
}

.outlier-review-card {
  margin-top: 20px;
}

.outlier-review-card .card-title {
  margin-bottom: 0;
}

.outlier-review-card .dd-calc-note,
.outlier-review-card .outlier-option-grid,
.outlier-review-card .outlier-summary-grid {
  padding-left: 18px;
  padding-right: 18px;
}

.outlier-review-card #outlierReviewSummary,
.outlier-review-card #outlierReviewWarning {
  margin: 0 18px 12px;
  padding: 10px 14px;
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-sm);
  background: var(--brand-50);
}

.outlier-review-card #outlierReviewWarning {
  background: #fff4e6;
  border-color: #ffd9a8;
}

.outlier-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
  margin-bottom: 14px;
}

.outlier-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.outlier-action-panel {
  margin: 0 18px 14px;
  padding: 14px 16px;
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-md);
  background: var(--brand-50);
}

.outlier-action-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 10px;
}

.outlier-action-header h4 {
  margin: 0;
  color: var(--saber-primary);
}

.outlier-action-header .dd-calc-note {
  padding: 0;
  margin: 0;
  flex: 1 1 320px;
}

.outlier-action-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(240px, 1.6fr) auto;
  gap: 10px 12px;
  align-items: end;
}

.outlier-action-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.outlier-action-field label {
  color: var(--saber-primary);
  font-size: 0.82rem;
  font-weight: var(--font-weight-semibold);
}

.outlier-action-note-field input {
  width: 100%;
}

.outlier-action-button-field {
  justify-content: flex-end;
}

.outlier-action-button-field .btn {
  white-space: nowrap;
}

#outlierActionStatus {
  margin: 12px 0 0;
  padding: 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.outlier-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.outlier-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--saber-accent-light);
  color: var(--saber-primary);
  border: 1px solid var(--brand-200);
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
}

.outlier-chip-hint {
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.summary-card {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.summary-label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--font-weight-semibold);
}

.summary-value {
  color: var(--saber-primary);
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 4px;
}

.outlier-review-card .chart-grid,
.outlier-review-card .table-responsive,
.outlier-review-card h4 {
  margin-left: 18px;
  margin-right: 18px;
}

.outlier-review-card .chart-grid {
  margin-bottom: 14px;
}

.outlier-review-card .chart-container.chart-clickable {
  cursor: pointer;
}

.outlier-review-card .table-responsive {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: #ffffff;
}

@media (max-width: 1100px) {
  .outlier-action-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 720px) {
  .outlier-action-grid {
    grid-template-columns: 1fr;
  }
  .outlier-action-button-field {
    justify-content: stretch;
  }
  .outlier-action-button-field .btn {
    width: 100%;
  }
}

.outlier-review-card h4 {
  margin-top: 10px;
  margin-bottom: 10px;
}

#mvMonthlyTable th,
#mvMonthlyTable td {
  white-space: nowrap;
}

#mvMonthlyTableCard .table-responsive {
  max-height: 420px;
}

#valTotalBasisNote,
#valDDReportingMessages {
  margin-top: 8px;
}

/* 17. MV CHARTS SECTION
   ------------------------------------------------------------ */
.mv-charts-section {
  margin-top: 14px;
}

/* 18. HR PAGE (Page 3) SPECIFICS
   ------------------------------------------------------------ */
.hr-status-badges {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 0.74rem;
  font-weight: var(--font-weight-semibold);
  border-radius: 999px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  color: var(--text-secondary);
}

.status-badge.status-loaded {
  background: var(--saber-accent-light);
  border-color: var(--brand-300);
  color: var(--saber-accent);
}

.status-badge i {
  font-size: 0.5rem;
}

.hr-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  padding: 18px;
}

.form-group-wide {
  grid-column: 1 / -1;
}

.hr-run-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-top: 1px solid var(--brand-100);
  background: var(--brand-50);
}

.progress-bar-container {
  flex: 1;
}

progress.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  border: none;
}

progress.progress-bar::-webkit-progress-bar {
  background: var(--brand-100);
  border-radius: 999px;
}

progress.progress-bar::-webkit-progress-value {
  background: linear-gradient(90deg, var(--saber-accent), var(--saber-primary-lighter));
  border-radius: 999px;
}

progress.progress-bar::-moz-progress-bar {
  background: linear-gradient(90deg, var(--saber-accent), var(--saber-primary-lighter));
  border-radius: 999px;
}

.best-model-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 18px;
}

.best-model-item {
  text-align: center;
  padding: 14px;
  background: var(--brand-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-100);
}

.best-model-label {
  display: block;
  font-size: 0.7rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.best-model-value {
  display: block;
  font-size: 1.15rem;
  font-weight: var(--font-weight-bold);
  color: var(--saber-primary);
}

.evaluation-table,
.eval-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.evaluation-table th,
.eval-table th {
  background: var(--brand-50);
  color: var(--saber-primary);
  font-weight: var(--font-weight-semibold);
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.evaluation-table td,
.eval-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.evaluation-table tbody tr:hover td,
.eval-table tbody tr:hover td {
  background: var(--brand-50);
}

/* 19. HR RESULTS TABS
   ------------------------------------------------------------ */
.hr-tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--brand-100);
}

.hr-tab {
  padding: 11px 18px;
  font-size: 0.84rem;
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.hr-tab:hover {
  color: var(--saber-primary);
}

.hr-tab.active {
  color: var(--saber-primary);
  border-bottom-color: var(--saber-accent);
}

.hr-panel {
  padding: 18px 0;
}

.chart-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  margin-bottom: 8px;
}

.chart-nav-label {
  font-size: 0.86rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
}

.savings-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  padding: 18px 0;
}

.savings-item {
  text-align: center;
  padding: 14px;
  background: var(--brand-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-100);
}

.savings-label {
  display: block;
  font-size: 0.7rem;
  color: var(--saber-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--font-weight-semibold);
  margin-bottom: 6px;
}

.savings-value {
  display: block;
  font-size: 1.05rem;
  font-weight: var(--font-weight-bold);
  color: var(--saber-primary);
}

.uncertainty-section {
  padding: 14px 0;
  border-top: 1px solid var(--brand-100);
}

/* 20. SUMMARY PAGE (Page 4)
   ------------------------------------------------------------ */
.summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.summary-cards-grid .summary-card {
  padding: 22px;
}

.summary-cards-grid .summary-card h3 {
  font-size: 0.98rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.summary-cards-grid .summary-card h3 i {
  color: var(--saber-accent);
}

.summary-cards-grid .summary-card p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.summary-cards-grid .summary-card p strong {
  color: var(--saber-primary);
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.summary-metric {
  text-align: center;
  padding: 12px 10px;
  background: var(--brand-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-100);
}

.summary-metric .label {
  display: block;
  font-size: 0.7rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.summary-metric .value {
  display: block;
  font-size: 1.1rem;
  font-weight: var(--font-weight-bold);
  color: var(--saber-primary);
}

.warning-title i {
  color: var(--accent-warning);
}

.alert-title i {
  color: var(--accent-danger);
}

.warnings-content,
.alerts-content {
  padding: 0 18px 14px;
}

.warning-list,
.drift-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.warning-list li,
.drift-list li {
  padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.84rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.warning-list li {
  color: var(--accent-warning);
}

.warning-list li::before {
  content: '\26A0';
  flex-shrink: 0;
}

.drift-list li {
  color: var(--accent-danger);
}

.drift-list li::before {
  content: '\26A0';
  flex-shrink: 0;
}

.export-actions {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* 21. PAGE NAVIGATION
   ------------------------------------------------------------ */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--brand-100);
  margin-top: 24px;
}

/* 22. LOADING OVERLAY
   ------------------------------------------------------------ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 61, 0, 0.18);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-panel {
  width: min(560px, 86vw);
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loading-title {
  font-size: 0.95rem;
  color: var(--saber-primary);
  font-weight: var(--font-weight-semibold);
}

.loading-progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--brand-100);
  overflow: hidden;
}

.loading-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--saber-accent), var(--saber-primary-lighter));
  transition: width 0.28s ease;
}

.loading-progress-meta {
  display: flex;
  justify-content: flex-end;
}

.loading-progress-meta span {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

/* 23. TOAST NOTIFICATIONS
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: var(--text-primary);
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition-slow);
  background: #ffffff;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-default);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-info {
  background: #ffffff;
  border-color: var(--brand-300);
}

.toast-success {
  background: var(--saber-accent-light);
  border-color: var(--brand-300);
  color: var(--saber-primary);
}

.toast-warning {
  background: #fff4e6;
  border-color: #ffd9a8;
  color: #7a500a;
}

.toast-error {
  background: #fee2e2;
  border-color: #f9b3b3;
  color: #b91c1c;
}

/* 24. ALERT CONTAINER
   ------------------------------------------------------------ */
.alert-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
}

/* 25. SCROLLBAR
   ------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-muted);
}

::-webkit-scrollbar-thumb {
  background: var(--brand-300);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--brand-400);
}

/* 26. UTILITY CLASSES
   ------------------------------------------------------------ */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--saber-primary); }
.text-success { color: var(--saber-accent); }
.text-warning { color: var(--accent-warning); }
.text-danger  { color: var(--accent-danger); }

.hidden { display: none !important; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

/* Current analysis controls and accessible status text. */
#btnMVQuick {
  min-width: 130px;
  justify-content: center;
}

#btnMVQuick.is-active {
  border-color: var(--accent-blue);
  background: var(--saber-accent-light);
  color: var(--accent-blue);
}

#btnMVQuick.is-active:hover {
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.hr-input-note {
  margin: 0;
  padding: 0 16px 16px;
  color: var(--text-secondary);
}

.summary-card h3 {
  font-size: 0.9rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-card h3 i {
  color: var(--accent-blue);
}

.summary-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.summary-card p strong {
  color: var(--text-primary);
}

.text-center {
  text-align: center;
}

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

.text-accent {
  color: var(--accent-blue);
}

.text-teal {
  color: var(--accent-teal);
}

.mt-0 {
  margin-top: 0;
}

.mb-0 {
  margin-bottom: 0;
}

.d-none {
  display: none;
}

.d-flex {
  display: flex;
}

.d-grid {
  display: grid;
}

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

/* 27. RESPONSIVE - max-width: 1200px
   ------------------------------------------------------------ */
@media (max-width: 1200px) {
  .analysis-layout {
    grid-template-columns: 1fr;
  }

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

  .best-model-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 28. RESPONSIVE - max-width: 900px (top bar collapses)
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  .sidebar {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 14px 18px;
  }

  .sidebar-brand,
  .sidebar-nav,
  .sidebar-footer {
    min-width: 0;
    max-width: 100%;
  }

  .sidebar-brand {
    align-items: center;
    text-align: center;
  }

  .sidebar-footer {
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .step-label {
    font-size: 0.68rem;
  }

  .step-number {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .step-connector {
    min-width: 16px;
    margin-top: 17px;
  }

  .main-area {
    padding: 18px;
  }

  .form-grid,
  .hr-config-grid {
    grid-template-columns: 1fr;
  }

  .analysis-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

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

/* 29. RESPONSIVE - max-width: 600px
   ------------------------------------------------------------ */
@media (max-width: 600px) {
  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .step-indicator {
    min-width: 0;
    width: 100%;
    padding: 4px 2px;
  }

  .step-label {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .step-connector {
    display: none;
  }

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

  .page-header h1 {
    font-size: 1.2rem;
  }

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

  .best-model-grid {
    grid-template-columns: 1fr;
  }

  .radio-group {
    flex-direction: column;
  }
}

/* 30. FOOTER
   ------------------------------------------------------------ */
.main-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 18px 16px;
  border-top: 1px solid var(--brand-100);
  margin-top: 24px;
}

/* --- Weather Source lock state (when temp already provided by data file) --- */
.weather-lock-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 18px 14px;
  padding: 10px 14px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-left: 3px solid var(--saber-accent);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--saber-primary);
  line-height: 1.4;
}

.weather-lock-note i {
  color: var(--saber-accent);
  font-size: 0.95rem;
  flex-shrink: 0;
}

#weatherSourceCard.is-locked {
  opacity: 0.55;
  pointer-events: none;
  position: relative;
}

#weatherSourceCard.is-locked .weather-lock-note {
  opacity: 1;
  pointer-events: auto;
}

#weatherSourceCard.is-locked select,
#weatherSourceCard.is-locked input,
#weatherSourceCard.is-locked button {
  cursor: not-allowed;
}

/* --- Manual Weather Entry (Saber-themed) --- */
.manual-weather-zone {
  margin: 0 18px 18px;
  padding: 16px 18px;
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-md);
  background: var(--brand-50);
}

.manual-weather-header {
  margin-bottom: 14px;
}

.manual-weather-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  margin: 0 0 4px;
}

.manual-weather-header h3 i {
  color: var(--saber-accent);
}

.manual-weather-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.manual-weather-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.manual-weather-grid .manual-entry-column h4 {
  font-size: 0.82rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .manual-weather-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Manual Data Entry (Saber-themed) --- */
.manual-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px;
}

.manual-entry-column {
  min-width: 0;
}

.manual-entry-column h3 {
  font-size: 0.9rem;
  font-weight: var(--font-weight-semibold);
  color: var(--saber-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-entry-column h3 i {
  color: var(--saber-accent);
}

.manual-table-wrap {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.manual-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.manual-data-table thead th {
  background: var(--brand-50);
  color: var(--saber-primary);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-default);
}

.manual-data-table tbody td {
  padding: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.manual-data-table tbody tr:last-child td {
  border-bottom: none;
}

.manual-data-table td[contenteditable="true"] {
  padding: 10px 14px;
  min-width: 80px;
  min-height: 38px;
  outline: none;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.manual-data-table td[contenteditable="true"]:hover {
  background: var(--brand-50);
}

/* Transparent placeholder for empty cells with data-placeholder attribute.
   Shown only when the cell is empty AND not focused. Disappears on click/focus. */
.manual-data-table td[contenteditable="true"][data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  opacity: 0.45;
  font-style: italic;
  pointer-events: none;
}

.manual-data-table td[contenteditable="true"][data-placeholder]:focus::before {
  content: none;
}

.manual-data-table td[contenteditable="true"]:focus {
  background: var(--saber-accent-light);
  box-shadow: inset 0 0 0 2px var(--saber-accent);
}

.manual-table-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .manual-entry-grid {
    grid-template-columns: 1fr;
  }
}

/* Match the reference header and decorative elements. */
.noaa-hint,
.brand-tag,
.form-group-icon {
  display: none !important;
}

/* 31. PRINT STYLES
   ------------------------------------------------------------ */
@media print {
  .sidebar,
  .page-nav,
  .analysis-toolbar,
  .toast-container,
  .loading-overlay,
  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-outline,
  .btn-ghost {
    display: none !important;
  }

  .main-area {
    margin-left: 0;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #aaa;
    page-break-inside: avoid;
  }

  body {
    background: #ffffff;
  }
}

/* Honest progress, persistent feedback, and keyboard-accessible project reset. */
[hidden] { display: none !important; }
.results-state-notice { color: var(--text-secondary); margin: 0 0 14px; }
.results-state-notice:empty { display: none; }
.selected-model-description { font-size: 0.76rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.persistent-error { display: flex; align-items: flex-start; gap: 18px; justify-content: space-between; padding: 16px; margin-bottom: 18px; border: 1px solid var(--accent-danger); border-left-width: 4px; border-radius: var(--radius-sm); background: #fff5f5; color: #781b1b; }
.persistent-error p { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; }
.loading-progress-fill { width: 35%; animation: indeterminate-progress 1.5s ease-in-out infinite; }
.loading-cancel { margin-top: 18px; }
.hr-coverage-note { padding: 12px 14px; margin: 12px 0; border-left: 3px solid var(--accent-warning, #a16207); background: #fffbeb; color: #713f12; white-space: pre-line; overflow-wrap: anywhere; }
@keyframes indeterminate-progress { from { transform: translateX(-110%); } to { transform: translateX(390%); } }
.reset-project-overlay { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(12, 61, 0, 0.38); }
.reset-project-panel { width: min(100%, 560px); max-height: 90vh; overflow: auto; background: var(--bg-card); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-lg); }
.reset-project-panel h2 { margin-bottom: 16px; }
.reset-project-panel p { margin-bottom: 20px; }
.reset-project-error { color: var(--accent-danger); }
.reset-project-error:empty { display: none; }
.reset-project-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; }
button:disabled { opacity: 0.55; }
.upload-zone[aria-disabled="true"] { cursor: wait; }
@media (prefers-reduced-motion: reduce) { .loading-progress-fill { animation-duration: 4s; } }
