/* ─────────────────────────────────────────────────────────────────────────
   Otra — components
   Colour, spacing, type and radius all come from tokens.css, which base.html
   loads first. Nothing here may introduce a raw hex: if a value isn't in the
   token set, add it there.

   Fonts: Archivo (display, matching the wordmark) + DM Sans (body), loaded in
   base.html so the preconnect can do its job.
───────────────────────────────────────────────────────────────────────── */

/* ── Legacy aliases ──────────────────────────────────────────────────────
   These screens were built against the old gold palette. Rather than rewrite
   every rule at once, the old names now point at tokens — so the whole app
   moves to the Otra palette, and gains light mode, in one step. Each alias
   retires as its screen is rebuilt; new code uses token names directly. */
:root {
  --black:        var(--bg-deep);
  --dark:         var(--bg);
  --dark-2:       var(--surface);
  --dark-3:       var(--raised);
  --dark-4:       var(--raised-2);
  --border:       var(--line);
  --border-light: var(--line-strong);
  --text:         var(--ink);
  --text-muted:   var(--ink-muted);
  --text-faint:   var(--ink-faint);
  --gold:         var(--act);       /* the resting action colour */
  --gold-light:   var(--act-hot);   /* what it becomes on hover */
  --gold-dark:    var(--act-press);
  --green:        var(--good);
  --red:          var(--danger);
  --blue:         var(--info);
  --radius:       var(--radius-sm);
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold-light); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }

/* ── Typography ─────────────────────────────────────────────────────────
   Archivo is a heavier face than the serif it replaced, so the display sizes
   come down a step and tighten up; at the old sizes they shouted. */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p  { color: var(--ink-muted); line-height: 1.7; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}
/* Purple rests, orange responds. The label flips to near-black on the orange
   because white on it measures 2.9:1 and fails. */
.btn-primary  { background: var(--act); color: var(--on-act); border-color: var(--act); }
.btn-primary:hover {
  background: var(--act-hot); border-color: var(--act-hot); color: var(--on-hot);
}
.btn-primary:active {
  background: var(--act-press); border-color: var(--act-press); color: var(--on-hot);
}
.btn-outline  { background: transparent; color: var(--ink-muted); border-color: var(--line); }
.btn-outline:hover { border-color: var(--act-hot); color: var(--orange-text); }
.btn-ghost    { background: transparent; color: var(--ink-muted); border-color: transparent; }
.btn-ghost:hover { color: var(--orange-text); }
.btn-danger   { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn[disabled], .btn:disabled {
  background: var(--raised); border-color: var(--line); color: var(--ink-faint);
  cursor: not-allowed;
}
.btn[disabled]:hover, .btn:disabled:hover {
  background: var(--raised); border-color: var(--line); color: var(--ink-faint);
}

/* Keyboard users get the same signal the mouse gets. */
.btn:focus-visible,
.form-control:focus-visible,
a:focus-visible {
  outline: 2px solid var(--act-hot);
  outline-offset: 2px;
}
/* A submit that's taking a moment (static/js/orbs.js): a small orb and a
   "Sending…" label. It stays in its resting colour — no hover flip to orange
   while it can't be pressed. */
.is-busy { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; cursor: progress; }
.btn-primary.is-busy, .btn-primary.is-busy:hover {
  background: var(--act); border-color: var(--act); color: var(--on-act);
}
.btn-orb { flex: none; }

.btn-sm  { padding: .35rem .8rem;  font-size: .78rem; }
.btn-lg  { padding: .75rem 1.8rem; font-size: .95rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: .45rem;
}

.form-control {
  width: 100%;
  background: var(--dark-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: .7rem 1rem;
  font-size: .9rem;
  transition: border-color .15s, background .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--act-hot);   /* focus is a response, so it's orange */
  background: var(--raised-2);
}
.form-control::placeholder { color: var(--text-faint); }
.form-control.is-invalid { border-color: var(--red); }

.form-error {
  font-size: .76rem;
  color: var(--red);
  margin-top: .35rem;
}

.form-hint {
  font-size: .76rem;
  color: var(--text-faint);
  margin-top: .35rem;
}

/* Two-column form grid */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ── Auth pages ──────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  padding: 2rem 1rem;
}

.auth-wrap {
  width: 100%;
  max-width: 440px;
}

/* ── Otra's logo (partials/brand_mark.html) ───────────────────────────────
   Two overlapping circles and the wordmark, drawn in CSS rather than loaded
   as an image: no request, and it recolours with the theme (the wordmark
   follows the text colour, like the dark "otra" in logo/otra.jpeg).
   Proportions measured from logo/otra.jpeg, in em so the whole mark scales
   with font-size: circles 1em; the purple one .441em right of the orange and
   on top; the hole (radius .2765em) centred .72em in. The hole is cut with a
   mask — a real hole, right on any background. */
