/* BuildOS System Manual — Clean Industrial Dark Design System
   Optimized for narrow preview panels and full-width browsers alike. */

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

/* ─── Tokens ─── */
:root {
  --bg:           #0B0D14;
  --bg-elev:      #11141D;
  --bg-3:         #181C28;
  --surface:      rgba(255,255,255,0.03);
  --surface-2:    rgba(255,255,255,0.05);
  --border:       rgba(255,255,255,0.07);
  --border-2:     rgba(255,255,255,0.12);
  --accent:       #4ADE80;
  --accent-soft:  rgba(74,222,128,0.10);
  --accent-line:  rgba(74,222,128,0.22);
  --text:         #ECEEF3;
  --text-2:       #A8B0BF;
  --text-3:       #6B7385;
  --red:          #F87171;
  --red-soft:     rgba(248,113,113,0.10);
  --amber:        #FBBF24;
  --amber-soft:   rgba(251,191,36,0.10);
  --blue:         #60A5FA;
  --blue-soft:    rgba(96,165,250,0.10);
  --purple:       #A78BFA;
  --purple-soft:  rgba(167,139,250,0.10);
  --sidebar-w:    248px;
  --content-max:  780px;
  --r-sm:         6px;
  --r:            10px;
  --r-lg:         14px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15.5px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

/* ─── Layout ─── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity .15s;
}
.sidebar-logo:hover { opacity: 0.85; text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  flex-shrink: 0;
  padding: 3px;
}
.logo-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}
.logo-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}
.logo-text small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

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

.nav-section {
  padding: 16px 22px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
}
.nav-section:first-of-type { padding-top: 4px; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 22px;
  text-decoration: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
  border-left: 2px solid transparent;
  transition: all 0.12s ease;
}
.sidebar nav a:hover {
  color: var(--text);
  background: var(--surface);
}
.sidebar nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
}
.nav-icon {
  font-size: 13px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  opacity: 0.85;
}
.sidebar nav a.active .nav-icon { opacity: 1; }

/* ─── Main / Topbar / Content ─── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  background: rgba(11,13,20,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 14px 36px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-3);
  min-width: 0;
  overflow: hidden;
}
.breadcrumb a {
  color: var(--text-3);
  text-decoration: none;
  white-space: nowrap;
  transition: color .12s;
}
.breadcrumb a:hover { color: var(--text-2); }
.breadcrumb .sep { color: var(--text-3); flex-shrink: 0; }
.breadcrumb .current {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 3px 10px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.content {
  padding: 56px 36px 100px;
  max-width: var(--content-max);
}

/* ─── Typography ─── */
.page-title {
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.025em;
}
.page-title .accent { color: var(--accent); }

.page-subtitle {
  font-size: 16px;
  color: var(--text-2);
  margin-bottom: 48px;
  max-width: 640px;
  line-height: 1.65;
  font-weight: 400;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 56px 0 16px;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
h2:first-of-type { margin-top: 0; }

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 10px;
  letter-spacing: -0.01em;
}

p {
  color: var(--text-2);
  margin-bottom: 16px;
  font-size: 15px;
  max-width: 680px;
  line-height: 1.7;
}
p:last-child { margin-bottom: 0; }

strong { color: var(--text); font-weight: 600; }
em { color: var(--text); font-style: italic; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .12s;
}
a:hover { border-bottom-color: var(--accent); }

ul, ol {
  color: var(--text-2);
  font-size: 15px;
  padding-left: 22px;
  margin-bottom: 16px;
  max-width: 680px;
  line-height: 1.7;
}
li { margin-bottom: 6px; padding-left: 4px; }
li::marker { color: var(--text-3); }

hr, .divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 40px 0;
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 14px;
  transition: border-color .15s, background .15s;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 14px 0 28px;
}
.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 14px 0 28px;
}
.card-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px 0 28px;
}
.card-icon {
  font-size: 22px;
  margin-bottom: 12px;
  line-height: 1;
}
.card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.card-body {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
}
.card-accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

