/* Login / registration screen styles.
 *
 * Extracted from base_auth.html; served static so it caches
 * instead of re-shipping inline on every render.
 */

:root {
      color-scheme: dark;
      --page: #07090f;
      --panel: #10141f;
      --panel-soft: #161b29;
      --ink: #f3f5f9;
      --muted: #9aa6b8;
      --subtle: #67718a;
      --line: rgba(148, 163, 184, .16);
      --line-strong: rgba(148, 163, 184, .32);
      --brand: #f97316;
      --brand-hot: #fb923c;
      --brand-strong: #fdba74;
      --brand-soft: rgba(249, 115, 22, .1);
      --ember: #ef4444;
      --steel: #cbd5e1;
      --success: #34d399;
      --danger-bg: rgba(239, 68, 68, .1);
      --danger-text: #fda4af;
      --glass: rgba(255, 255, 255, .035);
      --shadow: 0 30px 90px rgba(0, 0, 0, .5);
      --panel-shadow: 0 24px 70px rgba(0, 0, 0, .45);
    }

    * { box-sizing: border-box; }
    html {
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizeLegibility;
      /* Clip horizontal overflow at the viewport so the off-screen decorative
         glow (.auth-story::after) can't be scrolled into as blank space on
         mobile. overflow-x: clip clips without creating a scroll container or
         forcing overflow-y to auto, so vertical scrolling stays normal. */
      max-width: 100%;
      overflow-x: clip;
    }
    body {
      margin: 0;
      min-height: 100vh;
      max-width: 100%;
      overflow-x: clip;
      background:
        radial-gradient(circle at 14% -6%, rgba(249, 115, 22, .16), transparent 32%),
        radial-gradient(circle at 86% 14%, rgba(239, 68, 68, .08), transparent 34%),
        linear-gradient(180deg, #0a0d15 0%, var(--page) 55%, #05070c 100%);
      color: var(--ink);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      line-height: 1.45;
    }

    ::selection { background: rgba(249, 115, 22, .35); }

    .auth-shell {
      min-height: 100vh;
      display: grid;
      grid-template-columns: minmax(0, 1.12fr) minmax(380px, 520px);
      align-items: stretch;
      isolation: isolate;
    }

    .auth-story {
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 28px;
      min-width: 0;
      padding: 40px clamp(28px, 5vw, 76px);
      border-right: 1px solid var(--line);
      background: linear-gradient(160deg, rgba(18, 23, 36, .7), rgba(8, 10, 17, .9));
      overflow: hidden;
    }

    .auth-story::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -2;
      background-image:
        linear-gradient(rgba(148, 163, 184, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .07) 1px, transparent 1px);
      background-size: 44px 44px;
      mask-image: linear-gradient(90deg, #000 0%, rgba(0,0,0,.82) 58%, transparent 100%);
    }

    .auth-story::after {
      content: "";
      position: absolute;
      width: 460px;
      height: 460px;
      right: -170px;
      bottom: -190px;
      z-index: -1;
      border-radius: 50%;
      border: 1px solid rgba(249, 115, 22, .3);
      background: radial-gradient(circle, rgba(249, 115, 22, .18), transparent 66%);
      animation: auth-glow 7s ease-in-out infinite;
    }

    @keyframes auth-glow {
      0%, 100% { opacity: .8; transform: scale(1); }
      50% { opacity: 1; transform: scale(1.05); }
    }

    .brand-mark {
      display: inline-flex;
      align-items: center;
      gap: 12px;
      width: max-content;
      color: var(--ink);
      font-weight: 750;
      letter-spacing: 0;
      text-decoration: none;
      animation: auth-rise .42s ease both;
    }

    .mark-box {
      display: grid;
      place-items: center;
      width: 40px;
      height: 40px;
      border-radius: 10px;
      border: 1px solid var(--line-strong);
      background: linear-gradient(150deg, #1e2433, #0d111c);
      color: #fff7ed;
      font-weight: 800;
      box-shadow: inset 0 0 18px rgba(249, 115, 22, .28), 0 12px 32px rgba(0, 0, 0, .45);
    }

    .story-grid {
      display: grid;
      grid-template-columns: minmax(0, .88fr) minmax(320px, 480px);
      align-items: center;
      gap: clamp(24px, 4vw, 56px);
      min-width: 0;
    }

    .story-copy {
      max-width: 620px;
      padding: 24px 0;
      animation: auth-rise .48s .05s ease both;
    }

    .eyebrow {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin: 0 0 14px;
      color: var(--brand-hot);
      font-size: 12px;
      font-weight: 750;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .eyebrow::before {
      content: "";
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--success);
      box-shadow: 0 0 0 4px rgba(52, 211, 153, .14);
    }

    h1 {
      margin: 0;
      max-width: 13ch;
      font-size: clamp(38px, 5vw, 68px);
      line-height: .98;
      letter-spacing: -.02em;
    }

    h1 em, .fire-text {
      font-style: normal;
      background: linear-gradient(110deg, var(--brand-hot), var(--brand) 50%, var(--ember));
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }

    .story-copy p {
      max-width: 58ch;
      margin: 20px 0 0;
      color: var(--muted);
      font-size: 16px;
    }

    .story-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 24px;
    }

    .story-chip {
      display: inline-flex;
      align-items: center;
      min-height: 34px;
      border: 1px solid var(--line-strong);
      border-radius: 999px;
      padding: 0 13px;
      background: var(--glass);
      color: var(--steel);
      font-size: 13px;
      font-weight: 760;
    }

    .operations-preview {
      width: min(100%, 460px);
      min-width: 0;
      justify-self: end;
      border: 1px solid var(--line-strong);
      border-radius: 14px;
      background: linear-gradient(180deg, rgba(20, 25, 38, .92), rgba(11, 14, 23, .95));
      box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
      overflow: hidden;
      animation: auth-rise .52s .12s ease both;
    }

    .preview-topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      min-height: 52px;
      padding: 0 16px;
      border-bottom: 1px solid var(--line);
      background: rgba(255, 255, 255, .02);
    }

    .preview-title {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
      font-size: 13px;
      font-weight: 740;
    }

    .preview-title span {
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .preview-title svg {
      flex: 0 0 auto;
      width: 18px;
      height: 18px;
      color: var(--brand);
    }

    .preview-live {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      gap: 7px;
      color: var(--success);
      font-size: 12px;
      font-weight: 720;
    }

    .preview-live::before {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--success);
      animation: auth-glow 2.2s ease-in-out infinite;
    }

    .preview-body {
      display: grid;
      gap: 14px;
      padding: 16px;
    }

    .dispatch-map {
      position: relative;
      min-height: 194px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background:
        linear-gradient(90deg, rgba(148, 163, 184, .08) 1px, transparent 1px),
        linear-gradient(rgba(148, 163, 184, .08) 1px, transparent 1px),
        linear-gradient(135deg, rgba(22, 27, 41, .8), rgba(249, 115, 22, .05));
      background-size: 28px 28px, 28px 28px, 100% 100%;
      overflow: hidden;
    }

    .route-line {
      position: absolute;
      inset: 46px 42px 48px 54px;
      border-left: 3px solid rgba(249, 115, 22, .56);
      border-bottom: 3px solid rgba(249, 115, 22, .56);
      border-radius: 0 0 0 18px;
    }

    .route-line::after {
      content: "";
      position: absolute;
      width: 10px;
      height: 10px;
      right: -6px;
      bottom: -7px;
      border-radius: 50%;
      background: var(--brand);
      box-shadow: 0 0 0 6px rgba(249, 115, 22, .18), 0 0 16px rgba(249, 115, 22, .7);
      animation: auth-orbit .9s .4s ease-out both;
    }

    .map-node {
      position: absolute;
      display: grid;
      place-items: center;
      width: 30px;
      height: 30px;
      border: 2px solid rgba(243, 245, 249, .85);
      border-radius: 50%;
      background: #334155;
      color: #fff;
      box-shadow: 0 10px 22px rgba(0, 0, 0, .4);
      font-size: 11px;
      font-weight: 800;
    }

    .map-node.one { top: 34px; left: 42px; }
    .map-node.two { right: 28px; bottom: 34px; background: var(--brand); box-shadow: 0 10px 22px rgba(249, 115, 22, .35); }

    .map-card {
      position: absolute;
      right: 20px;
      top: 22px;
      width: min(210px, calc(100% - 40px));
      padding: 12px;
      border: 1px solid var(--line-strong);
      border-radius: 10px;
      background: rgba(16, 20, 31, .92);
      box-shadow: 0 16px 34px rgba(0, 0, 0, .4);
      backdrop-filter: blur(8px);
    }

    .map-card strong,
    .metric strong {
      display: block;
      font-size: 13px;
    }

    .map-card span,
    .metric span {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
    }

    .preview-metrics {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
    }

    .metric {
      min-height: 78px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--glass);
    }

    .auth-proof {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      max-width: 820px;
      animation: auth-rise .48s .18s ease both;
    }

    .proof-item {
      min-height: 94px;
      padding: 16px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: var(--glass);
      transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
    }

    .proof-item:hover {
      transform: translateY(-2px);
      border-color: rgba(249, 115, 22, .48);
      box-shadow: 0 18px 42px rgba(0, 0, 0, .35);
    }

    .proof-item strong {
      display: block;
      margin-bottom: 6px;
      font-size: 14px;
    }

    .proof-item span {
      display: block;
      color: var(--muted);
      font-size: 13px;
    }

    .auth-panel-wrap {
      display: grid;
      align-items: center;
      padding: 40px clamp(20px, 4vw, 52px);
      background: rgba(10, 13, 21, .55);
    }

    .auth-panel {
      width: 100%;
      max-width: 460px;
      margin: 0 auto;
      padding: 30px;
      border: 1px solid var(--line-strong);
      border-radius: 16px;
      background: linear-gradient(170deg, rgba(22, 27, 41, .92), rgba(13, 17, 28, .96));
      box-shadow: var(--panel-shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
      animation: auth-panel-in .44s .1s ease both;
      backdrop-filter: blur(14px);
    }

    .auth-panel.wide { max-width: 560px; }

    .panel-kicker {
      margin: 0 0 8px;
      color: var(--brand-hot);
      font-size: 12px;
      font-weight: 750;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .auth-panel h2 {
      margin: 0;
      font-size: 28px;
      line-height: 1.14;
      letter-spacing: -.01em;
    }

    .panel-copy {
      margin: 10px 0 24px;
      color: var(--muted);
      font-size: 15px;
    }

    .form-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14px;
    }

    .field { margin-top: 14px; }
    .field.full { grid-column: 1 / -1; }

    label {
      display: block;
      margin-bottom: 6px;
      color: var(--steel);
      font-size: 13px;
      font-weight: 760;
    }

    input {
      width: 100%;
      min-height: 44px;
      border: 1px solid var(--line-strong);
      border-radius: 10px;
      padding: 10px 12px;
      background: rgba(7, 9, 15, .6);
      color: var(--ink);
      font: inherit;
      transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
    }

    input::placeholder { color: var(--subtle); }
    input:focus {
      outline: none;
      border-color: var(--brand);
      box-shadow: 0 0 0 4px rgba(249, 115, 22, .2);
      background: rgba(7, 9, 15, .85);
    }

    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus {
      -webkit-text-fill-color: var(--ink);
      -webkit-box-shadow: 0 0 0 60px #0d111c inset;
      caret-color: var(--ink);
    }

    .helptext {
      display: block;
      margin-top: 5px;
      color: var(--muted);
      font-size: 12px;
    }

    .errorlist {
      margin: 8px 0 0;
      padding: 0;
      list-style: none;
      color: var(--danger-text);
      font-size: 13px;
    }

    .alert {
      margin: 0 0 16px;
      padding: 12px 14px;
      border: 1px solid rgba(239, 68, 68, .4);
      border-radius: 10px;
      background: var(--danger-bg);
      color: var(--danger-text);
      font-size: 14px;
      font-weight: 680;
    }

    .alert-info {
      border-color: rgba(37, 99, 235, .32);
      background: #eff6ff;
      color: #1e3a8a;
    }

    .alert-success {
      border-color: rgba(22, 163, 74, .32);
      background: #f0fdf4;
      color: #166534;
    }

    .row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin: 16px 0;
      font-size: 14px;
    }

    .check-label {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin: 0;
      font-weight: 680;
    }

    .check-label input {
      width: 16px;
      height: 16px;
      min-height: 0;
      padding: 0;
      accent-color: var(--brand);
    }

    .button-row {
      display: flex;
      gap: 10px;
      margin-top: 20px;
    }

    .button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 44px;
      border: 1px solid transparent;
      border-radius: 10px;
      padding: 0 16px;
      background: linear-gradient(135deg, var(--brand-hot), var(--brand) 55%, var(--ember));
      color: #fff8f1;
      font: inherit;
      font-weight: 720;
      text-decoration: none;
      cursor: pointer;
      box-shadow: 0 10px 28px rgba(249, 115, 22, .26);
      transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
    }

    .button:hover {
      transform: translateY(-1px);
      box-shadow: 0 16px 38px rgba(249, 115, 22, .38);
    }

    .button.secondary {
      background: var(--glass);
      border-color: var(--line-strong);
      color: var(--ink);
      box-shadow: none;
    }

    .button.secondary:hover {
      background: rgba(255, 255, 255, .07);
      border-color: rgba(249, 115, 22, .5);
      box-shadow: none;
    }

    .button.fill { width: 100%; }

    .button:focus-visible,
    a:focus-visible,
    .check-label input:focus-visible {
      outline: 3px solid rgba(249, 115, 22, .4);
      outline-offset: 3px;
    }

    .divider {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 18px 0;
      color: var(--muted);
      font-size: 12px;
      font-weight: 760;
      text-transform: uppercase;
      letter-spacing: .08em;
    }

    .divider::before,
    .divider::after {
      content: "";
      height: 1px;
      flex: 1;
      background: var(--line);
    }

    a {
      color: var(--brand-strong);
      font-weight: 760;
      text-decoration: none;
    }

    a:hover { text-decoration: underline; }

    .footer-link {
      margin: 18px 0 0;
      color: var(--muted);
      font-size: 14px;
      text-align: center;
    }

    @keyframes auth-rise {
      from { opacity: 0; transform: translateY(14px); }
      to { opacity: 1; transform: translateY(0); }
    }

    @keyframes auth-panel-in {
      from { opacity: 0; transform: translateY(12px) scale(.985); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    @keyframes auth-orbit {
      from { transform: translate(-130px, -72px); opacity: .3; }
      to { transform: translate(0, 0); opacity: 1; }
    }

    @media (max-width: 1120px) {
      .story-grid { grid-template-columns: 1fr; }
      .operations-preview { justify-self: start; }
    }

    @media (max-width: 860px) {
      .auth-shell { grid-template-columns: 1fr; }
      .auth-story {
        min-height: auto;
        padding: 24px 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
      }
      .story-copy { padding: 18px 0 6px; }
      h1 { max-width: 17ch; font-size: clamp(31px, 9vw, 38px); line-height: 1.02; }
      .story-copy p { font-size: 15px; }
      .story-actions { margin-top: 18px; }
      .operations-preview { width: 100%; max-width: 520px; }
      .auth-proof { grid-template-columns: 1fr; }
      .auth-panel-wrap { padding: 24px 16px 36px; }
      .auth-panel { padding: 22px; }
      .form-grid { grid-template-columns: 1fr; }
      .button-row { flex-direction: column; }
      .button { width: 100%; }
    }

    @media (max-width: 520px) {
      .auth-story { gap: 18px; padding: 20px 14px; }
      /* Keep the decorative glow inside the panel on small screens. */
      .auth-story::after { width: 300px; height: 300px; right: -90px; bottom: -120px; }
      .brand-mark { font-size: 14px; }
      .mark-box { width: 34px; height: 34px; }
      .story-grid { gap: 18px; }
      .story-copy { padding: 10px 0 0; }
      .story-actions { gap: 8px; }
      .story-chip { min-height: 30px; padding: 0 10px; font-size: 12px; }
      .preview-topbar { min-height: auto; padding: 12px; align-items: flex-start; }
      .preview-body { padding: 12px; }
      .preview-metrics { grid-template-columns: 1fr; }
      .metric { min-height: auto; padding: 11px 12px; }
      .dispatch-map { display: none; }
      .row { align-items: flex-start; flex-direction: column; }
    }

    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
      }
    }
