/* base.css — reset, typography, layout shell, forms, buttons, badges, tables.
   Shared across marketing, auth, and the /accounts + /sa app shell. */

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: 17px;
  background: var(--ground);
  color: var(--ink);
  line-height: 1.6;
  transition: background 0.2s ease, color 0.15s ease;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
.mt-2 { margin-top: 0.75rem; }

/* —— Marketing / auth shell —— */
.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}
.wrap-wide { max-width: var(--wrap); }

/* Marketing bands run full-bleed, so the wrap stops constraining them and the
   topbar takes over the centring instead. */
.is-marketing .wrap { padding-left: 0; padding-right: 0; max-width: none; }
.is-marketing .topbar { max-width: var(--wrap); margin: 0 auto 28px; padding: 0 20px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}
.brand-logo { width: 28px; height: 28px; border-radius: 50%; }
.brand-logo-dark { display: none; }
html[data-theme="dark"] .brand-logo-light { display: none; }
html[data-theme="dark"] .brand-logo-dark { display: block; }
.nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.nav a:hover { color: var(--ink); }
/* Duplicate theme-toggle button for mobile (see layout.php): hidden on
   desktop, shown standalone next to the hamburger at <=900px, while the
   copy inside .nav[data-nav] is hidden at that width instead. */
.topbar-toggle-standalone { display: none; }

h1, h2, h3, .price-amount, .stat-value {
  font-family: var(--font-display);
  font-weight: 700; /* Lato has no 600 (static weights only: 400/700/900) */
  letter-spacing: -0.02em;
}
/* Sizes come from the type scale in tokens.css (--fs-h1, --fs-h2, ...) —
   change a size there, it updates every heading that uses it. */
h1 { font-size: var(--fs-h1); margin: 0 0 12px; }
h2 { font-size: var(--fs-h2); margin: 0 0 12px; }
h3 { font-size: var(--fs-h3); font-family: var(--font-body); font-weight: 600; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; font-size: var(--fs-lead); max-width: 52ch; }

.card {
  background: var(--panel-alpha);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 25px 25px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.auth-card {
  max-width: 460px;
  margin: 64px auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 30px;
  box-shadow: var(--shadow);
}
.auth-card .lead { font-size: 1rem; margin-bottom: 24px; }
.auth-card .btn-primary { width: 100%; padding: 13px; font-size: 1rem; }
.auth-card .btn-row { flex-direction: column; align-items: stretch; }
.auth-trust {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 12px 0 6px;
}
input:not([type]),
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--link-ring);
  border-color: var(--link-ring);
}
textarea { min-height: 88px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--ground-alt);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-primary {
  /* Inverted, not coloured: white pill on the dark theme, near-black on the
     light one. The hardcoded #fff here used to be safe only because the fill
     was always dark. */
  background: var(--cta-bg);
  border-color: transparent;
  color: var(--cta-ink);
}
.btn-ghost {
  background: transparent;
}
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.impersonate-banner {
  background: #7a3b12;
  color: #fff8f0;
  padding: 10px 18px;
  text-align: center;
  font-size: 0.95rem;
  border-bottom: 2px solid #f0c14b;
  position: sticky;
  top: 0;
  z-index: 50;
}
.impersonate-banner strong { color: #f0c14b; }

.flash {
  background: rgba(143, 191, 138, 0.15);
  border: 1px solid rgba(143, 191, 138, 0.35);
  color: var(--sage);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.error {
  background: rgba(240, 113, 120, 0.12);
  border: 1px solid rgba(240, 113, 120, 0.35);
  color: var(--danger);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--link-soft);
  color: var(--link);
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-warn {
  background: rgba(240, 193, 75, 0.15);
  color: var(--warn);
}
.badge-ok {
  background: rgba(143, 191, 138, 0.15);
  color: var(--sage);
}
.badge-muted {
  background: rgba(238, 242, 248, 0.08);
  color: var(--muted);
}

table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* —— Tablet / small-laptop —— */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; }
  .topbar-toggle-standalone { display: inline-flex; }
  #nav-theme-toggle { display: none; } /* superseded by .topbar-toggle-standalone at this width */
  .nav[data-nav] {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  .nav[data-nav].is-open { display: flex; }
  .nav[data-nav] a {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 1rem;
    color: var(--ink); /* full contrast in the mobile menu, vs. the muted desktop nav color */
  }
  .nav[data-nav] .btn { width: 100%; min-height: 44px; }

  table.data { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}

/* —— Phone —— */
@media (max-width: 520px) {
  .wrap { padding: 16px 14px 48px; }
  .card { padding: 16px 16px; }
  .btn { min-height: 44px; }
  .btn-row .btn { flex: 1 1 auto; }
}

/* —— Accessibility: skip link + focus-visible —— */
.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: 1000;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 12px;
}
:focus-visible {
  /* Solid --link, not the translucent --link-ring: an outline needs full
     contrast against whatever it lands on. --link-ring stays for the softer
     box-shadow rings on cards and inputs. */
  outline: 2px solid var(--link);
  outline-offset: 2px;
}
