/* ─────────────────────────────────────────────────────────────────────────
   AutoHub — autohub.css  (UI/UX hardening release)
   Fonts, base tokens, shared primitive components.
   All selectors are additive — no existing class names removed.
───────────────────────────────────────────────────────────────────────── */

/* ── Design tokens ───────────────────────────────────────────────────── */
:root {
  --ah-bg:           #f2f5f9;
  --ah-surface:      #ffffff;
  --ah-surface-2:    #f8fafc;
  --ah-surface-3:    #f1f5f9;
  --ah-border:       #dde4ee;
  --ah-border-2:     #c8d3e0;
  --ah-text:         #0f172a;
  --ah-muted:        #64748b;
  --ah-muted-2:      #94a3b8;

  /* Brand – deep navy-blue, single source of truth */
  --ah-blue:         #1a4bae;
  --ah-blue-2:       #133b8a;
  --ah-blue-weak:    rgba(26,75,174,.10);
  --ah-blue-ring:    rgba(26,75,174,.20);

  /* Semantic */
  --ah-green:        #15803d;
  --ah-red:          #b91c1c;
  --ah-amber:        #b45309;

  /* Sidebar */
  --ah-sidebar:      #0d1629;
  --ah-sidebar-2:    #111e34;
  --ah-sidebar-text: #d4dcec;
  --ah-sidebar-muted:#7d8fa6;

  /* Geometry */
  --ah-radius:       5px;
  --ah-radius-lg:    8px;
  --ah-shadow:       0 3px 10px rgba(15,23,42,.07), 0 1px 3px rgba(15,23,42,.04);
  --ah-shadow-lg:    0 12px 32px rgba(15,23,42,.12), 0 3px 8px rgba(15,23,42,.05);
  --ah-control-h:    30px;

  /* Typography */
  --ah-font:  Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ah-mono:  ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Motion */
  --ah-ease:     cubic-bezier(.16,1,.3,1);
  --ah-dur:      160ms;
  --ah-dur-fast: 100ms;
}

/* ── Reset + base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body                { height: 100%; }

body.autohub-body {
  margin: 0;
  background: var(--ah-bg);
  color: var(--ah-text);
  font-family: var(--ah-font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ah-blue); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

/* ── Utility classes ─────────────────────────────────────────────────── */
.ah-muted  { color: var(--ah-muted); }
.ah-muted-2{ color: var(--ah-muted-2); }

.ah-code {
  font-family: var(--ah-mono);
  background: #eef2f7;
  border: 1px solid #dde5ee;
  border-radius: var(--r-xs, 3px);
  padding: 1px 5px;
  font-size: 12px;
  color: #1e3a5f;
  letter-spacing: -.01em;
}
.ah-pre {
  font-family: var(--ah-mono);
  white-space: pre-wrap;
  margin: 0;
  font-size: 12px;
  color: #334155;
}

