/* ==========================================================================
   SOLAR PAKISTAN GUIDE — MOBILE-FIRST CALCULATOR COMPONENT STYLES
   Engineering-Grade, Touch-Optimized UI for Solar Sizing & Economic Calculations
   ========================================================================== */

/* 1. Main Calculator Container & Shell */
.spg-calc-wrapper {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  padding: 1.25rem 1rem;
  margin: 1.5rem 0;
  transition: box-shadow var(--transition-normal);
  overflow: hidden;
}

@media (min-width: 640px) {
  .spg-calc-wrapper {
    padding: 1.75rem;
    border-radius: 16px;
  }
}

@media (min-width: 992px) {
  .spg-calc-wrapper {
    padding: 2.5rem;
    margin: 2rem 0;
  }
}

/* 2-Column Responsive Layout (Sticky Output Card on Desktop) */
.spg-calc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  align-items: start;
}

@media (min-width: 992px) {
  .spg-calc-layout {
    grid-template-columns: 1.35fr 1fr;
    gap: 2.5rem;
  }
}

/* Section Subheadings inside Calculators */
.spg-calc-section-title {
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #0f172a;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid #f1f5f9;
  letter-spacing: -0.01em;
}

.spg-calc-section-title svg {
  color: var(--eco-emerald);
  flex-shrink: 0;
}

/* ==========================================================================
   2. AI DIRECT ANSWER & FORMULA CARDS (AEO & GEO OPTIMIZATION)
   ========================================================================== */
.spg-ai-answer-box {
  background: linear-gradient(135deg, #f0fdfa 0%, #f8fafc 100%);
  border: 1.5px solid #ccfbf1;
  border-left: 5px solid var(--eco-emerald);
  border-radius: 14px;
  padding: 1.25rem 1.15rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 4px 15px -3px rgba(15, 118, 110, 0.06);
}

@media (min-width: 640px) {
  .spg-ai-answer-box {
    padding: 1.4rem 1.6rem;
    margin-bottom: 2rem;
  }
}

.spg-ai-answer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.spg-ai-answer-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f766e;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

@media (min-width: 640px) {
  .spg-ai-answer-title {
    font-size: 1.15rem;
  }
}

.spg-ai-formula-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

@media (min-width: 580px) {
  .spg-ai-formula-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .spg-ai-formula-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.95rem;
  }
}

.spg-ai-formula-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.spg-ai-formula-card:hover {
  transform: translateY(-2px);
  border-color: #0f766e;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.08);
}

.spg-ai-formula-card strong {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.spg-ai-formula-card code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f766e;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  display: inline-block;
  word-break: break-all;
}

/* ==========================================================================
   3. PRESET QUICK SELECTION BARS (TOUCH CAROUSEL ON MOBILE)
   ========================================================================== */
.spg-calc-presets-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 0.85rem;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.spg-calc-presets-bar::-webkit-scrollbar {
  display: none;
}

@media (min-width: 992px) {
  .spg-calc-presets-bar {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

.spg-preset-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.25rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.spg-preset-btn,
.spg-inv-preset-btn,
.spg-bat-preset-btn,
.spg-pay-preset-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 38px;
}

.spg-preset-btn:hover,
.spg-inv-preset-btn:hover,
.spg-bat-preset-btn:hover,
.spg-pay-preset-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Active Preset Themes */
.spg-preset-btn.active {
  background: var(--solar-amber);
  border-color: var(--solar-orange);
  color: white;
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.28);
}

.spg-inv-preset-btn.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary-dark);
  color: white;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.28);
}

.spg-bat-preset-btn.active {
  background: var(--eco-emerald);
  border-color: var(--eco-emerald-dark);
  color: white;
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.28);
}

.spg-pay-preset-btn.active {
  background: var(--solar-amber);
  border-color: var(--solar-orange);
  color: white;
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.28);
}

.spg-preset-btn.reset-btn {
  color: #dc2626;
  border-color: #fecaca;
  background: #fff5f5;
  margin-left: auto;
}

.spg-preset-btn.reset-btn:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

/* ==========================================================================
   4. FORM CONTROLS, SELECTS, SLIDERS & NUMERIC INPUTS
   ========================================================================== */
.spg-form-group {
  margin-bottom: 1.35rem;
}

