/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a3c5e;
  --primary-light: #2563a8;
  --accent: #e8a020;
  --accent-light: #f5c55a;
  --success: #16a34a;
  --danger: #dc2626;
  --bg: #f8f9fb;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(26,60,94,0.09);
  --shadow-hover: 0 8px 36px rgba(26,60,94,0.16);
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
}

/* ===== LAYOUT ===== */
.page-wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-light);
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-logo p {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  margin-top: 4px;
}

.sidebar nav { padding: 16px 0; flex: 1; }

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.4);
  padding: 16px 24px 6px;
  font-weight: 600;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left-color: var(--accent);
}

.sidebar nav a .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  overflow-x: hidden;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1e4d7b 50%, #2563a8 100%);
  color: white;
  padding: 80px 60px 70px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 400px; height: 400px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -100px; left: 200px;
  width: 300px; height: 300px;
  background: rgba(232,160,32,0.12);
  border-radius: 50%;
}

.hero-badge {
  display: inline-block;
  background: rgba(232,160,32,0.2);
  color: var(--accent-light);
  border: 1px solid rgba(232,160,32,0.4);
  padding: 5px 16px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.hero h1 span { color: var(--accent-light); }

.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.8);
  max-width: 620px;
  position: relative;
  z-index: 1;
  margin-bottom: 36px;
}

.hero-stats {
  display: flex;
  gap: 40px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.hero-stat { text-align: left; }
.hero-stat .number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-light);
  line-height: 1;
}
.hero-stat .label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}

/* ===== TOC STRIP ===== */
.toc-strip {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 60px;
  display: flex;
  gap: 0;
  overflow-x: auto;
}

