/* ============================================================
   WarrantyPro — design system
   Glassmorphism + soft shadows + gradient accents, light & dark.
   ============================================================ */

:root {
  --brand: #4F46E5;
  --brand-2: #0EA5E9;
  --accent: #F59E0B;
  --brand-rgb: 79, 70, 229;

  --bg: #F6F7FB;
  --bg-2: #EEF1F8;
  --surface: #FFFFFF;
  --surface-2: #FBFCFE;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  --border: #E4E8F0;
  --border-strong: #D2D8E4;

  --text: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;

  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, .07), 0 2px 4px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 12px 24px -8px rgba(15, 23, 42, .12), 0 4px 10px -4px rgba(15, 23, 42, .06);
  --shadow-xl: 0 24px 48px -12px rgba(15, 23, 42, .18);
  --shadow-brand: 0 10px 30px -10px rgba(var(--brand-rgb), .45);

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --sidebar-w: 264px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

html[data-theme="dark"] {
  --bg: #0B1020;
  --bg-2: #070B16;
  --surface: #131A2C;
  --surface-2: #172038;
  --glass: rgba(19, 26, 44, 0.72);
  --glass-border: rgba(255, 255, 255, 0.08);
  --border: #24304C;
  --border-strong: #33415F;

  --text: #E9EEF8;
  --text-2: #A6B2C9;
  --text-3: #6C7B96;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 4px 8px -2px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 32px -12px rgba(0, 0, 0, .6);
  --shadow-xl: 0 30px 60px -18px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease), color .3s var(--ease);
}

/* Ambient gradient wash behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 8% -10%, rgba(var(--brand-rgb), .13), transparent 60%),
    radial-gradient(900px 520px at 100% 0%, rgba(14, 165, 233, .11), transparent 55%),
    radial-gradient(700px 420px at 50% 108%, rgba(245, 158, 11, .09), transparent 60%);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ── Layout ─────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: transform .32s var(--ease), width .32s var(--ease);
}

.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: var(--shadow-brand);
  flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.brand-text { font-weight: 800; font-size: 16px; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 10px; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav-group { margin-bottom: 4px; }
.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-3); font-weight: 700; padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  cursor: pointer; user-select: none;
  transition: all .18s var(--ease);
  text-decoration: none;
  position: relative;
}
.nav-item:hover { background: rgba(var(--brand-rgb), .07); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: linear-gradient(100deg, rgba(var(--brand-rgb), .16), rgba(var(--brand-rgb), .05));
  color: var(--brand); font-weight: 650;
}
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-item i { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}

.search-trigger {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 12px; min-width: 260px;
  color: var(--text-3); font-size: 13px; cursor: pointer;
  transition: all .2s var(--ease);
}
.search-trigger:hover { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .09); }
.kbd {
  margin-left: auto; font-size: 10px; font-family: ui-monospace, Menlo, monospace;
  background: var(--surface); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 5px; color: var(--text-3);
}

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent;
  color: var(--text-2); cursor: pointer; position: relative;
  transition: all .18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
  cursor: pointer; flex-shrink: 0;
}

.content { padding: 22px; flex: 1; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.page-sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }

/* ── Cards & surfaces ───────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease);
}
.card-glass {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--glass-border);
}
.card-hover:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-strong); }
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; }
.card-body { padding: 18px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ── Stat cards ─────────────────────────────────────────── */
.stat {
  position: relative; overflow: hidden;
  padding: 17px 18px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all .28s var(--ease);
  cursor: default;
}
.stat.linked { cursor: pointer; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--stat-color, var(--brand)) 0%, transparent 68%);
  opacity: .1; pointer-events: none;
  transition: opacity .28s var(--ease), transform .4s var(--ease);
}
.stat:hover::after { opacity: .18; transform: scale(1.15); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.stat-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--stat-color, var(--brand)) 14%, transparent);
  color: var(--stat-color, var(--brand));
  flex-shrink: 0;
}
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.035em; margin-top: 9px; font-variant-numeric: tabular-nums; }
.stat-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--text-3); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 11.5px; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; line-height: 1.3;
  border: 1px solid transparent; cursor: pointer;
  transition: all .18s var(--ease);
  white-space: nowrap; text-decoration: none;
  font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn i { width: 16px; height: 16px; }

