/* goldpan.dev shared styles. Direction: design/v1 (Apple-grade, one blue).
   Tokens: light on :root, dark under prefers-color-scheme (guarded) and again under [data-theme="dark"]. */

:root {
  --page: #FFFFFF; --surface: #F5F5F7; --surface-2: #E8E8ED;
  --text: #1D1D1F; --text-2: #6E6E73; --text-3: #AEAEB2; --linenum: #C7C7CC;
  --hair: rgba(0,0,0,.08); --hair-strong: rgba(0,0,0,.16);
  --accent: #0071E3; --accent-soft: rgba(0,113,227,.12);
  --mark: rgba(255,214,10,.42);
  --pass: #34C759; --fail: #FF3B30; --defer: #FF9500;
  --pass-edge: rgba(52,199,89,.38); --fail-edge: rgba(255,59,48,.36); --defer-edge: rgba(255,149,0,.40);
  --key-bg: #E8E8ED; --key-fg: #6E6E73;
  --night: #000000; --night-text: #F5F5F7; --night-2: #86868B; --night-hair: rgba(255,255,255,.16); --night-surface: #161617; --night-dot: #2C2C2E;
  --scrim: rgba(0,0,0,.18); --sheet-edge: 0 0 0 0 transparent;
  --shadow-btn: 0 1px 2px rgba(0,0,0,.08), 0 3px 8px rgba(0,0,0,.07);
  --shadow-hero: 0 1px 2px rgba(0,0,0,.10), 0 6px 16px rgba(0,0,0,.14);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.10), 0 24px 56px rgba(0,0,0,.18);
  --shadow-sheet: 0 2px 8px rgba(0,0,0,.06), 0 30px 80px rgba(0,0,0,.12);
  --lift-edge: none;
  --r-lg: 12px; --r-md: 10px; --r-sm: 7px; --r-key: 5px;
  --spring: cubic-bezier(0.32,0.72,0,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #1C1C1E; --surface: #2C2C2E; --surface-2: #3A3A3C;
    --text: #F5F5F7; --text-2: #98989D; --text-3: #636366; --linenum: #48484A;
    --hair: rgba(255,255,255,.12); --hair-strong: rgba(255,255,255,.22);
    --accent: #0A84FF; --accent-soft: rgba(10,132,255,.22); --mark: rgba(255,214,10,.30);
    --pass: #30D158; --fail: #FF453A; --defer: #FF9F0A;
    --pass-edge: rgba(48,209,88,.45); --fail-edge: rgba(255,69,58,.45); --defer-edge: rgba(255,159,10,.45);
    --key-bg: #48484A; --key-fg: #C7C7CC; --night-surface: #1C1C1E; --scrim: rgba(0,0,0,.5);
    --sheet-edge: 0 0 0 1px rgba(255,255,255,.12);
    --shadow-btn: none; --shadow-hero: none; --shadow-lift: none; --shadow-sheet: none; --lift-edge: 0 0 0 1px rgba(255,255,255,.14);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #1C1C1E; --surface: #2C2C2E; --surface-2: #3A3A3C;
  --text: #F5F5F7; --text-2: #98989D; --text-3: #636366; --linenum: #48484A;
  --hair: rgba(255,255,255,.12); --hair-strong: rgba(255,255,255,.22);
  --accent: #0A84FF; --accent-soft: rgba(10,132,255,.22); --mark: rgba(255,214,10,.30);
  --pass: #30D158; --fail: #FF453A; --defer: #FF9F0A;
  --pass-edge: rgba(48,209,88,.45); --fail-edge: rgba(255,69,58,.45); --defer-edge: rgba(255,159,10,.45);
  --key-bg: #48484A; --key-fg: #C7C7CC; --night-surface: #1C1C1E; --scrim: rgba(0,0,0,.5);
  --sheet-edge: 0 0 0 1px rgba(255,255,255,.12);
  --shadow-btn: none; --shadow-hero: none; --shadow-lift: none; --shadow-sheet: none; --lift-edge: 0 0 0 1px rgba(255,255,255,.14);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  font-size: 15px; line-height: 1.47; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 40px; }
.display { font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
.fine { font-size: 12px; color: var(--text-2); }
[hidden] { display: none !important; }

/* keycaps: menu-shortcut glyphs with a small body */
.kc, kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: var(--r-key); background: var(--key-bg); color: var(--key-fg);
  font: 600 12px/1 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; transition: transform 90ms;
}
.kc.dip, kbd.down { transform: scale(.88); }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hair); }
.nav .wrap { display: flex; align-items: center; height: 52px; gap: 28px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 22px; height: 22px; border-radius: 5px; flex: none; display: block; }
.nav-links { display: flex; align-items: center; gap: 24px; margin-left: auto; font-size: 13px; }
.nav-links a { color: var(--text-2); display: inline-flex; align-items: center; line-height: 1; }
.nav-links a.btn-primary { color: #fff; }
.tabs { display: flex; gap: 4px; }
.tabs a { color: var(--text-2); font-size: 13px; padding: 6px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.on { background: var(--surface); color: var(--text); font-weight: 600; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }
.who { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-2); }
.who form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; border: 0; cursor: pointer; font-family: inherit; white-space: nowrap; transition: transform 90ms; }
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary .kc { background: rgba(255,255,255,.22); color: #fff; }
.btn-grey { background: var(--surface); color: var(--text); }
.btn-quiet { background: transparent; color: var(--accent); }
.btn-lg { height: 48px; padding: 0 24px; font-size: 17px; }
.btn[disabled] { opacity: .45; cursor: default; }

/* flash: one short line under the nav */
.flash { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--text); color: var(--page);
  font-size: 13px; padding: 8px 16px; border-radius: 999px; max-width: calc(100% - 32px); animation: flash 4.5s ease forwards; pointer-events: none; }
