/* ═══════════════════════════════════════════════════════════════════
   docs.loteflow.com — main.css
   Tokens + app chrome (topbar, sidebar, shell, footer, search overlay).
   Brand language mirrors loteflow.com: cream / pine / gold, Inter.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* brand */
  --cream: #FDFBF7;
  --cream-2: #F8F5F0;
  --cream-3: #F1EEE8;
  --pine: #0F2E22;
  --pine-2: #143D2E;
  --pine-3: #1B4D3A;
  --pine-soft: #EAF1EC;
  --gold: #C9A86A;
  --gold-2: #D6B98C;
  --accent: #C9773B;

  /* neutrals */
  --text: #191813;
  --muted: #5F5A52;
  --muted-2: #8B847A;
  --line: #E8E2D9;
  --line-2: #DFD9CF;
  --white: #FFFFFF;

  /* semantic — values match the product (frontend/src/styles/tokens.css) */
  --ok: #3D7A57;
  --info: #4B7F99;
  --warn: #B45309;
  --danger: #B91C1C;

  /* phase system — matches the product's stage-phase UI (journeys list) */
  --phase-marketing: #4B7F99;
  --phase-marketing-bg: #E8EEF7;
  --phase-marketing-text: #33586C;
  --phase-sales: #3D7A57;
  --phase-sales-bg: #E8F5EE;
  --phase-sales-text: #2B5A41;
  --phase-closed: #8B847A;
  --phase-closed-bg: #F1EEE8;

  /* layout */
  --topbar-h: 60px;
  --sidebar-w: 288px;
  --toc-w: 220px;
  --container: 1280px;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(15, 46, 34, .06);
  --shadow-md: 0 6px 18px rgba(15, 46, 34, .09);
  --shadow-lg: 0 18px 44px rgba(15, 46, 34, .16);

  --font: Inter, "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── Reset-lite ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--cream);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: inline-block; vertical-align: middle; }
a { color: var(--pine-3); text-decoration: none; }
a:hover { text-decoration: underline; }
.ico { flex-shrink: 0; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--pine); color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(253, 251, 247, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--container); margin: 0 auto;
  height: var(--topbar-h); padding: 0 20px;
  display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(140deg, var(--pine-2), var(--pine-3));
  color: #F3EAD7; font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.brand__text strong { color: var(--pine-3); }
.wordmark { font-weight: 700; letter-spacing: -0.03em; font-size: 17px; color: var(--text); }
.wordmark .flow { color: var(--accent); }
.wordmark--sm { font-size: 13.5px; }
.brand__docs {
  color: var(--muted); font-size: 12.5px; font-weight: 650;
  padding-left: 9px; margin-left: 2px;
  border-left: 1px solid var(--line-2);
}
.topbar__nav { display: flex; gap: 4px; margin-right: auto; }
.topbar__nav a {
  color: var(--muted); font-size: 14px; font-weight: 500;
  padding: 7px 11px; border-radius: 8px;
}
.topbar__nav a:hover { color: var(--pine-3); background: var(--cream-3); text-decoration: none; }
.topbar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar__burger {
  display: none; border: 1px solid var(--line); background: var(--white);
  border-radius: 8px; width: 36px; height: 36px;
  align-items: center; justify-content: center; color: var(--text); cursor: pointer;
}

.search-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--white); color: var(--muted);
  font: inherit; font-size: 13.5px;
  padding: 7px 10px 7px 12px; border-radius: 9px; cursor: pointer;
  min-width: 210px; transition: border-color .15s, box-shadow .15s;
}
.search-btn:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.search-btn span { flex: 1; text-align: left; }
.search-btn kbd {
  font-family: var(--font); font-size: 11px; color: var(--muted-2);
  border: 1px solid var(--line); border-bottom-width: 2px;
  padding: 1px 5px; border-radius: 5px; background: var(--cream-2);
}
.search-btn--lg { min-width: 0; padding: 10px 16px; font-size: 15px; }
.topbar__app {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--pine-2); color: #F3EAD7;
  font-size: 13.5px; font-weight: 600;
  padding: 8px 14px; border-radius: 9px; white-space: nowrap;
}
.topbar__app:hover { background: var(--pine-3); text-decoration: none; }

