/* Spyder Solutions app family: components. Load after tokens.css (and accents.css if used).
   Class names follow PaidKindly's (.btn, .field, .card, .table …) so PaidKindly can adopt this with few changes.
   Works with server-rendered HTML under a strict CSP: no inline styles, no scripts needed.
   React/TS apps: use the same class names (className="btn btn--primary"). */

/* ── Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: var(--weight-body) var(--text-base)/var(--leading) var(--font);
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent-dark); }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; font-weight: var(--weight-bold); }
h1 { font-size: var(--h1); }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); }
p { margin: 0 0 1em; }
code, kbd { font: .88em var(--mono); background: var(--sunken); padding: 1px 6px; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-6) 0; }
/* Two-tone focus ring: 2px ink next to the element, then 3px gold. The ink part gives 3:1+ on white and cream,
   the gold part keeps PaidKindly's look and shows on dark fills. */
:focus-visible { outline: 3px solid var(--focus-outer); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-inner); border-radius: 4px; }
[hidden] { display: none !important; }
[data-density] { font-size: var(--text-base); }   /* a compact or site wrapper re-sets the base size */

/* Utilities (the CSP blocks style="", so use these) */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--space-4); }
@media (min-width: 700px) { .wrap { padding: 0 var(--space-6); } }
.narrow { max-width: var(--max-narrow); margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.w-full { width: 100%; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: var(--space-2); } .mt-16 { margin-top: var(--space-4); }
.mt-24 { margin-top: var(--space-6); } .mt-32 { margin-top: var(--space-8); } .mb-0 { margin-bottom: 0; }
.stack { display: grid; gap: var(--space-4); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 50; }
.skip:focus { left: 8px; }
.eyebrow { color: var(--accent-dark); font-weight: var(--weight-bold); font-size: var(--text-xs); letter-spacing: .08em; text-transform: uppercase; margin: 0 0 .3em; }
.lead { font-size: 1.15rem; color: var(--muted); }

/* ── Logo lockup: icon + two-weight wordmark (Paid**Kindly**) ─────── */
.logo { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--ink); font-weight: var(--weight-heavy); font-size: 1.2rem; letter-spacing: -.01em; }
.logo:hover { color: var(--ink); }
.logo img, .logo svg { width: 28px; height: 28px; flex: none; }
.logo-text > span { color: var(--accent); }
.logo--lg { font-size: 1.8rem; gap: var(--space-3); }
.logo--lg img, .logo--lg svg { width: 44px; height: 44px; }

/* "by Spyder Solutions" endorsement */
.endorse { font-size: var(--text-xs); color: var(--muted); font-weight: var(--weight-strong); letter-spacing: .01em; white-space: nowrap; }
.endorse a { color: inherit; text-decoration: none; }
.endorse a:hover { color: var(--ink); text-decoration: underline; }
.logo-block { display: inline-grid; gap: 0; line-height: 1.15; }
.logo-block .endorse { padding-left: 36px; }               /* lines up under the wordmark, not the icon */
.logo--lg + .endorse { padding-left: 56px; }

/* ── App shell: top bar ───────────────────────────────────────────── */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(251, 248, 242, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--topbar); }
.nav { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); font-weight: var(--weight-strong); font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
.nav .btn, .nav .btn:hover { color: inherit; box-shadow: none; }
.nav .btn--primary, .nav .btn--primary:hover { color: var(--on-accent); }
.nav form { margin: 0; }
@media (max-width: 759px) {
  .site-header .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; row-gap: 6px; }
  .site-header .nav { width: 100%; justify-content: space-between; gap: var(--space-2); }
  .site-header .nav a { font-size: .88rem; }
}
.app-main { padding-top: var(--space-8); padding-bottom: var(--space-16); }