.spg-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.45rem;
  line-height: 1.35;
}

/* Styled Select Dropdown with SVG Chevron */
.spg-select {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") no-repeat right 0.85rem center;
  background-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  color: #1e293b;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 46px;
}

.spg-select:focus {
  outline: none;
  border-color: var(--eco-emerald);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.spg-select:hover {
  border-color: #94a3b8;
}

/* Touch-Optimized Range Sliders */
.spg-range-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.35rem;
}

.spg-range-input {
  flex: 1;
  height: 8px;
  border-radius: 9999px;
  background: #e2e8f0;
  outline: none;
  accent-color: var(--eco-emerald);
  cursor: pointer;
  transition: background 0.2s ease;
  min-height: 36px; /* Touch target buffer */
}

.spg-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--eco-emerald);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 2px solid #ffffff;
  transition: transform 0.15s ease, background 0.15s ease;
}

.spg-range-input::-webkit-slider-thumb:hover,
.spg-range-input::-webkit-slider-thumb:active {
  transform: scale(1.18);
  background: var(--eco-emerald-dark);
}

.spg-range-input::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--eco-emerald);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 2px solid #ffffff;
}

.spg-range-display {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.92rem;
  color: #0f766e;
  min-width: 76px;
  text-align: right;
  background: #f0fdfa;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  border: 1px solid #ccfbf1;
  flex-shrink: 0;
}

/* Numeric Synchronized Inputs */
.spg-sync-num-input,
.spg-input-sync-num {
  padding: 0.35rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f766e;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  text-align: right;
  background: #ffffff;
  transition: all 0.2s ease;
  min-height: 38px;
}

.spg-sync-num-input:focus,
.spg-input-sync-num:focus {
  outline: none;
  border-color: var(--eco-emerald);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

/* Custom Input Field Panel */
.spg-custom-input-panel {
  background: rgba(15, 23, 42, 0.03);
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-top: 0.85rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.spg-custom-input-panel:focus-within {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.03);
}
.spg-custom-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* Parameter Grid (City & Voltage Sizers) */
.spg-calc-params-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 600px) {
  .spg-calc-params-grid {
    grid-template-columns: 1.25fr 1fr;
  }
}

.spg-param-box {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
}

.spg-param-label {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.spg-param-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #1e293b;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 42px;
}

.spg-param-select:focus {
  outline: none;
  border-color: var(--eco-emerald);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

/* Category Filter Tabs for Load Calculator */
.spg-app-filter-tabs {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
}

.spg-app-filter-tabs::-webkit-scrollbar {
  display: none;
}

.spg-app-tab-btn {
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-height: 38px;
}

.spg-app-tab-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.spg-app-tab-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

/* ==========================================================================
   5. APPLIANCE ITEM CARDS & STEPPER CONTROLS
   ========================================================================== */
.spg-appliance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: #ffffff;
  margin-bottom: 0.75rem;
  border: 1.5px solid #e2e8f0;
  transition: all 0.2s ease;
  gap: 0.75rem;
}

.spg-appliance-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
}

/* Active Appliance Highlight (Qty > 0) */
.spg-appliance-item.has-qty {
  background: #f0fdfa;
  border-color: #14b8a6;
  border-left: 4px solid #0f766e;
  box-shadow: 0 2px 10px rgba(15, 118, 110, 0.08);
}

.spg-appliance-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.spg-appliance-name {
  font-weight: 700;
  font-size: 0.94rem;
  color: #0f172a;
  line-height: 1.35;
  word-break: break-word;
}

.spg-appliance-watts {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.2rem;
  line-height: 1.3;
}

