/* CashTank Financial Planner user manual */

:root {
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-faint: #eff6ff;
  --bg: #ffffff;
  --sidebar-bg: #fefbea;
  --code-bg: #f3f4f6;
  --note-bg: #eff6ff;
  --tip-bg: #f0fdf4;
  --warn-bg: #fffbeb;
  --preview-bg: #fff7ed;
  --header-h: 56px;
  --sidebar-w: 270px;
}

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--header-h) + 12px); }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

.skip-link { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; }
.brand small { font-weight: 400; color: var(--muted); font-size: 15px; }
.menu-toggle {
  display: none;
  border: 1px solid var(--border); background: #fff; border-radius: 6px;
  padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer;
}

/* ---------- Layout ---------- */
.page { display: flex; min-height: calc(100vh - var(--header-h)); }

.sidebar {
  flex: 0 0 var(--sidebar-w);
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 18px 12px 40px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}
.nav-section { margin: 16px 10px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav-section:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 15px; }
.sidebar a:hover { background: #fdf3c4; }
.sidebar a.active { background: var(--accent); color: #fff; font-weight: 600; }

.content { flex: 1 1 auto; min-width: 0; max-width: 900px; padding: 28px 44px 60px; }

/* ---------- Typography ---------- */
h1 { font-size: 32px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 23px; margin: 40px 0 10px; padding-top: 8px; border-top: 1px solid var(--border); }
h3 { font-size: 18px; margin: 28px 0 6px; }
.lead { font-size: 18px; color: #374151; margin-top: 4px; }
p, ul, ol { margin: 10px 0; }
li { margin: 4px 0; }
code, kbd { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
kbd { border: 1px solid #d1d5db; border-bottom-width: 2px; }
strong { font-weight: 650; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 14px 0; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #f9fafb; font-weight: 650; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.highlight td { background: #fef9c3; }

/* ---------- Figures ---------- */
figure { margin: 22px 0; }
figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; }
figure.screenshot img { box-shadow: 0 4px 18px rgba(15, 23, 42, .10); }
figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* ---------- Callouts ---------- */
.callout { margin: 18px 0; padding: 12px 16px; border-radius: 8px; border-left: 5px solid; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout .title { display: block; font-weight: 700; margin-bottom: 2px; }
.note { background: var(--note-bg); border-color: #60a5fa; }
.tip { background: var(--tip-bg); border-color: #22c55e; }
.warn { background: var(--warn-bg); border-color: #f59e0b; }
.preview { background: var(--preview-bg); border-color: #fb923c; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.badge.built { background: #dcfce7; color: #166534; }
.badge.preview { background: #ffedd5; color: #9a3412; }

/* ---------- Cards (welcome page) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 18px 0; }
.card { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; background: #fff; }
.card:hover { border-color: var(--accent); background: var(--accent-faint); }
.card strong { display: block; color: var(--accent-dark); margin-bottom: 2px; }
.card span { font-size: 14px; color: var(--muted); }

.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 44px; margin: 14px 0; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}

dl.terms dt { font-weight: 700; margin-top: 14px; }
dl.terms dd { margin: 2px 0 0 0; }

/* ---------- Pager / footer ---------- */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 50px; padding-top: 18px; border-top: 1px solid var(--border); }
.pager a { display: flex; flex-direction: column; text-decoration: none; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; max-width: 48%; }
.pager a span { font-size: 13px; color: var(--muted); }
.pager a.next { text-align: right; margin-left: auto; }
.pager a:hover { border-color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); padding: 16px 24px; font-size: 13px; color: var(--muted); background: #fafafa; }
.site-footer p { margin: 0; max-width: 900px; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .menu-toggle { display: inline-block; }
  .sidebar {
    position: fixed; left: 0; top: var(--header-h); bottom: 0; z-index: 15;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 4px 0 18px rgba(0, 0, 0, .12);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .content { padding: 22px 18px 50px; }
  h1 { font-size: 27px; }
  .brand small { display: none; }
}

@media print {
  .site-header, .sidebar, .pager, .site-footer { display: none; }
  .content { max-width: none; padding: 0; }
  figure { break-inside: avoid; }
}
