/* ============================================================================
 * AIRouting Child Theme for New API Console & Auth Pages
 * Architecture: 100% Upgrade-Safe External Skin (Token Override + Semantic Slot Polish)
 * - Zero New API source/image modifications
 * - Automatically inherits future New API pages & updates via standard CSS variables
 * - Full Light + Dark Mode parity matching https://airouting.top/
 * ============================================================================ */

/* ----------------------------------------------------------------------------
 * PART 1: DESIGN TOKENS (LIGHT & DARK MODE)
 * Uses `html:root` (0,1,1) / `html.dark:root` (0,2,1) to cleanly override
 * New API's `:root` / `.dark` (0,1,0) without breaking user theme presets.
 * ---------------------------------------------------------------------------- */

html:root {
  /* Typography */
  --font-ui-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-body: var(--font-ui-sans);

  /* Geometry */
  --radius: 0.875rem;

  /* Surfaces (Soft slate-blue canvas + pure white elevated cards) */
  --background: #f6f8fc;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;

  /* AIRouting Brand Accent (Royal Blue -> Violet family) */
  --primary: #2563eb;
  --primary-foreground: #ffffff;
  --secondary: #eef4ff;
  --secondary-foreground: #1d4ed8;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: rgba(37, 99, 235, 0.085);
  --accent-foreground: #1e40af;

  /* Borders & Focus */
  --border: #e2e8f0;
  --input: #d7e0ec;
  --ring: #3b82f6;

  /* Semantic Status */
  --success: #059669;
  --success-foreground: #ffffff;
  --warning: #d97706;
  --warning-foreground: #ffffff;
  --destructive: #e11d48;
  --destructive-foreground: #ffffff;
  --info: #2563eb;
  --info-foreground: #ffffff;

  /* Sidebar */
  --sidebar: #ffffff;
  --sidebar-foreground: #334155;
  --sidebar-primary: #2563eb;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: rgba(37, 99, 235, 0.09);
  --sidebar-accent-foreground: #1d4ed8;
  --sidebar-border: #e2e8f0;
  --sidebar-ring: #3b82f6;

  /* Data Visualization & Overview Charts */
  --chart-1: #2563eb;
  --chart-2: #7c3aed;
  --chart-3: #059669;
  --chart-4: #0ea5e9;
  --chart-5: #f59e0b;
  --overview-accent-1: #2563eb;
  --overview-accent-2: #7c3aed;
  --overview-accent-3: #059669;

  /* Tables & Skeletons */
  --table-row: #ffffff;
  --table-header: #f8fafc;
  --table-header-hover: #f1f5f9;
  --skeleton-base: #eaf0f7;
  --skeleton-highlight: #f8fafc;
}

html.dark:root {
  color-scheme: dark;

  /* Surfaces (Deep obsidian navy instead of flat gray) */
  --background: #0b0f19;
  --foreground: #f1f5f9;
  --card: #121826;
  --card-foreground: #f1f5f9;
  --popover: #161e2e;
  --popover-foreground: #f1f5f9;

  /* AIRouting Brand Accent (Dark) */
  --primary: #3b82f6;
  --primary-foreground: #ffffff;
  --secondary: #1b2538;
  --secondary-foreground: #bfdbfe;
  --muted: #182132;
  --muted-foreground: #94a3b8;
  --accent: rgba(59, 130, 246, 0.16);
  --accent-foreground: #93c5fd;

  /* Borders & Focus */
  --border: rgba(148, 163, 184, 0.16);
  --input: rgba(148, 163, 184, 0.24);
  --ring: #60a5fa;

  /* Semantic Status (Dark) */
  --success: #10b981;
  --success-foreground: #042f2e;
  --warning: #f59e0b;
  --warning-foreground: #1c1917;
  --destructive: #fb7185;
  --destructive-foreground: #ffffff;
  --info: #38bdf8;
  --info-foreground: #082f49;

  /* Sidebar (Dark) */
  --sidebar: #0e1422;
  --sidebar-foreground: #cbd5e1;
  --sidebar-primary: #3b82f6;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: rgba(59, 130, 246, 0.16);
  --sidebar-accent-foreground: #93c5fd;
  --sidebar-border: rgba(148, 163, 184, 0.14);
  --sidebar-ring: #60a5fa;

  /* Charts (Dark) */
  --chart-1: #60a5fa;
  --chart-2: #a78bfa;
  --chart-3: #34d399;
  --chart-4: #38bdf8;
  --chart-5: #fbbf24;
  --overview-accent-1: #60a5fa;
  --overview-accent-2: #a78bfa;
  --overview-accent-3: #34d399;

  /* Tables & Skeletons (Dark) */
  --table-row: #121826;
  --table-header: #161f32;
  --table-header-hover: #1c2740;
  --skeleton-base: #1b2436;
  --skeleton-highlight: #243047;
}

