:root {
  --bg-main: #070f1e;
  --bg-surface: #0e1c31;
  --bg-card: #13243d;
  --bg-card-hover: #182d4b;
  --border: #1e3656;
  --border-light: #2c4c77;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary-navy: #0a192f;
  --cyan: #0284c7;
  --cyan-bright: #38bdf8;
  --orange: #ea580c;
  --orange-light: #f97316;
  --green: #10b981;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-heading);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font: inherit;
}

.app-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 16px 40px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--orange), #c2410c);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.sub-brand {
  font-size: 12px;
  color: var(--cyan-bright);
  font-weight: 600;
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--cyan);
  color: #fff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--border-light);
  color: var(--cyan-bright);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s ease;
}

.btn-download:hover {
  background: var(--border);
  color: #fff;
  border-color: var(--cyan);
}

/* SECTION PILLS */
.section-nav {
  padding: 12px 0 16px;
  overflow: hidden;
}

.section-pills-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.pill-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.15s ease;
}

.pill-btn.active, .pill-btn:hover {
  background: var(--border);
  color: #fff;
  border-color: var(--cyan);
}

/* VIEW PANELS */
.view-panel {
  display: none;
}

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

/* SLIDE DECK STAGE */
.deck-stage-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.slide-aspect-box {
  width: 100%;
  min-height: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.slide-card {
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  background: radial-gradient(circle at top right, rgba(2, 132, 199, 0.08), transparent 50%),
              radial-gradient(circle at bottom left, rgba(234, 88, 12, 0.05), transparent 40%),
              var(--bg-surface);
}

/* SLIDE INTERNAL LAYOUTS */
.slide-header {
  margin-bottom: 20px;
}

.slide-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--orange-light);
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}

.slide-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.slide-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* SLIDE CARDS GRID (3 OR 4 COLS) */
.slide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
  flex: 1;
}

.grid-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.grid-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.card-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.bar-teal { background: var(--cyan); }
.bar-orange { background: var(--orange); }
.bar-navy { background: #3b82f6; }
.bar-green { background: var(--green); }
.bar-slate { background: #64748b; }

.card-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--cyan-bright);
  display: inline-block;
  margin-bottom: 6px;
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.3;
}

.card-item-list {
  list-style: none;
}

.card-item {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 8px;
  line-height: 1.45;
  padding-left: 14px;
  position: relative;
}

.card-item::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--cyan-bright);
  font-weight: bold;
}

.card-item strong {
  color: #fff;
  font-weight: 700;
}

/* SLIDE TABLE */
.table-scroll-box {
  overflow-x: auto;
  margin: 16px 0 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.slide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 680px;
}

.slide-table th {
  background: #0f1f38;
  color: var(--cyan-bright);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.slide-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: #cbd5e1;
}

.slide-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.slide-table td:first-child {
  font-weight: 700;
  color: #fff;
}

/* HERO SLIDE 1 STYLING */
.hero-slide-layout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  min-height: 420px;
}

.hero-badge {
  background: rgba(234, 88, 12, 0.15);
  border: 1px solid var(--orange);
  color: var(--orange-light);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero-heading {
  font-size: 36px;
  font-weight: 900;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 16px;
  max-width: 900px;
}

.hero-desc {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 850px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.hero-meta-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: var(--cyan-bright);
  font-size: 13px;
  font-weight: 600;
}

/* TAKEAWAY BANNER */
.slide-takeaway-banner {
  background: linear-gradient(90deg, #0f172a, #13243d);
  border: 1px solid var(--cyan);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}

.takeaway-lbl {
  background: var(--cyan);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.takeaway-txt {
  font-size: 13px;
  color: #f8fafc;
  font-weight: 600;
}

/* DECK CONTROLS */
.deck-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  gap: 16px;
  flex-wrap: wrap;
}

.control-left, .control-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-ctrl {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.15s ease;
}

.btn-ctrl:hover {
  background: var(--border);
  border-color: var(--cyan);
}

.slide-indicator {
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 0 8px;
  color: var(--text-muted);
}

.num-highlight {
  font-size: 18px;
  font-weight: 800;
  color: var(--cyan-bright);
}

.num-divider {
  margin: 0 4px;
}

.control-center.progress-wrap {
  flex: 1;
  min-width: 140px;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--orange));
  width: 3.33%;
  transition: width 0.25s ease;
}