/* ── Icons ───────────────────────────────────────────────────────────── */
.btn-ico, .nav-ico {
  width: 14px;
  height: 14px;
  object-fit: contain;
  vertical-align: -2px;
  opacity: .80;
  flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.ah-btn {
  height: var(--ah-control-h);
  min-height: var(--ah-control-h);
  border: 1px solid var(--ah-border-2);
  background: #ffffff;
  border-radius: var(--ah-radius);
  padding: 0 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12.5px;
  color: #1a2b42;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1;
  letter-spacing: -.01em;
  transition:
    background  var(--ah-dur-fast) ease,
    border-color var(--ah-dur-fast) ease,
    color        var(--ah-dur-fast) ease,
    box-shadow   var(--ah-dur-fast) ease,
    transform    var(--ah-dur-fast) ease;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ah-btn:hover {
  background: #f4f7fb;
  border-color: var(--ah-border-2);
  box-shadow: 0 1px 4px rgba(15,23,42,.07);
  transform: translateY(-1px);
  text-decoration: none;
}
.ah-btn:active  { transform: translateY(0); box-shadow: none; }
.ah-btn:focus-visible {
  outline: 2px solid var(--ah-blue);
  outline-offset: 2px;
}

/* Variants */
.ah-btn.primary {
  background: var(--ah-blue);
  border-color: var(--ah-blue-2);
  color: #fff;
  box-shadow: 0 1px 3px rgba(26,75,174,.25), inset 0 1px 0 rgba(255,255,255,.12);
}
.ah-btn.primary:hover {
  background: var(--ah-blue-2);
  border-color: var(--ah-blue-2);
  box-shadow: 0 3px 8px rgba(26,75,174,.30);
}
.ah-btn.danger {
  background: var(--ah-red);
  border-color: #991b1b;
  color: #fff;
  box-shadow: 0 1px 3px rgba(185,28,28,.20);
}
.ah-btn.danger:hover {
  background: #991b1b;
  border-color: #7f1d1d;
  box-shadow: 0 3px 8px rgba(185,28,28,.28);
}
.ah-btn.danger-soft {
  background: #fff;
  border-color: #f3b5ae;
  color: var(--ah-red);
}
.ah-btn.danger-soft:hover {
  background: #fff5f5;
  border-color: #f3b5ae;
  box-shadow: 0 1px 4px rgba(185,28,28,.12);
}
.ah-btn.soft {
  background: var(--ah-surface-2);
  border-color: var(--ah-border);
  color: #334155;
}
.ah-btn.soft:hover { background: #edf2f8; }

.ah-btn.full   { width: 100%; }
.ah-btn.icon   { width: var(--ah-control-h); padding: 0; }
.ah-btn[disabled], .ah-btn:disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Alerts ──────────────────────────────────────────────────────────── */
.ah-alert {
  padding: 9px 11px;
  border-radius: var(--ah-radius);
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}
.ah-alert::before {
  flex-shrink: 0;
  font-size: 14px;
  margin-top: 1px;
}
.ah-alert.ok     { background: #f0fdf4; border-color: var(--ok-line, #a7f3c0); color: #14532d; }
.ah-alert.warn   { background: #fffbeb; border-color: var(--warn-line, #fde68a); color: #78350f; }
.ah-alert.error  { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }

/* ── Form field base ─────────────────────────────────────────────────── */
.ah-field          { display: grid; gap: 5px; margin-bottom: 12px; }
.ah-field label    { font-weight: 750; font-size: 12px; color: #283a52; }
.ah-field input,
.ah-field select,
.ah-field textarea {
  width: 100%;
  height: var(--ah-control-h);
  border: 1px solid var(--ah-border-2);
  border-radius: var(--ah-radius);
  background: #fff;
  padding: 0 9px;
  font: inherit;
  color: var(--ah-text);
  outline: none;
  transition: border-color var(--ah-dur-fast) ease, box-shadow var(--ah-dur-fast) ease;
}
.ah-field textarea {
  height: auto;
  min-height: 100px;
  padding: 7px 9px;
  resize: vertical;
  line-height: 1.5;
}
.ah-field input:hover,
.ah-field select:hover,
.ah-field textarea:hover {
  border-color: var(--ah-border-2);
}
.ah-field input:focus,
.ah-field select:focus,
.ah-field textarea:focus {
  border-color: var(--ah-blue);
  box-shadow: 0 0 0 3px var(--ah-blue-ring, rgba(26,75,174,.18));
}

/* ── Login page ──────────────────────────────────────────────────────── */
.clean-business-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0d1629 0%, #1a2f56 55%, #0f2244 100%);
}
/* subtle dot-grid texture */
.clean-business-login::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.login-frame {
  width: 100%;
  padding: 22px;
  position: relative;
  z-index: 1;
}
.login-panel {
  width: min(400px, 100%);
  margin: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--ah-radius-lg);
  padding: 30px 28px;
  box-shadow: 0 24px 64px rgba(0,0,0,.38), 0 6px 18px rgba(0,0,0,.20);
  animation: loginSlideIn .4s var(--ah-ease, cubic-bezier(.16,1,.3,1));
}
@keyframes loginSlideIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ah-border);
}
.login-brand img   { width: 36px; height: 36px; border-radius: 7px; }
.login-brand strong{ display: block; font-size: 17px; color: var(--ah-text); letter-spacing: -.025em; }
.login-brand span  { display: block; color: var(--ah-muted); font-size: 11.5px; margin-top: 1px; }
.login-panel h1    { margin: 0 0 4px; font-size: 22px; letter-spacing: -.03em; color: var(--ah-text); }
.login-panel > p   { margin: 0 0 18px; color: var(--ah-muted); font-size: 13px; }

/* ── Pills / badges ──────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-xs, 3px);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 750;
  border: 1px solid transparent;
  background: #edf2ff;
  color: #2446a3;
  white-space: nowrap;
  letter-spacing: .01em;
  line-height: 1.5;
}
.pill.ok      { background: #ecfdf5; color: var(--ah-green);  border-color: #a7f3c0; }
.pill.warn    { background: #fffbeb; color: var(--ah-amber);  border-color: #fde68a; }
.pill.danger  { background: #fef2f2; color: var(--ah-red);    border-color: #fecaca; }
.pill.off     { background: #f8fafc; color: #64748b;          border-color: #dde5ee; }

/* ── Misc shared ─────────────────────────────────────────────────────── */
.ah-actions-between { justify-content: space-between; }
/* 0.8.33 global motion polish */
:root {
  --ah-dur-mid: 180ms;
  --ah-dur-slow: 320ms;
  --ah-ease-spring: cubic-bezier(.18, .89, .32, 1.28);
  --ah-ease-soft: cubic-bezier(.16, 1, .3, 1);
}

.ah-btn {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  transition:
    background-color var(--ah-dur-mid) var(--ah-ease-soft),
    border-color var(--ah-dur-mid) var(--ah-ease-soft),
    color var(--ah-dur-mid) var(--ah-ease-soft),
    box-shadow var(--ah-dur-mid) var(--ah-ease-soft),
    transform var(--ah-dur-mid) var(--ah-ease-soft),
    filter var(--ah-dur-mid) var(--ah-ease-soft);
}
.ah-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,.34), transparent 44%);
  opacity: 0;
  transition: opacity var(--ah-dur-mid) ease;
  pointer-events: none;
}
.ah-btn:hover::after { opacity: .45; }
.ah-btn:hover { transform: translateY(-1px); filter: saturate(1.03); }
.ah-btn:active { transform: translateY(0) scale(.985); filter: saturate(.98); }
.ah-btn.icon:hover .btn-ico,
.top-icon:hover img,
.spa-nav a:hover .nav-ico { transform: translateY(-1px) scale(1.06); }
.btn-ico, .nav-ico { transition: transform var(--ah-dur-mid) var(--ah-ease-soft), opacity var(--ah-dur-mid) ease; }

