/**
 * styles.css
 *
 * PowerPlanner PWA — full styling.
 * Mobile-first. Modern SaaS dashboard aesthetic.
 * Desktop: sidebar + content grid. Mobile: bottom nav + collapsibles.
 */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #0f172a;
  --navy-light: #1e293b;
  --navy-mid:   #334155;
  --surface:    #f1f5f9;
  --card:       #ffffff;
  --border:     #e2e8f0;
  --text-1:     #0f172a;
  --text-2:     #475569;
  --text-3:     #94a3b8;

  --solar:        #f59e0b;
  --solar-bg:     #fffbeb;
  --solar-muted:  #fef3c7;
  --wind:         #06b6d4;
  --wind-bg:      #ecfeff;
  --wind-muted:   #cffafe;
  --hydro:        #3b82f6;
  --hydro-bg:     #eff6ff;
  --hydro-muted:  #dbeafe;
  --generator:    #8b5cf6;
  --generator-bg: #f5f3ff;
  --generator-muted: #ede9fe;
  --battery:      #10b981;
  --battery-bg:   #ecfdf5;
  --battery-muted:#d1fae5;
  --water:        #0ea5e9;
  --water-bg:     #f0f9ff;
  --water-muted:  #e0f2fe;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  18px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);

  --nav-h:       64px;
  --header-h:    56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--surface);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
}

#app-shell {
  min-height: 100vh;
  position: relative;
  background: var(--surface);
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: var(--navy);
  z-index: 100;
  padding: 0 1.25rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

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

.logo-icon { font-size: 20px; }

