:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #f1f5f9;
  --panel: #ffffff;
  --sidebar: #0b1220;
  --sidebar-2: #111827;
  /* Brand oranges, matching the SK Auto Smart logo.
     --accent (Aesthetic Orange) and --accent-hover (Calm Orange) are light, so
     anything drawn on top of them uses --accent-ink rather than white.
     --accent-text is the darkened shade for orange text and icons sitting on
     white, where a pastel cannot reach a readable contrast ratio.
     --accent-deep is for dark headers and gradients that still carry white text. */
  --accent: #f4ab6a;
  --accent-hover: #fab972;
  --accent-ink: #0f172a;
  --accent-text: #b14507;
  --accent-soft: #fef1e5;
  --accent-deep: #7c2d12;
  --danger: #b91c1c;
  --warn: #b45309;
  --ok: #15803d;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .04);
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── App shell ── */
.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--surface);
}

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transform: translateX(-100%);
  transition: transform .2s ease;
}

.app-sidebar.is-open,
.app-shell.sidebar-open .app-sidebar {
  transform: translateX(0);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}

/* Full SK AUTO SMART wordmark (white plate). Height-sized so dark sidebars
   and headers show it as a small rounded badge. */
.app-brand-mark {
  height: 40px;
  width: auto;
  max-width: 148px;
  flex: 0 0 auto;
  display: block;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.auth-logo {
  display: block;
  height: 72px;
  width: auto;
  max-width: 220px;
  margin-bottom: 20px;
  object-fit: contain;
}

.app-brand-text strong {
  display: block;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
}

.app-brand-text span {
  font-size: 11px;
  color: #94a3b8;
}

.app-nav {
  padding: 14px 10px;
  overflow-y: auto;
  flex: 1;
}

.app-nav-label {
  margin: 10px 10px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.app-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #cbd5e1;
}

.app-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }

.app-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.app-nav-ico {
  width: 18px;
  text-align: center;
  opacity: .85;
  font-size: 14px;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: 0;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(90deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  color: #e2e8f0;
}

.app-menu-btn {
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: #e2e8f0;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.app-menu-btn:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.app-topbar-title {
  min-width: 0;
  flex: 1;
}

.app-topbar-title h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
  color: #fff;
}

.app-topbar-title p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.app-topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 650;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  font-size: 12px;
  color: #e2e8f0;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.user-chip:hover {
  border-color: rgba(244, 171, 106, .55);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.user-chip-text { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-topbar .btn-secondary {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.14);
  color: #e2e8f0;
}
.app-topbar .btn-secondary:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-deep);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  object-fit: cover;
  flex: 0 0 auto;
}

.app-content {
  padding: 16px;
  flex: 1;
}

.app-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 35;
}

.app-shell.sidebar-open .app-overlay { display: block; }

@media (min-width: 1024px) {
  .app-sidebar { transform: none; }
  .app-main { margin-left: 260px; }
  .app-menu-btn { display: none; }
  .app-overlay { display: none !important; }
  .app-content { padding: 22px 24px 32px; }
  .app-topbar-title h1 { font-size: 18px; }
}

@media (max-width: 639px) {
  .user-chip { padding-right: 5px; }
  .user-chip-text { display: none; }
}

