/* ============================================================
   Solar Load Calculator – stylesheet
   Primary brand: #F13F15  |  Font: Outfit + DM Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ── CSS VARIABLES ── */
:root {
  --brand:        #F13F15;
  --brand-dark:   #C22F0E;
  --brand-light:  #FF6B47;
  --brand-bg:     #FFF3F0;

  --surface:      #FFFFFF;
  --surface-2:    #F8F9FA;
  --surface-3:    #F0F1F3;

  --ink:          #0D0D0D;
  --ink-2:        #3B3B3B;
  --ink-3:        #6B6B6B;
  --ink-4:        #A0A0A0;

  --success:      #16A34A;
  --success-bg:   #F0FDF4;
  --warning:      #D97706;
  --warning-bg:   #FFFBEB;
  --danger:       #DC2626;
  --danger-bg:    #FEF2F2;
  --info:         #2563EB;
  --info-bg:      #EFF6FF;

  --border:       #E5E7EB;
  --border-focus: #F13F15;

  --radius-sm:    6px;
  --radius:       12px;
  --radius-lg:    20px;
  --radius-xl:    28px;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 16px rgba(0,0,0,.09);
  --shadow-lg:    0 12px 40px rgba(0,0,0,.13);
  --shadow-brand: 0 6px 24px rgba(241,63,21,.28);

  --font-body:    'Outfit', sans-serif;
  --font-mono:    'DM Mono', monospace;

  --step-max:     6;
  --transition:   .2s cubic-bezier(.4,0,.2,1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--surface-2);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── HEADER ── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.app-header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  flex-shrink: 0;
  min-width: 0;
}
.logo:hover { opacity: .85; text-decoration: none !important; }
.logo-img {
  height: 40px;
  width: auto;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}
.logo-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
  min-width: 0;
}
.logo-brand {
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  white-space: nowrap;
  letter-spacing: -.01em;
}
.logo-sub {
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--brand);
  white-space: nowrap;
}
@media (max-width: 400px) {
  .logo-sub  { display: none; }
  .logo-img  { height: 32px; }
  .logo-brand { font-size: .9rem; }
}
.header-actions { display: flex; gap: 8px; align-items: center; }
.btn-ghost {
  background: none; border: 1px solid var(--border);
  color: var(--ink-3); padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-4); }
.btn-ghost.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

/* ── PROGRESS BAR ── */
.progress-wrap {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px 0;
}
.progress-wrap-inner { max-width: 900px; margin: 0 auto; }
.progress-steps {
  display: flex;
  gap: 0;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.progress-steps::-webkit-scrollbar { display: none; }
.progress-step {
  flex: 1;
  min-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  cursor: pointer;
  padding-bottom: 8px;
}
.progress-step::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border);
  transition: background var(--transition);
}
.progress-step.active::after { background: var(--brand); }
.progress-step.done::after { background: var(--success); }
.step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: grid; place-items: center;
  font-size: .75rem; font-weight: 700;
  color: var(--ink-4);
  transition: var(--transition);
  flex-shrink: 0;
}
.progress-step.active .step-dot {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 4px var(--brand-bg);
}
.progress-step.done .step-dot {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.step-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-4);
  text-align: center;
  line-height: 1.2;
}
.progress-step.active .step-label { color: var(--brand); }
.progress-step.done .step-label { color: var(--success); }