/* ── App shell: sidebar (for apps with many sections) ─────────────── */
.shell { display: grid; min-height: 100vh; grid-template-columns: 1fr; }
@media (min-width: 960px) { .shell { grid-template-columns: var(--sidebar) 1fr; } }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: var(--space-4) var(--space-3); display: flex; flex-direction: column; gap: var(--space-4); }
@media (max-width: 959px) { .sidebar { border-right: 0; border-bottom: 1px solid var(--line); } }
.sidebar .logo-block { padding: var(--space-1) var(--space-2) var(--space-2); }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: var(--space-2); padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-weight: var(--weight-strong); }
.side-nav a:hover { background: var(--sunken); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); }
.side-nav .side-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: var(--weight-bold); padding: var(--space-3) 10px var(--space-1); }
.sidebar-foot { margin-top: auto; padding: var(--space-2) 10px 0; border-top: 1px solid var(--line); }
.shell-main { padding: var(--space-6) var(--space-4) var(--space-16); min-width: 0; }
@media (min-width: 700px) { .shell-main { padding: var(--space-8); } }

/* Page heading row */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.page-head h1, .page-head h2 { margin: 0; }
.crumbs { font-size: var(--text-sm); color: var(--muted); margin-bottom: var(--space-2); }
.crumbs a { color: var(--muted); }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); white-space: nowrap;
  padding: 11px 22px; border-radius: var(--radius-pill); border: 2px solid transparent;
  font: var(--weight-bold) 1rem var(--font); text-decoration: none; cursor: pointer;
  background: var(--surface); color: var(--ink);
  transition: background .15s, color .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-dark); color: var(--on-accent); }
.btn--ghost { background: transparent; color: var(--accent-dark); border-color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--quiet:hover { background: var(--sunken); color: var(--ink); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn--sun { background: var(--sun); color: var(--ink); }
.btn--sun:hover { background: #ffc85e; color: var(--ink); }
.btn--small { padding: 6px 14px; font-size: var(--text-sm); }
.btn--link { background: none; border: 0; padding: 0; color: var(--accent-dark); text-decoration: underline; font-weight: var(--weight-strong); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-5); }

/* ── Forms ────────────────────────────────────────────────────────── */
.field { margin-bottom: var(--space-5); }
.field label, .field legend { display: block; font-weight: var(--weight-bold); margin-bottom: 6px; }
.field .hint, .hint { font-weight: 400; color: var(--muted); font-size: var(--text-sm); }
.field .hint { display: block; margin-top: 4px; }
.field label .hint, .field legend .hint { display: inline; margin: 0 0 0 6px; }
.input,
.field input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-input);
  background: var(--surface); font: inherit; color: var(--ink);
}
.field textarea { min-height: 110px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
/* Inputs show focus with the accent border (5.01:1 or more against white and cream for every accent) plus a soft glow. */
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: var(--text-sm); font-weight: var(--weight-strong); margin: 6px 0 0; }
fieldset.field { border: 0; padding: 0; margin-left: 0; margin-right: 0; }
.field-row { display: grid; gap: 0 var(--space-4); }
@media (min-width: 700px) { .field-row { grid-template-columns: 1fr 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; margin-bottom: var(--space-2); }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: inline-block; padding: 7px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); cursor: pointer; font-size: .95rem; background: var(--surface); }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: var(--weight-bold); }
.choice input:focus-visible + span { outline: 3px solid var(--focus-outer); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-inner); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }  /* honeypot field */
.inline { display: inline; margin: 0; }