/* Global Polish: crisp typography, selection, smooth scrollbars */
html body {
  font-family: var(--font-ui-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(37, 99, 235, 0.18);
  color: inherit;
}

html.dark ::selection {
  background: rgba(96, 165, 250, 0.28);
}

/* ----------------------------------------------------------------------------
 * PART 2: USER CONSOLE COMMERCIAL SAAS SKIN (Tier 2 Semantic Slot Polish)
 * Scoped strictly to non-auth pages (`html:not([data-airouting-auth="1"])`)
 * Only targets standard shadcn `data-slot` / `data-sidebar` hooks -> 100% upgrade-safe!
 * ---------------------------------------------------------------------------- */

/* 2.1 Subtle ambient brand atmosphere on main workspace canvas */
html:not([data-airouting-auth="1"]) [data-slot="sidebar-inset"] {
  background-color: var(--background);
  background-image:
    radial-gradient(55% 320px at 18% 0%, rgba(37, 99, 235, 0.055), transparent 72%),
    radial-gradient(45% 280px at 88% 0%, rgba(124, 58, 237, 0.045), transparent 70%);
  background-repeat: no-repeat;
}

html.dark:not([data-airouting-auth="1"]) [data-slot="sidebar-inset"] {
  background-image:
    radial-gradient(55% 340px at 18% 0%, rgba(59, 130, 246, 0.10), transparent 72%),
    radial-gradient(45% 300px at 88% 0%, rgba(139, 92, 246, 0.08), transparent 70%);
}

/* 2.2 Frosted-glass top header inside console */
html:not([data-airouting-auth="1"]) [data-slot="sidebar-inset"] > header {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

html.dark:not([data-airouting-auth="1"]) [data-slot="sidebar-inset"] > header {
  background: rgba(11, 15, 25, 0.76);
  border-bottom-color: rgba(148, 163, 184, 0.14);
}

/* 2.3 Crisp Sidebar & Brand-Highlighted Active Navigation Pill */
html:not([data-airouting-auth="1"]) [data-sidebar="sidebar"] {
  background: var(--sidebar);
  box-shadow: 1px 0 0 var(--sidebar-border);
}

html:not([data-airouting-auth="1"]) [data-sidebar="menu-button"] {
  border-radius: 10px;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

html:not([data-airouting-auth="1"]) [data-sidebar="menu-button"][data-active="true"],
html:not([data-airouting-auth="1"]) [data-sidebar="menu-sub-button"][data-active="true"] {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.08)) !important;
  color: #1d4ed8 !important;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #2563eb, 0 1px 2px rgba(37, 99, 235, 0.06);
}

html.dark:not([data-airouting-auth="1"]) [data-sidebar="menu-button"][data-active="true"],
html.dark:not([data-airouting-auth="1"]) [data-sidebar="menu-sub-button"][data-active="true"] {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(139, 92, 246, 0.16)) !important;
  color: #93c5fd !important;
  box-shadow: inset 3px 0 0 #60a5fa, 0 1px 4px rgba(0, 0, 0, 0.25);
}

html:not([data-airouting-auth="1"]) [data-sidebar="menu-button"][data-active="true"] svg {
  color: #2563eb;
}
html.dark:not([data-airouting-auth="1"]) [data-sidebar="menu-button"][data-active="true"] svg {
  color: #60a5fa;
}

/* 2.4 Elevated SaaS Cards with Tabular Numbers */
html:not([data-airouting-auth="1"]) [data-slot="card"] {
  background-color: var(--card);
  border-color: rgba(226, 232, 240, 0.92);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.035),
    0 8px 24px -10px rgba(15, 23, 42, 0.06);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

html:not([data-airouting-auth="1"]) [data-slot="card"]:hover {
  border-color: rgba(37, 99, 235, 0.22);
}