/* ── MAIN CONTENT ── */
.app-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* ── STEP PANELS ── */
.step-panel {
  display: none;
  animation: fadeUp .3s ease forwards;
}
.step-panel.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-header {
  margin-bottom: 24px;
}
.step-badge {
  display: inline-block;
  background: var(--brand-bg);
  color: var(--brand);
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 10px; border-radius: 20px;
  margin-bottom: 8px;
}
.step-title {
  font-size: 1.6rem; font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 6px;
}
.step-desc { font-size: .95rem; color: var(--ink-3); line-height: 1.6; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 1rem; font-weight: 700;
  margin-bottom: 14px;
  color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.card-title .icon { font-size: 1.2rem; }

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .875rem; font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.form-label .optional {
  font-size: .75rem; font-weight: 400; color: var(--ink-4);
  margin-left: 4px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  color: var(--ink);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(241,63,21,.12);
}
.form-hint {
  font-size: .78rem; color: var(--ink-4);
  margin-top: 4px; line-height: 1.4;
}
.form-error {
  font-size: .78rem; color: var(--danger);
  margin-top: 4px; display: none;
}
.form-group.has-error .form-input,
.form-group.has-error .form-select { border-color: var(--danger); }
.form-group.has-error .form-error { display: block; }

/* ── TOOLTIP ── */
.tooltip-trigger {
  display: inline-flex;
  width: 16px; height: 16px;
  background: var(--surface-3);
  border-radius: 50%;
  font-size: .65rem; font-weight: 700; color: var(--ink-3);
  align-items: center; justify-content: center;
  cursor: help;
  position: relative;
}
.tooltip-trigger::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: .72rem; font-weight: 400;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap; max-width: 220px;
  line-height: 1.4; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
  z-index: 999;
}
.tooltip-trigger:hover::after { opacity: 1; }

/* ── OPTION PILLS ── */
.option-group {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 4px;
}
.option-pill {
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: .875rem; font-weight: 500;
  cursor: pointer; background: var(--surface);
  color: var(--ink-2);
  transition: var(--transition);
  user-select: none;
}
.option-pill:hover { border-color: var(--brand-light); color: var(--brand); }
.option-pill.selected {
  border-color: var(--brand);
  background: var(--brand-bg);
  color: var(--brand);
  font-weight: 600;
}

/* ── GRID OPTION CARDS ── */
.option-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.option-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  cursor: pointer;
  background: var(--surface);
  text-align: center;
  transition: var(--transition);
}
.option-card:hover { border-color: var(--brand-light); box-shadow: var(--shadow); }
.option-card.selected {
  border-color: var(--brand);
  background: var(--brand-bg);
  box-shadow: 0 0 0 3px rgba(241,63,21,.1);
}
.option-card-icon { font-size: 1.8rem; margin-bottom: 6px; }
.option-card-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); line-height: 1.3; }
.option-card.selected .option-card-label { color: var(--brand); }

/* ── STEPPER INPUT ── */
.stepper {
  display: flex; align-items: center; gap: 2px;
}
.stepper-btn {
  width: 34px; height: 34px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 1.1rem; font-weight: 700;
  cursor: pointer; color: var(--ink-2);
  display: grid; place-items: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.stepper-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-bg); }
.stepper-val {
  width: 42px; text-align: center;
  font-weight: 700; font-size: .95rem;
  color: var(--ink);
  border: none; background: none; outline: none;
}

/* ── RANGE SLIDER ── */
.range-wrap { position: relative; padding-bottom: 20px; }
.range-input {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--brand) 0%,
    var(--brand) var(--pct, 50%),
    var(--border) var(--pct, 50%),
    var(--border) 100%
  );
  outline: none;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--brand);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.range-input::-webkit-slider-thumb:hover { box-shadow: 0 0 0 6px rgba(241,63,21,.15); }
.range-labels {
  display: flex; justify-content: space-between;
  font-size: .72rem; color: var(--ink-4); margin-top: 4px;
}
.range-value {
  position: absolute;
  bottom: 0; left: 50%; transform: translateX(-50%);
  background: var(--brand);
  color: #fff;
  font-size: .7rem; font-weight: 700;
  padding: 2px 7px; border-radius: 20px;
  pointer-events: none;
}

/* ── TOGGLE SWITCH ── */
.toggle-wrap {
  display: flex; align-items: center; gap: 10px;
}
.toggle {
  position: relative; width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--brand); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label { font-size: .875rem; font-weight: 500; color: var(--ink-2); }

