/* =======================================
   TPM.ai — Design System
   Clean. Minimal. Professional.
   ======================================= */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,400;0,600;0,700;0,800;1,400;1,700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg: #FAFAF7;
  --bg-deep: #F2F0EA;
  --surface: #FFFFFF;
  --surface-muted: #F8F7F4;
  --ink: #1A1A1A;
  --ink-soft: #2D2D2D;
  --text: #4A4A4A;
  --text-light: #6B6B6B;
  --text-muted: #999999;
  --border: #E5E2DB;
  --border-strong: #D0CCC3;
  --rust: #B45309;
  --rust-light: #FEF3C7;
  --rust-border: #FDE68A;
  --teal: #0F766E;
  --teal-light: #CCFBF1;
  --teal-border: #5EEAD4;
  --navy: #1E293B;
  --navy-light: #E2E8F0;
  --navy-border: #94A3B8;
  --crimson: #B91C1C;
  --crimson-light: #FEE2E2;
  --violet: #6D28D9;
  --violet-light: #EDE9FE;
  --blue: #2563EB;
  --blue-light: #DBEAFE;
  --green: #059669;
  --green-light: #D1FAE5;
  --amber: #D97706;
  --amber-light: #FEF3C7;
  --orange: #EA580C;
  --purple: #7C3AED;
  --cyan: #0891B2;
  --display: 'Source Serif 4', Georgia, serif;
  --body: 'DM Sans', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

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

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

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

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--surface-muted);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand h1 {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  font-style: italic;
  line-height: 1;
}

.sidebar-brand h1 span { color: var(--rust); }

.sidebar-brand .subtitle {
  font-family: var(--body);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-top: 6px;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  transition: all 0.15s ease;
  margin-bottom: 1px;
}

.sidebar-nav a:hover {
  background: var(--surface);
  color: var(--ink);
}

.sidebar-nav a.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sidebar-nav a .nav-num {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 20px;
}

.sidebar-nav a.active .nav-num { color: var(--rust); }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.6;
}

.main-content {
  margin-left: 240px;
  flex: 1;
  min-width: 0;
}

/* ---- HERO ---- */
.page-hero {
  padding: 64px 64px 56px;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
  border-bottom: 1px solid var(--border);
}

.page-hero .pill { margin-bottom: 16px; }

.page-hero h2 {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.12;
  max-width: 680px;
  font-style: italic;
}

.page-hero h2 .accent { color: var(--rust); }

.page-hero .lead {
  font-size: 17px;
  color: var(--text);
  line-height: 1.65;
  max-width: 580px;
  margin-top: 16px;
}

/* ---- CONTENT ---- */
.content-body {
  padding: 0 64px 80px;
  max-width: 880px;
}

.section {
  padding-top: 56px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 28px;
}

.section-num {
  font-family: var(--display);
  font-size: 64px;
  font-weight: 900;
  color: var(--border);
  line-height: 1;
  margin-right: 16px;
  font-style: italic;
  user-select: none;
  flex-shrink: 0;
}

.section-title {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
  font-style: italic;
}

.section-subtitle {
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
  margin-top: 8px;
  max-width: 600px;
}

/* ---- TYPOGRAPHY ---- */
p { margin-bottom: 16px; font-size: 15px; line-height: 1.75; color: var(--ink-soft); }
p strong { color: var(--ink); font-weight: 700; }
p em { font-style: italic; }

.divider {
  width: 48px;
  height: 3px;
  background: var(--rust);
  border-radius: 2px;
  margin: 48px 0;
}

/* ---- PILL ---- */
.pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-family: var(--body);
}