/* ─── Tables ─── */
.table-wrap {
  overflow-x: auto;
  margin: 14px 0 28px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-elev);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
  line-height: 1.55;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface); }
td strong { font-weight: 600; color: var(--text); }

/* ─── Chips / Badges ─── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.5;
  border-bottom: none !important;
}
.chip-green  { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.chip-amber  { background: var(--amber-soft);  color: var(--amber);  border: 1px solid rgba(251,191,36,0.22); }
.chip-red    { background: var(--red-soft);    color: var(--red);    border: 1px solid rgba(248,113,113,0.22); }
.chip-blue   { background: var(--blue-soft);   color: var(--blue);   border: 1px solid rgba(96,165,250,0.22); }
.chip-purple { background: var(--purple-soft); color: var(--purple); border: 1px solid rgba(167,139,250,0.22); }
.chip-gray   { background: var(--surface-2);   color: var(--text-2); border: 1px solid var(--border-2); }
a.chip:hover { filter: brightness(1.15); border-bottom: none; }

/* ─── Callouts ─── */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--r);
  margin: 16px 0 24px;
  max-width: 720px;
}
.callout-icon { font-size: 18px; flex-shrink: 0; line-height: 1.4; }
.callout-body { font-size: 14px; color: var(--text-2); line-height: 1.65; }
.callout-body strong { color: var(--text); }
.callout-green  { background: var(--accent-soft);  border: 1px solid var(--accent-line); }
.callout-amber  { background: var(--amber-soft);   border: 1px solid rgba(251,191,36,0.22); }
.callout-red    { background: var(--red-soft);     border: 1px solid rgba(248,113,113,0.22); }
.callout-blue   { background: var(--blue-soft);    border: 1px solid rgba(96,165,250,0.22); }

/* ─── Journey Flow ─── */
.flow {
  display: flex;
  flex-direction: column;
  margin: 16px 0 28px;
  max-width: 700px;
}
.flow-step {
  display: flex;
  gap: 16px;
  position: relative;
}
.flow-step-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 32px;
}
.flow-node {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
}
.flow-node.accent   { background: var(--accent-soft);  border-color: var(--accent-line); color: var(--accent); }
.flow-node.critical { background: var(--red-soft);     border-color: rgba(248,113,113,0.35); color: var(--red); }
.flow-line {
  width: 1px;
  flex: 1;
  background: var(--border-2);
  margin: 4px 0;
  min-height: 24px;
}
.flow-content { padding: 4px 0 28px; flex: 1; min-width: 0; }
.flow-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.45;
}
.flow-desc {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
}

/* ─── Stat Strip ─── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 48px;
}
.stat-cell {
  background: var(--bg-elev);
  padding: 22px 16px;
  text-align: center;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.025em;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
  letter-spacing: 0.02em;
}

/* ─── Persona Cards ─── */
.persona-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 18px;
}
.persona-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.persona-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.persona-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.persona-role {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
}
.persona-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 18px;
}
.persona-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}
.persona-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13.5px;
}
.persona-list li {
  font-size: 13.5px;
  color: var(--text-2);
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  line-height: 1.55;
}
.persona-list li:last-child { border-bottom: none; }
.li-icon { flex-shrink: 0; line-height: 1.4; }
.persona-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

/* ─── Stage Pipeline ─── */
.pipeline-stages {
  display: flex;
  gap: 8px;
  margin: 18px 0 24px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.stage {
  flex: 1;
  min-width: 120px;
  text-align: center;
}
.stage-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 10px;
  height: 100%;
}
.stage.active .stage-inner {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.stage-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.04em;
}
.stage.active .stage-name { color: var(--accent); }
.stage-prob {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  margin: 6px 0 4px;
  letter-spacing: -0.02em;
}
.stage.active .stage-prob { color: var(--accent); }

/* ─── Permission cells ─── */
.perm-yes  { color: var(--accent); font-weight: 600; }
.perm-read { color: var(--blue);   font-weight: 500; }
.perm-no   { color: var(--text-3); }