html.dark:not([data-airouting-auth="1"]) [data-slot="card"] {
  border-color: rgba(148, 163, 184, 0.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 10px 28px -12px rgba(0, 0, 0, 0.5);
}

html.dark:not([data-airouting-auth="1"]) [data-slot="card"]:hover {
  border-color: rgba(96, 165, 250, 0.28);
}

/* 2.5 Signature AIRouting Gradient on Primary Action Buttons Only */
html:not([data-airouting-auth="1"]) [data-slot="button"].bg-primary,
html:not([data-airouting-auth="1"]) button.bg-primary:not([role="switch"]):not([role="checkbox"]):not([role="radio"]) {
  background-image: linear-gradient(135deg, #2563eb 0%, #6d28d9 100%);
  box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.30);
  transition: filter 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

html:not([data-airouting-auth="1"]) [data-slot="button"].bg-primary:hover:not(:disabled),
html:not([data-airouting-auth="1"]) button.bg-primary:not([role="switch"]):not([role="checkbox"]):not([role="radio"]):hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 6px 18px -2px rgba(37, 99, 235, 0.38);
}

html.dark:not([data-airouting-auth="1"]) [data-slot="button"].bg-primary,
html.dark:not([data-airouting-auth="1"]) button.bg-primary:not([role="switch"]):not([role="checkbox"]):not([role="radio"]) {
  background-image: linear-gradient(135deg, #3b82f6 0%, #7c3aed 100%);
  box-shadow: 0 4px 14px -2px rgba(59, 130, 246, 0.34);
}

/* 2.6 Crisp Data Tables */
html:not([data-airouting-auth="1"]) [data-slot="table"] {
  font-variant-numeric: tabular-nums;
}

html:not([data-airouting-auth="1"]) [data-slot="table-header"] th {
  font-weight: 600;
  color: var(--muted-foreground);
  letter-spacing: 0.01em;
}

html:not([data-airouting-auth="1"]) [data-slot="table"] tbody tr {
  transition: background-color 0.12s ease;
}

html:not([data-airouting-auth="1"]) [data-slot="table"] tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.032);
}

html.dark:not([data-airouting-auth="1"]) [data-slot="table"] tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.075);
}

/* 2.7 Elevated Dialogs, Popovers & Dropdown Menus */
html:not([data-airouting-auth="1"]) [data-slot="dialog-content"],
html:not([data-airouting-auth="1"]) [data-slot="popover-content"],
html:not([data-airouting-auth="1"]) [data-slot="dropdown-menu-content"] {
  border-color: rgba(203, 213, 225, 0.85);
  box-shadow:
    0 18px 44px -12px rgba(15, 23, 42, 0.14),
    0 4px 12px -2px rgba(15, 23, 42, 0.05);
}

html.dark:not([data-airouting-auth="1"]) [data-slot="dialog-content"],
html.dark:not([data-airouting-auth="1"]) [data-slot="popover-content"],
html.dark:not([data-airouting-auth="1"]) [data-slot="dropdown-menu-content"] {
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 22px 54px -12px rgba(0, 0, 0, 0.65);
}

/* 2.8 Subtle Inputs & Switches Polish */
html:not([data-airouting-auth="1"]) [data-slot="input"]:focus-visible,
html:not([data-airouting-auth="1"]) [data-slot="select-trigger"]:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* 2.9 Refined Thin Scrollbars (WebKit & Firefox) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.55);
}

/* 2.10 Inline API Endpoint Pills on /keys (Auto-synced from /api/status) */
.ar-keys-endpoints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 2px 0 12px;
  font-family: var(--font-ui-sans);
}

.ar-ep-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  font-size: 13px;
  line-height: 1.3;
  color: #334155;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.ar-ep-pill:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.12);
}

html.dark .ar-ep-pill {
  background: #121826;
  border-color: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.4);
}

html.dark .ar-ep-pill:hover {
  border-color: rgba(96, 165, 250, 0.42);
}