.toc-strip a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 22px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.toc-strip a:hover { color: var(--primary); border-bottom-color: var(--primary-light); }
.toc-strip a .toc-num {
  background: var(--bg);
  color: var(--primary);
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

/* ===== CONTENT SECTIONS ===== */
.content-body { padding: 60px; max-width: 1100px; }

.section {
  margin-bottom: 80px;
  scroll-margin-top: 20px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.section-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.icon-blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.icon-green { background: linear-gradient(135deg, #dcfce7, #bbf7d0); }
.icon-orange { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.icon-purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }

.section-header-text h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.section-header-text p {
  color: var(--text-muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

.section-number {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary-light);
  margin-bottom: 4px;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  transition: box-shadow 0.25s;
}

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

.card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h3 .card-icon { font-size: 1.3rem; }

.card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 12px; }
.card p:last-child { margin-bottom: 0; }

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ===== HIGHLIGHT BOX ===== */
.highlight-box {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.highlight-box.orange {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border-color: #fde68a;
  border-left-color: var(--accent);
}

.highlight-box.green {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #bbf7d0;
  border-left-color: var(--success);
}

.highlight-box.red {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border-color: #fecaca;
  border-left-color: var(--danger);
}

.highlight-box h4 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  color: var(--primary);
}

.highlight-box.orange h4 { color: #92400e; }
.highlight-box.green h4 { color: #14532d; }
.highlight-box.red h4 { color: #7f1d1d; }
.highlight-box p { font-size: 0.93rem; color: var(--text); margin: 0; }

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

table { width: 100%; border-collapse: collapse; background: var(--card-bg); }

thead {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
}

thead th {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody td {
  padding: 13px 20px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-green { background: #dcfce7; color: #15803d; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-orange { background: #fef3c7; color: #b45309; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-purple { background: #ede9fe; color: #7c3aed; }

/* ===== STEPS ===== */
.steps { counter-reset: step; }

.step {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.step-num {
  counter-increment: step;
  width: 40px; height: 40px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.step-content { flex: 1; }
.step-content h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.step-content p { font-size: 0.92rem; color: var(--text-muted); margin: 0; }

/* ===== METRIC CARDS ===== */
.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.metric-card .metric-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 6px;
}

.metric-card .metric-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-card .metric-sub {
  font-size: 0.8rem;
  color: var(--success);
  margin-top: 6px;
  font-weight: 600;
}

/* ===== FEASIBILITY CALCULATOR ===== */
.calc-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 28px;
}

.calc-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 20px 28px;
}

.calc-header h3 { font-size: 1.1rem; font-weight: 700; }
.calc-header p { font-size: 0.83rem; color: rgba(255,255,255,0.7); margin-top: 3px; }

.calc-body { padding: 28px; }

.calc-section { margin-bottom: 24px; }
.calc-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.92rem;
}

.calc-row.total {
  border-top: 2px solid var(--border);
  margin-top: 8px;
  padding-top: 14px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
}

.calc-row.profit {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--success);
  margin-top: 8px;
}

.calc-label { color: var(--text-muted); }
.calc-value { font-weight: 600; }
.calc-value.negative { color: var(--danger); }
.calc-value.positive { color: var(--success); }

/* ===== CHECKLIST ===== */
.checklist { list-style: none; }
.checklist li {
  padding: 10px 0;
  font-size: 0.93rem;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.checklist li:last-child { border-bottom: none; }
.checklist li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  margin-top: 2px;
}

/* ===== PROCESS FLOW ===== */
.process-flow {
  display: flex;
  gap: 0;
  overflow-x: auto;
  margin-bottom: 28px;
}

.process-step {
  flex: 1;
  min-width: 140px;
  text-align: center;
  position: relative;
}

.process-step:not(:last-child)::after {
  content: '→';
  position: absolute;
  right: -10px;
  top: 30px;
  font-size: 1.2rem;
  color: var(--accent);
  z-index: 1;
}

.process-circle {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 10px;
  box-shadow: 0 4px 12px rgba(26,60,94,0.25);
}

.process-step h4 { font-size: 0.82rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.process-step p { font-size: 0.75rem; color: var(--text-muted); }

/* ===== FINANCE CARDS ===== */
.finance-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s;
}

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

.finance-card-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.finance-card-header .finance-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.finance-card-header h3 { font-size: 1rem; font-weight: 700; color: var(--primary); }
.finance-card-header p { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

.finance-card-body { padding: 0 24px 24px; }

.rate-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), #d97706);
  color: white;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}

/* ===== MARKETING CARDS ===== */
.marketing-channel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary-light);
}

.marketing-channel.accent-orange { border-top-color: var(--accent); }
.marketing-channel.accent-green { border-top-color: var(--success); }
.marketing-channel.accent-purple { border-top-color: #7c3aed; }

.channel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.channel-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  background: var(--bg);
}

.channel-header h3 { font-size: 1rem; font-weight: 700; color: var(--primary); }

/* ===== DEPRECIATION EXAMPLE ===== */
.depr-example {
  background: linear-gradient(135deg, #1a3c5e, #2563a8);
  color: white;
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 28px;
}

.depr-example h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--accent-light);
}

.depr-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.93rem;
}

.depr-row:last-child { border-bottom: none; }
.depr-row .dr-label { color: rgba(255,255,255,0.7); }
.depr-row .dr-value { font-weight: 700; color: white; }
.depr-row.highlight .dr-value { color: var(--accent-light); font-size: 1.1rem; }

/* ===== TIPS BOX ===== */
.tips-box {
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  border: 1px solid #fde047;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.tips-box h4 {
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tips-box ul { list-style: none; }
.tips-box ul li {
  font-size: 0.92rem;
  color: #78350f;
  padding: 5px 0;
  display: flex;
  gap: 8px;
}
.tips-box ul li::before { content: '💡'; font-size: 0.85rem; flex-shrink: 0; }

/* ===== FOOTER ===== */
.page-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.6);
  padding: 40px 60px;
  font-size: 0.85rem;
  margin-top: 40px;
}

.page-footer a { color: var(--accent-light); text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 40px; margin-bottom: 30px; }
.footer-grid h4 { color: white; font-size: 0.9rem; margin-bottom: 12px; }
.footer-grid ul { list-style: none; }
.footer-grid ul li { padding: 3px 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; text-align: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .hero { padding: 50px 30px; }
  .hero h1 { font-size: 2rem; }
  .content-body { padding: 30px; }
  .toc-strip { padding: 0 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .page-footer { padding: 30px; }
  .hero-stats { gap: 20px; }
}

@media (max-width: 600px) {
  .hero { padding: 36px 20px; }
  .content-body { padding: 20px; }
  .process-flow { flex-direction: column; }
  .process-step:not(:last-child)::after { content: '↓'; right: auto; top: auto; bottom: -12px; left: 50%; transform: translateX(-50%); }
}