/* Liensure — app.css
   Brand: #1F3A5F navy, #5F6B7A slate, #F5F7FA off-white
   Font: Montserrat
*/

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand colours */
  --navy:        #1F3A5F;
  --navy-dark:   #162d4a;
  --navy-light:  #e8eef5;
  --navy-mid:    #2d5282;
  --slate:       #5F6B7A;
  --slate-light: #f0f3f7;

  /* Page surfaces */
  --bg-page:     #F5F7FA;
  --bg:          #ffffff;
  --bg-2:        #f8fafc;
  --bg-3:        #f0f3f7;

  /* Borders */
  --border:      #dde3ea;
  --border-2:    #c8d0db;

  /* Text */
  --text:        #1a2332;
  --text-2:      #4a5568;
  --text-3:      #8fa3be;

  /* Accent — use navy as primary */
  --blue:        #1F3A5F;
  --blue-light:  #e8eef5;
  --blue-mid:    #2d5282;
  --blue-hover:  #162d4a;

  /* Status colours */
  --green:       #059669;
  --green-light: #f0fdf4;
  --green-border:#bbf7d0;

  --amber:       #d97706;
  --amber-light: #fffbeb;
  --amber-border:#fde68a;

  --red:         #dc2626;
  --red-light:   #fef2f2;
  --red-border:  #fecaca;

  --sidebar-w:   230px;
  --topbar-h:    58px;
  --radius:      8px;
  --radius-lg:   10px;

  --font-ui:     'Montserrat', system-ui, -apple-system, sans-serif;
  --font-mono:   'Courier New', monospace;

  --shadow-sm:   0 1px 3px rgba(31,58,95,.08), 0 1px 2px rgba(31,58,95,.05);
  --shadow:      0 4px 16px rgba(31,58,95,.10), 0 1px 4px rgba(31,58,95,.06);
}

html { font-size: 15px; }
body {
  font-family: var(--font-ui);
  background: var(--bg-page);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; }

.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .2s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.logo-mark {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 36px; height: 36px; }

