/*
 * tetha — the app's look on app.tetha.net (docs/tracking-product-line-PLAN.md §6).
 *
 * Loaded by assets/brand.js only when the host's brand is tetha, so the
 * QRAALYS portal never downloads it. It re-points the app's own tokens
 * (assets/src/input.css) at the tetha design system; pages are not restyled
 * one by one. Every rule is scoped to html[data-brand="tetha"], which out-ranks
 * the :root / :root[data-theme] / :root:not([data-theme="light"]) blocks it
 * overrides — keep that true when adding rules.
 *
 * Dark mode uses the same two selectors as input.css, on purpose: an explicit
 * data-theme="dark", and "System" (no light choice) under a dark OS.
 *
 * Unversioned URL (brand.js injects it), so Caddy caches it for an hour.
 * Fonts: Asap Condensed, SIL Open Font License (fonts/OFL.txt).
 */

@font-face { font-family: "Asap Condensed"; font-style: normal; font-weight: 300; font-display: swap; src: url(fonts/AsapCondensed-Light.ttf) format("truetype"); }
@font-face { font-family: "Asap Condensed"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/AsapCondensed-Regular.ttf) format("truetype"); }
@font-face { font-family: "Asap Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/AsapCondensed-Medium.ttf) format("truetype"); }
@font-face { font-family: "Asap Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/AsapCondensed-SemiBold.ttf) format("truetype"); }
@font-face { font-family: "Asap Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/AsapCondensed-Bold.ttf) format("truetype"); }
@font-face { font-family: "Asap Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url(fonts/AsapCondensed-ExtraBold.ttf) format("truetype"); }

/* ── Light ─────────────────────────────────────────────────────────── */
html[data-brand="tetha"] {
  --font-sans: "Asap Condensed", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

  /* Accent = brand blue. #0e77a9 is 4.96:1 on white, so one value carries
     text, rings and white-on-blue buttons alike. */
  --accent:             #0e77a9;
  --accent-ink:         #0e77a9;
  --accent-solid:       #0e77a9;
  --accent-solid-hover: #0b638d;
  --accent-on-solid:    #ffffff;
  --accent-tint:        rgba(14, 119, 169, 0.12);
  --accent-tint-strong: rgba(14, 119, 169, 0.20);

  /* Semantic blue/green follow the brand: Parked is brand blue, Moving is
     brand green (status-moving / status-parked in the design system). */
  --blue:       #0e77a9;
  --blue-tint:  rgba(14, 119, 169, 0.12);
  --green:      #69bd45;
  --green-tint: rgba(105, 189, 69, 0.14);
  --status-info-ink: #0e77a9;

  --label:           #1c2a33;
  --label-secondary: #5a6870;

  --bg-system:             #f4f7f9;
  --bg-secondary:          #ffffff;
  --bg-tertiary:           #eef3f6;
  --bg-grouped:            #f4f7f9;
  --bg-grouped-secondary:  #ffffff;
  --bg-elevated:           #ffffff;
  --separator-opaque:      #d5dee3;
}

/* ── Dark ──────────────────────────────────────────────────────────── */
html[data-brand="tetha"][data-theme="dark"] {
  --accent:             #5bb4e0;
  --accent-ink:         #5bb4e0;
  --accent-solid:       #5bb4e0;
  --accent-solid-hover: #7cc4e8;
  --accent-on-solid:    #111d25;
  --accent-tint:        rgba(91, 180, 224, 0.18);
  --accent-tint-strong: rgba(91, 180, 224, 0.28);
  --blue:               #5bb4e0;
  --blue-tint:          rgba(91, 180, 224, 0.18);
  --status-info-ink:    #5bb4e0;

  --label:           #edf2f5;
  --label-secondary: #a3b1ba;

  --bg-system:             #111d25;
  --bg-secondary:          #1a2a34;
  --bg-tertiary:           #22343f;
  --bg-grouped:            #111d25;
  --bg-grouped-secondary:  #1a2a34;
  --bg-elevated:           #1a2a34;
  --separator-opaque:      #2c3d48;
}
@media (prefers-color-scheme: dark) {
  html[data-brand="tetha"]:not([data-theme="light"]) {
    --accent:             #5bb4e0;
    --accent-ink:         #5bb4e0;
    --accent-solid:       #5bb4e0;
    --accent-solid-hover: #7cc4e8;
    --accent-on-solid:    #111d25;
    --accent-tint:        rgba(91, 180, 224, 0.18);
    --accent-tint-strong: rgba(91, 180, 224, 0.28);
    --blue:               #5bb4e0;
    --blue-tint:          rgba(91, 180, 224, 0.18);
    --status-info-ink:    #5bb4e0;

    --label:           #edf2f5;
    --label-secondary: #a3b1ba;

    --bg-system:             #111d25;
    --bg-secondary:          #1a2a34;
    --bg-tertiary:           #22343f;
    --bg-grouped:            #111d25;
    --bg-grouped-secondary:  #1a2a34;
    --bg-elevated:           #1a2a34;
    --separator-opaque:      #2c3d48;
  }
}

/* ── Sign-in page (index.html) ─────────────────────────────────────────
   The canvas "tetha app" › "Web portal · sign in": a brand panel (wordmark,
   map, pitch) beside the form, stacking above it at phone width. index.html
   marks the panel, footer and brand-only controls `hidden`; this shows them.
   Colours are the design system's (ds/tetha/tokens.css), set here as
   --login-* because the portal's own tokens differ (its dark accent button
   is light blue on ink; the design keeps brand blue with white). */
html[data-brand="tetha"] {
  --login-surface: #ffffff;
  --login-surface-muted: #f4f7f9;
  --login-blue-tint: #e7f1f6;
  --login-ink: #1c2a33;
  --login-ink-muted: #5a6870;
  --login-hairline: #d5dee3;
  --login-accent-text: #0e77a9;
  --login-brand-blue: #0e77a9;
  --login-brand-blue-hover: #0b638d;
  --login-on-blue: #ffffff;
  --login-moving: #69bd45;
  --login-parked: #0e77a9;
}
html[data-brand="tetha"][data-theme="dark"] {
  --login-surface: #111d25;
  --login-surface-muted: #1a2a34;
  --login-blue-tint: #163447;
  --login-ink: #edf2f5;
  --login-ink-muted: #a3b1ba;
  --login-hairline: #2c3d48;
  --login-accent-text: #5bb4e0;
  --login-brand-blue-hover: #1688bf;
  --login-parked: #5bb4e0;
}
@media (prefers-color-scheme: dark) {
  html[data-brand="tetha"]:not([data-theme="light"]) {
    --login-surface: #111d25;
    --login-surface-muted: #1a2a34;
    --login-blue-tint: #163447;
    --login-ink: #edf2f5;
    --login-ink-muted: #a3b1ba;
    --login-hairline: #2c3d48;
    --login-accent-text: #5bb4e0;
    --login-brand-blue-hover: #1688bf;
    --login-parked: #5bb4e0;
  }
}

html[data-brand="tetha"] body.login-page {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
  background: var(--login-surface);
  color: var(--login-ink);
  font-family: var(--font-sans);
}
html[data-brand="tetha"] .login-page a:focus-visible,
html[data-brand="tetha"] .login-page button:focus-visible {
  outline: 2px solid var(--login-accent-text);
  outline-offset: 2px;
}

/* The panel */
html[data-brand="tetha"] .login-aside {
  flex: 1 1 560px;
  min-width: 0;
  box-sizing: border-box;
  padding: clamp(24px, 4vw, 56px);
  background: var(--login-surface-muted);
  display: flex;
  flex-direction: column;
  gap: 32px;
  overflow: hidden;
}
html[data-brand="tetha"] .login-wordmark { display: block; align-self: flex-start; }
html[data-brand="tetha"] .login-wordmark img { height: 64px; width: auto; display: block; }
html[data-brand="tetha"] .login-art { width: 100%; max-width: 620px; height: auto; max-height: 420px; flex-grow: 1; display: block; }
html[data-brand="tetha"] .login-art .art-block { fill: var(--login-blue-tint); }
html[data-brand="tetha"] .login-art .art-road { fill: none; stroke: var(--login-surface); }
html[data-brand="tetha"] .login-art .art-route { fill: none; stroke: var(--login-brand-blue); stroke-width: 5; stroke-linecap: round; }
html[data-brand="tetha"] .login-art .art-start { fill: var(--login-surface); stroke: var(--login-brand-blue); stroke-width: 3; }
html[data-brand="tetha"] .login-art .art-moving { fill: var(--login-moving); stroke: var(--login-surface); stroke-width: 5; }
html[data-brand="tetha"] .login-art .art-parked { fill: var(--login-parked); stroke: var(--login-surface); stroke-width: 4; }
html[data-brand="tetha"] .login-art .art-p { fill: var(--login-on-blue); font-family: var(--font-sans); font-size: 13px; font-weight: 800; }
html[data-brand="tetha"] .login-pitch { max-width: 480px; display: flex; flex-direction: column; gap: 8px; }
html[data-brand="tetha"] .login-pitch h2 { margin: 0; font-size: clamp(28px, 2vw + 12px, 40px); line-height: 1.1; font-weight: 700; color: var(--login-ink); }
html[data-brand="tetha"] .login-pitch p { margin: 0; font-size: 18px; line-height: 27px; color: var(--login-ink-muted); }

/* The form column: a 400px column, centred, footer at the bottom */
html[data-brand="tetha"] .login-page .auth-card {
  flex: 1 1 440px;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  padding: clamp(32px, 5vw, 72px) 24px 32px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
html[data-brand="tetha"] .login-page .auth-card > * { width: 100%; max-width: 400px; }
html[data-brand="tetha"] .login-page .auth-card > #loginTitle { margin-top: auto; }
html[data-brand="tetha"] .login-logo,
html[data-brand="tetha"] .login-default-only { display: none; }

html[data-brand="tetha"] #loginTitle { margin-bottom: 6px; text-align: left; font-size: 32px; line-height: 40px; font-weight: 600; color: var(--login-ink); }
html[data-brand="tetha"] #loginLead { margin-bottom: 20px; text-align: left; font-size: 16px; line-height: 24px; color: var(--login-ink-muted); }

html[data-brand="tetha"] .login-page .form-group label { font-size: 15px; font-weight: 600; color: var(--login-ink); margin-bottom: 6px; }
html[data-brand="tetha"] .login-page .form-group input:not([type="checkbox"]):not([type="radio"]) {
  height: 48px;
  max-width: none;
  padding: 0 12px;
  border: 1px solid var(--login-ink-muted);
  border-radius: 4px;
  background: var(--login-surface);
  color: var(--login-ink);
  font-size: 16px;
}
html[data-brand="tetha"] .login-page .form-group input:not([type="checkbox"]):not([type="radio"]):focus {
  border-color: var(--login-accent-text);
  box-shadow: 0 0 0 1px var(--login-accent-text);
}
html[data-brand="tetha"] .login-page .form-group input::placeholder { color: transparent; }
html[data-brand="tetha"] .login-forgot { display: inline; font-size: 15px; font-weight: 600; color: var(--login-accent-text); text-decoration: underline; }
html[data-brand="tetha"] .login-pw #password { padding-right: 72px; }
html[data-brand="tetha"] .login-pw-toggle {
  display: block;
  position: absolute;
  right: 4px;
  top: 4px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--login-ink);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

html[data-brand="tetha"] .login-page .btn-primary {
  height: 52px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  background: var(--login-brand-blue);
  color: var(--login-on-blue);
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
}
html[data-brand="tetha"] .login-page .btn-primary:hover:not(:disabled) { background: var(--login-brand-blue-hover); }

/* "Verify your email first" */
html[data-brand="tetha"] .login-notice { padding: 14px; border-radius: 8px; background: var(--login-blue-tint); color: var(--login-ink); font-size: 15px; line-height: 21px; }
html[data-brand="tetha"] .login-notice strong { font-size: 16px; }
html[data-brand="tetha"] .login-notice svg { flex-shrink: 0; }
html[data-brand="tetha"] .login-textbtn { height: 36px; padding: 0; border: 0; background: transparent; color: var(--login-ink); text-decoration: underline; font-family: var(--font-sans); font-size: 15px; font-weight: 700; cursor: pointer; }

/* "New to tetha?" and the account button */
html[data-brand="tetha"] #signupLink { margin-top: 20px; }
html[data-brand="tetha"] .login-divider { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; color: var(--login-ink-muted); font-size: 14px; }
html[data-brand="tetha"] .login-divider > span:first-child,
html[data-brand="tetha"] .login-divider > span:last-child { flex-grow: 1; height: 1px; background: var(--login-hairline); }
html[data-brand="tetha"] .login-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  box-sizing: border-box;
  border: 1px solid var(--login-hairline);
  border-radius: 8px;
  color: var(--login-ink);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}

/* The code step */
html[data-brand="tetha"] .auth-card.is-mfa #signupLink { display: none; }
html[data-brand="tetha"] .login-page #otpInput { height: 56px; font-size: 26px; font-weight: 600; letter-spacing: 0.3em; }
html[data-brand="tetha"] .login-mfa-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin: 20px 0 0; }
html[data-brand="tetha"] .login-mfa-links a { font-size: 15px; font-weight: 600; color: var(--login-accent-text); }

html[data-brand="tetha"] .login-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: auto;
  padding: 32px 0 0;
  border: 0;
  font-size: 14px;
  color: var(--login-ink-muted);
}
html[data-brand="tetha"] .login-footer a { color: var(--login-ink-muted); text-decoration: underline; }

/* ── Policy consent dialog (assets/policy-gate.js) ───────────────────
   The dialog injects its own stylesheet with a system font stack, and its
   buttons don't inherit a font at all, so on tetha it fell back to the
   system font. The brand font here outranks both (html[data-brand] adds
   specificity); QRAALYS keeps the dialog exactly as it was. */
html[data-brand="tetha"] #qraalys-policy-gate-root,
html[data-brand="tetha"] #qraalys-policy-gate-root button {
  font-family: var(--font-sans);
}