.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 12px 28px -10px rgba(var(--brand-rgb), .6); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.btn-soft { background: rgba(var(--brand-rgb), .1); color: var(--brand); }
.btn-soft:hover { background: rgba(var(--brand-rgb), .17); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 11px 22px; font-size: 15px; border-radius: 12px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-block { width: 100%; }

/* ── Forms ──────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.label { display: block; font-size: 12.5px; font-weight: 650; color: var(--text-2); margin-bottom: 5px; }
.label .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 13.5px; font-family: inherit;
  transition: all .18s var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .13);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 84px; }
.select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px;
}
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.error-text { font-size: 11.5px; color: var(--danger); margin-top: 4px; }
.input.invalid { border-color: var(--danger); }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border-strong); border-radius: 99px; transition: .25s var(--ease);
}
.switch span::before {
  content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .25s var(--ease); box-shadow: var(--shadow-sm);
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 14px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable:hover { color: var(--brand); }
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { transition: background .15s var(--ease); }
table.tbl tbody tr:hover { background: rgba(var(--brand-rgb), .04); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 11.5px; color: var(--text-3); }
.mono { font-family: ui-monospace, 'Cascadia Code', Menlo, monospace; font-size: 12.5px; }

/* ── Badges & chips ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap;
}
.badge-success { background: rgba(16, 185, 129, .14); color: #059669; }
.badge-warning { background: rgba(245, 158, 11, .16); color: #B45309; }
.badge-danger  { background: rgba(239, 68, 68, .14); color: #DC2626; }
.badge-info    { background: rgba(59, 130, 246, .14); color: #2563EB; }
.badge-neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge-brand   { background: rgba(var(--brand-rgb), .13); color: var(--brand); }
html[data-theme="dark"] .badge-success { color: #34D399; }
html[data-theme="dark"] .badge-warning { color: #FBBF24; }
html[data-theme="dark"] .badge-danger  { color: #F87171; }
html[data-theme="dark"] .badge-info    { color: #60A5FA; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2); cursor: pointer;
  transition: all .18s var(--ease);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: rgba(var(--brand-rgb), .12); border-color: var(--brand); color: var(--brand); font-weight: 600; }

/* ── Modal & drawer ─────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade .2s var(--ease);
}
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl); border: 1px solid var(--border);
  width: 100%; max-width: 560px; max-height: 90vh;
  display: flex; flex-direction: column;
  animation: pop .28s var(--ease);
}
.modal.lg { max-width: 860px; }
.modal.xl { max-width: 1120px; }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 15px 20px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-end; }

.drawer-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.5); backdrop-filter: blur(4px); animation: fade .2s var(--ease); }
.drawer {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column;
  animation: slideIn .3s var(--ease);
}
.drawer.wide { width: min(880px, 100%); }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97) } to { opacity: 1; transform: none } }
@keyframes slideIn { from { transform: translateX(100%) } to { transform: none } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

.fade-in { animation: fade .35s var(--ease); }
.slide-up { animation: slideUp .4s var(--ease) both; }

/* ── Command palette ────────────────────────────────────── */
.palette-wrap { position: fixed; inset: 0; z-index: 120; background: rgba(15,23,42,.55); backdrop-filter: blur(6px); padding-top: 12vh; display: flex; justify-content: center; animation: fade .16s var(--ease); }
.palette {
  width: min(640px, 92vw); max-height: 62vh;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop .22s var(--ease);
}
.palette input {
  border: none; outline: none; background: transparent;
  padding: 16px 18px; font-size: 16px; color: var(--text);
  border-bottom: 1px solid var(--border); font-family: inherit;
}
.palette-list { overflow-y: auto; padding: 7px; }
.palette-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  transition: background .12s var(--ease);
}
.palette-item:hover, .palette-item.sel { background: rgba(var(--brand-rgb), .1); }
.palette-item .pi-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); flex-shrink: 0; }
.palette-item .pi-type { margin-left: auto; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; }

/* ── Toasts ─────────────────────────────────────────────── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; max-width: 380px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm); padding: 12px 14px;
  box-shadow: var(--shadow-lg); animation: slideUp .3s var(--ease);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-title { font-weight: 700; font-size: 13.5px; }
.toast-msg { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* ── Skeletons & empty states ───────────────────────────── */
.skel {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }
.skel-text { height: 12px; margin-bottom: 8px; }
.skel-card { height: 108px; }