.logo-text {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.build-name-badge {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  background: var(--navy-light);
  padding: 4px 12px;
  border-radius: 20px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Main Content Area ── */
.app-main {
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-scroll {
  padding: 1.25rem 1rem;
}

/* ── Context Bar ── */
.context-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.context-item {
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.context-item strong {
  color: #e2e8f0;
  font-weight: 600;
}

/* ── Bill Input Card ── */
.section-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.bill-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bill-currency {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-2);
}

.bill-input {
  flex: 1;
  font-size: 40px;
  font-weight: 700;
  color: var(--text-1);
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Plus Jakarta Sans', sans-serif;
  width: 100%;
  min-width: 0;
  line-height: 1;
}

.bill-period {
  font-size: 14px;
  color: var(--text-3);
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 6px;
}

/* ── Source Sections ── */
.source-section {
  background: var(--card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.source-section:hover {
  box-shadow: var(--shadow-md);
}

.source-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.source-header.solar      { background: var(--solar-bg); }
.source-header.wind       { background: var(--wind-bg); }
.source-header.hydro      { background: var(--hydro-bg); }
.source-header.generator  { background: var(--generator-bg); }
.source-header.battery    { background: var(--battery-bg); }
.source-header.water      { background: var(--water-bg); }

.source-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.source-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.source-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-btn {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.add-btn:hover {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.component-list {
  padding: 10px;
}

/* ── Empty hint inside cards ── */
.empty-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  text-align: center;
}

.empty-hint-icon {
  font-size: 32px;
  opacity: 0.4;
  line-height: 1;
}

.empty-hint-text {
  font-size: 13px;
  font-style: italic;
  color: var(--text-3);
  line-height: 1.4;
}

.empty-hint-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all 0.15s;
  margin-top: 4px;
}

.empty-hint-action:hover {
  color: var(--text-1);
  border-color: var(--navy-mid);
}

/* ── Component Cards ── */
.component-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  margin-bottom: 6px;
  gap: 10px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.component-card:last-child { margin-bottom: 0; }

.component-card:hover {
  background: #f8fafc;
  border-color: var(--border);
}

.comp-info { flex: 1; min-width: 0; }

.comp-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comp-meta {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comp-stat {
  text-align: right;
  flex-shrink: 0;
}

.comp-kwh {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  line-height: 1;
}

.comp-kwh-label {
  font-size: 10px;
  color: var(--text-3);
  text-align: right;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.comp-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.comp-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.comp-btn.delete {
  color: var(--text-3);
}

.comp-btn.delete:hover {
  color: #ef4444;
  border-color: #fecaca;
  background: #fef2f2;
}

/* ── Collapsible Sections (mobile) ── */
.collapsible-section {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.collapse-arrow {
  font-size: 11px;
  color: var(--text-3);
  transition: transform 0.2s;
}

.collapsible-section.open .collapse-arrow { transform: rotate(180deg); }

.collapse-body {
  display: none;
  padding: 0 8px 8px;
  border-top: 1px solid var(--border);
}

.collapsible-section.open .collapse-body { display: block; }
.collapse-body .source-section { margin-top: 8px; }

/* ── Bottom Nav ── */
.bottom-nav {
  position: sticky;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  transition: background 0.15s;
  border-radius: 0;
}

.nav-item:active { background: var(--surface); }
.nav-icon { font-size: 20px; line-height: 1; }

.nav-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.nav-item.active .nav-label { color: var(--navy); font-weight: 700; }
.nav-item.active .nav-icon  { filter: saturate(1.5); }

/* ── Results Tab ── */
.results-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 100%);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 16px;
  color: white;
  box-shadow: var(--shadow-md);
}

.results-hero-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.results-hero-value {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.results-hero-sub {
  font-size: 13px;
  color: #94a3b8;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.result-card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.result-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
}

.result-card-unit {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}

.result-card.accent-green { border-left: 3px solid var(--battery); }
.result-card.accent-amber { border-left: 3px solid var(--solar); }
.result-card.accent-blue  { border-left: 3px solid var(--hydro); }
.result-card.accent-cyan  { border-left: 3px solid var(--wind); }

.results-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 20px 0 10px;
}

/* Generation bar chart */
.gen-bar-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.gen-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.gen-bar-name { font-weight: 600; color: var(--text-1); }
.gen-bar-val  { color: var(--text-2); font-weight: 600; }

.gen-bar-track {
  height: 6px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

.gen-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

/* Financial projection table */
.projection-table {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.proj-row {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 8px;
}

.proj-row:last-child { border-bottom: none; }
.proj-row.header { background: var(--surface); font-weight: 700; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.proj-year  { width: 40px; font-weight: 600; color: var(--text-2); }
.proj-gen   { flex: 1; color: var(--text-1); }
.proj-save  { flex: 1; color: #10b981; font-weight: 600; }
.proj-cumul { flex: 1; text-align: right; font-weight: 700; color: var(--text-1); }
.proj-row.payback-row { background: #f0fdf4; }

/* ── Saves Tab ── */
.saves-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.save-new-btn {
  font-size: 13px;
  font-weight: 700;
  color: white;
  background: var(--navy);
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.15s;
}

.save-new-btn:hover { background: var(--navy-light); }

.save-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.save-card:hover { box-shadow: var(--shadow-md); }

.save-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.save-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}

.save-card-date {
  font-size: 11px;
  color: var(--text-3);
}

.save-card-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.save-stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.save-stat-value { font-size: 15px; font-weight: 700; color: var(--text-1); }

.save-card-actions { display: flex; gap: 8px; }

.save-action-btn {
  flex: 1;
  padding: 9px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all 0.15s;
}

.save-action-btn.load { background: var(--navy); color: white; border-color: var(--navy); }
.save-action-btn.load:hover { background: var(--navy-light); }
.save-action-btn.del  { color: #ef4444; }
.save-action-btn.del:hover  { background: #fef2f2; border-color: #fecaca; }

/* ── Settings Tab ── */
.settings-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.settings-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  transition: background 0.15s;
}

.settings-row:hover { background: #f8fafc; }
.settings-row:last-child { border-bottom: none; }

.settings-row label {
  font-size: 14px;
  color: var(--text-1);
  flex: 1;
}

.settings-row input {
  width: 100px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: var(--surface);
  font-family: 'Plus Jakarta Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}

.settings-row input:focus { border-color: var(--navy-mid); background: white; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.open { display: flex; }

.modal-sheet {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 0 0 calc(1rem + var(--safe-bottom));
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background 0.15s;
}

.modal-close:hover { background: var(--border); }

.modal-body { padding: 20px; }

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 14px 20px 0;
  border-top: 1px solid var(--border);
}

.modal-cancel {
  flex: 1;
  padding: 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-1);
  transition: background 0.15s;
}

.modal-cancel:hover { background: var(--border); }

.modal-save {
  flex: 2;
  padding: 13px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--navy);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: background 0.15s;
}

.modal-save:hover { background: var(--navy-light); }

/* Modal form fields */
.form-field { margin-bottom: 16px; }

.form-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-field input, .form-field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-1);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.form-field input:focus, .form-field select:focus {
  border-color: var(--navy-mid);
  background: white;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 5px;
}

/* ── Empty States (tab-level) ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 1.5rem;
  text-align: center;
}

.empty-icon  { font-size: 52px; margin-bottom: 16px; opacity: 0.7; }

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 280px;
  margin-bottom: 24px;
}

.cta-btn {
  padding: 12px 28px;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: background 0.15s;
}

.cta-btn:hover { background: var(--navy-light); }

/* ── Toast ── */
.toast {
  display: none;
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 20px;
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}

.toast.show { display: block; animation: fadeInOut 2.5s forwards; }

@keyframes fadeInOut {
  0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Utilities ── */
.text-green { color: #10b981; }
.text-amber { color: var(--solar); }
.text-red   { color: #ef4444; }

/* ═══════════════════════════════════════════════════
   DESKTOP LAYOUT
   Sidebar + content column. Breakpoint: 1024px+
═══════════════════════════════════════════════════ */

.sidebar     { display: none; }
.mobile-only { display: flex; }

@media (min-width: 1024px) {

  #app-shell {
    display: flex;
    flex-direction: row;
    width: 100%;
  }

  /* ── Sidebar ── */
  .sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    min-width: 240px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: var(--navy);
    border-right: 1px solid rgba(255,255,255,0.06);
    z-index: 50;
    overflow: hidden;
  }

  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .sidebar-logo .logo-icon { font-size: 22px; }

  .sidebar-logo .logo-text {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 10px;
    flex: 1;
  }

  .sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    border: none;
    background: none;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    text-align: left;
    transition: background 0.15s, color 0.15s;
  }

  .sidebar-nav-item:hover {
    background: var(--navy-light);
    color: #e2e8f0;
  }

  .sidebar-nav-item.active {
    background: var(--navy-light);
    color: #ffffff;
    font-weight: 600;
  }

  .sidebar-nav-item.active .snav-icon {
    filter: saturate(1.5) brightness(1.2);
  }

  .snav-icon  { font-size: 18px; line-height: 1; flex-shrink: 0; }
  .snav-label { line-height: 1; }

  .sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
  }

  .sidebar-build-label {
    font-size: 10px;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 5px;
  }

  .sidebar-build-name {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── Main column ── */
  .main-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .mobile-only { display: none; }

  .app-header {
    position: sticky;
    top: 0;
  }

  .panel-scroll {
    padding: 1.5rem;
  }

  /* Inner content wrapper — AdSense pattern */
  .content-inner {
    max-width: 1400px;
    width: 100%;
  }

  .bottom-nav { display: none; }

  .app-main {
    min-height: calc(100vh - var(--header-h));
  }

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

  .settings-row input {
    width: 120px;
  }

  .toast {
    bottom: 24px;
  }

  /* Modal: centered dialog */
  .modal-overlay {
    align-items: center;
  }

  .modal-sheet {
    width: 500px;
    max-width: 500px;
    border-radius: var(--radius-xl);
    max-height: 85vh;
    animation: fadeScaleIn 0.2s ease;
  }

  @keyframes fadeScaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
  }

  /* ── Desktop build grid ── */
  .mobile-build-layout { display: none; }

  .build-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
  }

  .build-grid-header {
    margin-bottom: 16px;
  }

  /* Each grid card */
  .build-grid .source-section {
    margin-bottom: 0;
    min-height: 200px;
    display: flex;
    flex-direction: column;
  }

  .build-grid .component-list {
    flex: 1;
    padding: 12px;
  }

  /* Empty hint inside grid cards — substantial, Minute-style */
  .build-grid .empty-hint {
    padding: 32px 16px;
    gap: 10px;
  }

  .build-grid .empty-hint-icon {
    font-size: 36px;
    opacity: 0.35;
  }

  .build-grid .empty-hint-text {
    font-size: 13px;
    color: var(--text-3);
    font-style: italic;
  }

  /* Compact tile — saved mode, empty section */
  .source-section.compact-tile {
    min-height: 80px;
  }

  .source-section.compact-tile .component-list {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
  }

  .compact-add-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    cursor: pointer;
    color: var(--text-3);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
  }

  .compact-add-btn:hover {
    border-color: var(--navy-mid);
    color: var(--text-1);
    background: var(--surface);
  }

  .compact-add-icon {
    font-size: 22px;
    line-height: 1;
  }

  /* Edit build button */
  .edit-build-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--solar);
    background: none;
    border: 1px solid var(--solar);
    border-radius: 20px;
    padding: 5px 14px;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: background 0.15s;
  }

  .edit-build-btn:hover {
    background: rgba(245,158,11,0.1);
  }
}

/* ── 1440p: 4 columns ── */
@media (min-width: 1440px) {
  .build-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}