/* ── Cards, panels, stats ─────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-6); }
.card > :last-child { margin-bottom: 0; }
.card--raised { box-shadow: var(--shadow); }
.card--accent { border-top: 4px solid var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6) var(--space-5); }
@media (min-width: 700px) { .panel { padding: 36px; } }
.auth-card { align-self: start; max-width: 460px; margin: var(--space-12) auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px var(--space-6); box-shadow: var(--shadow); }
.grid { display: grid; gap: var(--space-5); }
@media (min-width: 700px) { .grid--2 { grid-template-columns: repeat(2, 1fr); } .grid--3 { grid-template-columns: repeat(3, 1fr); } .grid--4 { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px var(--space-5); display: grid; gap: 2px; }
.stat-label { color: var(--muted); font-size: var(--text-sm); font-weight: var(--weight-strong); }
.stat-value { font-size: 1.7rem; font-weight: var(--weight-heavy); font-variant-numeric: tabular-nums; }
.stat-value--warn { color: var(--danger); }
.stat-sub { color: var(--muted); font-size: .85rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--space-5); margin: var(--space-4) 0; }
.facts dt { color: var(--muted); font-weight: var(--weight-strong); }
.facts dd { margin: 0; }

/* ── Tables ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table thead th { background: var(--sunken); color: var(--muted); font-weight: var(--weight-strong); font-size: .85rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fdfbf7; }
.table .num { text-align: right; }
.table td.wrap-ok { white-space: normal; }
.table a { font-weight: var(--weight-strong); text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* Status pills: meaning colours are fixed across apps */
.status { display: inline-block; font-size: .78rem; font-weight: var(--weight-bold); padding: 2px 10px; border-radius: var(--radius-pill); background: var(--sunken); color: var(--muted); }
.status--ok { background: var(--ok-soft); color: var(--ok-ink); }
.status--warn { background: var(--warn-soft); color: var(--warn-ink); }
.status--danger { background: var(--danger-soft); color: var(--danger-ink); }
.status--info { background: var(--info-soft); color: var(--info-ink); }
.status--accent { background: var(--accent-soft); color: var(--accent-dark); }
.badge { display: inline-block; background: var(--sun-soft); color: var(--sun-ink); font-weight: var(--weight-bold); font-size: var(--text-xs); padding: 4px 10px; border-radius: var(--radius-pill); }

/* Tabs (links or buttons) */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.tab { padding: 6px 14px; border-radius: var(--radius-pill); text-decoration: none; color: var(--muted); font-weight: var(--weight-strong); border: 1.5px solid var(--line); background: var(--surface); font-size: .95rem; }
.tab:hover { color: var(--ink); border-color: var(--line-strong); }
.tab--active, .tab[aria-current="page"] { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }

/* ── Alerts ───────────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-input); padding: 12px 14px; margin-bottom: var(--space-4); font-weight: var(--weight-strong); border: 1px solid transparent; }
.alert p { margin: 0; font-weight: 400; }
.alert strong { display: block; }
.alert--ok { background: var(--ok-soft); color: var(--ok-ink); border-color: #bfe0cc; }
.alert--info { background: var(--info-soft); color: var(--info-ink); border-color: #c4d7f3; }
.alert--warn { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--sun); }
.alert--danger { background: var(--danger-soft); color: var(--danger-ink); border-color: #efc3bf; }
/* PaidKindly's older names */
.form-msg { border-radius: var(--radius-input); padding: 12px 14px; margin-bottom: var(--space-4); font-weight: var(--weight-strong); }
.form-msg--error { background: var(--danger-soft); color: var(--danger); }
.form-msg--ok { background: var(--ok-soft); color: var(--ok-ink); }

/* ── Empty state ──────────────────────────────────────────────────── */
.empty { border: 2px dashed var(--line); border-radius: var(--radius); padding: var(--space-8) var(--space-6); text-align: center; background: transparent; }
.empty-icon { width: 48px; height: 48px; margin: 0 auto var(--space-3); border-radius: 14px; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; }
.empty-icon svg { width: 26px; height: 26px; }
.empty h2, .empty h3 { margin-bottom: .3em; }
.empty p { color: var(--muted); max-width: 440px; margin-left: auto; margin-right: auto; }

/* ── Danger zone ──────────────────────────────────────────────────── */
.danger-zone { margin-top: 28px; padding-top: var(--space-4); border-top: 1px solid var(--line); display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

/* ── Footer: "by Spyder Solutions" and cross-links ────────────────── */
.site-footer { padding: var(--space-8) 0 var(--space-12); color: var(--muted); font-size: var(--text-sm); border-top: 1px solid var(--line); margin-top: var(--space-12); }
.site-footer .links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin-bottom: var(--space-4); }
.site-footer .links a { color: var(--muted); }
.site-footer .maker { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-strong); color: var(--ink); margin-bottom: var(--space-2); }
.site-footer .legal-line { max-width: var(--max-narrow); margin: 0; }
.family { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: var(--space-2) 0 var(--space-4); padding: 0; list-style: none; }
.family a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: var(--weight-strong); }
.family a:hover { color: var(--ink); }
.family .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
