/* SurgeIQ design system — white-background product UI.
   System font stack (no external deps), one near-black primary, emerald accent,
   semantic state colors, tabular numerals for data. No italics. */

:root {
  --bg: #ffffff;
  --panel: #fafafa;
  --text: #18181b;
  --muted: #71717a;
  --faint: #a1a1aa;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;

  --primary: #18181b;
  --primary-hover: #27272a;
  --accent: #047857;          /* emerald — surge / positive / links */
  --accent-soft: #ecfdf5;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;

  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  /* Layered shadow-as-border: 1px ring + lift + ambient depth (adapts to any bg). */
  --shadow-border:
    0 0 0 1px rgba(0, 0, 0, .06),
    0 1px 2px -1px rgba(0, 0, 0, .06),
    0 2px 4px 0 rgba(0, 0, 0, .04);
  --shadow-border-hover:
    0 0 0 1px rgba(0, 0, 0, .08),
    0 1px 2px -1px rgba(0, 0, 0, .08),
    0 4px 10px -2px rgba(0, 0, 0, .07);
  --shadow-lift: 0 8px 24px -6px rgba(0, 0, 0, .12), 0 0 0 1px rgba(0, 0, 0, .06);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  text-wrap: pretty;            /* avoid orphans in body copy */
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.011em; text-wrap: balance; }
h1 { font-size: 26px; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* tabular figures wherever numbers carry meaning */
.num, .surge, .commission, .badge, table, time { font-variant-numeric: tabular-nums; }

/* ---- skip link (a11y) ---- */
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--primary); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 12px; text-decoration: none; }

/* ---- top navigation ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand {
  color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: 8px;
}
.topbar .brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.topbar nav { display: flex; gap: 4px; align-items: center; }
.topbar nav a {
  color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 500; transition: background .15s, color .15s;
}
.topbar nav a:hover { color: var(--text); background: #f4f4f5; text-decoration: none; }
.topbar nav a.active { color: var(--text); background: #f4f4f5; }

.container { max-width: 1080px; margin: 32px auto 64px; padding: 0 24px; }
.container.narrow { max-width: 460px; }

.page-head { margin-bottom: 20px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---- buttons ---- */
.btn, .act {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 550; line-height: 1; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, scale .1s ease, box-shadow .15s ease;
  background: var(--primary); color: #fff;
}
.btn:hover, .act:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }
.btn:active, .act:active { scale: 0.97; }   /* tactile press feedback */
.btn:focus-visible, .act:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn[disabled], .act[disabled] { opacity: .45; cursor: not-allowed; }

.btn.secondary, .act.secondary {
  background: var(--bg); color: var(--text); border-color: var(--border);
}
.btn.secondary:hover, .act.secondary:hover { background: var(--panel); color: var(--text); border-color: var(--border-strong); }

.btn.danger, .act.danger {
  background: var(--bg); color: var(--danger); border-color: var(--border);
}
.btn.danger:hover, .act.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }

.linkbtn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px 10px; font-size: 14px; font-weight: 500; border-radius: var(--radius-sm); }
.linkbtn:hover { color: var(--text); background: #f4f4f5; }
.inline { display: inline; }

/* Native buttons (e.g. allauth's built-in forms) get the primary look. */
button:not(.act):not(.btn):not(.linkbtn) {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 550; cursor: pointer;
  background: var(--primary); color: #fff; transition: background .15s, transform .05s;
}
button:not(.act):not(.btn):not(.linkbtn) { min-height: 40px; transition: background .15s ease, scale .1s ease; }
button:not(.act):not(.btn):not(.linkbtn):hover { background: var(--primary-hover); }
button:not(.act):not(.btn):not(.linkbtn):active { scale: 0.97; }

/* ---- cards / lead rows ---- */
.card {
  background: var(--bg); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-border);
}
.card + .card { margin-top: 12px; }

.lead {
  background: var(--bg); border-radius: var(--radius-lg);
  padding: 16px 18px; margin-bottom: 10px; box-shadow: var(--shadow-border);
  transition: box-shadow .15s ease, translate .15s ease;
}
.lead:hover { box-shadow: var(--shadow-border-hover); translate: 0 -1px; }
.lead h3 a { color: var(--text); }
.lead h3 a:hover { color: var(--accent); }
.lead .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.stat-right { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.surge { font-weight: 600; font-size: 13px; color: var(--text); }
.surge b { color: var(--accent); }
.commission { font-size: 13px; color: var(--muted); }
.commission b { color: var(--text); font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---- status badges (no dot, no glow) ---- */
.badge {
  display: inline-block; font-size: 12px; font-weight: 600; line-height: 1;
  padding: 4px 8px; border-radius: var(--radius-sm); letter-spacing: .005em;
  background: #f4f4f5; color: #52525b; border: 1px solid var(--border);
}
.badge.UNCLAIMED { background: var(--accent-soft); color: #047857; border-color: #a7f3d0; }
.badge.RESERVED  { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge.CLAIMED   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge.SUPPRESSED{ background: #f4f4f5; color: #52525b; border-color: var(--border); }

/* ---- forms ---- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
input, textarea, select {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field { margin-bottom: 14px; }
.form-row { display: flex; gap: 8px; align-items: flex-end; }
.form-row input { flex: 1; }
form p { margin-bottom: 14px; }

/* ---- inline panels (notes / follow-ups) ---- */
.list-item { padding: 12px 0; border-top: 1px solid var(--border); }
.list-item:first-of-type { border-top: none; }
.list-item .when { color: var(--faint); font-size: 12px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }

/* ---- empty state ---- */
.empty {
  text-align: center; color: var(--muted); padding: 56px 24px;
  border: 1px dashed var(--border); border-radius: var(--radius-lg); background: var(--panel);
}
.empty strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }

/* ---- messages / toast ---- */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); color: #065f46; border: 1px solid #a7f3d0; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  background: var(--primary); color: #fff; padding: 11px 16px; border-radius: var(--radius);
  font-size: 14px; box-shadow: var(--shadow-lift); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); }

.muted { color: var(--muted); }
.back-link { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.back-link:hover { color: var(--text); }

/* ---- footer ---- */
.site-footer {
  max-width: 1080px; margin: 0 auto; padding: 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  color: var(--faint); font-size: 13px;
}
.site-footer nav { display: flex; gap: 16px; }
.site-footer a { color: var(--muted); }

/* ---- legal pages ---- */
.legal h2 { font-size: 16px; margin: 18px 0 6px; }
.legal p { color: var(--text); margin-bottom: 8px; max-width: 65ch; }

/* ---- staggered enter (split chunks, ~80-100ms apart); off for reduced motion ---- */
@media (prefers-reduced-motion: no-preference) {
  .page-head, .card, .lead {
    animation: fadeInUp .42s cubic-bezier(0.2, 0, 0, 1) backwards;
  }
  .page-head { animation-delay: 0ms; }
  .card { animation-delay: 60ms; }
  .lead:nth-of-type(1) { animation-delay: 80ms; }
  .lead:nth-of-type(2) { animation-delay: 160ms; }
  .lead:nth-of-type(3) { animation-delay: 240ms; }
  .lead:nth-of-type(4) { animation-delay: 300ms; }
  .lead:nth-of-type(5) { animation-delay: 350ms; }
  .lead:nth-of-type(n+6) { animation-delay: 400ms; }
}
@keyframes fadeInUp {
  from { opacity: 0; translate: 0 12px; filter: blur(4px); }
  to   { opacity: 1; translate: 0 0;    filter: blur(0); }
}
code { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 6px; font-size: 13px; word-break: break-all; }