/* ── APPLIANCE TABS ── */
.appliance-tabs {
  display: flex; gap: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.appliance-tabs::-webkit-scrollbar { display: none; }
.appliance-tab {
  padding: 10px 16px;
  font-size: .82rem; font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  display: flex; align-items: center; gap: 6px;
  background: none; border-top: none; border-left: none; border-right: none;
}
.appliance-tab:hover { color: var(--brand); }
.appliance-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── APPLIANCE CARDS ── */
.appliance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.appliance-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: var(--transition);
  position: relative;
}
.appliance-card.selected {
  border-color: var(--brand);
  background: var(--brand-bg);
  box-shadow: 0 0 0 3px rgba(241,63,21,.08);
}
.appliance-card-header {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 10px;
}
.appliance-icon {
  font-size: 1.6rem; flex-shrink: 0; margin-top: 2px;
}
.appliance-name {
  font-size: .875rem; font-weight: 700; color: var(--ink);
  line-height: 1.2; margin-bottom: 2px;
}
.appliance-watts {
  font-size: .75rem; color: var(--ink-4);
  font-family: var(--font-mono);
}
.appliance-watts.editable { color: var(--brand); cursor: pointer; }
.appliance-card-footer {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.appliance-label-sm {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-4);
  white-space: nowrap;
}
.hours-select {
  flex: 1;
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  color: var(--ink);
  background: var(--surface);
  min-width: 0;
}
.appliance-card.selected .hours-select { border-color: rgba(241,63,21,.3); }
.watt-input {
  width: 60px;
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-family: var(--font-mono);
}
.watt-input:focus { outline: none; border-color: var(--brand); }
.add-appliance-checkbox {
  position: absolute; top: 12px; right: 12px;
  width: 18px; height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* ── ALERTS / CALLOUTS ── */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: .875rem; line-height: 1.5;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert .alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.alert-info { background: var(--info-bg); border-color: #BFDBFE; color: #1E40AF; }
.alert-warning { background: var(--warning-bg); border-color: #FDE68A; color: #92400E; }
.alert-success { background: var(--success-bg); border-color: #BBF7D0; color: #14532D; }
.alert-danger { background: var(--danger-bg); border-color: #FECACA; color: #991B1B; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: var(--transition);
  text-decoration: none !important;
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 8px 28px rgba(241,63,21,.35); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--ink-3); background: var(--surface-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803D; }
.btn-sm { padding: 8px 14px; font-size: .82rem; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── NAV BUTTONS ROW ── */
.step-nav {
  display: flex; gap: 10px; justify-content: space-between;
  margin-top: 28px;
  flex-wrap: wrap;
}
.step-nav .btn { flex: 0 0 auto; }
.step-nav .btn-primary { flex: 1; max-width: 220px; }

/* ── RESULTS ── */
.results-hero {
  background: linear-gradient(135deg, var(--brand) 0%, #FF6B47 100%);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  color: #fff;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.results-hero::before {
  content: '☀️';
  position: absolute;
  font-size: 10rem;
  opacity: .08;
  right: -20px; top: -20px;
  line-height: 1;
}
.results-hero-title {
  font-size: 1.1rem; font-weight: 600; opacity: .85; margin-bottom: 4px;
}
.results-hero-sub {
  font-size: .875rem; opacity: .7;
}
.results-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.result-card-label {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-4); margin-bottom: 6px;
}
.result-card-value {
  font-size: 1.5rem; font-weight: 800;
  color: var(--brand); line-height: 1.1;
  font-family: var(--font-mono);
}
.result-card-unit {
  font-size: .78rem; font-weight: 500; color: var(--ink-3); margin-top: 2px;
}
.result-card-note {
  font-size: .72rem; color: var(--ink-4); margin-top: 6px; line-height: 1.4;
}

/* ── DETAIL TABLE ── */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.detail-table th {
  background: var(--surface-2);
  padding: 8px 10px;
  text-align: left; font-weight: 700;
  color: var(--ink-2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.detail-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-2);
  vertical-align: middle;
}
.detail-table tr:last-child td { border-bottom: none; }
.detail-table tr:nth-child(even) td { background: var(--surface-2); }
.surge-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.surge-high { background: #FEE2E2; color: #991B1B; }
.surge-med  { background: #FEF9C3; color: #854D0E; }
.surge-low  { background: #DCFCE7; color: #166534; }

/* ── EXPORT BUTTONS ── */
.export-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px;
}

/* ── ACCORDION ── */
.accordion { margin-bottom: 12px; }
.accordion-toggle {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer; font-weight: 600; font-size: .9rem;
  color: var(--ink); transition: var(--transition);
}
.accordion-toggle:hover { background: var(--surface-3); }
.accordion-toggle .chevron {
  font-style: normal;
  transition: transform var(--transition);
}
.accordion.open .accordion-toggle .chevron { transform: rotate(180deg); }
.accordion-body {
  display: none;
  padding: 14px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
  font-size: .875rem; color: var(--ink-2); line-height: 1.6;
}
.accordion.open .accordion-body { display: block; }

/* ── ASSUMPTIONS BOX ── */
.assumptions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.assumption-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.assumption-key { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-4); margin-bottom: 2px; }
.assumption-val { font-size: 1rem; font-weight: 700; color: var(--brand); font-family: var(--font-mono); }

/* ── TIPS SECTION ── */
.tips-list { list-style: none; }
.tips-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem; line-height: 1.5; color: var(--ink-2);
}
.tips-list li:last-child { border-bottom: none; }
.tip-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

/* ── CTA SECTION ── */
.cta-card {
  background: linear-gradient(135deg, #0D0D0D 0%, #2B2B2B 100%);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  color: #fff;
  text-align: center;
  margin-bottom: 24px;
}
.cta-card h3 { font-size: 1.3rem; font-weight: 800; margin-bottom: 8px; }
.cta-card p { font-size: .9rem; opacity: .7; margin-bottom: 20px; }
.cta-msg-box {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
  font-size: .8rem; font-family: var(--font-mono);
  color: rgba(255,255,255,.85);
  white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow-y: auto;
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 50px;
  font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .3s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: none; place-items: center;
  padding: 16px;
}
.modal-backdrop.open { display: grid; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .25s ease forwards;
}
.modal h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 10px; }
.modal p  { font-size: .9rem; color: var(--ink-2); line-height: 1.5; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── WATT GUIDE ── */
.watt-guide {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px; margin-top: 10px;
}
.watt-guide-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: .75rem;
}
.watt-guide-item strong { display: block; font-size: .85rem; color: var(--brand); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .step-title { font-size: 1.3rem; }
  .appliance-grid { grid-template-columns: 1fr 1fr; }
  .results-summary-grid { grid-template-columns: 1fr 1fr; }
  .step-nav { flex-direction: column-reverse; }
  .step-nav .btn-primary { max-width: 100%; }
  .export-bar { flex-direction: column; }
  .export-bar .btn { width: 100%; justify-content: center; }
}
@media (max-width: 400px) {
  .appliance-grid { grid-template-columns: 1fr; }
  .results-summary-grid { grid-template-columns: 1fr; }
}

/* ── PRINT ── */
@media print {
  .app-header, .progress-wrap, .step-nav, .export-bar, .cta-card, #toast, .modal-backdrop { display: none !important; }
  .step-panel { display: block !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .results-hero { background: #333 !important; -webkit-print-color-adjust: exact; }
}

/* ── MISC UTILS ── */
.text-center { text-align: center; }
.text-muted { color: var(--ink-4); }
.text-brand { color: var(--brand); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.mono { font-family: var(--font-mono); }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 4px !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mt-8 { margin-top: 8px !important; }
.mt-16 { margin-top: 16px !important; }
.flex-row { display: flex; align-items: center; gap: 10px; }
.flex-col { display: flex; flex-direction: column; gap: 8px; }
.badge {
  display: inline-block; padding: 3px 8px;
  border-radius: 20px; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-brand { background: var(--brand-bg); color: var(--brand); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.hidden { display: none !important; }
.row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row-2col { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════════════════
   ADDITIONS v2 – Installer card, Location UI, Live stats
══════════════════════════════════════════════════════════ */

/* ── Location Spinner ── */
.loc-spinner {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: .85rem;
  pointer-events: none;
  animation: spin 1.2s linear infinite;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

/* ── Appliance Toolbar ── */
.appliance-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

/* ── Live Stat on appliance card ── */
.live-stat {
  font-size: .68rem;
  font-family: var(--font-mono);
  color: var(--ink-4);
  width: 100%;
  text-align: right;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── WhatsApp Button ── */
.btn-wa {
  background: #25D366;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: var(--transition);
}
.btn-wa:hover { background: #1ebe5a; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,211,102,.3); }

/* ══ INSTALLER CARD (redesigned, bright & friendly) ══ */
.installer-card {
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 40px rgba(241,63,21,.12);
}

.installer-card-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.installer-card-icon-wrap {
  width: 56px; height: 56px;
  background: var(--brand-bg);
  border-radius: var(--radius);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.installer-card-title {
  font-size: 1.3rem; font-weight: 800;
  color: var(--ink); margin-bottom: 4px;
}
.installer-card-sub {
  font-size: .875rem; color: var(--ink-3); line-height: 1.4;
  margin: 0;
}

/* ── Spec Grid ── */
.inst-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 600px) { .inst-spec-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 380px) { .inst-spec-grid { grid-template-columns: 1fr; } }

.inst-spec-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  transition: var(--transition);
}
.inst-spec-card:hover { box-shadow: var(--shadow); }
.inst-primary {
  background: var(--brand-bg);
  border-color: rgba(241,63,21,.25);
}
.inst-icon { font-size: 1.5rem; margin-bottom: 4px; }
.inst-label {
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-4); margin-bottom: 4px;
}
.inst-value { font-size: 1.1rem; font-weight: 800; color: var(--brand); line-height: 1.1; font-family: var(--font-mono); }
.inst-primary .inst-value { color: var(--brand); }
.inst-spec-card:not(.inst-primary) .inst-value { color: var(--ink); }
.inst-sub { font-size: .7rem; color: var(--ink-4); margin-top: 2px; }

/* ── Toggle & Details ── */
.installer-details-toggle {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  font-size: .875rem; font-weight: 600;
  color: var(--ink-3);
  text-align: center;
  margin-bottom: 0;
  transition: var(--transition);
}
.installer-details-toggle:hover { background: var(--surface-3); color: var(--ink); }

.installer-details {
  margin-top: 0;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
  transition: var(--transition);
}
.installer-details.hidden { display: none; }
.inst-details-inner { padding: 16px; }
.inst-details-title {
  font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.inst-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.inst-pill {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: .75rem;
  font-family: var(--font-mono);
  color: var(--ink-2);
}

/* ── Actions Row ── */
.installer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  margin-bottom: 14px;
}
@media (max-width: 500px) {
  .installer-actions { flex-direction: column; }
  .installer-actions .btn { width: 100%; justify-content: center; }
}

/* ── Disclaimer ── */
.installer-disclaimer {
  font-size: .78rem;
  color: var(--ink-4);
  line-height: 1.5;
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin: 0;
}
.installer-disclaimer strong { color: var(--warning); }

/* ── FOOTER ── */
.app-footer {
  text-align: center;
  padding: 24px 16px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: .78rem;
  color: var(--ink-4);
  line-height: 1.8;
}
.app-footer strong {
  color: var(--ink-2);
  font-weight: 700;
}
.app-footer a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.app-footer a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════
   AI ANALYSIS CARD
══════════════════════════════════════════════════════════ */
.ai-analysis-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 24px;
  color: #e2e8f0 !important;
  box-shadow: 0 8px 40px rgba(0,0,0,.25), inset 0 0 0 1px rgba(241,63,21,.25);
  position: relative;
  overflow: hidden;
  border: none !important;
}
.ai-analysis-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(241,63,21,.18) 0%, transparent 70%);
  pointer-events: none;
}

.ai-analysis-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.ai-analysis-icon {
  width: 44px; height: 44px;
  background: rgba(241,63,21,.2);
  border: 1px solid rgba(241,63,21,.35);
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.ai-analysis-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -.01em;
}
.ai-analysis-sub {
  font-size: .75rem;
  color: #64748b;
  margin-top: 2px;
}
.ai-retry-btn {
  margin-left: auto;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: #94a3b8;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: grid; place-items: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.ai-retry-btn:hover { background: rgba(255,255,255,.13); color: #f1f5f9; }
.ai-retry-btn:disabled { opacity: .4; cursor: not-allowed; }

.ai-analysis-body {
  min-height: 60px;
  margin-bottom: 14px;
}

/* Loading dots */
.ai-loading {
  display: flex;
  align-items: center;
  padding: 8px 0;
}
.ai-dot {
  width: 8px; height: 8px;
  background: var(--brand);
  border-radius: 50%;
  margin-right: 5px;
  animation: ai-pulse 1.2s ease-in-out infinite;
}
.ai-dot:nth-child(2) { animation-delay: .2s; }
.ai-dot:nth-child(3) { animation-delay: .4s; }
@keyframes ai-pulse {
  0%, 80%, 100% { transform: scale(.7); opacity: .4; }
  40%            { transform: scale(1);  opacity: 1;   }
}

/* AI response text */
.ai-content {
  font-size: .9rem;
  line-height: 1.75;
  color: #cbd5e1;
}
.ai-content p { margin-bottom: .75rem; }
.ai-content p:last-child { margin-bottom: 0; }
.ai-content strong { color: #f1f5f9; font-weight: 700; }
.ai-content em { color: #94a3b8; font-style: italic; }

/* Error state */
.ai-error {
  display: flex;
  align-items: center;
  font-size: .875rem;
  color: #f87171;
  padding: 4px 0;
}

/* Footer */
.ai-analysis-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: .72rem;
  color: #475569;
}

/* ── AI Progress Steps ── */
.ai-progress-bar-wrap {
  background: rgba(255,255,255,.08);
  border-radius: 99px;
  height: 6px;
  margin-bottom: 18px;
  overflow: hidden;
}
.ai-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), #ff6b47);
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.ai-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  font-size: .83rem;
  color: #64748b;
  transition: all .3s ease;
}
.ai-step-icon { font-size: 1rem; flex-shrink: 0; }
.ai-step-label { flex: 1; }
.ai-step-status { font-size: .85rem; flex-shrink: 0; min-width: 20px; text-align: center; }

.ai-step-active {
  background: rgba(241,63,21,.12);
  border-color: rgba(241,63,21,.3);
  color: #fca997;
}
.ai-step-active .ai-step-status {
  animation: ai-spin 1s linear infinite;
  display: inline-block;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

.ai-step-done {
  background: rgba(22,163,74,.1);
  border-color: rgba(22,163,74,.25);
  color: #86efac;
}
.ai-step-error {
  background: rgba(220,38,38,.1);
  border-color: rgba(220,38,38,.25);
  color: #fca5a5;
}

/* ══════════════════════════════════════════════════════════
   RESULTS LOADING OVERLAY
══════════════════════════════════════════════════════════ */
#results-loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface);
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.rl-inner {
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.rl-logo-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  display: block;
  animation: rl-float 2s ease-in-out infinite;
}
@keyframes rl-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
.rl-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -.02em;
}
.rl-sub {
  font-size: .875rem;
  color: var(--ink-4);
  margin-bottom: 28px;
}
.rl-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  text-align: left;
}
.rl-step-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .875rem;
  color: var(--ink-4);
  transition: all .35s ease;
}
.rl-step-icon { flex-shrink: 0; font-size: 1.1rem; }
.rl-step-txt  { flex: 1; }
.rl-step-st   { flex-shrink: 0; font-size: .9rem; min-width: 20px; text-align: center; }
.rl-step-row.rl-active {
  background: var(--brand-bg);
  border-color: rgba(241,63,21,.3);
  color: var(--brand);
  font-weight: 600;
}
.rl-step-row.rl-active .rl-step-st {
  animation: rl-spin 1s linear infinite;
  display: inline-block;
}
@keyframes rl-spin { to { transform: rotate(360deg); } }
.rl-step-row.rl-done {
  background: var(--success-bg);
  border-color: rgba(22,163,74,.25);
  color: var(--success);
}
.rl-progress-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.rl-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), #ff6b47);
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}