/* ── Shell: sidebar + main ──────────────────────────────────────── */
.shell {
  max-width: var(--container); margin: 0 auto;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}
.sidebar {
  border-right: 1px solid var(--line);
  padding: 26px 18px 40px 8px;
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sidebar__section { margin-bottom: 6px; }
.sidebar__section-head {
  display: flex; align-items: center; gap: 9px;
  color: var(--text); font-size: 13.5px; font-weight: 650;
  padding: 8px 10px; border-radius: 8px; letter-spacing: .01em;
}
.sidebar__section-head:hover { background: var(--cream-3); text-decoration: none; }
.sidebar__section-icon { color: var(--gold); display: inline-flex; }
.sidebar__pages { list-style: none; margin: 2px 0 10px; padding: 0 0 0 14px; }
.sidebar__pages a {
  display: block; color: var(--muted); font-size: 14px;
  padding: 6px 10px 6px 16px; border-left: 2px solid var(--line);
  margin-left: 4px;
}
.sidebar__pages a:hover { color: var(--pine-3); text-decoration: none; }
.sidebar__pages a.is-active {
  color: var(--pine-3); font-weight: 600;
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(201, 168, 106, .1), transparent);
}
.sidebar__scrim { display: none; }
.sidebar__foot {
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar__foot a {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--muted-2); font-size: 12.5px; padding: 4px 10px;
}
.sidebar__foot a:hover { color: var(--pine-3); text-decoration: none; }

.main { min-width: 0; padding: 34px 44px 60px; }

/* ── Footer ─────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--line); background: var(--cream-2); }
.footer__inner {
  max-width: var(--container); margin: 0 auto; padding: 18px 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  color: var(--muted-2); font-size: 13px;
}
.footer__brand { display: inline-flex; align-items: center; gap: 8px; }
.footer__links { display: flex; gap: 18px; }
.footer__links a { color: var(--muted); }
.footer__links a:hover { color: var(--pine-3); }

/* ── Search overlay ─────────────────────────────────────────────── */
.search-overlay { position: fixed; inset: 0; z-index: 300; }
.search-overlay[hidden] { display: none; }
.search-overlay__scrim { position: absolute; inset: 0; background: rgba(15, 30, 24, .38); backdrop-filter: blur(3px); }
.search-panel {
  position: relative; z-index: 1;
  width: min(620px, calc(100vw - 32px));
  margin: 11vh auto 0;
  background: var(--white); border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 68vh;
}
.search-panel__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.search-panel__bar input {
  flex: 1; border: 0; outline: 0; font: inherit; font-size: 16px;
  color: var(--text); background: transparent;
}
.search-panel__bar input::-webkit-search-cancel-button,
.search-panel__bar input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-panel__close {
  border: 0; background: var(--cream-2); color: var(--muted);
  border-radius: 7px; width: 26px; height: 26px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.search-panel__results { overflow-y: auto; padding: 8px; }
.search-result {
  display: block; padding: 10px 12px; border-radius: 9px; color: var(--text);
}
.search-result:hover, .search-result.is-selected { background: var(--cream-2); text-decoration: none; }
.search-result__path { font-size: 11.5px; color: var(--gold); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.search-result__title { font-size: 14.5px; font-weight: 600; margin: 1px 0; }
.search-result__snippet { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-empty { padding: 26px 16px; text-align: center; color: var(--muted-2); font-size: 14px; }
.search-panel__hint {
  padding: 9px 16px; border-top: 1px solid var(--line);
  color: var(--muted-2); font-size: 12px; background: var(--cream);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 150; left: 0; top: var(--topbar-h);
    width: min(320px, 84vw); background: var(--cream);
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg); height: calc(100vh - var(--topbar-h));
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar__scrim.is-open { display: block; position: fixed; inset: 0; top: var(--topbar-h); z-index: 140; background: rgba(15,30,24,.32); }
  .topbar__burger { display: inline-flex; }
  .topbar__nav { display: none; }
  .search-btn { min-width: 0; }
  .search-btn span, .search-btn kbd { display: none; }
  .main { padding: 26px 20px 48px; }
}