/* ── Public shell ── */
.public-shell { min-height: 100vh; display: flex; flex-direction: column; background: #eef2f6; }
.public-top {
  background: #0b1220;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.public-top a.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; }
.public-body { flex: 1; padding: 20px 16px 40px; width: 100%; max-width: 1100px; margin: 0 auto; }

/* ── UI primitives ── */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.page-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

@media (min-width: 700px) {
  .kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.kpi .label {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.kpi .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1;
}

.kpi .hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-hd h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.panel-bd { padding: 16px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ── Inline auto-filter bar (lives on the right of a page header) ── */
.page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-input,
.filter-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
  height: 36px;
}

.filter-input {
  width: 200px;
  max-width: 100%;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 171, 106, .40);
}

.filter-clear {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
}

.filter-clear:hover {
  background: #f8fafc;
  color: var(--ink);
}

.date-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.date-range-select { min-width: 132px; }
.date-range-chip {
  display: inline-flex;
  align-items: center;
  max-width: 180px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.date-range-chip:hover { border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
  text-decoration: none;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  background-clip: padding-box;
}

/* The brand orange is light, so the primary button carries dark ink instead of
   white — white on it lands around 1.9:1 and is effectively unreadable. */
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn-secondary:hover { background: #f8fafc; }
.btn-ghost { background: transparent; color: var(--accent-text); border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-ok { background: #dcfce7; color: var(--ok); }
.badge-warn { background: #ffedd5; color: var(--warn); }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-muted { background: #f1f5f9; color: var(--muted); }
.badge-danger { background: #fee2e2; color: var(--danger); }

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th {
  text-align: left;
  padding: 10px 14px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

table.data tr:hover td { background: #f8fafc; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 768px) {
  .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 171, 106, .40);
}

.alert {
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.alert-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

.quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 700px) {
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
}

.quick-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}

.quick-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.quick-card strong { display: block; font-size: 14px; margin-bottom: 4px; }
.quick-card span { font-size: 12px; color: var(--muted); }

.stack-gap { display: grid; gap: 12px; }

/* Public / mobile warranty card */
.cert-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
}

.cert-card-hd {
  background: linear-gradient(135deg, #0b1220, var(--accent-deep));
  color: #fff;
  padding: 18px 18px 16px;
}

.cert-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: 160px;
  margin-bottom: 14px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}
.cert-card-hd .eyebrow { font-size: 11px; opacity: .75; text-transform: uppercase; letter-spacing: .08em; }
.cert-card-hd h2 { margin: 6px 0 0; font-size: 20px; }
.cert-rows { padding: 8px 18px 18px; }
.cert-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.cert-row:last-child { border-bottom: 0; }
.cert-row dt { color: var(--muted); }
.cert-row dd { margin: 0; font-weight: 650; text-align: right; }
.cert-actions { padding: 0 18px 18px; display: grid; gap: 8px; }

/* ── Centered split sign-in card + soft vector page décor ── */
.login-page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: #eef2f6;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.login-bg-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .08);
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}

.login-card-visual {
  display: none;
  position: relative;
  min-height: 460px;
  background: #0b1220;
  overflow: hidden;
}

.login-card-hero {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.login-card-form {
  position: relative;
  padding: 76px 22px 28px;
  background: #fff;
}

.login-card-form-inner {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
}

.login-card-logo {
  position: absolute;
  top: 16px;
  right: 16px;
  display: block;
  height: 58px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
}

.login-card-form h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
}

.login-form { margin-top: 22px; }

.login-card-form .field input {
  background: #fff;
  height: 44px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
}

.login-card-form .btn-primary {
  height: 44px;
  border-radius: 10px;
  margin-top: 4px;
}

@media (min-width: 780px) {
  .login-card {
    grid-template-columns: 1.05fr 0.95fr;
    min-height: 520px;
  }

  .login-card-visual { display: block; }

  .login-card-form {
    display: flex;
    align-items: center;
    padding: 72px 44px 40px;
  }

  .login-card-form-inner { margin: 0; }

  .login-card-logo {
    top: 20px;
    right: 22px;
    height: 72px;
    max-width: 230px;
  }
}

.auth-wrap {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card .sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.hero-app {
  background: linear-gradient(145deg, #0b1220 0%, var(--accent-deep) 55%, var(--accent-text) 100%);
  color: #fff;
  border-radius: 18px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
}

.hero-logo {
  display: block;
  height: 56px;
  width: auto;
  max-width: 200px;
  margin-bottom: 16px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.hero-app h1 {
  margin: 10px 0 0;
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.15;
  letter-spacing: -.03em;
  max-width: 16ch;
}

.hero-app p { margin: 12px 0 0; color: #cbd5e1; max-width: 42ch; font-size: 14px; line-height: 1.5; }
.hero-app .actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }

.link-accent { color: var(--accent-text); font-weight: 650; }
.link-accent:hover { text-decoration: underline; }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ── Modal (Alpine-driven) ── */
[x-cloak] { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
  width: 100%;
  max-width: 560px;
  margin: auto;
  overflow: hidden;
}

.modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-hd h3 { margin: 0; font-size: 16px; font-weight: 650; }

.modal-x {
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.modal-x:hover { background: #f1f5f9; color: var(--ink); }

.modal-bd { padding: 20px; }

.modal-ft {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

/* ══════════════════════════════════════════════════
   App-like mobile chrome + prototype-aligned flows
   ══════════════════════════════════════════════════ */

/* ── Bottom tab bar (mobile app feel) ── */
.bottom-nav { display: none; }

@media (max-width: 1023px) {
  .bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 45;
    display: flex;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 12px rgba(15, 23, 42, .06);
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
  }
  .bottom-nav a .bn-ico { font-size: 19px; line-height: 1; }
  .bottom-nav a.active { color: var(--accent-text); background: var(--accent-soft); }
  .bottom-nav a.bn-primary .bn-ico {
    width: 42px; height: 42px; margin-top: -20px;
    display: grid; place-items: center;
    background: var(--accent); color: var(--accent-ink);
    border-radius: 50%; font-size: 22px;
    box-shadow: 0 4px 12px rgba(177, 69, 7, .35);
    border: 3px solid #fff;
  }
  .bottom-nav a.bn-primary { color: var(--accent-text); }

  /* keep content clear of the bar */
  .app-content { padding-bottom: 84px; }
  /* on mobile the hamburger drawer is still available but bottom nav is primary */
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs a, .tabs .tab {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  cursor: pointer;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active, .tabs .tab.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}
.tab-count {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.tabs a.active .tab-count { color: var(--accent-text); }

/* ── Section titles ── */
.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 0 10px;
}

/* ── Wizard steps ── */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
}
.wizard-step {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 3px solid var(--line);
  transition: color .15s, border-color .15s;
}
.wizard-step.done { color: var(--ok); border-color: #86efac; }
.wizard-step.current { color: var(--accent-text); border-color: var(--accent); }
.wizard-step .wz-num {
  display: inline-flex;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--line);
  color: #fff;
  align-items: center; justify-content: center;
  font-size: 11px; margin-right: 5px;
}
.wizard-step.done .wz-num { background: var(--ok); }
.wizard-step.current .wz-num { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 560px) {
  .wizard-step .wz-label { display: none; }
  .wizard-step .wz-num { margin-right: 0; }
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}

/* ── Selectable pick cards (product / warranty) ── */
.pick-list { display: grid; gap: 10px; }
.pick-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pick-card:hover { border-color: var(--accent); }
.pick-card.selected { border-color: var(--accent); background: var(--accent-soft); }
/* Native controls draw a white tick on the fill, so they need the darker orange. */
.pick-card input { accent-color: var(--accent-text); width: 18px; height: 18px; }
.pick-card .pick-title { font-weight: 650; font-size: 14px; }
.pick-card .pick-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.product-pick {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.product-pick:hover { border-color: var(--accent); }
.product-pick.selected { border-color: var(--accent); background: var(--accent-soft); }
.product-pick h4 { margin: 0; font-size: 13px; }
.product-pick p { margin: 4px 0 0; font-size: 11px; color: var(--muted); }

/* ── Progress tracker (claim status) ── */
.progress-track {
  display: flex;
  align-items: flex-start;
  margin: 8px 0 20px;
}
.progress-step { flex: 1; text-align: center; position: relative; }
.progress-step .dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--line);
  color: #fff;
  margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  position: relative; z-index: 2;
}
.progress-step.done .dot { background: var(--ok); }
.progress-step.current .dot { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.progress-step.reject .dot { background: var(--danger); }
.progress-step .lbl { font-size: 10px; color: var(--muted); line-height: 1.2; }
.progress-step.current .lbl, .progress-step.done .lbl { color: var(--ink); font-weight: 600; }
.progress-line { flex: 1; height: 3px; background: var(--line); margin: 13px -6px 0; border-radius: 3px; }
.progress-line.done { background: var(--ok); }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 4px; bottom: 4px;
  width: 2px; background: var(--line);
}
.timeline-item { position: relative; margin-bottom: 16px; font-size: 13px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px; top: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel);
}
.timeline-item .tl-date { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.timeline-item .tl-role { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Thumb grid (uploads / attachments) ── */
.thumb-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb {
  width: 72px; height: 72px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: grid; place-items: center;
  background: #f8fafc;
  color: var(--muted);
  font-size: 22px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Claim upload step (photo picker + video dropzone) ── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.req { color: var(--danger); }

.field-error {
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
}

.thumb.add {
  border-style: dashed;
  border-color: #cbd5e1;
  color: var(--accent-text);
  font-size: 24px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.thumb.add:hover { border-color: var(--accent); background: var(--accent-soft); }

.thumb-pick { position: relative; }
.thumb-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.thumb-remove:hover { background: var(--danger); }

.upload-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dz-link { color: var(--accent-text); font-weight: 600; text-decoration: underline; }

.video-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}
.video-chip .vc-icon {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
}
.video-chip .vc-meta { min-width: 0; flex: 1; }
.video-chip .vc-meta strong {
  display: block;
  font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.video-chip .vc-meta small { color: var(--muted); font-size: 11px; }
.video-chip .vc-remove {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.video-chip .vc-remove:hover { color: var(--danger); }

.consent-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 18px;
  font-size: 13px;
  cursor: pointer;
}
.consent-line input { margin-top: 2px; }

/* ── Brand logo (lists) & logo picker (brand form) ── */
.brand-logo {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
  padding: 3px;
}
.brand-logo-fallback {
  display: grid; place-items: center;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 0;
}

.logo-picker { display: flex; gap: 14px; align-items: center; }
.logo-preview {
  width: 76px; height: 76px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  overflow: hidden;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview.is-avatar { border-radius: 50%; }
.logo-preview.is-avatar img { width: 100%; height: 100%; object-fit: cover; }
.logo-preview .logo-empty { font-size: 11px; color: var(--muted); }

.form-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0 14px;
}
.section-label {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 650;
}
.field input.is-readonly {
  background: #f8fafc;
  color: var(--muted);
  cursor: default;
}
.logo-actions { min-width: 0; }
.logo-actions .upload-hint {
  margin-top: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Password reveal toggle (injected around every password input) ── */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 42px; }
.pw-toggle {
  position: absolute;
  top: 50%; right: 4px;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--ink); background: var(--surface); }
.pw-toggle.is-on { color: var(--accent-text); }
.pw-toggle:focus-visible {
  outline: none;
  color: var(--accent-text);
  box-shadow: 0 0 0 3px rgba(244, 171, 106, .45);
}

/* Attachment previews on claim review / approval pages. */
.attachment-video {
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius);
  background: #0b1220;
}

/* ── Two-column info grid on cards ── */
.info-2col { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .info-2col { grid-template-columns: 1fr 1fr; } }
.info-line { font-size: 13px; line-height: 1.9; }
.info-line dt { color: var(--muted); font-size: 12px; }

/* ── List row (dashboard action lists) ── */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}
.list-row:last-child { border-bottom: 0; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-weight: 650; font-size: 13.5px; }
.list-row .lr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Radio decision groups ── */
.radio-group { display: grid; gap: 4px; }
.radio-group label {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
}
.radio-group label:hover { background: #f8fafc; }
.radio-group input { accent-color: var(--accent-text); width: 17px; height: 17px; }

/* ── Customer certificate cards ── */
.cert-list-card { border-left: 4px solid var(--accent); }
.cert-list-card.is-active { border-left-color: var(--ok); }
.cert-list-card.is-expiring { border-left-color: var(--warn); }
.cert-list-card.is-expired { border-left-color: var(--danger); }

/* Inline wizard field error */
.field-invalid,
.field .field-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .12) !important;
}

/* ── Active / inactive switch ── */
.switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  vertical-align: middle;
}
.switch-wrap .switch-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  min-width: 28px;
}
.switch-wrap.is-on .switch-label { color: var(--ok); }

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background .15s ease;
}
.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .2);
  transition: transform .15s ease;
}
/* The toggle reports Active / Inactive, so its track matches the green "Active"
   label beside it rather than the brand orange. */
.switch input[type="checkbox"]:checked ~ .switch-slider { background: var(--ok); }
.switch input[type="checkbox"]:checked ~ .switch-slider::before { transform: translateX(18px); }
.switch input[type="checkbox"]:focus-visible ~ .switch-slider { box-shadow: 0 0 0 3px rgba(244, 171, 106, .45); }
.switch input[type="hidden"] { display: none !important; }

/* Form checkbox styled as switch (edit pages / modals) */
.switch-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-size: 13px;
  font-weight: 600;
}
.switch-field .switch { margin: 0; }

/* ── Warranty search (file claim autocomplete) ── */
.file-claim-panel { overflow: visible; }
.file-claim-panel .panel-bd { overflow: visible; }
.ws-box { position: relative; z-index: 5; }
.ws-input-row { position: relative; }
.ws-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 36px 10px 12px;
  font: inherit;
  font-size: 14px;
  background: #fff;
}
.ws-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 171, 106, .40);
}
.ws-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 14px;
}
.ws-clear:hover { background: #f1f5f9; color: var(--ink); }
.ws-results {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
  max-height: 280px;
  overflow-y: auto;
}
.ws-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  border-bottom: 1px solid #f1f5f9;
}
.ws-item:last-child { border-bottom: 0; }
.ws-item:hover,
.ws-item.active { background: var(--accent-soft); }
.ws-item strong { font-size: 13.5px; }
.ws-item span { font-size: 12.5px; color: var(--ink-soft); }
.ws-item small { font-size: 11px; color: var(--muted); }
.ws-empty {
  padding: 14px 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.ws-selected {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ok);
}