.empty { text-align: center; padding: 52px 20px; }
.empty-icon {
  width: 68px; height: 68px; margin: 0 auto 16px;
  border-radius: 20px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(var(--brand-rgb), .12), rgba(14,165,233,.1));
  color: var(--brand);
}
.empty h3 { font-size: 16px; margin-bottom: 6px; }
.empty p { color: var(--text-2); font-size: 13.5px; max-width: 400px; margin: 0 auto 18px; }

/* ── Misc ───────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(var(--brand-rgb), .2); border-top-color: var(--brand);
  animation: spin .7s linear infinite; display: inline-block;
}
.spinner.lg { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg) } }

.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; transition: width .5s var(--ease); }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 9px 15px; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
  transition: all .18s var(--ease); margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.page-btns { display: flex; gap: 4px; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .16s var(--ease);
}
.page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--r);
  padding: 30px 20px; text-align: center; cursor: pointer;
  transition: all .2s var(--ease); background: var(--surface-2);
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: rgba(var(--brand-rgb), .05); }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--border);
}
.tl-item.success::before { background: var(--success); }
.tl-item.danger::before { background: var(--danger); }
.tl-item.warning::before { background: var(--warning); }

.rank-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.rank-row:last-child { border-bottom: none; }
.rank-n { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--surface-2); color: var(--text-3); flex-shrink: 0; }
.rank-row:nth-child(1) .rank-n { background: rgba(245,158,11,.16); color: #B45309; }
.rank-row:nth-child(2) .rank-n { background: rgba(148,163,184,.2); color: #64748B; }
.rank-row:nth-child(3) .rank-n { background: rgba(180,83,9,.14); color: #B45309; }

.ai-card {
  background: linear-gradient(135deg, rgba(var(--brand-rgb), .07), rgba(14,165,233,.05));
  border: 1px solid rgba(var(--brand-rgb), .18);
  border-radius: var(--r); padding: 15px 17px;
}
.ai-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--brand); background: rgba(var(--brand-rgb), .13);
  padding: 2px 8px; border-radius: 99px;
}

.qr-frame {
  display: inline-block; padding: 14px; background: #fff;
  border-radius: var(--r); box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.qr-frame img { display: block; width: 100%; height: auto; max-width: 220px; }

.verdict {
  border-radius: var(--r-lg); padding: 22px;
  display: flex; align-items: center; gap: 18px;
  border: 1px solid var(--border);
}
.verdict.genuine { background: linear-gradient(135deg, rgba(16,185,129,.1), rgba(16,185,129,.03)); border-color: rgba(16,185,129,.3); }
.verdict.expired { background: linear-gradient(135deg, rgba(148,163,184,.12), transparent); border-color: var(--border-strong); }
.verdict.invalid { background: linear-gradient(135deg, rgba(239,68,68,.1), rgba(239,68,68,.03)); border-color: rgba(239,68,68,.3); }
.verdict.suspect { background: linear-gradient(135deg, rgba(245,158,11,.12), rgba(245,158,11,.03)); border-color: rgba(245,158,11,.35); }
.verdict-icon { width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; flex-shrink: 0; }
.verdict.genuine .verdict-icon { background: rgba(16,185,129,.16); color: var(--success); }
.verdict.expired .verdict-icon { background: var(--surface-2); color: var(--text-3); }
.verdict.invalid .verdict-icon { background: rgba(239,68,68,.16); color: var(--danger); }
.verdict.suspect .verdict-icon { background: rgba(245,158,11,.18); color: var(--warning); }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); font-size: 12px; font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }

.text-muted { color: var(--text-2); }
.text-dim { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pointer { cursor: pointer; }

/* ── Responsive ─────────────────────────────────────────── */
.mobile-only { display: none; }
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .mobile-only { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: none; }
  .content { padding: 15px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .search-trigger { min-width: 0; flex: 1; }
  .search-trigger .kbd, .desktop-only { display: none; }
  .page-title { font-size: 20px; }
  .kv { grid-template-columns: 1fr; gap: 3px; }
  .kv dd { margin-bottom: 8px; }
  .verdict { flex-direction: column; text-align: center; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}
