/* ============================================================
   eServis — Design System
   Premium dark theme · glassmorphism · fluid motion
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Base surfaces */
  --bg-0: #070a14;
  --bg-1: #0a0e1a;
  --bg-2: #0e1424;
  --surface: #111a2e;
  --surface-2: #16203a;
  --surface-3: #1c2949;
  --glass: rgba(20, 28, 48, 0.62);
  --glass-hi: rgba(30, 41, 66, 0.72);

  /* Borders & lines */
  --border: rgba(148, 163, 184, 0.12);
  --border-hi: rgba(148, 163, 184, 0.22);
  --border-glow: rgba(99, 102, 241, 0.35);

  /* Text */
  --text: #eef2fb;
  --text-2: #aeb9d0;
  --text-3: #7f8bab;
  --text-muted: #5a6785;

  /* Brand / accents */
  --primary: #6366f1;
  --primary-2: #818cf8;
  --cyan: #22d3ee;
  --violet: #a855f7;
  --amber: #f59e0b;
  --emerald: #10b981;
  --rose: #f43f5e;

  --grad-primary: linear-gradient(135deg, #6366f1 0%, #22d3ee 100%);
  --grad-violet: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  --grad-warm: linear-gradient(135deg, #f59e0b 0%, #f43f5e 100%);
  --grad-emerald: linear-gradient(135deg, #10b981 0%, #22d3ee 100%);
  --grad-text: linear-gradient(120deg, #eef2fb 0%, #a5b4fc 45%, #67e8f9 100%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 12px 40px -8px rgba(99, 102, 241, 0.45);

  /* Geometry */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur: 0.32s;

  --sidebar-w: 268px;
  --topbar-h: 72px;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg-1);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 55% at 15% 0%, rgba(99, 102, 241, 0.16), transparent 60%),
    radial-gradient(55% 55% at 100% 15%, rgba(34, 211, 238, 0.12), transparent 55%),
    radial-gradient(50% 60% at 60% 100%, rgba(168, 85, 247, 0.12), transparent 60%),
    var(--bg-1);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.028'/%3E%3C/svg%3E");
  pointer-events: none;
}

img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

::selection { background: rgba(99, 102, 241, 0.4); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.35); background-clip: content-box; }

/* ---------- Splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-content: center; gap: 22px; justify-items: center;
  background: var(--bg-1);
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
.splash.hidden { opacity: 0; visibility: hidden; }
.splash__logo { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.splash__bar { width: 180px; height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.splash__bar span { display: block; height: 100%; width: 40%; border-radius: 99px; background: var(--grad-primary); animation: load 1.1s var(--ease-in-out) infinite; }
@keyframes load { 0% { transform: translateX(-120%); } 100% { transform: translateX(360%); } }

/* ---------- Brand mark ---------- */
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--grad-primary);
  position: relative;
  box-shadow: var(--shadow-glow);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 21l3-9h8l3 9M11 16.5h10' stroke='white' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/72% no-repeat;
}
.brand-mark--sm { width: 28px; height: 28px; border-radius: 8px; }
.brand-mark--lg { width: 46px; height: 46px; border-radius: 13px; }

/* ============================================================
   Typography helpers
   ============================================================ */