/* ==========================================================================
   Mobile refinements — everything below only applies to the phone/tablet shell.
   ========================================================================== */

@media (max-width: 1023px) {
  /* iOS Safari zooms the whole page whenever a focused control is under 16px.
     Desktop keeps the tighter 13–14px sizing defined above. */
  .field input,
  .field select,
  .field textarea,
  .filter-input,
  .filter-select,
  .ws-input {
    font-size: 16px;
  }

  .filter-input,
  .filter-select {
    height: 44px;
  }

  /* viewport-fit=cover lets content sit under the status bar / Dynamic Island. */
  .app-topbar {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }

  /* Comfortable hit areas. The visual size stays the same; only the tappable
     region grows, via padding on the control or an invisible ::after overlay. */
  .app-menu-btn,
  .modal-x,
  .filter-clear,
  .ws-clear,
  .vc-remove,
  .thumb-remove,
  .switch {
    position: relative;
  }

  .app-menu-btn::after,
  .modal-x::after,
  .filter-clear::after,
  .ws-clear::after,
  .vc-remove::after,
  .thumb-remove::after,
  .switch::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
  }

  .btn-sm,
  .pager a,
  .pager span,
  .tabs a,
  .bottom-nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Tall forms (add dealer especially) scrolled the overlay instead of the
     dialog, which dragged the page behind along with it. */
  .modal {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 32px);
  }

  .modal-bd {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-ft {
    flex-shrink: 0;
  }

  /* Wide admin grids stay horizontally scrollable, but the identifying column
     stays put so a row is still readable once scrolled sideways. */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  table.data th:first-child,
  table.data td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    box-shadow: 1px 0 0 var(--line);
  }

  table.data th:first-child {
    background: #f8fafc;
    z-index: 2;
  }

}

/* Body scroll lock while a modal is open — set by site.js. */
body.modal-open {
  overflow: hidden;
}

@media (max-width: 560px) {
  /* Five 10px captions do not fit; keep the numbered dots and show the caption
     only for the step the claim is actually on. */
  .progress-step .lbl {
    display: none;
  }

  .progress-step.current .lbl,
  .progress-step.reject .lbl {
    display: block;
  }
}