.btn-ctrl-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.btn-ctrl-icon:hover {
  color: #fff;
  border-color: var(--border-light);
}

/* SPEAKER NOTES DRAWER */
.speaker-notes-box {
  display: none;
  background: #091322;
  border: 1px solid var(--cyan);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 14px;
  animation: fadeIn 0.2s ease;
}

.speaker-notes-box.show {
  display: block;
}

.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--cyan-bright);
}

.notes-header h4 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.btn-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.notes-body {
  font-size: 13.5px;
  color: #e2e8f0;
  line-height: 1.6;
}

/* THUMBNAIL CAROUSEL */
.thumb-carousel-container {
  overflow-x: auto;
  padding: 10px 0;
  scrollbar-width: thin;
}

.thumb-carousel-track {
  display: flex;
  gap: 10px;
}

.thumb-card {
  flex: 0 0 140px;
  height: 85px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.thumb-card:hover {
  border-color: var(--border-light);
}

.thumb-card.active {
  border: 2px solid var(--cyan);
  background: var(--bg-card);
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.4);
}

.thumb-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan-bright);
}

.thumb-title {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* CALCULATOR VIEW */
.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 24px;
  margin-top: 8px;
}

.calc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-head {
  margin-bottom: 20px;
}

.pill-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--cyan-bright);
  background: rgba(2, 132, 199, 0.15);
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 8px;
}

.pill-tag.green {
  color: var(--green);
  background: rgba(16, 185, 129, 0.15);
}

.card-head h3 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.card-head p {
  font-size: 13px;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 20px;
}

.label-val-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.label-val-row label, .form-group label {
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
}

.form-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan-bright);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 999px;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.6);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.radio-toggle-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.radio-pill {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio-pill input {
  display: none;
}

.radio-pill.active {
  background: var(--border);
  color: #fff;
  border-color: var(--cyan);
}

.custom-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  min-height: 44px;
}

/* BOM OUTPUT STATS */
.bom-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-number {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}

.stat-box small {
  font-size: 11px;
  color: var(--cyan-bright);
}

.financial-summary {
  background: #091322;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.fin-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  color: #cbd5e1;
}

.fin-row strong {
  font-family: var(--font-mono);
  font-size: 14px;
}

.fin-row.total {
  border-bottom: 0;
  padding-top: 12px;
  font-size: 15px;
}

.fin-row.total strong {
  font-size: 18px;
}

.highlight-cyan { color: var(--cyan-bright); }
.highlight-green { color: var(--green); }
.highlight-orange { color: var(--orange-light); }

/* FULL MATRIX LIST VIEW */
.doc-matrix-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.doc-slide-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* FOOTER */
.app-footer {
  margin-top: auto;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-link {
  color: var(--cyan-bright);
  text-decoration: none;
  font-weight: 600;
}

/* RESPONSIVE MEDIA QUERIES (320px & 390px Mobile Rules) */
@media (max-width: 860px) {
  .calculator-grid {
    grid-template-columns: 1fr;
  }
  .bom-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero-heading {
    font-size: 26px;
  }
  .slide-title {
    font-size: 20px;
  }
}

@media (max-width: 520px) {
  .app-container {
    padding: 0 10px 24px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .view-tabs {
    width: 100%;
    justify-content: space-between;
  }
  .tab-btn {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 12px;
  }
  .btn-download {
    width: 100%;
    justify-content: center;
  }
  .slide-card {
    padding: 18px 14px;
  }
  .slide-grid {
    grid-template-columns: 1fr;
  }
  .slide-title {
    font-size: 18px;
  }
  .deck-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .control-left, .control-right {
    justify-content: space-between;
  }
  .bom-stats-grid {
    grid-template-columns: 1fr;
  }
  .slide-takeaway-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

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