.display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; }
.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
}
.muted { color: var(--text-3); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  --_bg: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 18px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; letter-spacing: 0.01em;
  background: var(--_bg); color: var(--text);
  border: 1px solid var(--border);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity 0.2s;
  white-space: nowrap; user-select: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); border-color: var(--border-hi); background: var(--surface-3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn--primary {
  background: var(--grad-primary); border-color: transparent; color: #06121f; font-weight: 700;
  box-shadow: 0 8px 26px -10px rgba(99, 102, 241, 0.7);
}
.btn--primary:hover { background: var(--grad-primary); box-shadow: 0 14px 40px -10px rgba(99, 102, 241, 0.85); transform: translateY(-2px); }

.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { background: var(--surface); }

.btn--danger { background: rgba(244, 63, 94, 0.12); border-color: rgba(244, 63, 94, 0.35); color: #fda4af; }
.btn--danger:hover { background: rgba(244, 63, 94, 0.2); border-color: rgba(244, 63, 94, 0.5); }

.btn--sm { padding: 8px 13px; font-size: 13px; border-radius: var(--r-sm); }
.btn--sm svg { width: 16px; height: 16px; }
.btn--lg { padding: 14px 26px; font-size: 15px; }
.btn--block { width: 100%; }
.btn--icon { padding: 10px; border-radius: var(--r-sm); }
.btn--icon svg { width: 18px; height: 18px; }

/* ============================================================
   Cards, badges, chips
   ============================================================ */
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-md);
}
.card--pad { padding: 22px; }
.card--hover { transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card--hover:hover { transform: translateY(-4px); border-color: var(--border-glow); box-shadow: var(--shadow-lg); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge svg { width: 13px; height: 13px; }
.badge--primary { background: rgba(99, 102, 241, 0.14); color: var(--primary-2); border-color: rgba(99, 102, 241, 0.3); }
.badge--cyan { background: rgba(34, 211, 238, 0.12); color: #67e8f9; border-color: rgba(34, 211, 238, 0.28); }
.badge--emerald { background: rgba(16, 185, 129, 0.13); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.3); }
.badge--amber { background: rgba(245, 158, 11, 0.13); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
.badge--rose { background: rgba(244, 63, 94, 0.13); color: #fda4af; border-color: rgba(244, 63, 94, 0.3); }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; box-shadow: 0 0 8px currentColor; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  cursor: pointer; transition: all var(--dur) var(--ease);
}
.chip:hover { border-color: var(--border-hi); color: var(--text); }
.chip.is-active { background: rgba(99, 102, 241, 0.16); border-color: rgba(99, 102, 241, 0.4); color: var(--primary-2); }

/* ============================================================
   Forms
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field__hint { font-size: 12px; color: var(--text-muted); }
.field__error { font-size: 12px; color: #fda4af; min-height: 0; }

.input, .select, .textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
  background: var(--bg-1);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.select { appearance: none; cursor: pointer;
  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='%237f8bab' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 44px; }
.input-group__icon { position: absolute; left: 14px; color: var(--text-3); display: grid; place-items: center; pointer-events: none; }
.input-group__icon svg { width: 18px; height: 18px; }
.input--mono { font-family: 'Space Grotesk', monospace; letter-spacing: 0.12em; text-transform: uppercase; }

.form-grid { display: grid; gap: 16px; }
.form-grid--2 { grid-template-columns: 1fr 1fr; }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-row { display: flex; gap: 16px; }

/* Toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch__track { width: 44px; height: 26px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border); transition: background var(--dur) var(--ease); position: relative; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-2); transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
.switch input:checked + .switch__track { background: var(--grad-primary); border-color: transparent; }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: #fff; }

/* ============================================================
   Auth screen
   ============================================================ */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
  animation: fadeIn 0.6s var(--ease);
}
.auth__brandside {
  position: relative; overflow: hidden;
  padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(80% 60% at 20% 10%, rgba(99, 102, 241, 0.3), transparent 60%),
    radial-gradient(70% 60% at 90% 90%, rgba(34, 211, 238, 0.22), transparent 55%),
    linear-gradient(160deg, #0c1226, #0a0e1a);
}
.auth__brandside::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(148,163,184,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(70% 70% at 40% 40%, #000, transparent);
  -webkit-mask-image: radial-gradient(70% 70% at 40% 40%, #000, transparent);
}
.auth__brandtop { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: 22px; font-weight: 700; position: relative; }
.auth__hero { position: relative; max-width: 460px; }
.auth__hero h1 { font-size: clamp(32px, 4vw, 46px); margin-bottom: 18px; }
.auth__hero p { color: var(--text-2); font-size: 16px; line-height: 1.7; }
.auth__points { position: relative; display: flex; flex-direction: column; gap: 16px; }
.auth__point { display: flex; gap: 14px; align-items: flex-start; }
.auth__point-ic { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--border); color: var(--cyan); }
.auth__point-ic svg { width: 20px; height: 20px; }
.auth__point b { display: block; font-size: 14.5px; margin-bottom: 2px; }
.auth__point span { color: var(--text-3); font-size: 13px; }

.auth__formside { display: grid; place-items: center; padding: 40px; }
.auth__form { width: 100%; max-width: 400px; animation: slideUp 0.5s var(--ease); }
.auth__tabs { display: flex; gap: 6px; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 28px; }
.auth__tab { flex: 1; padding: 10px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-3); transition: all var(--dur) var(--ease); }
.auth__tab.is-active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }
.auth__demo { margin-top: 18px; padding: 13px 15px; border-radius: var(--r-md); background: rgba(99,102,241,0.08); border: 1px dashed rgba(99,102,241,0.3); font-size: 12.5px; color: var(--text-2); display: flex; gap: 10px; align-items: center; }
.auth__demo b { color: var(--primary-2); }

/* ============================================================
   App shell
   ============================================================ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-right: 1px solid var(--border);
  z-index: 60;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 20px; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.sidebar__section { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); padding: 16px 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-md);
  color: var(--text-3); font-size: 14.5px; font-weight: 500;
  transition: all var(--dur) var(--ease); position: relative;
}
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.is-active { background: rgba(99, 102, 241, 0.14); color: var(--text); }
.nav-item.is-active::before { content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; border-radius: 99px; background: var(--grad-primary); box-shadow: 0 0 12px var(--primary); }
.nav-item__badge { margin-left: auto; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--grad-warm); color: #1a0a0a; display: grid; place-items: center; }
.sidebar__spacer { flex: 1; }
.sidebar__user { display: flex; align-items: center; gap: 11px; padding: 11px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: all var(--dur) var(--ease); }
.sidebar__user:hover { border-color: var(--border-hi); background: var(--surface-2); }
.sidebar__user .avatar { flex: none; }
.sidebar__user-meta { min-width: 0; flex: 1; }
.sidebar__user-meta b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-meta span { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.avatar {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff;
  background: var(--grad-violet); box-shadow: var(--shadow-sm);
}
.avatar--sm { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.avatar--lg { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }

/* Main column */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 32px;
  background: rgba(10, 14, 26, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar__menu { display: none; }
.topbar__title { min-width: 0; }
.topbar__title h1 { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.topbar__title p { font-size: 13px; color: var(--text-3); margin-top: 1px; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.searchbar { position: relative; width: 260px; max-width: 34vw; }
.searchbar .input { padding-left: 40px; padding-top: 9px; padding-bottom: 9px; background: var(--surface); }
.searchbar__ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.searchbar__ic svg { width: 17px; height: 17px; }

.view { padding: 32px; animation: viewIn 0.45s var(--ease); max-width: 1360px; width: 100%; margin: 0 auto; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ============================================================
   Layout helpers
   ============================================================ */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head { margin-bottom: 18px; }
.section-head h2 { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.section-head p { font-size: 13.5px; color: var(--text-3); margin-top: 2px; }

/* ============================================================
   Dashboard
   ============================================================ */
.hero-banner {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); padding: 34px;
  background:
    radial-gradient(70% 120% at 100% 0%, rgba(34, 211, 238, 0.22), transparent 55%),
    radial-gradient(80% 130% at 0% 100%, rgba(168, 85, 247, 0.22), transparent 55%),
    linear-gradient(135deg, #141d38, #0d1428);
  border: 1px solid var(--border-hi);
  margin-bottom: 24px;
}
.hero-banner::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 260px; height: 260px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1' opacity='0.09'%3E%3Cpath d='M5 17h14M6 17l1.5-5h9L18 17M8 12l.8-3h6.4l.8 3'/%3E%3Ccircle cx='8' cy='17' r='1.6'/%3E%3Ccircle cx='16' cy='17' r='1.6'/%3E%3C/svg%3E") center/contain no-repeat;
  pointer-events: none;
}
.hero-banner h2 { font-family: var(--font-display); font-size: clamp(22px, 3vw, 30px); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.hero-banner p { color: var(--text-2); max-width: 540px; }
.hero-banner .row { margin-top: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat {
  padding: 20px; border-radius: var(--r-lg);
  background: var(--glass); border: 1px solid var(--border);
  position: relative; overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.stat:hover { transform: translateY(-3px); border-color: var(--border-hi); }
.stat__ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; }
.stat__ic svg { width: 22px; height: 22px; }
.stat__ic--p { background: rgba(99,102,241,0.15); color: var(--primary-2); }
.stat__ic--c { background: rgba(34,211,238,0.13); color: var(--cyan); }
.stat__ic--e { background: rgba(16,185,129,0.14); color: var(--emerald); }
.stat__ic--a { background: rgba(245,158,11,0.14); color: var(--amber); }
.stat__val { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.stat__label { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.stat__trend { position: absolute; top: 20px; right: 20px; font-size: 12px; font-weight: 600; }

/* ============================================================
   Vehicle cards
   ============================================================ */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.vehicle-card { position: relative; overflow: hidden; padding: 0; cursor: pointer; }
.vehicle-card__top {
  position: relative; padding: 22px 22px 18px;
  background: linear-gradient(135deg, rgba(99,102,241,0.16), rgba(34,211,238,0.06));
  border-bottom: 1px solid var(--border);
}
.vehicle-card__badge-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.vehicle-card__name { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.vehicle-card__vin { font-family: 'Space Grotesk', monospace; font-size: 12.5px; color: var(--text-3); letter-spacing: 0.1em; margin-top: 4px; }
.vehicle-card__plate {
  position: absolute; top: 22px; right: 22px; z-index: 2;
  font-family: 'Space Grotesk', monospace; font-weight: 700; font-size: 14px; letter-spacing: 0.06em;
  padding: 5px 10px 5px 22px; border-radius: 6px;
  background: #eef2fb; color: #0b1020; border: 1px solid #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.plate-eu { position: absolute; left: 0; top: 0; bottom: 0; width: 15px; background: #1e3a8a; border-radius: 5px 0 0 5px; display: grid; align-content: center; justify-items: center; }
.plate-eu::before { content: "★"; color: #fbbf24; font-size: 7px; line-height: 1; }
.plate-eu::after { content: "CZ"; color: #fff; font-size: 6px; font-weight: 700; }
.vehicle-card__body { padding: 18px 22px 22px; }
.vehicle-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.vehicle-spec { display: flex; flex-direction: column; gap: 2px; }
.vehicle-spec span { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.vehicle-spec b { font-size: 14px; font-weight: 600; }
.vehicle-card__foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.mileage-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.mileage-bar span { display: block; height: 100%; border-radius: 99px; background: var(--grad-primary); }

/* ============================================================
   Service book / timeline
   ============================================================ */
.detail-head {
  position: relative; overflow: hidden;
  padding: 30px; border-radius: var(--r-xl); margin-bottom: 24px;
  background:
    radial-gradient(80% 140% at 100% 0%, rgba(34,211,238,0.18), transparent 55%),
    linear-gradient(135deg, #15203c, #0d1327);
  border: 1px solid var(--border-hi);
}
.detail-head__grid { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start; }
.detail-head h2 { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.detail-head__meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.timeline { position: relative; padding-left: 8px; }
.tl-item { position: relative; padding-left: 42px; padding-bottom: 24px; }
.tl-item::before { content: ""; position: absolute; left: 15px; top: 30px; bottom: -6px; width: 2px; background: linear-gradient(var(--border-hi), transparent); }
.tl-item:last-child::before { display: none; }
.tl-dot {
  position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--surface-3); z-index: 1;
}
.tl-dot svg { width: 13px; height: 13px; }
.tl-dot--service { border-color: rgba(99,102,241,0.5); color: var(--primary-2); box-shadow: 0 0 0 4px rgba(99,102,241,0.1); }
.tl-dot--repair { border-color: rgba(245,158,11,0.5); color: var(--amber); box-shadow: 0 0 0 4px rgba(245,158,11,0.1); }
.tl-dot--inspection { border-color: rgba(16,185,129,0.5); color: var(--emerald); box-shadow: 0 0 0 4px rgba(16,185,129,0.1); }
.tl-dot--tires { border-color: rgba(34,211,238,0.5); color: var(--cyan); box-shadow: 0 0 0 4px rgba(34,211,238,0.1); }
.tl-card { padding: 16px 18px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--border); transition: border-color var(--dur) var(--ease); }
.tl-card:hover { border-color: var(--border-hi); }
.tl-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tl-card__title { font-weight: 600; font-size: 15px; }
.tl-card__date { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.tl-card__desc { font-size: 13.5px; color: var(--text-2); margin-top: 6px; }
.tl-card__foot { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
.tl-card__foot .kv { display: inline-flex; align-items: center; gap: 6px; }
.tl-card__foot .kv svg { width: 14px; height: 14px; }
.tl-card__cost { margin-left: auto; font-family: var(--font-display); font-weight: 600; color: var(--text); font-size: 14px; }

/* VIN decode result */
.vin-result { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.vin-cell { background: var(--bg-2); padding: 14px 16px; }
.vin-cell span { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.vin-cell b { font-size: 14.5px; font-weight: 600; }
.vin-visual { display: flex; gap: 3px; flex-wrap: wrap; font-family: 'Space Grotesk', monospace; margin: 4px 0 2px; }
.vin-char { width: 30px; height: 40px; display: grid; place-items: center; border-radius: 7px; font-weight: 600; font-size: 16px; background: var(--surface-2); border: 1px solid var(--border); position: relative; transition: all var(--dur) var(--ease); }
.vin-char small { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--text-muted); font-family: var(--font-sans); white-space: nowrap; }
.vin-char.g-wmi { background: rgba(99,102,241,0.16); border-color: rgba(99,102,241,0.4); color: var(--primary-2); }
.vin-char.g-vds { background: rgba(34,211,238,0.12); border-color: rgba(34,211,238,0.35); color: var(--cyan); }
.vin-char.g-check { background: rgba(245,158,11,0.14); border-color: rgba(245,158,11,0.4); color: var(--amber); }
.vin-char.g-year { background: rgba(16,185,129,0.14); border-color: rgba(16,185,129,0.4); color: var(--emerald); }
.vin-char.g-vis { background: rgba(168,85,247,0.14); border-color: rgba(168,85,247,0.4); color: #d8b4fe; }
.vin-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 26px; font-size: 12px; color: var(--text-3); }
.vin-legend span { display: inline-flex; align-items: center; gap: 6px; }
.vin-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ============================================================
   Map
   ============================================================ */
.map-layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; height: calc(100vh - var(--topbar-h) - 64px); min-height: 540px; }
.map-panel { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.map-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-right: 6px; margin-right: -6px; }
.service-item { padding: 15px 16px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--border); cursor: pointer; transition: all var(--dur) var(--ease); }
.service-item:hover { border-color: var(--border-hi); transform: translateX(3px); }
.service-item.is-active { border-color: var(--border-glow); background: var(--glass-hi); box-shadow: var(--shadow-glow); }
.service-item__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.service-item__name { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.service-item__addr { font-size: 12.5px; color: var(--text-3); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.service-item__addr svg { width: 13px; height: 13px; flex: none; }
.service-item__tags { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }
.service-item__tags .tag { font-size: 11px; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }
.rating { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--amber); }
.rating svg { width: 13px; height: 13px; }
.map-wrap { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border-hi); position: relative; min-height: 0; }
#map { width: 100%; height: 100%; background: var(--bg-2); }

/* Leaflet dark theme adjustments */
.leaflet-container { background: #0c1120; font-family: var(--font-sans); }
.leaflet-tile { filter: brightness(0.72) invert(1) contrast(0.92) hue-rotate(190deg) saturate(0.55) brightness(0.95); }
.leaflet-control-attribution { background: rgba(10,14,26,0.7) !important; color: var(--text-muted) !important; }
.leaflet-control-attribution a { color: var(--text-3) !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--surface-2) !important; }
.leaflet-popup-content-wrapper { background: var(--surface) !important; color: var(--text) !important; border-radius: 14px !important; border: 1px solid var(--border-hi); box-shadow: var(--shadow-lg); }
.leaflet-popup-tip { background: var(--surface) !important; }
.leaflet-popup-content { margin: 15px 17px !important; font-size: 13px; }
.leaflet-popup-content b { font-family: var(--font-display); }
.map-marker { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(45deg); background: var(--grad-primary); border: 2px solid rgba(255,255,255,0.7); box-shadow: 0 6px 16px -4px rgba(99,102,241,0.7); }
.map-marker svg { transform: rotate(-45deg); width: 16px; height: 16px; color: #fff; }
.map-marker--home { background: var(--grad-warm); box-shadow: 0 6px 16px -4px rgba(245,158,11,0.7); }

/* ============================================================
   Transfers
   ============================================================ */
.transfer-card { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 20px; }
.transfer-flow { display: flex; align-items: center; gap: 14px; }
.transfer-flow__node { text-align: center; }
.transfer-flow__arrow { color: var(--text-muted); display: grid; place-items: center; }
.transfer-flow__arrow svg { width: 26px; height: 26px; }

/* Empty state */
.empty { text-align: center; padding: 56px 24px; }
.empty__ic { width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 20px; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--border); color: var(--text-3); }
.empty__ic svg { width: 34px; height: 34px; }
.empty h3 { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin-bottom: 8px; }
.empty p { color: var(--text-3); max-width: 400px; margin: 0 auto 22px; font-size: 14px; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 24px;
  background: rgba(6, 9, 18, 0.72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.25s var(--ease);
}
.modal {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border-hi); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.35s var(--ease);
}
.modal--lg { max-width: 720px; }
.modal--sm { max-width: 420px; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 24px 0; }
.modal__head h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.modal__head p { font-size: 13.5px; color: var(--text-3); margin-top: 4px; }
.modal__close { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--text-3); border: 1px solid var(--border); transition: all var(--dur) var(--ease); flex: none; }
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__body { padding: 22px 24px; }
.modal__foot { display: flex; gap: 12px; justify-content: flex-end; padding: 0 24px 24px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }

/* ============================================================
   Toasts
   ============================================================ */
.toast-root { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 13px; min-width: 300px; max-width: 400px;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--glass-hi); border: 1px solid var(--border-hi);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: toastIn 0.4s var(--ease);
}
.toast.leaving { animation: toastOut 0.3s var(--ease) forwards; }
.toast__ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.toast__ic svg { width: 18px; height: 18px; }
.toast--success .toast__ic { background: rgba(16,185,129,0.16); color: var(--emerald); }
.toast--error .toast__ic { background: rgba(244,63,94,0.16); color: var(--rose); }
.toast--info .toast__ic { background: rgba(99,102,241,0.16); color: var(--primary-2); }
.toast__body { flex: 1; min-width: 0; }
.toast__body b { display: block; font-size: 14px; font-weight: 600; }
.toast__body span { font-size: 12.5px; color: var(--text-3); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ============================================================
   Utility & misc
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 20px 0; border: none; }
.kv-list { display: grid; gap: 12px; }
.kv-list__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.kv-list__row:last-child { border-bottom: none; }
.kv-list__row span { color: var(--text-3); font-size: 13.5px; }
.kv-list__row b { font-weight: 600; font-size: 14px; text-align: right; }
.text-c { text-align: center; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* Icons — base sizing (component rules override via higher specificity) */
.ico { width: 20px; height: 20px; flex: none; }
.inline-ic { width: 15px; height: 15px; vertical-align: -2px; }
.eyebrow svg { width: 15px; height: 15px; }
.flip { transform: rotate(180deg); }
.modal__close svg { width: 18px; height: 18px; }
.hide-sm { display: inline; }
@media (max-width: 720px) { .hide-sm { display: none; } }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: slideUp 0.5s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0.03s; }
.stagger > *:nth-child(2) { animation-delay: 0.08s; }
.stagger > *:nth-child(3) { animation-delay: 0.13s; }
.stagger > *:nth-child(4) { animation-delay: 0.18s; }
.stagger > *:nth-child(5) { animation-delay: 0.23s; }
.stagger > *:nth-child(6) { animation-delay: 0.28s; }
.stagger > *:nth-child(7) { animation-delay: 0.33s; }
.stagger > *:nth-child(8) { animation-delay: 0.38s; }

/* ============================================================
   Responsive
   ============================================================ */
.backdrop { position: fixed; inset: 0; background: rgba(6,9,18,0.6); backdrop-filter: blur(4px); z-index: 55; animation: fadeIn 0.25s var(--ease); }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .map-layout { grid-template-columns: 300px 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 280px; height: 100vh;
    transform: translateX(-100%); transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .topbar__menu { display: grid; }
  .topbar { padding: 0 18px; }
  .view { padding: 20px 18px; }
  .searchbar { display: none; }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-wrap { height: 420px; }
  .detail-head__grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .auth { grid-template-columns: 1fr; }
  .auth__brandside { display: none; }
  .form-grid--2, .form-grid--3, .form-row { grid-template-columns: 1fr; flex-direction: column; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .vehicle-grid { grid-template-columns: 1fr; }
  .transfer-card { grid-template-columns: 1fr; }
  .topbar__title p { display: none; }
  .hero-banner, .detail-head { padding: 24px 20px; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
