/* Design tokens + auth primitives, ported from @aotc/ui/styles.css (the Aqueduct design system).
   Light-only, IBM Plex. The pages are built against docs/mockups/login.html. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root {
  /* The DEFAULT theme — mapped 1:1 from aotc-main's design system (packages/ui/styles.css :root) so the
     pages match the existing mockups and the platform's styling. A dealer overrides any of these (see
     agents/theming.md); the values below are the starting point, not a constraint. */

  /* Base */
  --background: #ffffff;
  --foreground: #111827;
  --card: #ffffff;
  --card-border: #e5e7eb;
  --muted: #6b7280;
  --accent: #000000;
  --accent-hover: #1f2937;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;

  /* Surface hierarchy */
  --surface-subtle: #f8fafc;
  --surface-inset: #f1f5f9;
  --border-strong: #cbd5e1;
  --ring: #111827;

  /* Type */
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 0.9375rem;

  /* Radius / space */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;

  /* Elevation */
  --shadow-float: 0 1px 2px rgb(15 23 42 / 6%), 0 4px 12px rgb(15 23 42 / 4%);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);

  /* Direction & P&L — the ONE green/red pair */
  --up: #047857;
  --down: #be123c;
  --up-soft: #ecfdf5;
  --down-soft: #fff1f2;

  /* Micro / density */
  --text-micro: 0.625rem;
  --tracking-micro: 0.08em;
  --col-head-size: 0.71875rem;
  --col-head-weight: 500;
  --col-head-tracking: 0;
  --col-head-case: none;
  --table-cell: 0.8125rem;
  --table-cell-lh: 1.25rem;
  --table-row-pad: 0.5rem;
  --text-data: 0.8125rem;

  /* Status */
  --warn: #f59e0b;
  --warn-ink: #b45309;
  --warn-soft: #fffbeb;
  --warn-border: #fcd34d;
  --danger-solid: #ef4444;
  --danger-ink: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fca5a5;

  /* Neutral chrome + faint/placeholder ink */
  --org-accent: #64748b;
  --org-accent-hover: #475569;
  --org-accent-ring: #64748b;
  --org-accent-soft: #f1f5f9;
  --faint: #9ca3af;
  --accent-ink: #ffffff;
  --placeholder: #b9c0ca;

  /* Persona colours — the DEFAULT chrome per persona (design doc D12): purple super-admin, blue dealer,
     green customer. Overridable per dealer like every other token. */
  --persona-superadmin: #6d28d9;
  --persona-superadmin-soft: #f5f3ff;
  --persona-superadmin-border: #ddd6fe;
  --persona-superadmin-ink: #4c1d95;
  --persona-dealer: #1d4ed8;
  --persona-dealer-soft: #eff6ff;
  --persona-dealer-border: #bfdbfe;
  --persona-dealer-ink: #1e3a8a;
  --persona-customer: #15803d;
  --persona-customer-soft: #f0fdf4;
  --persona-customer-border: #bbf7d0;
  --persona-customer-ink: #14532d;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); font-size: var(--text-sm); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card {
  width: 100%; max-width: 24rem; border: 1px solid var(--card-border); border-radius: 0.75rem;
  background: var(--card); padding: 2rem; text-align: center; box-shadow: var(--shadow-sm);
}
.logo-wrap { display: flex; justify-content: center; margin-bottom: 1rem; }
.dealer-logo {
  height: 2.5rem; width: 2.5rem; border-radius: var(--radius-md); color: #fff;
  font-weight: 700; font-size: var(--text-xs); display: inline-flex; align-items: center;
  justify-content: center; line-height: 1;
}
.dealer-name { font-size: var(--text-sm); font-weight: 600; color: var(--foreground); margin-bottom: 0.25rem; }
.auth-card h2 { font-size: 1.125rem; font-weight: 600; color: var(--foreground); margin: 0.75rem 0 0; }
.auth-card .subtitle { margin-top: 0.5rem; font-size: var(--text-sm); color: var(--muted); }
.auth-body { margin-top: 1.5rem; text-align: left; }

.label { display: block; margin-bottom: 0.375rem; font-size: var(--text-xs); font-weight: 500; color: var(--muted); }
.input {
  width: 100%; border: 1px solid var(--card-border); padding: 0.5rem 0.75rem; font-size: var(--text-sm);
  border-radius: var(--radius-sm); background: var(--surface-inset); color: var(--foreground); font-family: inherit;
}
.input::placeholder { color: #9ca3af; }
.input:focus { outline: none; border-color: var(--ring); background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent); }

.btn-solid {
  width: 100%; margin-top: 1rem; padding: 0.5rem 0.75rem; font: inherit; font-weight: 600; font-size: var(--text-sm);
  color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius-md); cursor: pointer;
}
.btn-solid:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-solid:disabled { opacity: 0.4; cursor: not-allowed; }

.redirect { display: flex; align-items: center; justify-content: center; gap: 0.625rem; padding: 1.25rem 0 0.25rem; color: var(--muted); font-size: var(--text-sm); }
.spinner { height: 1rem; width: 1rem; border-radius: 9999px; border: 2px solid var(--card-border); border-top-color: var(--foreground); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.as { margin-top: 0.75rem; font-size: var(--text-sm); color: var(--muted); }
.as b { color: var(--foreground); font-weight: 500; }
.row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 0.75rem; }
.link { color: var(--accent); font-size: var(--text-xs); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.error { margin-top: 0.75rem; padding: 0.5rem 0.75rem; border: 1px solid var(--danger-border); border-radius: var(--radius-md); background: var(--danger-soft); color: var(--danger-ink); font-size: var(--text-xs); }
.hidden { display: none; }

.footer { margin-top: 1.25rem; text-align: center; }
.footer .powered { font-size: 11px; color: var(--muted); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.375rem 0.75rem; margin: 0; }
.kv dt { color: var(--muted); font-size: var(--text-xs); font-weight: 500; }
.kv dd { margin: 0; font-size: var(--text-sm); word-break: break-all; }
.kv dd.ok { color: var(--up); font-weight: 500; }
.mono { font-family: var(--font-mono); }

/* The not-found page reuses the auth card; only the message + the link differ. */
.notfound .subtitle { margin-bottom: 1.25rem; }
.notfound .code { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.25rem; }