.brand-mark { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); }
.brand-mark:hover { color: var(--ink); }
.brand-dots {
  position: relative; display: inline-block; flex-shrink: 0;
  font-size: 17px; width: 1.4706em; height: 1em;
  -webkit-mask: radial-gradient(circle at .7206em .5em, transparent .2765em, #000 .2941em);
          mask: radial-gradient(circle at .7206em .5em, transparent .2765em, #000 .2941em);
}
.brand-dots i {
  position: absolute; top: 0; display: block;
  width: 1em; height: 1em; border-radius: 50%;
}
.brand-dots i:nth-of-type(1) { left: 0; background: var(--act-hot); }
.brand-dots i:nth-of-type(2) { left: .4412em; background: var(--act); }
.brand-word {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -.04em;
  text-transform: lowercase;          /* the logo's wordmark is "otra" */
}
/* Larger, for the sign-in screens. */
.brand-mark-lg { gap: .65rem; }
.brand-mark-lg .brand-dots { font-size: 30px; }
.brand-mark-lg .brand-word { font-size: 2.1rem; }
/* The circles alone, as a big icon (empty states, the 404 page). */
.brand-dots-icon { font-size: 44px; }

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo p {
  font-size: .78rem;
  color: var(--text-faint);
  margin-top: .2rem;
  letter-spacing: .05em;
}

.auth-card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.75rem;
}

/* The card's title is the page's h1 (one per page, for screen-reader
   navigation); h2 kept so nothing else that uses it changes. */
.auth-card h1,
.auth-card h2 {
  font-size: 1.5rem;
  margin-bottom: .35rem;
}
.auth-card .auth-subtitle {
  font-size: .83rem;
  color: var(--text-faint);
  margin-bottom: 1.75rem;
}

/* Plan prices on the business signup page (ADR 0004, decision 16). */
.signup-plans {
  margin: -1rem 0 1.5rem;
  padding: .75rem .9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .8rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.signup-plans p { margin: 0; }
.signup-plans strong { color: var(--text); }
.signup-plans .signup-plans-lock { margin-top: .35rem; color: var(--text-faint); }

.auth-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.auth-footer {
  text-align: center;
  font-size: .8rem;
  color: var(--text-faint);
  margin-top: 1.25rem;
}

/* Slug preview pill */
.slug-preview {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--dark-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .9rem;
  font-size: .78rem;
  color: var(--text-faint);
  margin-top: .5rem;
  transition: border-color .2s;
}
.slug-preview span { color: var(--gold); font-weight: 500; }

/* Password strength bar. The colour is keyed off data-strength rather than set
   from JavaScript, so it follows the theme like everything else. */
.pw-strength {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--line);
  margin-top: .5rem;
  overflow: hidden;
}
.pw-strength-bar {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: transparent;
  transition: width .3s, background .3s;
}
.pw-strength-bar[data-strength="0"] { background: var(--danger); }
.pw-strength-bar[data-strength="1"] { background: var(--warn); }
.pw-strength-bar[data-strength="2"] { background: var(--act); }
.pw-strength-bar[data-strength="3"] { background: var(--good); }

.form-control.is-valid { border-color: var(--good); }

/* Verification screens — shared by both portals. --accent resolves to Otra's
   purple here and to the shop's colour under /<slug>/. */
.verify-icon { font-size: 2.2rem; text-align: center; margin-bottom: var(--sp-2); }
.verify-target {
  display: block;
  text-align: center;
  font-weight: 600;
  color: var(--accent);
  margin: .35rem 0 var(--sp-4);
  word-break: break-all;
}

/* Visible to screen readers, invisible on screen. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Skip link ─────────────────────────────────────────────────────────
   The first thing Tab reaches on every page: jumps past the navigation to
   the page's content (#main). Off-screen until focused, so it costs mouse
   users nothing. */
.skip-link {
  position: absolute;
  top: .75rem;
  left: .75rem;
  z-index: 10000;
  padding: .6rem 1rem;
  border-radius: var(--radius);
  background: var(--act);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; outline: 2px solid var(--act-hot); outline-offset: 2px; }
/* The skip target takes focus so Tab continues from there, but it's a
   region, not a control — no ring around the whole page. */
#main:focus { outline: none; }

/* ── Disclosure ──────────────────────────────────────────────────────────
   A <details> used as a "show me the rest" toggle. Shared, because both the
   customer area and the portal need one and neither should need a script. */
.change-details summary {
  display: inline-block;
  padding: .4rem 0;
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  text-decoration: underline;
  cursor: pointer;
  list-style: none;
}
.change-details summary::-webkit-details-marker { display: none; }
.change-details summary:hover { color: var(--orange-text); }
.change-details summary:focus-visible { outline: 2px solid var(--act-hot); outline-offset: 2px; }
.change-details[open] summary { margin-bottom: var(--sp-3); }

/* ── Theme switch ────────────────────────────────────────────────────────
   Otra's own chrome only. Sits quietly until hovered, like the rest of the
   secondary controls. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .7rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.theme-toggle:hover { border-color: var(--act-hot); color: var(--orange-text); }
.theme-toggle:focus-visible { outline: 2px solid var(--act-hot); outline-offset: 2px; }

/* Half-filled dot: the same mark reads correctly in either theme. */
.theme-toggle-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: linear-gradient(to right, currentColor 50%, transparent 50%);
  flex-shrink: 0;
}

/* ── Flash messages ──────────────────────────────────────────────────── */
.flash-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 360px;
  pointer-events: none;
}
.flash {
  padding: .8rem 1.1rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .6rem;
  pointer-events: all;
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  color: var(--text);
  animation: flashIn .25s ease;
}
.flash-success { border-left-color: var(--green); }
.flash-error   { border-left-color: var(--red);   }
.flash-info    { border-left-color: var(--gold);  }
.flash-text { flex: 1; }
.flash-close {
  margin-left: .25rem; padding: 0 .3rem; border: 0; background: none;
  color: var(--text-muted); font: inherit; font-size: 1.1rem; line-height: 1;
  cursor: pointer; border-radius: 4px;
}
.flash-close:hover { color: var(--text); }
.flash-close:focus-visible { outline: 2px solid var(--act-hot); outline-offset: 2px; }
@keyframes flashIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Where the rest went ─────────────────────────────────────────────────
   The dashboard sidebar, stat cards, queue rows, tables and chart styles
   moved to static/portal.css; the shop-facing screens are in
   static/customer.css. This file is only what both areas share. */