.ar-ep-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2563eb;
  flex-shrink: 0;
}
.ar-ep-pill[data-color="green"] .ar-ep-dot,
.ar-ep-pill[data-color="emerald"] .ar-ep-dot,
.ar-ep-pill[data-color="teal"] .ar-ep-dot { background: #10b981; }
.ar-ep-pill[data-color="purple"] .ar-ep-dot,
.ar-ep-pill[data-color="violet"] .ar-ep-dot,
.ar-ep-pill[data-color="indigo"] .ar-ep-dot { background: #7c3aed; }
.ar-ep-pill[data-color="orange"] .ar-ep-dot,
.ar-ep-pill[data-color="amber"] .ar-ep-dot { background: #f59e0b; }
.ar-ep-pill[data-color="cyan"] .ar-ep-dot { background: #06b6d4; }

.ar-ep-label {
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
}
html.dark .ar-ep-label { color: #f1f5f9; }

.ar-ep-sep {
  width: 1px;
  height: 13px;
  background: #e2e8f0;
  flex-shrink: 0;
}
html.dark .ar-ep-sep { background: rgba(148, 163, 184, 0.24); }

.ar-ep-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  color: #475569;
  cursor: pointer;
  user-select: all;
  transition: color 0.15s ease;
}
.ar-ep-url:hover { color: #2563eb; }
html.dark .ar-ep-url { color: #94a3b8; }
html.dark .ar-ep-url:hover { color: #60a5fa; }

.ar-ep-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ar-ep-btn:hover {
  background: rgba(37, 99, 235, 0.09);
  color: #2563eb;
}
html.dark .ar-ep-btn { color: #94a3b8; }
html.dark .ar-ep-btn:hover {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
}

.ar-ep-btn.is-copied {
  color: #059669 !important;
  background: rgba(5, 150, 105, 0.1) !important;
}
.ar-ep-ms {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.ar-ep-ping.is-fast { color: #059669 !important; }
.ar-ep-ping.is-mid { color: #d97706 !important; }
.ar-ep-ping.is-slow { color: #e11d48 !important; }
html.dark .ar-ep-ping.is-fast { color: #34d399 !important; }
html.dark .ar-ep-ping.is-mid { color: #fbbf24 !important; }
html.dark .ar-ep-ping.is-slow { color: #fb7185 !important; }

/* ============================================================================
 * PART 3: AUTH PAGES SKIN (/sign-in, /sign-up, /register, /reset, /forgot-password, /otp)
 * Scoped strictly via `html[data-airouting-auth="1"]`
 * ============================================================================ */

html[data-airouting-auth="1"] body {
  background-color: #f6f8fc !important;
  background-image:
    radial-gradient(60% 50% at 15% 0%, rgba(37, 99, 235, 0.13), transparent 70%),
    radial-gradient(50% 45% at 88% 12%, rgba(124, 58, 237, 0.11), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(15, 23, 42, 0.045) 1px, transparent 0) !important;
  background-size: 100% 100%, 100% 100%, 24px 24px !important;
  background-attachment: fixed !important;
  min-height: 100vh;
}

html.dark[data-airouting-auth="1"] body {
  background-color: #090c12 !important;
  background-image:
    radial-gradient(60% 50% at 15% 0%, rgba(59, 130, 246, 0.16), transparent 70%),
    radial-gradient(50% 45% at 88% 12%, rgba(139, 92, 246, 0.14), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0) !important;
  background-size: 100% 100%, 100% 100%, 24px 24px !important;
}

/* Transparent wrappers so ambient brand backdrop shows cleanly.
 * IMPORTANT: Never match bare `#root > div` because New API mounts react-top-loading-bar
 * as a direct `position: fixed; z-index: 2147483647` div child of `#root`! */
html[data-airouting-auth="1"] #root,
html[data-airouting-auth="1"] #root > div:has(> .container),
html[data-airouting-auth="1"] #root > div:has(form),
html[data-airouting-auth="1"] main {
  background-color: transparent !important;
}

/* Hide New API's duplicate native top-left logo inside AuthLayout */
html[data-airouting-auth="1"] #root > div:has(> .container) > a[href="/"] {
  display: none !important;
}

/* Floating AIRouting Brand Top Bar on Auth Pages */
.ar-auth-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  height: 60px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  font-family: var(--font-ui-sans);
}

html.dark .ar-auth-topbar {
  background: rgba(9, 12, 18, 0.78);
  border-bottom-color: rgba(34, 43, 61, 0.9);
}

.ar-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: #0f172a;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}
html.dark .ar-auth-brand { color: #edf2f9; }
.ar-auth-brand:hover { opacity: 0.88; }

.ar-auth-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #ffffff;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28);
}

.ar-auth-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13.5px;
  font-weight: 600;
}
.ar-auth-nav a {
  color: #475569;
  text-decoration: none !important;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.15s ease;
}
.ar-auth-nav a:hover {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}
html.dark .ar-auth-nav a { color: #9aa7bd; }
html.dark .ar-auth-nav a:hover {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.14);
}

/* Position Sonner toast cleanly below our 60px topbar */
html[data-airouting-auth="1"] [data-sonner-toaster] {
  top: 72px !important;
  z-index: 10001 !important;
}

/* Center ONLY the AuthLayout container cleanly between topbar and footer */
html[data-airouting-auth="1"] #root > div:has(> .container),
html[data-airouting-auth="1"] #root > div:has(form) {
  min-height: 100svh !important;
  height: auto !important;
  padding: 84px 16px 64px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  z-index: 1 !important;
}

html[data-airouting-auth="1"] #root .container {
  padding-top: 0 !important;
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
}

/* Elevated Frosted Glass Card around Login / Register Form */
html[data-airouting-auth="1"] #root .container > div:has(form):not(:has([data-slot="card"])),
html[data-airouting-auth="1"] #root [data-slot="card"]:has(form) {
  width: 100% !important;
  max-width: 448px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;
  border: 1px solid rgba(203, 213, 225, 0.85) !important;
  border-radius: 22px !important;
  padding: 34px 32px 30px !important;
  box-shadow:
    0 22px 54px -14px rgba(15, 23, 42, 0.11),
    0 4px 16px -4px rgba(37, 99, 235, 0.07) !important;
}

html.dark[data-airouting-auth="1"] #root .container > div:has(form):not(:has([data-slot="card"])),
html.dark[data-airouting-auth="1"] #root [data-slot="card"]:has(form) {
  background: rgba(19, 25, 38, 0.9) !important;
  border: 1px solid rgba(51, 65, 92, 0.78) !important;
  box-shadow:
    0 24px 60px -12px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(96, 165, 250, 0.08) !important;
}

/* Pure CSS Grid Reorder: Place Cloudflare Turnstile ABOVE Login/Register Button */
html[data-airouting-auth="1"] #root form > * {
  order: 1;
}
html[data-airouting-auth="1"] #root form > button[type="submit"] ~ div {
  order: 5;
}
html[data-airouting-auth="1"] #root form > div:has(iframe[src*="challenges.cloudflare.com"]),
html[data-airouting-auth="1"] #root form > div:has(input[name="cf-turnstile-response"]),
html[data-airouting-auth="1"] #root form > div:has(> div > iframe),
html[data-airouting-auth="1"] #root form > button[type="submit"] + div.mt-2:not(:has(button)):not(:has(#legal-consent)) {
  order: 2 !important;
  margin-top: 6px !important;
  margin-bottom: 2px !important;
  min-height: 65px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
}
html[data-airouting-auth="1"] #root form > div:has(#legal-consent) {
  order: 3 !important;
}
html[data-airouting-auth="1"] #root form > button[type="submit"] {
  order: 4 !important;
  margin-top: 4px !important;
}

/* Auth Inputs */
html[data-airouting-auth="1"] input[type="text"],
html[data-airouting-auth="1"] input[type="email"],
html[data-airouting-auth="1"] input[type="password"] {
  border-radius: 10px !important;
  height: 42px !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}
html[data-airouting-auth="1"] input[type="text"]:focus,
html[data-airouting-auth="1"] input[type="email"]:focus,
html[data-airouting-auth="1"] input[type="password"]:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16) !important;
}

/* Auth Submit Button */
html[data-airouting-auth="1"] button[type="submit"] {
  background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
  border: none !important;
  color: #ffffff !important;
  border-radius: 10px !important;
  height: 44px !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25) !important;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease !important;
}
html[data-airouting-auth="1"] button[type="submit"]:hover:not(:disabled) {
  filter: brightness(1.06) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.34) !important;
}

/* Subtle Brand Footer on Auth Pages */
.ar-auth-foot {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  text-align: center;
  padding: 10px 16px;
  font-size: 12px;
  color: #64748b;
  pointer-events: none;
  font-family: var(--font-ui-sans);
}
html.dark .ar-auth-foot { color: #6d7b94; }

@media (max-width: 600px) {
  .ar-auth-topbar { padding: 0 14px; }
  .ar-auth-nav { gap: 6px; font-size: 12.5px; }
  html[data-airouting-auth="1"] #root .container > div:has(form):not(:has([data-slot="card"])),
  html[data-airouting-auth="1"] #root [data-slot="card"]:has(form) {
    padding: 26px 20px 22px !important;
  }
  .ar-auth-foot { display: none; }
}