@keyframes flash { 0% { opacity: 0; transform: translate(-50%, -6px); } 4%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* page heads and small pages */
.page { padding: 40px 0 120px; }
.page-head h1 { font-size: 34px; font-weight: 700; letter-spacing: -.022em; line-height: 1.1; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }
.narrow { max-width: 560px; margin: 0 auto; }
.section-title { font-size: 22px; font-weight: 600; letter-spacing: -.015em; margin: 40px 0 12px; }

/* forms */
.form { display: grid; gap: 16px; margin-top: 28px; }
.field { display: grid; gap: 6px; }
.field label, .legend { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 13px; color: var(--text-2); }
.input, select.input { height: 44px; border-radius: var(--r-md); border: 1px solid var(--hair-strong); background: var(--page); color: var(--text);
  padding: 0 14px; font: 17px/1 inherit; font-family: inherit; width: 100%; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { background: color-mix(in srgb, var(--fail) 10%, var(--page)); color: var(--text); border-radius: var(--r-md); padding: 10px 14px; font-size: 15px; }
.spaced { margin-top: 14px; }
.form .acts { display: flex; gap: 12px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.choice { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: start; padding: 14px 16px; border: 1px solid var(--hair); border-radius: var(--r-lg); cursor: pointer; }
.choice + .choice { margin-top: 8px; }
.choice input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--accent); }
.choice b { display: block; font-weight: 600; }
.choice span { font-size: 13px; color: var(--text-2); }
.choice .side { text-align: right; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.choice .side b { color: var(--text); }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.group-box { background: var(--surface); border-radius: var(--r-lg); padding: 18px 20px; }
.group-box h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.group-box p { margin: 0 0 12px; color: var(--text-2); font-size: 13px; }
.group-box .choice { background: var(--page); }

/* the bottom key bar on app pages */
.keybar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--hair); }
.keybar .wrap { height: 48px; display: flex; align-items: center; justify-content: flex-end; gap: 28px; font-size: 12px; color: var(--text-2); }
.keybar .g { display: flex; align-items: center; gap: 6px; }
.keybar .g .kc { min-width: 18px; height: 18px; font-size: 11px; }
.keybar .left { margin-right: auto; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* sheets and the ? help */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); display: none; place-items: center; z-index: 40; padding: 16px; }
.scrim.open { display: grid; }
.sheet { width: 100%; max-width: 520px; max-height: 90dvh; overflow: auto; background: var(--page); border-radius: 14px; box-shadow: var(--shadow-sheet), var(--sheet-edge); padding: 24px; animation: rise 160ms var(--spring); }
@keyframes rise { from { transform: translateY(8px) scale(.985); } to { transform: none; } }
.sheet h3 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
.sheet .sub { margin: 2px 0 18px; color: var(--text-2); font-size: 13px; }
.sheet .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.help-group { background: var(--surface); border-radius: var(--r-lg); padding: 6px 14px; margin-top: 10px; }
.help-group h4 { margin: 8px 0 2px; font-size: 11px; font-weight: 600; color: var(--text-2); }
.help-group .krow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; font-size: 15px; border-top: 1px solid var(--hair); }
.help-group .krow:first-of-type { border-top: 0; }
.help-group .krow .k { display: flex; gap: 4px; flex: none; }
.help-group .krow .note { display: block; font-size: 13px; color: var(--text-2); }

/* lines: money sheets and ledgers */
.lines-list { border-top: 1px solid var(--hair); }
.line { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--hair); font-size: 15px; }
.line > span:first-child { color: var(--text-2); }
.line.total { font-size: 19px; font-weight: 700; letter-spacing: -.01em; border-bottom: 0; padding-top: 14px; }
.line.total > span:first-child { color: var(--text); }

/* small footer on app pages */
.site-foot { border-top: 1px solid var(--hair); margin-top: 64px; padding: 18px 0 72px; font-size: 12px; color: var(--text-2); display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; }
.site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-foot a { color: var(--text-2); }

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .nav .wrap { gap: 12px; }
  .nav-links a:not(.btn) { display: none; }
  .tabs a { padding: 6px 8px; }
  .who span { display: none; }
  .two { grid-template-columns: 1fr; }
  .keybar .g:not(.keep), .keybar .left { display: none; }
  .keybar .wrap { justify-content: space-between; gap: 12px; }
  .page-head h1 { font-size: 28px; }
}
@media (max-width: 520px) {
  .tabs { gap: 0; }
  .tabs a { font-size: 12px; padding: 6px 6px; }
  .who { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .flash { animation: none; }
  .btn, .kc, kbd { transition: none; }
}

/* small shared helpers used by templates (CSP forbids inline style attributes) */
.spaced-lg { margin-top: 28px; }
.spaced-xl { margin-top: 40px; }
.plain { padding-left: 18px; color: var(--text-2); display: grid; gap: 6px; }
.rules .rule-list { margin: 0; border-top: 1px solid var(--hair); }
.rules .rule-list dt { font-size: 17px; font-weight: 600; letter-spacing: -.01em; padding-top: 16px; }
.rules .rule-list dd { margin: 4px 0 0; padding-bottom: 16px; border-bottom: 1px solid var(--hair); color: var(--text-2); }
