/* Fleet Control — modern UI. Indigo accent, soft surfaces, Inter font. */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --line: #e7e9f0;
  --line-strong: #d6dae4;

  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;

  --red: #dc2626;    --red-bg: #fef2f2;    --red-ring: #fecaca;
  --orange: #ea580c; --orange-bg: #fff7ed; --orange-ring: #fed7aa;
  --yellow: #ca8a04; --yellow-bg: #fefce8; --yellow-ring: #fde68a;
  --green: #16a34a;  --green-bg: #f0fdf4;  --green-ring: #bbf7d0;

  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px -8px rgba(15, 23, 42, 0.18), 0 4px 8px -4px rgba(15, 23, 42, 0.08);
  --ring: 0 0 0 4px rgba(79, 70, 229, 0.15);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar: 252px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  font-size: 14.5px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
@supports (font-variation-settings: normal) {
  body { font-family: 'InterVariable', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; letter-spacing: -0.015em; color: var(--text); }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 16.5px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { background: var(--brand-50); color: var(--brand-600); padding: 3px 8px; border-radius: 6px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
::selection { background: var(--brand-100); }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.with-icon { display: flex; align-items: center; gap: 8px; }
.with-icon .icon { color: var(--muted); }

/* ---------- boot spinner ---------- */
.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16.5px; letter-spacing: -0.02em; color: var(--text); }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #7c3aed 100%);
  color: #fff; box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.45);
}
.logo-mark svg { width: 19px; height: 19px; }
.brand.light { color: #fff; }
.brand.light .logo-mark { background: rgba(255, 255, 255, 0.18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }

/* ---------- app layout ---------- */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  display: flex; flex-direction: column; gap: 24px;
  padding: 22px 16px 16px; background: var(--surface); border-right: 1px solid var(--line); z-index: 10;
}
.sidebar .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.nav-item .icon { color: var(--muted); transition: color 0.18s var(--ease); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover .icon { color: var(--text); }
.nav-item:active { transform: scale(0.98); }
.nav-item.active { background: var(--brand-50); color: var(--brand-600); font-weight: 600; }
.nav-item.active .icon { color: var(--brand); }
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
  animation: grow-y 0.3s var(--ease);
}
.badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  display: inline-grid; place-items: center; background: var(--red); color: #fff; font-size: 12px; font-weight: 700;
  animation: pulse 2.4s ease-out infinite;
}
.side-foot { display: flex; flex-direction: column; gap: 10px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #818cf8, #6366f1); color: #fff; font-weight: 700; font-size: 13px;
}
.user-meta { min-width: 0; flex: 1; line-height: 1.3; }
.user-meta strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lang-select { position: relative; display: flex; align-items: center; margin: 0; }
.lang-select .icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.lang-select select { padding-left: 34px; height: 36px; font-size: 13px; }

.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: var(--line); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }

