/* ============================================================
   KajerHisab — Premium App Stylesheet (v2)
   Fonts : Plus Jakarta Sans (Latin) + Hind Siliguri (Bangla) + JetBrains Mono (numbers)
   Works : Desktop · Tablet · Mobile (bottom navigation) · Light / Dark
   ============================================================ */

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --primary-soft: rgba(13,148,136,.10);
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;

  --grad-brand: linear-gradient(135deg, #0d9488 0%, #0891b2 55%, #2563eb 120%);
  --grad-gold:  linear-gradient(135deg, #f59e0b, #f97316);

  --sidebar-bg: #08111f;
  --sidebar-bg-2: #0b1d2e;
  --sidebar-text: #8fa3bd;
  --sidebar-active: #14b8a6;
  --sidebar-hover: rgba(20,184,166,.10);
  --sidebar-border: rgba(255,255,255,.06);
  --sidebar-width: 272px;

  --bg: #f3f6fb;
  --bg-card: #ffffff;
  --bg-soft: #f8fafc;
  --text: #0b1324;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --muted: #64748b;
  --border: #e5e9f2;
  --border-focus: #0d9488;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 20px rgba(15,23,42,.05);
  --shadow-md: 0 8px 30px rgba(15,23,42,.10);
  --shadow-lg: 0 20px 50px rgba(15,23,42,.18);
  --transition: .22s cubic-bezier(.4,0,.2,1);
  --topbar-h: 66px;
  --bottom-nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Plus Jakarta Sans', 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #060b14;
  --bg-card: #0e1626;
  --bg-soft: #0a1220;
  --text: #e8eefb;
  --text-muted: #8da0bd;
  --text-light: #5f7392;
  --muted: #8da0bd;
  --border: #1b2740;
  --primary-light: rgba(20,184,166,.16);
  --accent-light: rgba(245,158,11,.16);
  --danger-light: rgba(239,68,68,.16);
  --success-light: rgba(16,185,129,.16);
  --info-light: rgba(59,130,246,.18);
  --purple-light: rgba(139,92,246,.18);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-md: 0 10px 34px rgba(0,0,0,.5);
  --sidebar-bg: #050a14;
  --sidebar-bg-2: #08121f;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; }
::selection { background: rgba(13,148,136,.25); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* ============ Sidebar ============ */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  z-index: 300;
  transition: transform var(--transition);
  border-right: 1px solid var(--sidebar-border);
}
.sidebar::before {
  content: ''; position: absolute; top: -80px; left: -80px; width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(20,184,166,.28), transparent 70%);
  pointer-events: none;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px; position: relative;
}
.sidebar-logo { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.logo-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(20,184,166,.35), inset 0 0 0 1px rgba(255,255,255,.3);
  overflow: hidden; padding: 4px;
}
.logo-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-text {
  font-size: 1.08rem; font-weight: 800; color: #f8fafc; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}
.logo-sub { display: block; font-size: .68rem; color: var(--sidebar-text); font-weight: 500; letter-spacing: .04em; }
.sidebar-close {
  display: none; background: rgba(255,255,255,.06); border: none; color: var(--sidebar-text);
  width: 34px; height: 34px; border-radius: 10px; font-size: 15px; cursor: pointer;
}
.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 14px 8px; padding: 12px 14px;
  background: rgba(255,255,255,.04); border: 1px solid var(--sidebar-border); border-radius: 14px;
  position: relative;
}
.user-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  overflow: hidden; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.15);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { min-width: 0; }
.user-company { font-size: .86rem; font-weight: 700; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.user-plan { font-size: .72rem; margin-top: 2px; font-weight: 600; }
.user-plan.plan-paid { color: #fbbf24; }
.user-plan.plan-free { color: var(--sidebar-text); }

.sidebar-nav { flex: 1; padding: 10px 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; position: relative; }
.nav-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: #52657f; padding: 12px 12px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: .88rem; font-weight: 600;
  transition: all var(--transition); white-space: nowrap; position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #f1f5f9; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(20,184,166,.28), rgba(8,145,178,.14));
  color: #5eead4; box-shadow: inset 0 0 0 1px rgba(20,184,166,.25);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 22%; bottom: 22%; width: 4px;
  background: var(--sidebar-active); border-radius: 0 4px 4px 0;
}
.nav-icon { font-size: 17px; width: 22px; text-align: center; }
.nav-divider { height: 1px; background: var(--sidebar-border); margin: 10px 4px; }
.nav-logout:hover { color: #fca5a5; background: rgba(239,68,68,.12); }
.sidebar-foot { padding: 12px 18px 18px; font-size: .7rem; color: #4b5d78; text-align: center; border-top: 1px solid var(--sidebar-border); }

.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(2,6,15,.6); backdrop-filter: blur(3px);
  z-index: 250; opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

/* ============ Main + Topbar ============ */
.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg-card) 86%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px; position: sticky; top: 0; z-index: 100;
}
.topbar-menu-btn {
  display: none; flex-direction: column; justify-content: center; gap: 4.5px;
  width: 42px; height: 42px; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; padding: 0 11px;
}
.topbar-menu-btn span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
.topbar-title { font-size: 1.12rem; font-weight: 800; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-brand { display: none; align-items: center; gap: 9px; text-decoration: none; min-width: 0; }
.topbar-brand img { width: 30px; height: 30px; object-fit: contain; border-radius: 8px; }
.topbar-brand b { font-size: 1rem; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; position: relative; }
.topbar-ctrl-btn, .notif-btn {
  position: relative; height: 40px; min-width: 40px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--text); cursor: pointer; font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; transition: all var(--transition);
}
.topbar-ctrl-btn:hover, .notif-btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.topbar-lang-btn { font-size: .8rem; }
.notif-btn svg { width: 19px; height: 19px; }
.notif-badge {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
  background: var(--danger); color: #fff; border-radius: 10px; font-size: .66rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg-card);
}
.topbar-avatar {
  width: 40px; height: 40px; border-radius: 12px; background: var(--grad-brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; overflow: hidden;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.main-content { padding: 26px 28px 40px; max-width: 1500px; width: 100%; margin: 0 auto; flex: 1; min-width: 0; }

/* ============ Page header ============ */
.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-header h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.page-sub { color: var(--text-muted); font-size: .86rem; margin-top: 2px; }

/* ============ Cards ============ */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
a.card { text-decoration: none; color: inherit; transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: .98rem; font-weight: 800; letter-spacing: -.01em; }
.card-body { padding: 22px; }

/* ============ Hero balance (dashboard) ============ */
.hero-balance {
  position: relative; overflow: hidden; border-radius: 22px; padding: 26px 28px; color: #fff;
  background: linear-gradient(135deg, #064e4b 0%, #0d9488 45%, #0891b2 100%);
  box-shadow: 0 18px 40px rgba(13,148,136,.28);
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.hero-balance.loss { background: linear-gradient(135deg, #7f1d1d 0%, #dc2626 55%, #f97316 120%); box-shadow: 0 18px 40px rgba(220,38,38,.28); }
.hero-balance::before, .hero-balance::after {
  content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); pointer-events: none;
}
.hero-balance::before { width: 260px; height: 260px; right: -60px; top: -110px; }
.hero-balance::after  { width: 180px; height: 180px; right: 120px; bottom: -110px; }
.hb-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; opacity: .8; font-weight: 700; }
.hb-value { font-family: var(--mono); font-size: clamp(1.9rem, 5vw, 2.8rem); font-weight: 700; letter-spacing: -.03em; margin: 4px 0; line-height: 1.1; word-break: break-word; }
.hb-formula { font-size: .78rem; opacity: .8; }
.hb-side { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }
.hb-pill { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(6px); border-radius: 14px; padding: 10px 16px; min-width: 120px; }
.hb-pill small { display: block; font-size: .68rem; opacity: .8; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.hb-pill b { font-family: var(--mono); font-size: .98rem; }
.hb-main { position: relative; z-index: 1; min-width: 0; }

/* ============ Stats ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden; box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; }
.stat-card.green::before  { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.teal::before   { background: linear-gradient(90deg, var(--primary), #22d3ee); }
.stat-card.amber::before, .stat-card.yellow::before, .stat-card.orange::before { background: linear-gradient(90deg, var(--accent), #fcd34d); }
.stat-card.red::before    { background: linear-gradient(90deg, var(--danger), #fb7185); }
.stat-card.blue::before   { background: linear-gradient(90deg, var(--info), #60a5fa); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple), #c4b5fd); }
.stat-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 21px; margin-bottom: 14px; }
.stat-card.green .stat-icon  { background: var(--success-light); }
.stat-card.teal .stat-icon   { background: var(--primary-light); }
.stat-card.amber .stat-icon, .stat-card.yellow .stat-icon, .stat-card.orange .stat-icon { background: var(--accent-light); }
.stat-card.red .stat-icon    { background: var(--danger-light); }
.stat-card.blue .stat-icon   { background: var(--info-light); }
.stat-card.purple .stat-icon { background: var(--purple-light); }
.stat-value { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; word-break: break-word; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 5px; font-weight: 600; }
.stat-sub { font-size: .68rem; color: var(--text-light); margin-top: 2px; }

/* ============ Tables ============ */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 13px 18px; text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 800; background: var(--bg-soft); border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td, tfoot td { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: .88rem; vertical-align: middle; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--primary-soft); }
tbody tr:last-child td { border-bottom: none; }
tfoot td { background: var(--primary-light); font-weight: 800; border-top: 2px solid var(--primary); border-bottom: none; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============ Badges ============ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 99px; font-size: .74rem; font-weight: 700; }
.badge-success { background: var(--success-light); color: #047857; }
.badge-danger  { background: var(--danger-light);  color: #b91c1c; }
.badge-warning { background: var(--accent-light);  color: #b45309; }
.badge-info    { background: var(--info-light);    color: #1d4ed8; }
.badge-gray    { background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border); }
.badge-purple  { background: var(--purple-light);  color: #6d28d9; }
[data-theme="dark"] .badge-success { color: #6ee7b7; }
[data-theme="dark"] .badge-danger  { color: #fca5a5; }
[data-theme="dark"] .badge-warning { color: #fcd34d; }
[data-theme="dark"] .badge-info    { color: #93c5fd; }
[data-theme="dark"] .badge-purple  { color: #c4b5fd; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-family: inherit; font-size: .86rem; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: all var(--transition); line-height: 1.2; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad-brand); color: #fff; box-shadow: 0 6px 16px rgba(13,148,136,.28); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(13,148,136,.38); filter: brightness(1.05); }
.btn-accent { background: var(--grad-gold); color: #fff; box-shadow: 0 6px 16px rgba(245,158,11,.28); }
.btn-accent:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-danger { background: var(--danger-light); color: #b91c1c; border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-whatsapp { background: #25d366; color: #fff; box-shadow: 0 6px 16px rgba(37,211,102,.3); }
.btn-whatsapp:hover { background: #1fb957; }
.btn-sm { padding: 7px 13px; font-size: .78rem; border-radius: 10px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; }
[data-theme="dark"] .btn-danger { color: #fca5a5; }

/* ============ Forms ============ */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 7px; letter-spacing: .01em; }
.form-control {
  width: 100%; padding: 12px 14px; background: var(--bg-card); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 12px; font-family: inherit; font-size: .92rem;
  transition: border-color var(--transition), box-shadow var(--transition); appearance: none; -webkit-appearance: none;
  min-height: 46px;
}
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(13,148,136,.14); }
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { min-height: 96px; resize: vertical; }
[data-theme="dark"] input[type="date"] { color-scheme: dark; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.form-hint { font-size: .76rem; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 5px; }

/* ============ Filter bar + Quick Filters ============ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; padding: 16px 20px; }
.filter-bar > div { min-width: 0; }
.filter-bar .form-control { width: auto; min-width: 150px; min-height: 42px; padding: 9px 12px; }
.filter-bar .form-label { margin-bottom: 5px; }

.quick-filters {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.qf-title { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.qf-ico { font-style: normal; }
.qf-scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; flex: 1; -webkit-overflow-scrolling: touch; }
.qf-scroll::-webkit-scrollbar { display: none; }
.qf-chip {
  flex-shrink: 0; padding: 8px 16px; border-radius: 99px; font-size: .8rem; font-weight: 700;
  background: var(--bg-soft); color: var(--text-muted); border: 1.5px solid var(--border);
  text-decoration: none; transition: all var(--transition); white-space: nowrap;
}
.qf-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.qf-chip.active { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(13,148,136,.3); }

/* ============ Empty state ============ */
.empty-state { text-align: center; padding: 54px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 46px; margin-bottom: 14px; filter: grayscale(.15); }
.empty-state h3 { font-size: 1.05rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: .88rem; }

/* ============ Alerts ============ */
.alert { padding: 13px 16px; border-radius: 12px; font-size: .88rem; margin-bottom: 18px; font-weight: 600; border: 1px solid transparent; }
.alert-success { background: var(--success-light); color: #047857; border-color: rgba(16,185,129,.3); }
.alert-danger  { background: var(--danger-light);  color: #b91c1c; border-color: rgba(239,68,68,.3); }
.alert-info    { background: var(--info-light);    color: #1d4ed8; border-color: rgba(59,130,246,.3); }
.alert-warning { background: var(--accent-light);  color: #b45309; border-color: rgba(245,158,11,.3); }
.alert a { color: inherit; text-decoration: underline; }
[data-theme="dark"] .alert-success { color: #6ee7b7; }
[data-theme="dark"] .alert-danger  { color: #fca5a5; }
[data-theme="dark"] .alert-info    { color: #93c5fd; }
[data-theme="dark"] .alert-warning { color: #fcd34d; }

/* ============ Modal (bottom-sheet on mobile) ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2,6,15,.62); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 400; padding: 20px;
}
.modal-backdrop.open { display: flex; animation: fadeIn .2s ease; }
.modal {
  background: var(--bg-card); border-radius: 22px; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: popIn .26s cubic-bezier(.2,.9,.3,1.2);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
.modal-header h3 { font-size: 1.02rem; font-weight: 800; }
.modal-close { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-muted); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.modal-close:hover { color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); background: var(--bg-soft); }

/* ============ Pagination ============ */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.page-link { padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; font-size: .84rem; color: var(--text-muted); font-weight: 700; background: var(--bg-card); }
.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--grad-brand); color: #fff; border-color: transparent; }

/* ============ Dashboard layout ============ */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; margin-bottom: 20px; }
.chart-box { position: relative; height: 300px; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.act-ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 17px; }
.act-ico.in { background: var(--success-light); } .act-ico.out { background: var(--danger-light); }
.act-main { flex: 1; min-width: 0; }
.act-title { font-size: .86rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-date { font-size: .74rem; color: var(--text-muted); }
.act-amt { font-family: var(--mono); font-size: .86rem; font-weight: 700; white-space: nowrap; }
.act-amt.in { color: var(--success); } .act-amt.out { color: var(--danger); }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.quick-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.quick-card .qi { width: 50px; height: 50px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.quick-card b { display: block; font-size: .9rem; font-weight: 800; }
.quick-card small { color: var(--text-muted); font-size: .78rem; }

/* ============ Plan cards ============ */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 22px; }
.plan-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: 22px; padding: 28px; position: relative; box-shadow: var(--shadow); }
.plan-card.current { border-color: var(--primary); box-shadow: 0 0 0 5px rgba(13,148,136,.12); }
.plan-card.featured { border-color: var(--accent); }
.plan-card-badge { position: absolute; top: -13px; left: 24px; background: var(--grad-gold); color: #fff; font-size: .7rem; font-weight: 800; padding: 5px 14px; border-radius: 99px; letter-spacing: .05em; }
.plan-name { font-size: 1.1rem; font-weight: 800; margin-bottom: 6px; }
.plan-price { font-family: var(--mono); font-size: 2.3rem; font-weight: 700; color: var(--primary); letter-spacing: -.04em; }
.plan-price span { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.plan-features { list-style: none; margin: 18px 0 24px; }
.plan-features li { padding: 9px 0; font-size: .88rem; display: flex; gap: 10px; align-items: center; border-bottom: 1px dashed var(--border); }
.plan-features li:last-child { border: none; }
.plan-features li::before { content: '✓'; width: 20px; height: 20px; border-radius: 50%; background: var(--success-light); color: var(--success); font-weight: 800; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ============ Auth pages ============ */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(20,184,166,.35), transparent 60%),
    radial-gradient(800px 500px at 100% 110%, rgba(37,99,235,.28), transparent 60%),
    linear-gradient(160deg, #050b16, #0a1626 60%, #07111d);
  position: relative; overflow: hidden;
}
.auth-page::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at center, #000, transparent 75%); -webkit-mask-image: radial-gradient(circle at center, #000, transparent 75%); }
.auth-container { width: 100%; max-width: 440px; position: relative; z-index: 1; }
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo .logo-icon-lg { width: 76px; height: 76px; margin: 0 auto 14px; background: #fff; border-radius: 22px; display: flex; align-items: center; justify-content: center; padding: 8px; box-shadow: 0 14px 40px rgba(20,184,166,.45); overflow: hidden; }
.auth-logo .logo-icon-lg img { width: 100%; height: 100%; object-fit: contain; }
.auth-logo h1 { font-size: 1.7rem; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.auth-logo p { color: #7f93b0; font-size: .9rem; margin-top: 4px; }
.auth-card { background: rgba(14,22,38,.82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.09); border-radius: 24px; padding: 30px; box-shadow: 0 30px 70px rgba(0,0,0,.5); }
.auth-card .form-label { color: #9fb1cb; }
.auth-card .form-control { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); color: #f1f5f9; }
.auth-card .form-control:focus { border-color: #14b8a6; background: rgba(255,255,255,.07); }
.auth-card .form-control::placeholder { color: #55688a; }
.auth-footer { text-align: center; margin-top: 22px; font-size: .88rem; color: #7f93b0; }
.auth-footer a { color: #5eead4; text-decoration: none; font-weight: 700; }
.auth-footer a:hover { text-decoration: underline; }
.auth-tools { position: absolute; top: 16px; right: 16px; z-index: 2; display: flex; gap: 8px; }
.auth-tools .topbar-ctrl-btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #e2e8f0; }

/* ============ Bottom navigation (mobile) ============ */
.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  height: calc(var(--bottom-nav-h) + var(--safe-b)); padding: 8px 8px calc(8px + var(--safe-b));
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border); box-shadow: 0 -8px 30px rgba(15,23,42,.08);
  justify-content: space-around; align-items: stretch;
}
.bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--text-muted); font-size: .66rem; font-weight: 700; border-radius: 14px; position: relative; -webkit-tap-highlight-color: transparent; }
.bn-item .bn-ico { font-size: 20px; line-height: 1; transition: transform var(--transition); }
.bn-item.active { color: var(--primary); }
.bn-item.active .bn-ico { transform: translateY(-2px) scale(1.12); }
.bn-item.active::after { content: ''; position: absolute; top: -9px; width: 26px; height: 4px; border-radius: 0 0 6px 6px; background: var(--primary); }
.bn-item.center .bn-ico { width: 50px; height: 50px; margin-top: -26px; border-radius: 50%; background: var(--grad-brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; box-shadow: 0 10px 24px rgba(13,148,136,.45); border: 4px solid var(--bg-card); }
.bn-item.center.active::after { display: none; }

/* ============ Notification dropdown ============ */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute; top: calc(100% + 12px); right: 0; width: 360px; max-width: calc(100vw - 24px);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-8px) scale(.98); pointer-events: none; transition: all .2s ease; z-index: 500; overflow: hidden;
}
.notif-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.np-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 800; font-size: .92rem; }
.np-list { max-height: 340px; overflow-y: auto; }
.np-item { display: flex; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.np-item:hover { background: var(--primary-soft); }
.np-item.unread { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.np-dot { width: 36px; height: 36px; flex-shrink: 0; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.np-dot.success { background: var(--success-light); } .np-dot.warning { background: var(--accent-light); } .np-dot.info { background: var(--info-light); }
.np-msg { font-size: .84rem; font-weight: 600; line-height: 1.4; }
.np-time { font-size: .7rem; color: var(--text-muted); margin-top: 2px; }
.np-empty { padding: 30px 18px; text-align: center; color: var(--text-muted); font-size: .86rem; }
.np-foot { display: block; text-align: center; padding: 12px; font-size: .82rem; font-weight: 800; color: var(--primary); text-decoration: none; background: var(--bg-soft); }

/* ============ Notification popups (toast / modal / banner) ============ */
.kh-toasts { position: fixed; top: 18px; right: 18px; z-index: 900; display: flex; flex-direction: column; gap: 12px; width: 380px; max-width: calc(100vw - 24px); pointer-events: none; }
.kh-toast {
  pointer-events: auto; position: relative; overflow: hidden; display: flex; gap: 13px; align-items: flex-start;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-left: 5px solid var(--info);
  border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-lg);
  animation: toastIn .4s cubic-bezier(.2,.9,.3,1.2) both;
}
.kh-toast.out { animation: toastOut .3s ease forwards; }
.kh-toast .kt-ico { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; background: var(--info-light); }
.kh-toast .kt-body { flex: 1; min-width: 0; }
.kh-toast .kt-title { font-size: .88rem; font-weight: 800; }
.kh-toast .kt-msg { font-size: .83rem; color: var(--text-muted); margin-top: 2px; word-wrap: break-word; }
.kh-toast .kt-x { background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 15px; padding: 2px 4px; }
.kh-toast .kt-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .5; animation: ktBar linear forwards; }
.kh-toast.success { border-left-color: var(--success); color: var(--success); } .kh-toast.success .kt-ico { background: var(--success-light); }
.kh-toast.error, .kh-toast.danger { border-left-color: var(--danger); color: var(--danger); } .kh-toast.error .kt-ico, .kh-toast.danger .kt-ico { background: var(--danger-light); }
.kh-toast.warning { border-left-color: var(--accent); color: var(--accent); } .kh-toast.warning .kt-ico { background: var(--accent-light); }
.kh-toast.info { border-left-color: var(--info); color: var(--info); }
.kh-toast .kt-title, .kh-toast .kt-msg { color: inherit; }
.kh-toast .kt-title { color: var(--text); } .kh-toast .kt-msg { color: var(--text-muted); }

/* centered popup */
.kh-popup-bd { position: fixed; inset: 0; z-index: 950; background: rgba(2,6,15,.6); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s ease; }
.kh-popup { background: var(--bg-card); border: 1px solid var(--border); border-radius: 26px; width: 100%; max-width: 400px; text-align: center; padding: 34px 28px 26px; box-shadow: var(--shadow-lg); animation: popIn .35s cubic-bezier(.2,.9,.3,1.3) both; position: relative; overflow: hidden; }
.kh-popup::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--info); }
.kh-popup.success::before { background: linear-gradient(90deg, var(--success), #34d399); }
.kh-popup.warning::before { background: linear-gradient(90deg, var(--accent), #fb923c); }
.kh-popup.error::before, .kh-popup.danger::before { background: linear-gradient(90deg, var(--danger), #fb7185); }
.kh-popup.info::before { background: linear-gradient(90deg, var(--info), #22d3ee); }
.kh-popup .kp-ico { width: 74px; height: 74px; margin: 0 auto 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 34px; background: var(--info-light); animation: ringPulse 2s infinite; }
.kh-popup.success .kp-ico { background: var(--success-light); } .kh-popup.warning .kp-ico { background: var(--accent-light); } .kh-popup.error .kp-ico, .kh-popup.danger .kp-ico { background: var(--danger-light); }
.kh-popup h4 { font-size: 1.12rem; font-weight: 800; margin-bottom: 6px; }
.kh-popup p { color: var(--text-muted); font-size: .9rem; margin-bottom: 22px; }
.kh-popup .kp-actions { display: flex; gap: 10px; justify-content: center; }
.kh-popup .kp-actions .btn { flex: 1; }

/* top banner */
.kh-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 920; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 13px 52px 13px 18px; color: #fff; font-size: .88rem; font-weight: 700; background: var(--info); animation: bannerIn .4s ease both; box-shadow: 0 8px 30px rgba(0,0,0,.2); text-align: center; }
.kh-banner.success { background: linear-gradient(90deg, #059669, #10b981); } .kh-banner.warning { background: linear-gradient(90deg, #d97706, #f59e0b); }
.kh-banner.error, .kh-banner.danger { background: linear-gradient(90deg, #dc2626, #ef4444); } .kh-banner.info { background: linear-gradient(90deg, #0369a1, #0891b2); }
.kh-banner button { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.2); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; }
.kh-banner.out { animation: bannerOut .3s ease forwards; }

/* ============ Support toggle widget ============ */
.support-widget { position: fixed; right: 20px; bottom: 20px; z-index: 600; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.sw-toggle {
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer; color: #fff; position: relative;
  background: var(--grad-brand); box-shadow: 0 14px 34px rgba(13,148,136,.5);
  display: flex; align-items: center; justify-content: center; transition: transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.sw-toggle:hover { transform: scale(1.07); }
.sw-toggle svg { width: 28px; height: 28px; position: absolute; transition: all .3s ease; }
.sw-toggle .ic-close { opacity: 0; transform: rotate(-90deg) scale(.5); }
.support-widget.open .sw-toggle .ic-open { opacity: 0; transform: rotate(90deg) scale(.5); }
.support-widget.open .sw-toggle .ic-close { opacity: 1; transform: none; }
.sw-toggle::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit; z-index: -1; animation: swPulse 2.4s infinite; }
.support-widget.open .sw-toggle::before { animation: none; }
.sw-panel {
  width: 300px; max-width: calc(100vw - 32px); background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.94); transform-origin: bottom right; pointer-events: none; transition: all .28s cubic-bezier(.2,.9,.3,1.2);
}
.support-widget.open .sw-panel { opacity: 1; transform: none; pointer-events: auto; }
.sw-head { background: var(--grad-brand); color: #fff; padding: 18px 20px; position: relative; overflow: hidden; }
.sw-head::after { content: ''; position: absolute; width: 120px; height: 120px; right: -30px; top: -50px; border-radius: 50%; background: rgba(255,255,255,.14); }
.sw-head b { display: block; font-size: 1rem; font-weight: 800; position: relative; z-index: 1; }
.sw-head small { font-size: .76rem; opacity: .85; position: relative; z-index: 1; }
.sw-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sw-link { display: flex; align-items: center; gap: 13px; padding: 11px 13px; border-radius: 14px; text-decoration: none; color: var(--text); background: var(--bg-soft); border: 1px solid var(--border); transition: all var(--transition); }
.sw-link:hover { transform: translateX(-3px); border-color: currentColor; }
.sw-ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.sw-ico svg { width: 21px; height: 21px; }
.sw-link b { display: block; font-size: .88rem; font-weight: 800; color: var(--text); }
.sw-link small { font-size: .72rem; color: var(--text-muted); }
.sw-link.whatsapp:hover { color: #25d366; } .sw-link.telegram:hover { color: #229ed9; } .sw-link.youtube:hover { color: #ff0000; } .sw-link.facebook:hover { color: #1877f2; }
.sw-ico.whatsapp { background: #25d366; } .sw-ico.telegram { background: #229ed9; } .sw-ico.youtube { background: #ff0000; } .sw-ico.facebook { background: #1877f2; }
.sw-arrow { margin-left: auto; color: var(--text-light); font-size: 14px; }

/* ============ Animations ============ */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(.94) } to { opacity: 1; transform: none } }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px) scale(.94) } to { opacity: 1; transform: none } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px) scale(.94) } }
@keyframes bannerIn { from { transform: translateY(-100%) } to { transform: none } }
@keyframes bannerOut { to { transform: translateY(-100%) } }
@keyframes ktBar { from { width: 100% } to { width: 0 } }
@keyframes swPulse { 0% { transform: scale(1); opacity: .55 } 100% { transform: scale(1.75); opacity: 0 } }
@keyframes ringPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(13,148,136,.25) } 50% { box-shadow: 0 0 0 14px rgba(13,148,136,0) } }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: min(300px, 86vw); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; }
  .main-wrapper { margin-left: 0; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-menu-btn { display: flex; }
  .topbar-title { display: none; }
  .topbar-brand { display: inline-flex; flex: 1; }
  .topbar-lang-btn { padding: 0 10px; }
  .main-content { padding: 18px 14px calc(var(--bottom-nav-h) + var(--safe-b) + 28px); }
  .bottom-nav { display: flex; }
  .support-widget { right: 14px; bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 16px); }
  .sw-toggle { width: 54px; height: 54px; }
  .page-header h2 { font-size: 1.15rem; }
  .hero-balance { padding: 22px 20px; border-radius: 20px; }
  .hb-side { width: 100%; }
  .hb-pill { flex: 1; min-width: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.15rem; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; margin-bottom: 10px; }
  .filter-bar { padding: 14px; gap: 10px; }
  .filter-bar > div:not([style*="flex:1"]) { flex: 1 1 calc(50% - 6px); }
  .filter-bar .form-control { width: 100%; min-width: 0; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: 24px 24px 0 0; max-height: 94vh; animation: sheetUp .3s cubic-bezier(.2,.9,.3,1) both; }
  .modal-footer { position: sticky; bottom: 0; padding-bottom: calc(16px + var(--safe-b)); }
  .notif-panel { position: fixed; top: calc(var(--topbar-h) + 8px); left: 12px; right: 12px; width: auto; max-width: none; }
  .kh-toasts { top: 10px; right: 10px; left: 10px; width: auto; max-width: none; }
  .quick-filters { padding: 10px; gap: 8px; }
  .qf-title span { display: none; }
}
@keyframes sheetUp { from { transform: translateY(100%) } to { transform: none } }

@media (max-width: 640px) {
  html { font-size: 14.5px; }
  .quick-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .quick-card { flex-direction: column; text-align: center; padding: 16px 10px; gap: 8px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .card-header { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .auth-card { padding: 24px 20px; border-radius: 22px; }
  .logo-text { max-width: 120px; }

  /* tables become stacked cards (labels injected by main.js) */
  table.rt, table.rt tbody, table.rt tr, table.rt td { display: block; width: 100%; }
  table.rt thead { display: none; }
  table.rt tbody tr { padding: 12px 14px; border-bottom: 8px solid var(--bg); }
  table.rt tbody tr:hover { background: transparent; }
  table.rt tbody td { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--border); text-align: right; font-size: .86rem; }
  table.rt tbody td:last-child { border-bottom: none; }
  table.rt tbody td[data-label]::before { content: attr(data-label); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); text-align: left; flex-shrink: 0; }
  table.rt tbody td.no-stack { display: table-cell; text-align: center; }
  table.rt tfoot, table.rt tfoot tr { display: block; }
  table.rt tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; padding: 12px 14px; background: var(--primary-light); border-top: 2px solid var(--primary); }
  table.rt tfoot td { display: block; width: auto; padding: 2px 4px; background: transparent; border: none; }
  table.rt tfoot td:empty { display: none; }
}
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-brand b { max-width: 90px; }
}

/* ============ Print ============ */
@media print {
  .sidebar, .topbar, .bottom-nav, .support-widget, .kh-toasts, .quick-filters, .sidebar-overlay { display: none !important; }
  .main-wrapper { margin: 0 !important; }
  .main-content { padding: 0 !important; max-width: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
