/* =====================================================================
   Lkota — design system (Milestone 8). Layered on top of Bootstrap 5.
   Premium, high-trust automotive SaaS look. Mobile-first.
   ===================================================================== */
:root {
  --lk-navy: #0f172a;        /* sidebar / header */
  --lk-navy-2: #1e293b;
  --lk-navy-3: #334155;
  --lk-ink: #0f172a;         /* primary text */
  --lk-muted: #64748b;
  --lk-line: #e2e8f0;
  --lk-bg: #f1f5f9;          /* app background */
  --lk-surface: #ffffff;
  --lk-accent: #2563eb;      /* electric blue */
  --lk-accent-2: #1d4ed8;
  --lk-teal: #0d9488;
  --lk-success: #16a34a;
  --lk-warning: #d97706;
  --lk-danger: #dc2626;
  --lk-radius: 16px;
  --lk-radius-sm: 11px;
  --lk-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  --lk-shadow-lg: 0 12px 40px rgba(15,23,42,.12);
  --lk-sidebar-w: 264px;
}

* { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--lk-bg);
  color: var(--lk-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--lk-accent); text-decoration: none; }
a:hover { color: var(--lk-accent-2); }
.text-muted { color: var(--lk-muted) !important; }

/* ---------- Cards ---------- */
.card, .lk-card {
  border: 1px solid var(--lk-line);
  border-radius: var(--lk-radius);
  box-shadow: var(--lk-shadow);
  background: var(--lk-surface);
}
.lk-card-hover { transition: transform .12s ease, box-shadow .12s ease; }
.lk-card-hover:hover { transform: translateY(-2px); box-shadow: var(--lk-shadow-lg); }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--lk-radius-sm); font-weight: 600; min-height: 46px;
       display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { min-height: 36px; border-radius: 9px; }
.btn-lg { min-height: 52px; }
.btn-primary { background: var(--lk-accent); border-color: var(--lk-accent); }
.btn-primary:hover { background: var(--lk-accent-2); border-color: var(--lk-accent-2); }
.btn-success { background: var(--lk-success); border-color: var(--lk-success); }
.btn-outline-primary { color: var(--lk-accent); border-color: #c7d2fe; }
.btn-outline-primary:hover { background: var(--lk-accent); border-color: var(--lk-accent); }
.btn:focus-visible, .form-control:focus, .form-select:focus,
a:focus-visible, .nav-link:focus-visible {
  outline: 3px solid rgba(37,99,235,.35); outline-offset: 1px; box-shadow: none;
}

/* ---------- Forms ---------- */
.form-control, .form-select { border-radius: var(--lk-radius-sm); border-color: var(--lk-line);
  padding: .6rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--lk-accent); }
