:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --secondary: #3b82f6;
  --accent: #059669;
  --accent-hover: #047857;
  --background: #f8fafc;
  --surface: #ffffff;
  --foreground: #0f172a;
  --muted: #f1f5f9;
  --muted-2: #f1f5f9;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --destructive: #dc2626;
  --destructive-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --info: #0284c7;
  --info-soft: #f0f9ff;
  --ring: #2563eb;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --sidebar-w: 248px;
  --font-sans: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --z-content: 10;
  --z-topbar: 40;
  --z-overlay: 45;
  --z-sidebar: 50;
  --z-modal: 60;
  --z-notif: 65;
  --z-toast: 100;
}

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

html { -webkit-text-size-adjust: 100%; }

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app { min-height: 100vh; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

button, a, input, select, textarea { touch-action: manipulation; }

button, [role="button"], .btn, select, a.side-link, .clickable { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.ico-svg { flex-shrink: 0; vertical-align: middle; }

.spinner-svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn .spinner-svg { margin-right: 6px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(59, 130, 246, 0.22), transparent),
    radial-gradient(ellipse 60% 50% at 85% 90%, rgba(5, 150, 105, 0.16), transparent),
    linear-gradient(160deg, #1e3a8a 0%, #1e40af 45%, #2563eb 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 34px 30px;
}
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo .brand-mark {
  width: 60px; height: 60px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}
.login-logo .brand-mark svg { width: 30px; height: 30px; }
.login-logo h1 { font-size: 24px; font-weight: 700; color: var(--foreground); letter-spacing: -0.02em; }
.login-logo p { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }
.login-hint {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.login-hint code { font-family: var(--font-mono); font-size: 12px; background: var(--muted); padding: 1px 6px; border-radius: 4px; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #94a3b8;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transform: translateX(0);
  transition: transform 0.25s var(--ease);
}
.sidebar .brand {
  padding: 18px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar .brand .brand-mark {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: #fff;
}
.sidebar .brand .brand-mark svg { width: 16px; height: 16px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 8px;
  color: #94a3b8;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
  text-decoration: none;
  min-height: 42px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); color: #e2e8f0; text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav a .ico-svg { width: 18px; height: 18px; opacity: 0.9; }
.sidebar .nav-label { color: #475569; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 16px 14px 6px; }
.sidebar .side-user {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px;
  font-size: 13px;
}
.sidebar .side-user .name { color: #fff; font-weight: 600; }
.sidebar .side-user .role { color: #94a3b8; text-transform: capitalize; font-size: 12px; }
.sidebar .side-user button {
  margin-top: 10px;
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #e2e8f0;
  padding: 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  min-height: 40px;
  transition: background 0.18s var(--ease);
}
.sidebar .side-user button:hover { background: rgba(255, 255, 255, 0.16); }
.sidebar .side-user button .ico-svg { width: 16px; height: 16px; }

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

.topbar {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: var(--z-topbar);
}
.menu-btn {
  display: none;
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--foreground);
  width: 44px; height: 44px;
  border-radius: 8px;
  align-items: center; justify-content: center;
}
.menu-btn:hover { background: var(--muted); }
.topbar h2 { font-size: 17px; font-weight: 700; flex: 1; letter-spacing: -0.01em; }

.bell {
  position: relative;
  background: none; border: none;
  cursor: pointer;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--foreground);
  transition: background 0.18s var(--ease);
}
.bell:hover { background: var(--muted); }
.bell .ico-svg { width: 20px; height: 20px; }
.bell .badge {
  position: absolute; top: 5px; right: 5px;
  background: var(--destructive); color: #fff;
  font-size: 10.5px; font-weight: 700;
  min-width: 17px; height: 17px; line-height: 17px;
  border-radius: 9px; padding: 0 4px;
  font-family: var(--font-sans);
}

.content { padding: 22px; flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: var(--z-topbar);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
}
.bottom-nav .bn-inner { display: flex; }
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  min-height: 56px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: color 0.18s var(--ease);
}
.bottom-nav a .ico-svg { width: 21px; height: 21px; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a.active::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 40px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--primary);
}
.bottom-nav a:hover { color: var(--primary); text-decoration: none; }

/* ---------- Backdrop / overlay ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: var(--z-overlay);
  display: none;
}
.overlay.show { display: block; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 18px;
}
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--foreground); }
.card .muted { color: var(--text-muted); font-size: 13.5px; }

.stat {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.stat:hover { box-shadow: var(--shadow-md); }
.stat .num {
  font-size: 27px; font-weight: 800;
  color: var(--foreground);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat .lbl { color: var(--text-muted); font-size: 12.5px; margin-top: 3px; }
.stat .stat-ico {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
}
.stat .stat-ico svg { width: 18px; height: 18px; }
.stat.accent .stat-ico { color: var(--accent); background: var(--success-soft); }
.stat.warn .stat-ico { color: var(--warning); background: var(--warning-soft); }
.stat.danger .stat-ico { color: var(--destructive); background: var(--destructive-soft); }
.stat.info .stat-ico { color: var(--info); background: var(--info-soft); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  background: var(--muted);
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover td { background: #f8fafc; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge .ico-svg { width: 12px; height: 12px; }
.badge.success { background: var(--success-soft); color: #15803d; }
.badge.warning { background: var(--warning-soft); color: #b45309; }
.badge.danger { background: var(--destructive-soft); color: #b91c1c; }
.badge.info { background: var(--info-soft); color: #0369a1; }
.badge.neutral { background: var(--muted-2); color: #475569; }
.badge.primary { background: var(--primary-soft); color: #1d4ed8; }

.badge.type-entrada { background: var(--success-soft); color: #15803d; }
.badge.type-saida { background: var(--warning-soft); color: #b45309; }
.badge.type-conferencia { background: var(--info-soft); color: #0369a1; }
.badge.type-outro { background: var(--muted-2); color: #475569; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.08s var(--ease), opacity 0.18s;
}
.btn:hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25); }
.btn:active { transform: scale(0.98); }
.btn .ico-svg { width: 16px; height: 16px; }
.btn.secondary { background: var(--surface); color: var(--foreground); border-color: var(--border); }
.btn.secondary:hover { background: var(--muted); box-shadow: none; }
.btn.success { background: var(--accent); }
.btn.success:hover { background: var(--accent-hover); box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25); }
.btn.danger { background: var(--destructive); }
.btn.danger:hover { background: #b91c1c; box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25); }
.btn.ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.btn.ghost:hover { background: var(--primary-soft); box-shadow: none; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; }
.btn.sm .ico-svg { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover { background: var(--primary); }
.btn.secondary:disabled:hover { background: var(--surface); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--foreground); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--font-sans);
  background: #fff;
  color: var(--foreground);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.field .helper { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert .ico-svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert.error { background: var(--destructive-soft); color: #991b1b; border-color: #fecaca; }
.alert.success { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.alert.info { background: var(--info-soft); color: #075985; border-color: #bae6fd; }
.alert.warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: 16px;
  animation: fade-in 0.2s var(--ease);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.22s var(--ease);
}
.modal h3 { margin-bottom: 16px; font-size: 18px; font-weight: 700; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal .close-x {
  float: right;
  background: none; border: none;
  cursor: pointer;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.modal .close-x:hover { background: var(--muted); color: var(--foreground); }
.modal .close-x .ico-svg { width: 18px; height: 18px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Scanner ---------- */
.scanner-shell { max-width: 660px; margin: 0 auto; }
.scanner-box {
  background: #0f172a;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}
#qr-reader { width: 100%; height: 100%; }
#qr-reader video { border-radius: 0 !important; }
#qr-reader img { display: none; }
#qr-reader__dashboard_section_csr { border-top: none !important; }
#qr-reader__dashboard_section_swaplink { color: var(--primary) !important; }
#qr-reader__scan_region { min-height: 260px; }
.cam-toggle { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.cam-toggle .btn { flex: 1; min-width: 120px; }

.code-input-row { display: flex; gap: 8px; margin: 14px 0; }
.code-input-row input {
  flex: 1;
  min-height: 48px;
  font-size: 17px;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.code-input-row input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.code-input-row .btn { min-height: 48px; }

.scan-result {
  border-radius: 10px;
  padding: 13px 15px;
  margin-top: 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.scan-result .scan-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.scan-result .scan-ico svg { width: 18px; height: 18px; }
.scan-result.ok { border-color: #bbf7d0; background: #f0fdf4; }
.scan-result.ok .scan-ico { background: var(--success-soft); color: var(--success); }
.scan-result.dup { border-color: #fde68a; background: #fffbeb; }
.scan-result.dup .scan-ico { background: var(--warning-soft); color: var(--warning); }
.scan-result.err { border-color: #fecaca; background: #fef2f2; }
.scan-result.err .scan-ico { background: var(--destructive-soft); color: var(--destructive); }
.scan-result .code { font-weight: 700; font-size: 16px; font-family: var(--font-mono); }
.scan-result .item { color: var(--text-muted); font-size: 13px; }
.scan-result .warn-line { display: block; color: #92400e; font-size: 12.5px; margin-top: 4px; }

.scan-log { margin-top: 16px; }
.scan-log .entry {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.scan-log .entry:last-child { border-bottom: none; }
.scan-log .entry .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot.ok { background: var(--success); }
.dot.dup { background: var(--warning); }
.dot.err { background: var(--destructive); }

/* ---------- Dashboard ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 5px; height: 100px; }
.chart-bars .bar {
  flex: 1;
  background: var(--secondary);
  border-radius: 4px 4px 0 0;
  min-width: 6px;
  position: relative;
  transition: height 0.4s var(--ease), background 0.15s;
  opacity: 0.85;
}
.chart-bars .bar:hover { background: var(--primary); opacity: 1; }
.chart-bars .bar .tip {
  position: absolute; top: -22px; left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  background: var(--foreground); color: #fff;
  padding: 2px 7px; border-radius: 5px;
  opacity: 0; white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.15s;
  pointer-events: none;
}
.chart-bars .bar:hover .tip { opacity: 1; }
.chart-legend { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.chart-legend .row { display: flex; justify-content: space-between; align-items: center; }
.chart-legend .row .bar-track {
  height: 7px; border-radius: 4px;
  background: var(--muted);
  flex: 1; margin: 0 9px;
  overflow: hidden;
}
.chart-legend .row .bar-fill { height: 100%; background: var(--secondary); border-radius: 4px; transition: width 0.4s var(--ease); }

.alert-item { padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert-item:last-child { border-bottom: none; }
.alert-item .alert-ico { margin-top: 2px; flex-shrink: 0; }
.alert-item .alert-ico svg { width: 15px; height: 15px; }
.alert-item .t { font-weight: 600; }
.alert-item .time { color: var(--text-muted); font-size: 12px; }

/* ---------- Notifications panel ---------- */
.notif-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 350px;
  max-width: 92vw;
  background: var(--surface);
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.15);
  z-index: var(--z-notif);
  transform: translateX(100%);
  transition: transform 0.25s var(--ease);
  display: flex;
  flex-direction: column;
}
.notif-panel.open { transform: translateX(0); }
.notif-panel .head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-panel .head strong { font-size: 15px; }
.notif-panel .list { flex: 1; overflow-y: auto; padding: 6px 18px; }
.notif-panel .list .item { padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.notif-panel .list .item:last-child { border-bottom: none; }
.notif-panel .list .item .t { font-weight: 600; display: flex; gap: 7px; align-items: center; }
.notif-panel .list .item .t svg { width: 14px; height: 14px; }

/* ---------- Skeleton loading ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--muted) 25%, #e8edf3 50%, var(--muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
}
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-block { height: 80px; border-radius: 10px; }
.skeleton-card { height: 120px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(15, 23, 42, 0.3); }
  .main { margin-left: 0; }
  .menu-btn { display: flex; }
  .content { padding: 16px 14px; padding-bottom: 84px; }
  .bottom-nav { display: block; }
}

@media (max-width: 420px) {
  .grid.cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .num { font-size: 23px; }
  .content { padding: 14px 10px; padding-bottom: 84px; }
  .card { padding: 14px; }
  .login-card { padding: 26px 20px; }
}

/* ---------- Misc ---------- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt { margin-top: 16px; }
.mt-2 { margin-top: 10px; }
.mb { margin-bottom: 16px; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.empty { text-align: center; color: var(--text-muted); padding: 34px 12px; }
.empty .big { font-size: 36px; margin-bottom: 8px; color: #cbd5e1; }
.empty .empty-title { font-weight: 600; color: var(--text-muted); }
.empty p { font-size: 13.5px; margin-top: 4px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  padding: 8px 15px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  min-height: 38px;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select {
  padding: 9px 12px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  font-family: var(--font-sans);
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }

code.code-chip {
  background: var(--muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.qr-img { max-width: 180px; border-radius: 8px; border: 1px solid var(--border); }
.secret-box {
  background: var(--muted);
  border: 1px dashed var(--border);
  padding: 10px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
  margin: 10px 0;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  bottom: 76px; left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 400px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--foreground);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.22s var(--ease);
}
.toast .ico-svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success svg { color: #4ade80; }
.toast.error svg { color: #f87171; }
.toast.warning svg { color: #fbbf24; }
.toast.info svg { color: #60a5fa; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (min-width: 1025px) {
  .toast-wrap { bottom: 24px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .skeleton { animation: none; background: var(--muted); }
}
