/* SiteCash user manual — shared styles for every page in /help. */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #047857;
  --accent-soft: #ecfdf5;
  --tip: #0369a1;
  --tip-soft: #f0f9ff;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --code: #f3f4f6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a21;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #2a2f3a;
    --accent: #34d399;
    --accent-soft: #0f2a22;
    --tip: #7dd3fc;
    --tip-soft: #0c1f2b;
    --warn: #fbbf24;
    --warn-soft: #2a2110;
    --danger: #fca5a5;
    --danger-soft: #2a1414;
    --code: #232833;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}
img { max-width: 100%; }
a { color: var(--accent); }

/* Top bar */
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--accent); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 500; }
.app-link {
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--text);
  white-space: nowrap;
}
.app-link:hover { border-color: var(--accent); }

/* Layout */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; }
.sidebar {
  position: sticky;
  top: 56px;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 20px 12px 40px 20px;
  font-size: 0.93rem;
}
.sidebar .nav-title {
  margin: 18px 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar .nav-title:first-child { margin-top: 0; }
.sidebar a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.sidebar a:hover { background: var(--code); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.content { min-width: 0; padding: 28px 32px 60px; }
.content > * { max-width: 860px; }
.crumbs { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
h1 { margin: 0 0 6px; font-size: 2rem; line-height: 1.25; }
h2 { margin: 42px 0 10px; padding-top: 6px; font-size: 1.4rem; border-top: 1px solid var(--line); }
h3 { margin: 26px 0 6px; font-size: 1.1rem; }
.lead { font-size: 1.12rem; color: var(--muted); margin-top: 0; }
p, li { max-width: 72ch; }
code, kbd { background: var(--code); border-radius: 4px; padding: 1px 5px; font-size: 0.9em; }
/* Long paths, URLs and keyword lists may break instead of widening the page on phones. */
.content p, .content li, .content td, .content code { overflow-wrap: anywhere; }
pre code { overflow-wrap: normal; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; }

/* Who uses this page */
.who { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 4px; font-size: 0.9rem; color: var(--muted); }
.role { border-radius: 999px; padding: 1px 9px; font-size: 0.8rem; font-weight: 600; background: var(--code); color: var(--text); }
.role.owner { background: #dcfce7; color: #166534; }
.role.admin { background: #e0f2fe; color: #075985; }
.role.accountant { background: #fef3c7; color: #92400e; }
.role.site { background: #f3e8ff; color: #6b21a8; }
@media (prefers-color-scheme: dark) {
  .role.owner, .role.admin, .role.accountant, .role.site { filter: brightness(0.85); }
}

/* On this page */
.toc { margin: 18px 0 8px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font-size: 0.93rem; }
.toc strong { display: block; margin-bottom: 4px; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; }
@media (max-width: 700px) { .toc ol { columns: 1; } }

/* Steps */
ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li { counter-increment: step; position: relative; padding: 2px 0 10px 42px; }
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
}

/* Callouts */
.callout { margin: 18px 0; padding: 12px 16px; border-radius: 8px; border-left: 4px solid; }
.callout > strong:first-child { display: block; margin-bottom: 2px; }
.callout.tip { background: var(--tip-soft); border-color: var(--tip); }
.callout.note { background: var(--accent-soft); border-color: var(--accent); }
.callout.warn { background: var(--warn-soft); border-color: var(--warn); }
.callout.danger { background: var(--danger-soft); border-color: var(--danger); }

/* Screenshots */
figure { margin: 20px 0; }
figure img {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  background: #fff;
}
figure.phone img { max-width: 340px; }
figcaption { margin-top: 8px; font-size: 0.88rem; color: var(--muted); }

/* Command blocks, e.g. <pre><code>npm install</code></pre> */
pre {
  margin: 12px 0;
  padding: 12px 14px;
  overflow-x: auto;
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.55;
}
pre code { background: none; padding: 0; font-size: inherit; }

/* A row of phone screenshots */
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 18px 0; max-width: 860px; }
.shots figure { margin: 0; }
.shots img { width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; background: var(--panel); }
th, td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--code); font-weight: 600; }
tr:last-child td { border-bottom: none; }

/* Inline UI labels, e.g. <span class="ui">+ Expense</span> */
.ui {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  font-size: 0.88em;
  font-weight: 600;
  white-space: nowrap;
}
.badge { display: inline-block; padding: 0 7px; border-radius: 5px; font-size: 0.8em; font-weight: 600; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.blue { background: #e0f2fe; color: #075985; }
.badge.gray { background: #f3f4f6; color: #374151; }

/* Cards on the welcome page */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 18px 0; max-width: none; }
.card {
  display: block;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card b { display: block; color: var(--accent); margin-bottom: 2px; }
.card span { font-size: 0.9rem; color: var(--muted); }

/* Previous / next */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); }
.pager a { text-decoration: none; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.pager a:hover { border-color: var(--accent); }
.pager .next { margin-left: auto; text-align: right; }
.pager small { display: block; color: var(--muted); font-size: 0.78rem; }

/* Phones: the menu becomes a scrollable row above the page */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    max-height: none;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 8px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }
  .sidebar .nav-title { display: none; }
  .sidebar a { white-space: nowrap; }
  .content { padding: 20px 16px 48px; }
  h1 { font-size: 1.6rem; }
}

@media print {
  .topbar, .sidebar, .pager, .toc { display: none; }
  .layout { display: block; }
  body { background: #fff; }
  figure img { box-shadow: none; }
}