.pill--rust { color: var(--rust); border: 1.5px solid rgba(180,83,9,0.25); background: rgba(180,83,9,0.04); }
.pill--teal { color: var(--teal); border: 1.5px solid rgba(15,118,110,0.25); background: rgba(15,118,110,0.04); }
.pill--navy { color: var(--navy); border: 1.5px solid rgba(30,41,59,0.25); background: rgba(30,41,59,0.04); }
.pill--violet { color: var(--violet); border: 1.5px solid rgba(109,40,217,0.25); background: rgba(109,40,217,0.04); }
.pill--blue { color: var(--blue); border: 1.5px solid rgba(37,99,235,0.25); background: rgba(37,99,235,0.04); }
.pill--green { color: var(--green); border: 1.5px solid rgba(5,150,105,0.25); background: rgba(5,150,105,0.04); }
.pill--crimson { color: var(--crimson); border: 1.5px solid rgba(185,28,28,0.25); background: rgba(185,28,28,0.04); }
.pill--amber { color: var(--amber); border: 1.5px solid rgba(217,119,6,0.25); background: rgba(217,119,6,0.04); }

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.card--accent-left { border-left-width: 4px; }
.card--accent-top { border-top-width: 3px; }
.card--rust { border-left-color: var(--rust); }
.card--teal { border-left-color: var(--teal); }
.card--navy { border-left-color: var(--navy); }
.card--violet { border-left-color: var(--violet); }
.card--blue { border-left-color: var(--blue); }
.card--green { border-left-color: var(--green); }
.card--amber { border-left-color: var(--amber); }
.card--orange { border-left-color: var(--orange); }
.card--purple { border-left-color: var(--purple); }
.card--cyan { border-left-color: var(--cyan); }

.card-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  font-style: italic;
  line-height: 1.3;
  margin-bottom: 8px;
}

.card-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.65;
}

/* ---- ACCENT CARD ---- */
.accent-card {
  border-radius: 10px;
  padding: 24px;
  border-left-width: 4px;
  border-left-style: solid;
}

.accent-card--rust { background: var(--rust-light); border-color: var(--rust); border: 1px solid var(--rust-border); border-left: 4px solid var(--rust); }
.accent-card--teal { background: var(--teal-light); border-color: var(--teal); border: 1px solid var(--teal-border); border-left: 4px solid var(--teal); }
.accent-card--navy { background: var(--navy-light); border-color: var(--navy); border: 1px solid var(--navy-border); border-left: 4px solid var(--navy); }

/* ---- GRID ---- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ---- TABLE ---- */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table thead th {
  text-align: left;
  padding: 10px 16px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  line-height: 1.55;
  vertical-align: top;
}

table tbody tr:nth-child(even) { background: var(--surface-muted); }

/* ---- CODE BLOCK ---- */
.code-block {
  background: #1E1E2E;
  border-radius: 8px;
  padding: 20px 24px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: #CDD6F4;
  overflow-x: auto;
  white-space: pre-wrap;
  margin-bottom: 16px;
}

.code-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ---- CALLOUT ---- */
.callout {
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 16px;
  border-left: 3px solid;
}

.callout-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout-text { font-size: 13px; line-height: 1.7; color: var(--text); }

.callout--amber { background: var(--amber-light); border-color: var(--amber); }
.callout--amber .callout-title { color: var(--amber); }
.callout--blue { background: var(--blue-light); border-color: var(--blue); }
.callout--blue .callout-title { color: var(--blue); }
.callout--green { background: var(--green-light); border-color: var(--green); }
.callout--green .callout-title { color: var(--green); }
.callout--crimson { background: var(--crimson-light); border-color: var(--crimson); }
.callout--crimson .callout-title { color: var(--crimson); }

/* ---- LABEL ---- */
.label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--text-muted);
}

/* ---- MCP ENDPOINT ---- */
.mcp-endpoint {
  background: #0D1117;
  border: 1px solid #30363D;
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 12px;
  font-family: var(--mono);
}