.ah-alert, .form-error-summary, .pill, .ah-code {
  transition: background-color var(--ah-dur-mid) ease, border-color var(--ah-dur-mid) ease, color var(--ah-dur-mid) ease, box-shadow var(--ah-dur-mid) ease, transform var(--ah-dur-mid) var(--ah-ease-soft);
}

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


/* 0.9.0 UI/UX standardization layer: accessibility, predictable focus and shared app chrome */
:root {
  --ah-ink: var(--ah-text);
  --ah-card: var(--ah-surface);
  --ah-card-soft: #f8fafc;
  --ah-primary: var(--ah-blue);
  --ah-primary-2: var(--ah-blue-2);
  --ah-focus: rgba(26,75,174,.28);
  --ah-space-1: 4px;
  --ah-space-2: 8px;
  --ah-space-3: 12px;
  --ah-space-4: 16px;
  --ah-space-5: 20px;
}

.ah-skip-link {
  position: fixed;
  left: 12px;
  top: 10px;
  z-index: 2147483647;
  transform: translateY(-140%);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: #0d1629;
  color: #fff;
  box-shadow: var(--ah-shadow-lg);
  padding: 8px 12px;
  font-weight: 850;
  font-size: 12px;
  transition: transform var(--ah-dur-mid) var(--ah-ease-soft);
}
.ah-skip-link:focus { transform: none; outline: 3px solid var(--ah-focus); outline-offset: 2px; text-decoration: none; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ah-blue);
  outline-offset: 2px;
}
.ah-btn:focus-visible,
.top-icon:focus-visible,
.smart-choice-button:focus-visible {
  box-shadow: 0 0 0 4px var(--ah-focus), var(--ah-shadow);
  outline: 0;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.top-kbd, .kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border: 1px solid var(--ah-border-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f8fafc;
  color: #526274;
  font-family: var(--ah-mono);
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
}
.topbar-command .top-kbd { margin-left: 1px; }

.clean-business-login { isolation: isolate; }
.clean-business-login::after {
  content: '';
  position: fixed;
  inset: auto -10% -22% -10%;
  height: 48%;
  background: radial-gradient(ellipse at center, rgba(59,130,246,.20), transparent 62%);
  pointer-events: none;
  z-index: 0;
}
.login-panel { position: relative; overflow: hidden; }
.login-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ah-blue), #60a5fa, var(--ah-blue));
}