/* Category Badge Pills */
.spg-app-cat-tag {
  display: inline-block;
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.cat-cooling { background: #e0f2fe; color: #0284c7; }
.cat-heavy { background: #fef3c7; color: #d97706; }
.cat-lighting { background: #dcfce7; color: #16a34a; }
.cat-general { background: #f3e8ff; color: #9333ea; }

/* Mobile Touch-Friendly Stepper Controls */
.spg-stepper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 9999px;
  padding: 0.25rem 0.35rem;
  flex-shrink: 0;
}

.spg-step-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #ffffff;
  color: #0f172a;
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.spg-step-btn:hover {
  background: var(--eco-emerald);
  color: #ffffff;
}

.spg-step-btn:active {
  transform: scale(0.9);
}

.spg-step-val {
  min-width: 26px;
  text-align: center;
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.96rem;
  color: #0f172a;
}

/* Custom Appliance Addition Box */
.spg-custom-app-box {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 1.15rem;
  margin: 1.25rem 0;
}

.spg-custom-app-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

@media (min-width: 640px) {
  .spg-custom-app-form {
    grid-template-columns: 2fr 1fr 1fr auto;
    align-items: center;
  }
}

.spg-custom-input {
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #ffffff;
  color: #1e293b;
  font-weight: 600;
  min-height: 42px;
}

.spg-custom-input:focus {
  outline: none;
  border-color: var(--eco-emerald);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

/* ==========================================================================
   6. OUTPUT RESULTS CARD (STICKY ON DESKTOP, CLEAN COMPACT ON MOBILE)
   ========================================================================== */
.spg-calc-results {
  background: linear-gradient(155deg, #0b1324 0%, #111d33 45%, #1e293b 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 3.5px solid var(--solar-gold);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

@media (min-width: 640px) {
  .spg-calc-results {
    padding: 1.85rem;
  }
}

@media (min-width: 992px) {
  .spg-calc-results {
    position: sticky;
    top: 1.5rem;
    z-index: 20;
  }
}

.spg-calc-results::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.spg-res-head {
  margin-bottom: 1.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.spg-res-head h3 {
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.01em;
}

.spg-res-head p {
  color: #94a3b8;
  font-size: 0.82rem;
  margin: 0;
}

/* Big Highlight Stat Box */
.spg-highlight-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 1.2rem 0.85rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

.spg-stat-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.spg-stat-val {
  font-size: clamp(2rem, 5vw, 2.65rem);
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--solar-gold);
  line-height: 1.15;
  text-shadow: 0 2px 14px rgba(245, 158, 11, 0.3);
}

.spg-stat-sub {
  font-size: 0.82rem;
  color: #34d399;
  font-weight: 700;
  margin-top: 0.4rem;
}

/* Metric Rows Breakdown */
.spg-res-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.86rem;
  gap: 0.75rem;
}

.spg-res-row:last-child {
  border-bottom: none;
}

.spg-res-label {
  color: #94a3b8;
  font-weight: 500;
}

.spg-res-value {
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-mono);
  text-align: right;
}

/* Live Load Distribution Meter */
.spg-meter-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}

.spg-meter-title {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 0.45rem;
  font-weight: 700;
}

.spg-meter-bar {
  display: flex;
  height: 10px;
  border-radius: 9999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}

.spg-meter-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.seg-cooling { background: #38bdf8; }
.seg-heavy { background: #fbbf24; }
.seg-lighting { background: #34d399; }
.seg-other { background: #c084fc; }

.spg-meter-legend {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.45rem;
  font-size: 0.74rem;
  color: #cbd5e1;
}

.spg-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.spg-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Action Buttons: Copy & Print */
.spg-calc-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

@media (min-width: 520px) {
  .spg-calc-actions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.spg-action-btn,
.spg-calc-action-btn {
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transition: all 0.2s ease;
  user-select: none;
  width: 100%;
  min-height: 44px; /* Touch target */
}

.spg-action-btn:hover,
.spg-calc-action-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}

.spg-action-btn.copied,
.spg-calc-action-btn.copied {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

.spg-res-cta {
  margin-top: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.spg-res-cta .spg-btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
}

/* ==========================================================================
   7. BENCHMARK & COMPARISON TABLES (AEO / GEO OPTIMIZED)
   ========================================================================== */
.spg-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.spg-spec-table,
.spg-calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  text-align: left;
  min-width: 580px; /* Ensures tables don't squish unreadably on mobile */
}

.spg-spec-table th,
.spg-calc-table th {
  background: #f8fafc;
  color: #334155;
  padding: 0.85rem 1rem;
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.spg-spec-table td,
.spg-calc-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
  line-height: 1.45;
}

.spg-spec-table tr:hover td,
.spg-calc-table tr:hover td {
  background: #f8fafc;
}

.spg-spec-table tr:last-child td,
.spg-calc-table tr:last-child td {
  border-bottom: none;
}

.spg-table-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Warning & Advisory Banners */
.spg-warning-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-size: 0.84rem;
  color: #92400e;
  line-height: 1.55;
  margin-top: 0.85rem;
}

/* ==========================================================================
   10. CALCULATOR WORKFLOW SUITE NAVIGATION (Interconnected Suite Bar)
   ========================================================================== */
.spg-calc-suite-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.spg-calc-suite-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

@media (max-width: 820px) {
  .spg-calc-suite-bar {
    padding: 0.4rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
  }
  .spg-calc-suite-inner {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
  }
  .spg-calc-suite-inner::-webkit-scrollbar {
    display: none;
  }
}

.spg-calc-suite-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  text-decoration: none;
  background: #f8fafc;
  border: 1.5px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 52px;
  flex-shrink: 0;
}

@media (max-width: 820px) {
  .spg-calc-suite-item {
    min-width: 155px;
    padding: 0.55rem 0.75rem;
  }
}

.spg-calc-suite-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.spg-calc-suite-item.active {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-color: #0f172a;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.spg-suite-step {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.spg-calc-suite-item.active .spg-suite-step {
  color: #f59e0b;
}

.spg-suite-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.spg-calc-suite-item.active .spg-suite-name {
  color: #ffffff;
}

/* Related Calculators Bottom Grid */
.spg-related-calcs-section {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid #e2e8f0;
}
.spg-related-calcs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}
.spg-related-calc-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
}
.spg-related-calc-card:hover {
  border-color: var(--eco-emerald);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.1);
}
.spg-related-calc-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.4rem;
}
.spg-related-calc-desc {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 0.85rem;
}
.spg-related-calc-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f766e;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   8. STRICT MOBILE-FIRST OPTIMIZATIONS (< 768px & < 480px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Prevent iOS Safari Viewport Auto-Zoom on form input focus */
  input[type="text"],
  input[type="number"],
  select,
  .spg-select,
  .spg-sync-num-input,
  .spg-input-sync-num,
  .spg-custom-input,
  .spg-param-select {
    font-size: 16px !important;
  }

  .spg-appliance-item {
    padding: 0.75rem 0.75rem;
  }

  .spg-appliance-name {
    font-size: 0.9rem;
  }

  .spg-app-cat-tag {
    font-size: 0.64rem;
    padding: 0.1rem 0.35rem;
  }

  .spg-stat-val {
    font-size: clamp(1.85rem, 6vw, 2.25rem);
  }

  /* Table Horizontal Scroll Hint */
  .spg-table-wrap::after {
    content: '← Swipe horizontally to see all columns →';
    display: block;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    padding: 0.4rem 0.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
  }
}

/* Ultra-Compact Screens (< 380px e.g. iPhone SE) */
@media (max-width: 380px) {
  .spg-calc-wrapper {
    padding: 1rem 0.75rem;
  }

  .spg-appliance-item {
    gap: 0.5rem;
    padding: 0.65rem 0.55rem;
  }

  .spg-stepper {
    padding: 0.15rem 0.25rem;
  }

  .spg-step-btn {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }

  .spg-step-val {
    min-width: 20px;
    font-size: 0.9rem;
  }

  .spg-calc-results {
    padding: 1.25rem 0.85rem;
  }
}

/* ==========================================================================
   9. PRINT STYLES FOR CLEAN PHYSICAL AUDIT SHEETS
   ========================================================================== */
@media print {
  .spg-rates-bar,
  .spg-header,
  .spg-mobile-bar,
  .spg-footer,
  .spg-calc-presets-bar,
  .spg-stepper,
  .spg-res-cta,
  .spg-calc-actions-grid,
  .spg-custom-app-box,
  .spg-app-filter-tabs,
  .spg-table-wrap::after {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .spg-calc-wrapper {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .spg-calc-layout {
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
  }

  .spg-calc-results {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1.5px solid #000000 !important;
    box-shadow: none !important;
    padding: 1rem !important;
  }

  .spg-res-label,
  .spg-stat-label,
  .spg-res-head p {
    color: #333333 !important;
  }

  .spg-res-value,
  .spg-stat-val {
    color: #000000 !important;
    text-shadow: none !important;
  }

  .spg-table-wrap {
    box-shadow: none !important;
    border: 1px solid #333333 !important;
  }
}