.logo-text {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: .3px;
}
.logo-text span { color: #a0b8d8; font-weight: 400; }

.nav-list { list-style: none; padding: 12px 10px; flex: 1; overflow-y: auto; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .12s;
  margin-bottom: 2px;
  letter-spacing: .1px;
}
.nav-link:hover  { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-link .icon  { width: 15px; height: 15px; flex-shrink: 0; opacity: .8; }
.nav-link.active .icon { opacity: 1; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 14px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.user-avatar {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 12.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10.5px; color: rgba(255,255,255,.5); text-transform: capitalize; letter-spacing: .3px; }

.logout-btn { color: rgba(255,255,255,.4); display: flex; align-items: center; padding: 4px; border-radius: 4px; transition: color .12s; text-decoration: none; }
.logout-btn:hover { color: #ff8080; }
.logout-btn .icon { width: 14px; height: 14px; }

/* ── MAIN ────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky; top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 var(--border);
}

.page-title { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; letter-spacing: .1px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-2); padding: 4px; }
.menu-toggle .icon { width: 20px; height: 20px; }

.content { padding: 24px; }

.icon { width: 16px; height: 16px; display: inline-block; vertical-align: middle; }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: all .12s; white-space: nowrap; line-height: 1;
  letter-spacing: .2px;
}
.btn .icon { width: 14px; height: 14px; }
.btn-primary   { background: var(--navy);  color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-dark); border-color: var(--navy-dark); }
.btn-secondary { background: var(--bg); color: var(--text-2); border-color: var(--border-2); }
.btn-secondary:hover { background: var(--bg-3); color: var(--text); border-color: var(--slate); }
.btn-success   { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover { background: #047857; }
.btn-warning   { background: var(--amber); color: #fff; border-color: var(--amber); }
.btn-warning:hover { background: #b45309; }
.btn-danger    { background: var(--red);   color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost     { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-3); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── CARDS ───────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 11px; font-weight: 700;
  color: var(--slate);
  letter-spacing: .7px; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.card-title .icon { width: 13px; height: 13px; }

/* ── STAT TILES ──────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }

.stat-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-tile::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--navy);
  opacity: .15;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.stat-tile.warn::after   { background: var(--amber); opacity: 1; }
.stat-tile.danger::after { background: var(--red);   opacity: 1; }
.stat-tile.ok::after     { background: var(--green); opacity: 1; }
.stat-tile.blue::after   { background: var(--navy);  opacity: 1; }

.stat-label { font-size: 11px; color: var(--text-3); font-weight: 600; margin-bottom: 8px; letter-spacing: .5px; text-transform: uppercase; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; font-family: var(--font-mono); }
.stat-sub   { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.stat-tile.warn   .stat-value { color: var(--amber); }
.stat-tile.danger .stat-value { color: var(--red);   }
.stat-tile.ok     .stat-value { color: var(--green); }
.stat-tile.blue   .stat-value { color: var(--navy);  }

/* ── TABLE ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--navy);
  color: rgba(255,255,255,.75);
  font-weight: 600; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .7px;
  padding: 10px 14px; text-align: left;
  border-bottom: none; white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .08s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--navy-light); }
tbody td { padding: 11px 14px; color: var(--text-2); vertical-align: middle; }
tbody td.strong { color: var(--text); font-weight: 600; }
tbody td.mono   { font-family: var(--font-mono); font-size: 12px; }

/* ── BADGES ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid;
  letter-spacing: .2px;
}
.badge-success { background: var(--green-light); color: #065f46; border-color: var(--green-border); }
.badge-warning,
.badge-warn    { background: var(--amber-light); color: #92400e; border-color: var(--amber-border); }
.badge-danger  { background: var(--red-light);   color: #991b1b; border-color: var(--red-border);   }
.badge-info    { background: var(--navy-light);  color: var(--navy); border-color: #b8cfe0; }
.badge-default { background: var(--bg-3);        color: var(--text-2); border-color: var(--border); }

/* ── FORMS ───────────────────────────────────────── */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px 20px; }
.form-full   { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 11px; font-weight: 700; color: var(--slate); text-transform: uppercase; letter-spacing: .5px; }

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13.5px;
  padding: 9px 12px;
  transition: border-color .12s, box-shadow .12s;
  outline: none;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(31,58,95,.1);
}
.form-group input[name="vin"],
.form-group input.mono {
  font-family: var(--font-mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.form-group textarea { min-height: 80px; resize: vertical; }
.form-hint  { font-size: 11.5px; color: var(--text-3); }
.form-error { font-size: 11.5px; color: var(--red); }

.section-title {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--navy);
  margin: 24px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── ALERTS ──────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  margin-bottom: 18px; border: 1px solid;
}
.alert .icon { width: 15px; height: 15px; flex-shrink: 0; }
.alert-success { background: var(--green-light); color: #065f46; border-color: var(--green-border); }
.alert-error   { background: var(--red-light);   color: #991b1b; border-color: var(--red-border);   }
.alert-warning { background: var(--amber-light); color: #92400e; border-color: var(--amber-border); }

/* ── TIMELINE ────────────────────────────────────── */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 22px; }
.tl-dot {
  position: absolute; left: -23px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg-3); border: 2px solid var(--border-2); z-index: 1;
}
.tl-dot.done  { background: var(--green); border-color: var(--green); }
.tl-dot.warn  { background: var(--amber); border-color: var(--amber); }
.tl-dot.now   { background: var(--navy);  border-color: var(--navy);  box-shadow: 0 0 0 4px rgba(31,58,95,.12); }
.tl-dot.error { background: var(--red);   border-color: var(--red);   }
.tl-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.tl-date  { font-size: 11.5px; color: var(--text-3); margin-top: 2px; font-family: var(--font-mono); }
.tl-desc  { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* ── VIN ─────────────────────────────────────────── */
.vin {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 1px;
  background: var(--navy-light); border: 1px solid #b8cfe0;
  border-radius: 4px; padding: 2px 7px; color: var(--navy);
  display: inline-block; cursor: pointer; font-weight: 600;
}
.vin:hover { background: var(--navy); color: #fff; }

/* ── DETAIL ROWS ─────────────────────────────────── */
.detail-row { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 11px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.detail-value { font-size: 13.5px; color: var(--text); text-align: right; }

/* ── REGISTRY RESULT ─────────────────────────────── */
.registry-result {
  border-radius: var(--radius); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  margin-top: 6px; border: 1px solid;
}
.registry-result.clear { background: var(--green-light); border-color: var(--green-border); color: #065f46; }
.registry-result.lien  { background: var(--red-light);   border-color: var(--red-border);   color: #991b1b; }
.registry-result.error { background: var(--amber-light); border-color: var(--amber-border); color: #92400e; }
.registry-result .icon { width: 22px; height: 22px; flex-shrink: 0; }

/* ── DMS WARNING ─────────────────────────────────── */
.dms-warning-banner {
  background: var(--red-light); border: 1px solid var(--red-border);
  border-radius: var(--radius-lg); padding: 16px 20px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
}
.dms-warning-banner .icon { width: 22px; height: 22px; color: var(--red); flex-shrink: 0; }
.dms-warning-title { font-size: 14px; font-weight: 700; color: #991b1b; }
.dms-warning-sub   { font-size: 12.5px; color: #b91c1c; margin-top: 2px; }

/* ── PAGE HEADER ─────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 14px; }
.page-header-left h2 { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
.page-header-left p  { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.page-header-right   { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ── FILTER BAR ──────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar input,
.filter-bar select {
  background: var(--bg); border: 1px solid var(--border-2);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-ui); font-size: 13px;
  padding: 7px 11px; outline: none; transition: border-color .12s;
}
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--navy-mid); box-shadow: 0 0 0 3px rgba(31,58,95,.08); }

/* ── LOGIN ───────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
}
.login-box { width: 100%; max-width: 420px; padding: 0 16px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-mark-lg {
  width: 64px; height: 64px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.login-logo .logo-mark-lg svg { width: 64px; height: 64px; }
.login-logo h1 { font-size: 26px; font-weight: 700; color: #fff; letter-spacing: .2px; }
.login-logo h1 span { font-weight: 400; opacity: .7; }
.login-logo p  { font-size: 13px; color: rgba(255,255,255,.55); margin-top: 5px; letter-spacing: .2px; }
.login-card {
  background: var(--bg); border: none;
  border-radius: 14px; padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card .form-group { margin-bottom: 14px; }
.login-submit { width: 100%; justify-content: center; padding: 11px; font-size: 14px; margin-top: 4px; letter-spacing: .3px; }

/* ── MISC ────────────────────────────────────────── */
code {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--navy-light); border: 1px solid #b8cfe0;
  border-radius: 4px; padding: 1px 6px; color: var(--navy);
}

details { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
details + details { margin-top: 8px; }
summary {
  padding: 11px 14px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  background: var(--bg-2); list-style: none;
  display: flex; align-items: center; gap: 8px; user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: '›'; margin-left: auto; font-size: 16px; transition: transform .15s; }
details[open] summary::after { transform: rotate(90deg); }
details[open] summary { border-bottom: 1px solid var(--border); background: var(--bg); color: var(--navy); }
details > *:not(summary) { padding: 14px; }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .menu-toggle { display: flex; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .content { padding: 14px; }
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-header-right { width: 100%; }
}

@media print {
  .sidebar, .topbar, .btn, .filter-bar { display: none !important; }
  .main-wrap { margin-left: 0; }
  .card { box-shadow: none; }
}
