/* =========================================================
   Build Plan docs shell
   Structure adapted from Growth Hub layout.
   Colours and type from Marketlinx DIGITAL tokens.
   No gradients. No glassmorphism.
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

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

:root {
  --mkd-primary: #0f1c2e;
  --mkd-primary-lt: #eff4fb;
  --mkd-accent: #188bf6;
  --mkd-accent-hover: #0d72d4;
  --mkd-success: #37ca37;
  --mkd-success-lt: #e6f7e6;
  --mkd-warning: #ffc107;
  --mkd-warning-lt: #fff8e1;
  --mkd-danger: #df001b;
  --mkd-danger-lt: #fde8ea;
  --mkd-text: #2a2d34;
  --mkd-muted: #6b7280;
  --mkd-border: #e5e7eb;
  --mkd-border-strong: #cbd5e1;
  --mkd-bg: #fafafa;
  --mkd-surface: #ffffff;

  --bg-primary: var(--mkd-bg);
  --bg-secondary: var(--mkd-surface);
  --bg-tertiary: var(--mkd-primary-lt);
  --text-primary: var(--mkd-primary);
  --text-secondary: var(--mkd-text);
  --text-muted: var(--mkd-muted);
  --accent: var(--mkd-accent);
  --border: var(--mkd-border);
  --border-strong: var(--mkd-border-strong);

  --radius: 8px;
  --radius-sm: 4px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 28, 46, 0.06);
  --shadow: 0 4px 24px rgba(15, 28, 46, 0.08);
  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --topbar-h: 64px;
  --sidebar-w: 260px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--mkd-accent-hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- TOP BAR ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--mkd-primary);
  border-bottom: 1px solid var(--mkd-primary);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 1000;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  flex-shrink: 0;
}

.topbar-brand img {
  height: 28px;
  width: auto;
}

.topbar-brand-text {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
}

.topbar-pills {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: thin;
}

.topbar-pills::-webkit-scrollbar {
  height: 4px;
}
.topbar-pills::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.pill:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.pill.active {
  background: var(--mkd-accent);
  border-color: var(--mkd-accent);
  color: #ffffff;
}

.pill.active:hover,
.pill.active:focus {
  color: #ffffff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
}

/* ---------- LAYOUT ---------- */
.container {
  display: flex;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  position: fixed;
  left: 0;
  top: var(--topbar-h);
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 100;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.sidebar-panel {
  display: none;
}
.sidebar-panel.active {
  display: block;
}

.sidebar-title {
  padding: 0 20px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.toc-list {
  list-style: none;
}

.toc-link {
  display: block;
  padding: 7px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
  cursor: pointer;
}

.toc-link:hover {
  color: var(--text-primary);
  background: var(--mkd-primary-lt);
}

.toc-link.active {
  color: var(--mkd-accent);
  background: var(--mkd-primary-lt);
  border-left-color: var(--mkd-accent);
  font-weight: 600;
}

.content {
  margin-left: var(--sidebar-w);
  padding: 40px 48px 64px;
  max-width: 960px;
  flex: 1;
  width: 100%;
}

.system-content {
  display: none;
}
.system-content.active {
  display: block;
}

/* ---------- SECTIONS ---------- */
.section {
  margin-bottom: 48px;
  scroll-margin-top: 88px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.section-description {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-top: 8px;
  max-width: 720px;
}

h3.subhead {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 28px 0 12px;
}

h4.subhead-sm {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 10px;
}

p + p {
  margin-top: 10px;
}

ul.plain {
  list-style: none;
  margin: 12px 0;
}
ul.plain li {
  padding: 6px 0 6px 16px;
  position: relative;
  color: var(--text-secondary);
  font-size: 14px;
}
ul.plain li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mkd-accent);
}

ol.steps {
  list-style: none;
  counter-reset: step;
  margin: 16px 0;
}
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 16px 16px 16px 56px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mkd-primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
ol.steps > li strong.step-title {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 4px;
}
ol.steps > li .step-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ---------- STATS ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-number {
  font-size: 26px;
  font-weight: 700;
  color: var(--mkd-accent);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

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

.value-prop {
  background: var(--mkd-primary-lt);
  border-left: 3px solid var(--mkd-accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.value-prop-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--mkd-accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.value-prop-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ---------- CHIPS (In / Out / Later) ---------- */
.chip-row {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.chip:hover {
  border-color: var(--border-strong);
}

.chip[data-state="in"].selected,
.chip.in.selected {
  background: var(--mkd-success-lt);
  border-color: var(--mkd-success);
  color: #1a7a1a;
}

.chip[data-state="out"].selected,
.chip.out.selected {
  background: var(--mkd-danger-lt);
  border-color: var(--mkd-danger);
  color: var(--mkd-danger);
}

.chip[data-state="later"].selected,
.chip.later.selected {
  background: var(--mkd-warning-lt);
  border-color: var(--mkd-warning);
  color: #8a6d00;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-in {
  background: var(--mkd-success-lt);
  color: #1a7a1a;
}
.badge-out {
  background: var(--mkd-danger-lt);
  color: var(--mkd-danger);
}
.badge-later {
  background: var(--mkd-warning-lt);
  color: #8a6d00;
}
.badge-draft {
  background: var(--mkd-primary-lt);
  color: var(--mkd-primary);
}
.badge-example {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}
.badge-tbd {
  background: var(--mkd-primary-lt);
  color: var(--mkd-muted);
  border: 1px solid var(--border);
}

/* ---------- TABLES ---------- */
.table-wrapper {
  overflow-x: auto;
  margin: 12px 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}

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

table.data th {
  background: var(--mkd-primary-lt);
  color: var(--text-primary);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tr:hover td {
  background: rgba(24, 139, 246, 0.04);
}

table.data td.mono,
table.data .mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mkd-accent);
}

table.data.empty-row td {
  color: var(--text-muted);
  font-style: italic;
  height: 36px;
}

table.data.blank td {
  min-height: 32px;
  height: 36px;
  color: transparent;
}

/* Checklist element cards */
.element-card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: start;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
}

.element-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--mkd-primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.element-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.element-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- ACCORDION (details/summary) ---------- */
details.acc {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

details.acc summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  user-select: none;
}

details.acc summary::-webkit-details-marker {
  display: none;
}

details.acc summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 6px solid var(--mkd-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 160ms ease;
  flex-shrink: 0;
}

details.acc[open] summary::before {
  transform: rotate(90deg);
  border-left-color: var(--mkd-accent);
}

details.acc[open] summary {
  border-bottom: 1px solid var(--border);
  background: var(--mkd-primary-lt);
}

.acc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--mkd-primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.acc-body {
  padding: 16px 20px 18px;
}

.acc-body ol,
.acc-body ul {
  margin: 0;
  padding-left: 20px;
}

.acc-body li {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ---------- EXAMPLE BANNER ---------- */
.example-banner {
  background: var(--mkd-warning-lt);
  border: 1px solid var(--mkd-warning);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  font-size: 13px;
  color: #856404;
  font-weight: 500;
  line-height: 1.5;
}

.example-banner strong {
  font-weight: 700;
  color: #6b5300;
}

/* ---------- COVER BLOCK ---------- */
.cover-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.note-box {
  background: var(--mkd-primary-lt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--mkd-accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 12px 0;
  line-height: 1.55;
}

.warning-box {
  background: var(--mkd-warning-lt);
  border: 1px solid var(--mkd-warning);
  border-left: 3px solid var(--mkd-warning);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: #6b5300;
  margin: 12px 0;
  line-height: 1.55;
}

code, .mono-inline {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--mkd-primary-lt);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--mkd-primary);
}

/* ---------- FOOTER ---------- */
.site-footer {
  margin-left: var(--sidebar-w);
  padding: 24px 48px 40px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
}

.site-footer .footer-brand {
  font-weight: 600;
  color: var(--text-primary);
}

/* ---------- MOBILE ---------- */
@media (max-width: 900px) {
  .menu-toggle {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 200ms ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
    padding: 28px 20px 48px;
  }

  .site-footer {
    margin-left: 0;
    padding: 20px;
  }

  .topbar-brand-text {
    display: none;
  }

  .topbar-brand {
    min-width: auto;
  }

  .section-title {
    font-size: 22px;
  }

  .element-card {
    grid-template-columns: 32px 1fr;
  }

  .element-card .chip-row {
    grid-column: 1 / -1;
    margin-top: 4px;
  }
}

@media (max-width: 600px) {
  .status-pill {
    display: none;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- PREP PACK EXTRAS ---------- */
.item-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}
.item-list li {
  margin-bottom: 6px;
}
.item-list li::marker {
  color: var(--mkd-accent);
}
.muted-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 8px;
}
.def-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  font-size: 13px;
  margin: 12px 0;
}
.def-grid dt {
  font-weight: 600;
  color: var(--text-primary);
}
.def-grid dd {
  color: var(--text-secondary);
  margin: 0;
}
.offer-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--mkd-primary-lt);
  color: var(--mkd-accent);
  font-weight: 700;
  font-size: 13px;
  margin-right: 8px;
  flex-shrink: 0;
}
.offer-head {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.offer-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.price-table td:nth-child(2),
.price-table td:nth-child(3),
.price-table th:nth-child(2),
.price-table th:nth-child(3) {
  white-space: nowrap;
}
.card + .card {
  margin-top: 0;
}
.subhead {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 8px 0 12px;
}