.form-label { font-weight: 600; font-size: .85rem; color: #334155; }
.lk-form-section { border-top: 1px solid var(--lk-line); padding-top: 1rem; margin-top: 1rem; }

/* ---------- Badges (soft pill style) ---------- */
.badge { font-weight: 600; border-radius: 999px; padding: .38em .7em; letter-spacing: .2px; }
.badge.bg-success { background: #dcfce7 !important; color: #166534 !important; }
.badge.bg-info { background: #e0f2fe !important; color: #075985 !important; }
.badge.bg-warning { background: #fef3c7 !important; color: #92400e !important; }
.badge.bg-danger { background: #fee2e2 !important; color: #991b1b !important; }
.badge.bg-secondary { background: #eef2f7 !important; color: #475569 !important; }
.badge.bg-light { background: #f1f5f9 !important; color: #475569 !important; }
.badge.bg-dark { background: #0f172a !important; color: #fff !important; }

/* ---------- Layout shell ---------- */
.lk-shell { display: flex; min-height: 100vh; }
.lk-topbar {
  position: sticky; top: 0; z-index: 1040; height: 58px;
  background: var(--lk-surface); border-bottom: 1px solid var(--lk-line);
  display: flex; align-items: center; gap: .5rem; padding: 0 .9rem;
}
.lk-brand { font-weight: 800; letter-spacing: .3px; display: flex; align-items: center; gap: .5rem; }
.lk-brand .lk-logo { width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--lk-accent), var(--lk-teal));
  color: #fff; display: grid; place-items: center; font-size: 1rem; }

/* Sidebar (dark) */
.lk-sidebar {
  width: var(--lk-sidebar-w); background: var(--lk-navy) !important; color: #cbd5e1;
  display: flex; flex-direction: column; padding: 0;
}
@media (min-width: 992px) {
  .lk-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1045; }
}
.lk-sidebar .lk-brand { color: #fff; padding: 1rem 1.1rem; font-size: 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,.07); }
.lk-sidebar .lk-nav { padding: .75rem .6rem; overflow-y: auto; flex: 1; }
.lk-nav-label { text-transform: uppercase; font-size: .68rem; letter-spacing: .8px;
  color: #64748b; padding: .9rem .7rem .3rem; font-weight: 700; }
.lk-sidebar .nav-link {
  color: #cbd5e1; border-radius: 10px; padding: .62rem .75rem; margin-bottom: 2px;
  font-weight: 500; display: flex; align-items: center; gap: .65rem; font-size: .92rem;
}
.lk-sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .9; }
.lk-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.lk-sidebar .nav-link.active { background: var(--lk-accent); color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.4); }
.lk-sidebar .nav-link.disabled { color: #475569; }
.lk-sidebar-foot { padding: .75rem; border-top: 1px solid rgba(255,255,255,.07); }
.lk-userchip { display: flex; align-items: center; gap: .6rem; color: #e2e8f0; }
.lk-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--lk-navy-3);
  color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }

.lk-main { flex: 1; min-width: 0; }
@media (min-width: 992px) {
  .lk-main { margin-left: var(--lk-sidebar-w); }
  .lk-topbar { display: none; }
}
.lk-content { padding: 1.1rem; max-width: 1140px; margin: 0 auto; }
@media (min-width: 992px) { .lk-content { padding: 1.6rem; } }

/* Page header */
.lk-page-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.lk-page-title { font-size: 1.5rem; font-weight: 800; margin: 0; line-height: 1.1; }
.lk-page-sub { color: var(--lk-muted); font-size: .9rem; margin-top: .15rem; }

/* Chips */
.lk-chip { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600;
  font-size: .8rem; padding: .3rem .65rem; border-radius: 999px; background: #eef2f7; color: #475569; }
.lk-chip.ok { background: #dcfce7; color: #166534; }
.lk-chip.warn { background: #fef3c7; color: #92400e; }
.lk-chip.bad { background: #fee2e2; color: #991b1b; }

/* Stat cards */
.lk-stat-card { padding: 1rem 1.1rem; }
.lk-stat-card .lk-stat-icon { width: 38px; height: 38px; border-radius: 11px; display: grid;
  place-items: center; font-size: 1.1rem; margin-bottom: .55rem; background: #eff6ff; color: var(--lk-accent); }
.lk-stat-card .lk-stat-label { color: var(--lk-muted); font-size: .8rem; font-weight: 600; }
.lk-stat-card .lk-stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.lk-stat-icon.green { background: #dcfce7; color: var(--lk-success); }
.lk-stat-icon.amber { background: #fef3c7; color: var(--lk-warning); }
.lk-stat-icon.teal { background: #ccfbf1; color: var(--lk-teal); }

/* Status stepper / timeline */
.lk-stepper { display: flex; flex-wrap: wrap; gap: .25rem; }
.lk-step { flex: 1 1 0; min-width: 92px; text-align: center; position: relative; padding-top: 6px; }
.lk-step .lk-dot { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto .35rem;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  background: #e2e8f0; color: #64748b; border: 2px solid #e2e8f0; }
.lk-step .lk-step-label { font-size: .78rem; color: var(--lk-muted); font-weight: 600; }
.lk-step.done .lk-dot { background: var(--lk-success); border-color: var(--lk-success); color: #fff; }
.lk-step.current .lk-dot { background: var(--lk-accent); border-color: var(--lk-accent); color: #fff;
  box-shadow: 0 0 0 4px rgba(37,99,235,.18); }
.lk-step.current .lk-step-label { color: var(--lk-accent); }
.lk-step::before { content: ""; position: absolute; top: 21px; left: -50%; width: 100%; height: 2px;
  background: #e2e8f0; z-index: 0; }
.lk-step:first-child::before { display: none; }
.lk-step.done::before, .lk-step.current::before { background: var(--lk-success); }
.lk-step .lk-dot { position: relative; z-index: 1; }

/* Empty state */
.lk-empty { padding: 2.2rem 1rem; }
.lk-empty-icon { width: 60px; height: 60px; border-radius: 16px; margin: 0 auto .8rem;
  display: grid; place-items: center; font-size: 1.6rem; background: #eff6ff; color: var(--lk-accent); }
.lk-empty-title { font-weight: 700; font-size: 1.05rem; }
.lk-empty-text { color: var(--lk-muted); font-size: .9rem; max-width: 360px; margin: .25rem auto 0; }

/* Tables -> comfortable */
.table { --bs-table-bg: transparent; }
.table > thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px;
  color: var(--lk-muted); border-bottom-color: var(--lk-line); }
.table > tbody td { border-color: var(--lk-line); }
.lk-row-link { cursor: pointer; }
.lk-row-link:hover { background: #f8fafc; }

/* Alerts */
.alert { border: 0; border-radius: var(--lk-radius-sm); border-left: 4px solid transparent; }
.alert-success { background: #f0fdf4; color: #166534; border-left-color: var(--lk-success); }
.alert-info { background: #eff6ff; color: #1e40af; border-left-color: var(--lk-accent); }
.alert-warning { background: #fffbeb; color: #92400e; border-left-color: var(--lk-warning); }
.alert-danger { background: #fef2f2; color: #991b1b; border-left-color: var(--lk-danger); }

/* Mobile sticky bottom action bar */
.lk-bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1035;
  background: var(--lk-surface); border-top: 1px solid var(--lk-line);
  display: flex; padding: .4rem; gap: .4rem;
  box-shadow: 0 -6px 20px rgba(15,23,42,.06);
  padding-bottom: calc(.4rem + env(safe-area-inset-bottom));
}
.lk-bottombar a { flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: .35rem; border-radius: 10px; color: #475569; font-size: .68rem; font-weight: 600; }
.lk-bottombar a i { font-size: 1.2rem; }
.lk-bottombar a.primary { color: #fff; background: var(--lk-accent); }
@media (min-width: 992px) { .lk-bottombar { display: none; } }
.lk-has-bottombar .lk-content { padding-bottom: 84px; }
@media (min-width: 992px) { .lk-has-bottombar .lk-content { padding-bottom: 1.6rem; } }

/* Signature pad */
.lk-sigpad { width: 100%; height: 240px; border: 2px dashed #cbd5e1; border-radius: var(--lk-radius-sm);
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(45deg, #f8fafc, #f8fafc 6px, #fff 6px, #fff 12px);
  touch-action: none; }

/* Media thumbnails */
.lk-thumb { aspect-ratio: 4/3; border-radius: 11px; overflow: hidden; background: #f1f5f9;
  display: grid; place-items: center; border: 1px solid var(--lk-line); }
.lk-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Utilities */
.lk-soft { background: #f8fafc; border-radius: var(--lk-radius-sm); }
.lk-divider { height: 1px; background: var(--lk-line); margin: 1rem 0; }

/* ---------- Auth shell ---------- */
body.lk-auth { background: radial-gradient(1200px 520px at 50% -10%, #1e293b, #0f172a 62%); min-height: 100vh; }
.lk-auth-wrap { max-width: 440px; margin: 0 auto; padding: 2.4rem 1rem 3rem; }
.lk-auth .lk-brand { color: #fff; justify-content: center; font-size: 1.5rem; }
.lk-auth .lk-logo { width: 36px; height: 36px; font-size: 1.15rem; }
.lk-auth .card { box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.lk-auth-foot { text-align: center; color: #94a3b8; font-size: .8rem; margin-top: 1rem; }
.passcode { letter-spacing: .55em; text-align: center; font-size: 1.35rem; }

/* ---- VIN live scanner (Milestone 9 UX) ---------------------------------- */
.lk-noscroll { overflow: hidden; }
.lk-scan-overlay {
  position: fixed; inset: 0; z-index: 1080; background: #0b1020;
  display: flex; flex-direction: column;
}
.lk-scan-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; color: #fff;
}
.lk-scan-stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000; overflow: hidden;
}
.lk-scan-frame {
  position: relative; display: inline-block; line-height: 0;
  max-width: 100%; max-height: 78vh;
}
.lk-scan-video, .lk-scan-canvas { display: block; max-width: 100%; max-height: 78vh; }
.lk-scan-canvas { background: #000; }
/* Narrow horizontal guide box — only the VIN strip should sit inside it. */
.lk-scan-guide {
  position: absolute; left: 7%; right: 7%; top: 42%; height: 16%;
  border: 2px solid #fff; border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.5);
}
.lk-scan-line {
  position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: #4c8bf5; transform: translateY(-1px);
}
.lk-scan-hint {
  position: absolute; left: 0; right: 0; bottom: 6%; text-align: center;
  color: #fff; font-size: .9rem; padding: 0 1rem;
  text-shadow: 0 1px 4px rgba(0,0,0,.85);
}
.lk-scan-controls { padding: 1rem; background: #0b1020; display: flex; justify-content: center; }
.lk-scan-grp { display: flex; gap: .75rem; align-items: center; justify-content: center; }
.lk-scan-shutter {
  width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff;
  background: #4c8bf5; cursor: pointer;
}
.lk-scan-shutter:active { transform: scale(.94); }
.lk-scan-overlay .btn.active { background: #4c8bf5; color: #fff; border-color: #4c8bf5; }