.mcp-endpoint .tool-badge { color: var(--green); font-size: 12px; font-weight: 700; }
.mcp-endpoint .tool-name { color: #A5B4FC; font-size: 14px; font-weight: 600; margin-left: 10px; }
.mcp-endpoint .tool-desc { color: #8B949E; font-size: 12px; font-family: var(--body); margin: 8px 0 10px; }
.mcp-endpoint .param-label { font-size: 10px; color: #6E7681; margin-bottom: 3px; }
.mcp-endpoint .param-value { font-size: 12px; color: #FBBF24; padding-left: 12px; margin-bottom: 8px; }
.mcp-endpoint .return-value { font-size: 12px; color: #22D3EE; padding-left: 12px; }

/* ---- STATS ROW ---- */
.stats-row {
  display: flex;
  gap: 32px;
  margin-top: 32px;
}

.stat-item .stat-num {
  font-family: var(--display);
  font-size: 36px;
  font-weight: 900;
  color: var(--ink);
  font-style: italic;
  line-height: 1;
}

.stat-item .stat-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-light);
  margin-left: 4px;
}

.stat-item .stat-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- TIMELINE ---- */
.timeline {
  position: relative;
  padding-left: 40px;
  margin: 28px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--rust), var(--navy), var(--teal), var(--violet));
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-dot {
  position: absolute;
  left: -33px;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--rust);
}

/* ---- GANTT-STYLE CHART ---- */
.gantt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.gantt-label {
  width: 120px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  flex-shrink: 0;
}

.gantt-bars {
  display: flex;
  gap: 3px;
  flex: 1;
}

.gantt-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-deep);
  border-radius: 3px;
  opacity: 0.4;
  transition: all 0.3s;
}

.gantt-bar.active {
  height: 20px;
  opacity: 0.8;
  align-self: center;
}

.gantt-desc {
  width: 220px;
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ---- REPORT PREVIEW ---- */
.report-preview {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  max-width: 680px;
  margin: 0 auto 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* ---- FLOW STEPS ---- */
.flow-step {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  position: relative;
}

.flow-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: -20px;
  width: 1px;
  background: var(--border);
}

.flow-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--mono);
  border: 2px solid;
}

/* ---- METRIC CARD ---- */
.metric-card {
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.metric-card .metric-label { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.metric-card .metric-value { font-size: 22px; font-weight: 800; color: var(--navy); }
.metric-card .metric-delta { font-size: 10px; font-weight: 600; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .page-hero { padding: 40px 32px; }
  .page-hero h2 { font-size: 32px; }
  .content-body { padding: 0 32px 60px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section-num { font-size: 48px; }
  .section-title { font-size: 28px; }
}

/* ---- BEFORE/AFTER ---- */
.before-after {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ba-box {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
}

.ba-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ba-value { font-size: 12px; color: var(--text); }
.ba-arrow { font-family: var(--display); color: var(--text-muted); font-size: 18px; }

/* ---- COMPARE ---- */
.compare-block { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.compare-old { border-top: 2px solid var(--crimson); }
.compare-new { border-top: 2px solid var(--green); }

.compare-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
}

/* ---- COST TABLE ---- */
.cost-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ---- BOTTLENECK ---- */
.bottleneck {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}

.bottleneck-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-muted);
}

.bottleneck-body {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.severity-badge {
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ---- PAGE FOOTER ---- */
.page-footer {
  text-align: center;
  padding: 40px 0;
  margin-top: 48px;
}

.page-footer .conf {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.page-footer .ver {
  font-family: var(--display);
  font-size: 15px;
  color: var(--text-light);
  font-style: italic;
}

/* ---- UTILS ---- */
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }

.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
.fs-20 { font-size: 20px; }
.fs-22 { font-size: 22px; }

.font-display { font-family: var(--display); }
.font-mono { font-family: var(--mono); }
.font-body { font-family: var(--body); }

.color-ink { color: var(--ink); }
.color-rust { color: var(--rust); }
.color-teal { color: var(--teal); }
.color-navy { color: var(--navy); }
.color-muted { color: var(--text-muted); }

.italic { font-style: italic; }
.text-center { text-align: center; }