/* ─── Roadmap milestones ─── */
.milestone {
  display: flex;
  gap: 18px;
  margin-bottom: 10px;
  align-items: flex-start;
}
.milestone-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.milestone-dot.mvp    { background: var(--accent); }
.milestone-dot.post   { background: var(--blue); }
.milestone-dot.future { background: var(--text-3); }

/* ─── Mono / inline code ─── */
.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--accent);
  white-space: nowrap;
}

/* ─── Outcome strip ─── */
.outcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}
.outcome-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.outcome-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  white-space: nowrap;
  letter-spacing: -0.025em;
}
.outcome-label {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.45;
}

/* ─── Hub / Nav grid ─── */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}
.nav-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  text-decoration: none !important;
  border-bottom: 1px solid var(--border) !important;
  transition: all 0.15s ease;
}
.nav-card:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.nav-card-icon { font-size: 22px; line-height: 1; }
.nav-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}
.nav-card-desc {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
}

/* ─── Hero ─── */
.hero {
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 70%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 44px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(74,222,128,0.10) 0%, transparent 70%);
  pointer-events: none;
}
.hero-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  font-family: 'JetBrains Mono', monospace;
}
.hero-title {
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}
.hero-desc {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.65;
  max-width: 600px;
  margin-bottom: 0;
}

/* ─── Mobile / narrow viewport ─── */
@media (max-width: 1024px) {
  body { flex-direction: column; }
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    max-height: none;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0;
    overflow: visible;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(17,20,29,0.92);
  }
  .sidebar-logo {
    border-bottom: none;
    padding: 14px 18px;
    flex-shrink: 0;
  }
  .logo-text { font-size: 13px; }

  /* Wrapper for horizontal nav with fade gradient hint */
  .sidebar nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 36px 0 0;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    position: relative;
    mask-image: linear-gradient(to right, black calc(100% - 32px), transparent);
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 32px), transparent);
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-section { display: none; }
  .sidebar nav a {
    padding: 16px 14px;
    border-left: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .sidebar nav a:first-of-type { padding-left: 4px; }
  .sidebar nav a.active {
    border-bottom-color: var(--accent);
    border-left: none;
    background: transparent;
  }
  .nav-icon { display: none; }

  .main { margin-left: 0; }
  .topbar { padding: 12px 24px; }
  .content { padding: 36px 24px 80px; }

  .page-title { font-size: 30px; }
  .page-subtitle { font-size: 15px; margin-bottom: 36px; }
  h2 { font-size: 20px; margin: 44px 0 14px; }
  .hero { padding: 32px 28px; }
  .hero-title { font-size: 30px; }
  .hero-desc { font-size: 15px; }

  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .card-grid-3 { grid-template-columns: 1fr 1fr; }
  .nav-grid { grid-template-columns: 1fr 1fr; }

  /* Procurement formula — wrap pieces cleanly */
  .formula-pieces {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 700px) {
  .content { padding: 28px 18px 60px; }
  .topbar { padding: 10px 18px; }
  .topbar-badge { display: none; }

  .page-title { font-size: 26px; }
  .hero { padding: 26px 22px; }
  .hero-title { font-size: 24px; }

  .card-grid-3, .card-grid-2, .nav-grid { grid-template-columns: 1fr; }
  .persona-cols { grid-template-columns: 1fr; gap: 18px; }
  .outcome-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 24px; }

  .pipeline-stages { gap: 6px; }
  .stage { min-width: 90px; }
  .stage-inner { padding: 10px 6px; }

  .persona-card { padding: 22px; }
  .card { padding: 18px; }

  table { font-size: 12.5px; }
  thead th { padding: 9px 12px; }
  tbody td { padding: 10px 12px; }
}

/* ─── Print ─── */
@media print {
  .sidebar, .topbar { display: none; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  body { background: white; color: black; }
  .card, table { break-inside: avoid; }
}