.mobile-top { display: none; }
main { margin-left: var(--sidebar); padding: 36px 40px 64px; max-width: calc(1180px + var(--sidebar)); }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1, .page-head h2 { margin: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; transition: color 0.15s, gap 0.2s var(--ease); }
.back-link:hover { color: var(--brand); gap: 9px; }
.back-link .icon { width: 15px; height: 15px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 18px;
}
.card > h2:first-child { margin-bottom: 14px; }
.card:has(> .table-wrap) { overflow: hidden; }
.nowrap { white-space: nowrap; }
.vehicle-cell { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; color: inherit; }
.vehicle-cell:hover .plate { border-color: var(--brand); }
.vehicle-name { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ---------- dashboard tiles ---------- */
.grid-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.tile {
  --c: var(--muted); --c-bg: var(--surface-2); --c-ring: var(--line);
  display: flex; align-items: center; gap: 16px; text-align: left;
  padding: 18px 20px; border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; font: inherit; color: inherit;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.2s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tile:active { transform: translateY(-1px) scale(0.99); }
.tile.selected { border-color: var(--c); box-shadow: 0 0 0 3px var(--c-ring); }
.tile.overdue { --c: var(--red); --c-bg: var(--red-bg); --c-ring: var(--red-ring); }
.tile.soon { --c: var(--orange); --c-bg: var(--orange-bg); --c-ring: var(--orange-ring); }
.tile.warn { --c: var(--yellow); --c-bg: var(--yellow-bg); --c-ring: var(--yellow-ring); }
.tile.ok { --c: var(--green); --c-bg: var(--green-bg); --c-ring: var(--green-ring); }
.tile-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--c-bg); color: var(--c); flex-shrink: 0; transition: transform 0.3s var(--ease); }
.tile:hover .tile-icon { transform: scale(1.08) rotate(-4deg); }
.tile-icon .icon { width: 22px; height: 22px; }
.tile-text { display: flex; flex-direction: column; }
.tile .num { font-size: 28px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .label { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  font: inherit; font-size: 14.5px; color: inherit; background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; 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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
input:hover, select:hover, textarea:hover { border-color: #c3c8d4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input:disabled { background: var(--surface-2); color: var(--muted); }
input::placeholder, textarea::placeholder { color: #a0a8b8; }
/* built-in type names are shown translated as placeholder until renamed */
input.builtin::placeholder { color: var(--text); opacity: 1; }
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; padding: 0; margin: 0 10px 0 0; border-radius: 5px;
  border: 1.5px solid var(--line-strong); display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
input[type="checkbox"]::after { content: ''; width: 10px; height: 10px; transform: scale(0); transition: transform 0.15s var(--ease); clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background: #fff; }
input[type="checkbox"]:checked { background: var(--brand); border-color: var(--brand); }
input[type="checkbox"]:checked::after { transform: scale(1); }
.field { margin-bottom: 16px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.check { display: flex; align-items: center; color: var(--text); font-size: 14px; font-weight: 500; margin: 8px 0; cursor: pointer; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; font-size: 14px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.2s var(--ease), transform 0.15s var(--ease), color 0.15s;
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); border-color: #c3c8d4; color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary {
  background: linear-gradient(180deg, #5b52f0 0%, var(--brand) 100%); border-color: var(--brand-600); color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn.primary:hover { background: linear-gradient(180deg, #5148e6 0%, var(--brand-600) 100%); box-shadow: 0 6px 16px -4px rgba(79, 70, 229, 0.5); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0) scale(0.97); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red-ring); color: var(--red); }
.btn.small { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.small .icon { width: 15px; height: 15px; }
.btn.icon-only { width: 32px; padding: 0; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar > * { width: auto; min-width: 170px; }
.toolbar input[type="search"] {
  flex: 1; min-width: 220px; padding-left: 38px;
  background: var(--surface) 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 13px center;
}

/* ---------- tables + lists ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px -22px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600;
  padding: 10px 22px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
td { padding: 14px 22px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: #fafbff; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.empty-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; background: var(--surface-2); color: var(--muted); animation: pop 0.5s var(--ease); }
.empty-icon.ok { background: var(--green-bg); color: var(--green); }
.empty-icon .icon { width: 26px; height: 26px; }

.list-item { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.history { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* status pill with a dot */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.overdue { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1px var(--red-ring); }
.chip.overdue::before { animation: blink 1.6s ease-in-out infinite; }
.chip.soon { background: var(--orange-bg); color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange-ring); }
.chip.warn { background: var(--yellow-bg); color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow-ring); }
.chip.ok { background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px var(--green-ring); }
.chip.neutral { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }

/* EU-style number plate */
.plate {
  display: inline-flex; align-items: stretch; height: 26px; border-radius: 5px; overflow: hidden; vertical-align: middle;
  background: #fff; border: 1.5px solid #1e293b; color: #0f172a;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 700; font-size: 13.5px; letter-spacing: 0.06em; line-height: 23px;
  padding-right: 8px; box-shadow: var(--shadow-sm); white-space: nowrap;
}
.plate::before { content: ''; width: 9px; margin-right: 7px; background: #1d4ed8; }
h1 .plate { height: 34px; line-height: 31px; font-size: 19px; border-width: 2px; border-radius: 6px; padding-right: 11px; }
h1 .plate::before { width: 12px; margin-right: 10px; }

/* ---------- tabs (segmented) ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 20px; background: #eceef4; border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs a {
  padding: 8px 15px; border-radius: 9px; color: var(--muted); font-weight: 550; font-size: 13.5px; white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s, box-shadow 0.2s;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px 24px; }
.kv div { font-weight: 500; }
.kv div span { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- auth (split screen) ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(420px, 1fr); }
.auth-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px;
  color: #fff;
  background: radial-gradient(1200px 600px at -10% -20%, #818cf8 0%, transparent 55%),
    radial-gradient(900px 600px at 110% 120%, #a855f7 0%, transparent 50%),
    linear-gradient(140deg, #3730a3 0%, #4f46e5 45%, #6d28d9 100%);
  background-size: 140% 140%; animation: drift 18s ease-in-out infinite alternate;
}
.auth-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.18;
  background-image: linear-gradient(rgba(255,255,255,0.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.35) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse at 30% 40%, #000 0%, transparent 70%);
}
.hero-copy { position: relative; z-index: 1; max-width: 480px; }
.hero-copy h1 { color: #fff; font-size: 36px; line-height: 1.15; letter-spacing: -0.03em; margin-bottom: 28px; animation: rise 0.7s var(--ease) both; }
.features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.features li { display: flex; align-items: center; gap: 14px; font-size: 15px; color: rgba(255, 255, 255, 0.92); animation: rise 0.7s var(--ease) both; }
.features li:nth-child(1) { animation-delay: 0.12s; }
.features li:nth-child(2) { animation-delay: 0.22s; }
.features li:nth-child(3) { animation-delay: 0.32s; }
.features .icon { width: 38px; height: 38px; padding: 9px; border-radius: 11px; background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); }
.hero-foot { position: relative; z-index: 1; font-size: 12.5px; color: rgba(255, 255, 255, 0.6); }
.auth-hero .brand { position: relative; z-index: 1; }

.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; animation: rise 0.6s var(--ease) both; }
.auth-card h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 22px; }
.auth-card .btn.primary { width: 100%; height: 44px; margin-top: 4px; }
.auth-links { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-links a { font-weight: 550; }
.lang-pick { text-align: center; margin-top: 28px; }
.lang-pick select { width: auto; height: 36px; font-size: 13px; }
.mobile-only { display: none; }
.google-wrap { display: flex; justify-content: center; min-height: 44px; }
.google-wrap #google-btn { width: 100%; display: flex; justify-content: center; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; text-transform: uppercase; letter-spacing: 0.06em; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: rgba(15, 23, 42, 0.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade 0.2s ease both;
}
.modal {
  width: 100%; max-width: 580px; max-height: 92vh; overflow-y: auto; padding: 26px;
  background: var(--surface); border-radius: 20px; box-shadow: 0 24px 64px -12px rgba(15, 23, 42, 0.35);
  animation: modal-in 0.32s var(--ease) both;
}
.modal-backdrop.closing { animation: fade-out 0.16s ease both; }
.modal-backdrop.closing .modal { animation: modal-out 0.16s ease both; }
.modal h2 { font-size: 19px; font-weight: 700; margin-bottom: 20px; }
.modal .actions { justify-content: flex-end; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.modal fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 4px; margin: 4px 0 16px; background: var(--surface-2); }
.modal legend { font-size: 12.5px; font-weight: 600; color: var(--text-2); padding: 0 6px; }
.error { background: var(--red-bg); color: var(--red); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; font-weight: 500; box-shadow: inset 0 0 0 1px var(--red-ring); animation: shake 0.4s ease; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 12px; background: #0f172a; color: #fff; font-weight: 500; font-size: 14px;
  box-shadow: var(--shadow-lg); transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }

/* ---------- settings: types editor ---------- */
.type-row { display: grid; grid-template-columns: 2fr 1.4fr 0.9fr 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; animation: rise 0.3s var(--ease) both; }
.type-row.simple { grid-template-columns: 1fr auto; max-width: 520px; }
.type-head { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; animation: none; }

/* ---------- animations ---------- */
.page-enter > * { animation: rise 0.45s var(--ease) both; }
.page-enter > *:nth-child(2) { animation-delay: 0.05s; }
.page-enter > *:nth-child(3) { animation-delay: 0.1s; }
.page-enter > *:nth-child(4) { animation-delay: 0.15s; }
.page-enter > *:nth-child(5) { animation-delay: 0.2s; }
.page-enter .tile { animation: rise 0.5s var(--ease) both; }
.page-enter .tile:nth-child(2) { animation-delay: 0.06s; }
.page-enter .tile:nth-child(3) { animation-delay: 0.12s; }
.page-enter .tile:nth-child(4) { animation-delay: 0.18s; }
.page-enter tbody tr, .page-enter .list-item { animation: rise 0.4s var(--ease) both; }
.page-enter tbody tr:nth-child(2), .page-enter .list-item:nth-child(2) { animation-delay: 0.04s; }
.page-enter tbody tr:nth-child(3), .page-enter .list-item:nth-child(3) { animation-delay: 0.08s; }
.page-enter tbody tr:nth-child(4), .page-enter .list-item:nth-child(4) { animation-delay: 0.12s; }
.page-enter tbody tr:nth-child(5), .page-enter .list-item:nth-child(5) { animation-delay: 0.16s; }
.page-enter tbody tr:nth-child(n+6), .page-enter .list-item:nth-child(n+6) { animation-delay: 0.2s; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); } 70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@keyframes drift { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .mobile-only { display: flex; margin-bottom: 28px; }
  .auth-panel { align-items: start; padding-top: 48px; }

  /* sidebar becomes a bottom tab bar */
  .sidebar {
    inset: auto 0 0 0; width: auto; height: calc(66px + env(safe-area-inset-bottom)); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    flex-direction: row; border-right: none; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(15,23,42,0.05);
  }
  .sidebar .brand, .side-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 11.5px; flex: 1; text-align: center; }
  .nav-item.active { background: transparent; }
  .nav-item.active::before { left: 30%; right: 30%; top: -7px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .nav-item .badge { position: absolute; top: 0; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
  .mobile-top {
    position: sticky; top: 0; z-index: 9; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px; background: rgba(255,255,255,0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  }
  .mobile-top .lang-select select { width: 132px; }
  main { margin-left: 0; padding: 20px 16px 100px; }
  h1 { font-size: 22px; }
  .card { padding: 18px; }
  .table-wrap { margin: 0 -18px -18px; }
  .type-row { grid-template-columns: 1fr 1fr; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
  .type-row.simple { padding: 0; border: none; }
  .type-head { display: none; }
  .hide-mobile { display: none; }
  .list-item { flex-direction: column; align-items: flex-start; }

  /* tables become stacked cards on phones */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--line); padding: 14px 18px; }
  table.stack tr:last-child { border-bottom: none; }
  table.stack td { border: none; padding: 3px 0; text-align: left !important; }
  table.stack tbody tr:hover td { background: transparent; }
}
@media (max-width: 480px) {
  .grid-tiles { gap: 10px; }
  .tile { padding: 14px; gap: 12px; }
  .tile-icon { width: 38px; height: 38px; }
  .tile .num { font-size: 22px; }
  .toolbar > * { min-width: 0; flex: 1 1 100%; }
}
