/* GymFlow — soft UI design system */
:root {
  --primary: #4f46e5;
  --primary-rgb: 79, 70, 229;
  --accent: #06b6d4;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --border: #e8ebf3;
  --text: #1e2235;
  --text-2: #5b6178;
  --muted: #8a90a6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .12);
  --sidebar-w: 264px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* theme-aware tokens (dark values below) */
  --topbar-bg: rgba(244, 246, 251, .85);
  --row-hover: #fbfcff;
  --track: #eef0f5;
  --switch-off: #d7dbe7;
  --border-strong: #cfd4e2;
  --empty-icon: #cbd0de;
  --success-text: #047857;
  --warning-text: #b45309;
  --danger-text: #b91c1c;
  --info-text: #0369a1;
  --muted-text: #5b6178;
  --success-strong: #059669;
  --danger-strong: #dc2626;
  --flash-success-bg: #ecfdf5; --flash-success-border: #a7f3d0; --flash-success-text: #065f46;
  --flash-error-bg: #fef2f2; --flash-error-border: #fecaca; --flash-error-text: #991b1b;
  --flash-info-bg: #eff6ff; --flash-info-border: #bfdbfe; --flash-info-text: #1e40af;
  --flash-warning-bg: #fffbeb; --flash-warning-border: #fde68a; --flash-warning-text: #92400e;
  --banner-bg: #fff7ed; --banner-border: #fed7aa; --banner-text: #9a3412;
  --toast-bg: #111827; --toast-text: #fff;
  --google-bg: #fff;
  --chart-grid: #eef0f5;
  --chart-text: #8a90a6;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; line-height: 1.5; }
a { color: var(--link, var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
img { max-width: 100%; }
code, .mono { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
[data-lucide] { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .25s; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 20px 22px; border-bottom: 1px solid var(--border); min-height: 72px; }
.brand-logo { height: 34px; width: auto; max-width: 150px; object-fit: contain; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.brand-name { font-weight: 800; font-size: 17px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: -2px; }
.nav { padding: 14px 12px 24px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px; color: var(--text-2); font-weight: 600; margin-bottom: 2px; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: rgba(var(--primary-rgb), .09); color: var(--primary); }
.nav a .count { margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; padding: 1px 7px; border-radius: 99px; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.plan-chip { background: linear-gradient(135deg, rgba(var(--primary-rgb), .1), rgba(6, 182, 212, .1)); border-radius: 14px; padding: 12px 14px; font-size: 12px; color: var(--text-2); }
.plan-chip strong { color: var(--text); display: block; font-size: 13px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 72px; background: var(--topbar-bg); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 0 28px; border-bottom: 1px solid transparent; }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { padding-left: 38px; background: var(--surface); }
.topbar .search [data-lucide] { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .spacer { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; position: relative; }
.icon-btn:hover { color: var(--primary); text-decoration: none; }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.menu-toggle { display: none; }
.user-menu { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; position: relative; }
.user-menu .meta { line-height: 1.2; }
.user-menu .meta small { color: var(--muted); font-size: 11px; }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 20px; }
.avatar.xl { width: 96px; height: 96px; border-radius: 24px; font-size: 30px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; display: none; z-index: 50; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; color: var(--text-2); background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.alerts-panel { width: 360px; max-height: 440px; overflow-y: auto; }
.alerts-panel .alert-row { display: flex; gap: 10px; padding: 10px; border-radius: 10px; }
.alerts-panel .alert-row:hover { background: var(--surface-2); }

.acting-banner { background: linear-gradient(90deg, #1e1b4b, #312e81); color: #e0e7ff; padding: 8px 28px; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.acting-banner form { margin-left: auto; }
.acting-banner button { background: rgba(255, 255, 255, .15); color: #fff; border: 0; border-radius: 8px; padding: 5px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.billing-banner { background: var(--banner-bg); color: var(--banner-text); padding: 8px 28px; font-size: 13px; border-bottom: 1px solid var(--banner-border); }

.content { padding: 8px 28px 40px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 12px 0 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.footer { padding: 18px 28px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- Cards & KPI soft cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.card-head h3 { font-size: 15.5px; font-weight: 700; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px 20px 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { --tone: var(--primary); --tone-rgb: var(--primary-rgb); position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(16, 24, 40, .08); }
.kpi::after { content: ''; position: absolute; width: 140px; height: 140px; border-radius: 50%; right: -50px; top: -60px; background: rgba(var(--tone-rgb), .07); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; position: relative; z-index: 1; }
.kpi-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: rgba(var(--tone-rgb), .12); color: var(--tone); }
.kpi-icon [data-lucide] { width: 20px; height: 20px; }
.kpi-label { color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; position: relative; z-index: 1; }
.kpi-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 12px; position: relative; z-index: 1; }
.kpi a.stretched::before { content: ''; position: absolute; inset: 0; z-index: 2; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; font-weight: 700; font-size: 11.5px; }
.delta.up { background: rgba(16, 185, 129, .12); color: var(--success-strong); }
.delta.down { background: rgba(239, 68, 68, .1); color: var(--danger-strong); }
.delta.flat { background: var(--surface-2); color: var(--text-2); }
.kpi .spark { position: absolute; right: 14px; bottom: 12px; width: 90px; height: 32px; z-index: 1; opacity: .9; }
.tone-indigo { --tone: #4f46e5; --tone-rgb: 79, 70, 229; }
.tone-emerald { --tone: #10b981; --tone-rgb: 16, 185, 129; }
.tone-amber { --tone: #f59e0b; --tone-rgb: 245, 158, 11; }
.tone-rose { --tone: #f43f5e; --tone-rgb: 244, 63, 94; }
.tone-sky { --tone: #0ea5e9; --tone-rgb: 14, 165, 233; }
.tone-violet { --tone: #8b5cf6; --tone-rgb: 139, 92, 246; }
.tone-teal { --tone: #14b8a6; --tone-rgb: 20, 184, 166; }
.tone-slate { --tone: #64748b; --tone-rgb: 100, 116, 139; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--row-hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 800; background: var(--surface-2); }
.who { display: flex; align-items: center; gap: 10px; }
.who strong { display: block; color: var(--text); }
.who small { color: var(--muted); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty [data-lucide] { width: 40px; height: 40px; color: var(--empty-icon); margin-bottom: 8px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: rgba(16, 185, 129, .12); color: var(--success-text); }
.badge-warning { background: rgba(245, 158, 11, .14); color: var(--warning-text); }
.badge-danger { background: rgba(239, 68, 68, .12); color: var(--danger-text); }
.badge-info { background: rgba(14, 165, 233, .12); color: var(--info-text); }
.badge-muted { background: var(--track); color: var(--muted-text); }
.badge-primary { background: rgba(var(--primary-rgb), .12); color: var(--primary); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.input, input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=tel], input[type=url], input[type=search], input[type=color], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input[type=color] { padding: 4px; height: 42px; cursor: pointer; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .12); }
.field { margin-bottom: 16px; }
.field-hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 5px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); cursor: pointer; margin: 0; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; color: var(--text); }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--switch-off); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }
.input-group { display: flex; }
.input-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.filters .field { margin: 0; min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 13.5px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; white-space: nowrap; transition: transform .1s, box-shadow .2s, background .2s; color: var(--text); background: var(--surface); }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(var(--primary-rgb), .25); }
.btn-primary:hover { filter: brightness(1.06); color: #fff; }
.btn-light { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-light:hover { color: var(--text); border-color: var(--border-strong); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-soft-danger { background: rgba(239, 68, 68, .1); color: var(--danger-strong); }
.btn-soft { background: rgba(var(--primary-rgb), .1); color: var(--primary); }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }
.btn-block { width: 100%; }
.btn [data-lucide] { width: 16px; height: 16px; }
.btn-group { display: inline-flex; gap: 6px; }
form.inline { display: inline; }

/* ---------- Alerts / flash ---------- */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; font-weight: 600; border: 1px solid; }
.flash-success { background: var(--flash-success-bg); border-color: var(--flash-success-border); color: var(--flash-success-text); }
.flash-error { background: var(--flash-error-bg); border-color: var(--flash-error-border); color: var(--flash-error-text); }
.flash-info { background: var(--flash-info-bg); border-color: var(--flash-info-border); color: var(--flash-info-text); }
.flash-warning { background: var(--flash-warning-bg); border-color: var(--flash-warning-border); color: var(--flash-warning-text); }
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 280px; max-width: 380px; padding: 14px 16px; border-radius: 14px; background: var(--toast-bg); color: var(--toast-text); box-shadow: var(--shadow-lg); border: 1px solid var(--border); font-weight: 600; animation: slidein .3s ease; display: flex; gap: 10px; }
.toast.danger { background: #b91c1c; }
@keyframes slidein { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Tabs, misc ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; width: fit-content; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 10px; color: var(--text-2); font-weight: 700; font-size: 13px; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.list li:last-child { border-bottom: 0; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-success { color: var(--success-strong); }
.text-danger { color: var(--danger-strong); }
.text-warning { color: var(--warning-text); }
.fw-bold { font-weight: 700; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.pill-stat { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); margin-bottom: 8px; }
.progress { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 14px 20px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--border); color: var(--text-2); font-weight: 700; background: var(--surface); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .info { border: 0; background: none; margin-right: auto; color: var(--muted); font-weight: 500; }
.insight { display: flex; gap: 14px; padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 12px; }
.insight .kpi-icon { flex-shrink: 0; }
.insight h4 { font-size: 14.5px; margin-bottom: 3px; }
.insight p { margin: 0; color: var(--text-2); }
.copy-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 12px; padding: 10px 12px; word-break: break-all; }
.copy-box code { flex: 1; }
.log-box { background: #0f172a; color: #a5f3fc; border-radius: 14px; padding: 14px 16px; font-family: Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; align-items: center; justify-content: center; z-index: 80; padding: 16px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: 20px; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; }

/* ---------- Check-in kiosk ---------- */
.kiosk { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.scan-input { font-size: 22px !important; padding: 16px 18px !important; font-weight: 700; letter-spacing: .04em; }
.verdict { border-radius: 22px; padding: 28px; text-align: center; min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; transition: background .3s; border: 1px solid var(--border); background: var(--surface); }
.verdict .big { font-size: 30px; font-weight: 800; letter-spacing: .02em; }
.verdict.granted { background: linear-gradient(160deg, #ecfdf5, #d1fae5); border-color: #a7f3d0; color: #065f46; }
.verdict.warning { background: linear-gradient(160deg, #fffbeb, #fef3c7); border-color: #fde68a; color: #92400e; }
.verdict.denied { background: linear-gradient(160deg, #fef2f2, #fee2e2); border-color: #fecaca; color: #991b1b; animation: shake .4s; }
.verdict .verdict-icon { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; background: rgba(255, 255, 255, .7); }
.verdict .verdict-icon [data-lucide] { width: 40px; height: 40px; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.feed-item:last-child { border: 0; }

/* ---------- Auth (split screen) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-visual { position: sticky; top: 0; height: 100vh; overflow: hidden; overflow: clip; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(1200px 600px at -10% -10%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(145deg, var(--primary) 0%, #312e81 55%, #0f172a 100%); }
.auth-visual.has-image { background-size: cover; background-position: center; }
.auth-visual.has-image::before { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(var(--primary-rgb), .82), rgba(15, 23, 42, .9)); }
.auth-visual > * { position: relative; z-index: 1; }
.auth-visual .brand-mark { background: rgba(255, 255, 255, .16); backdrop-filter: blur(6px); }
.auth-visual h2 { font-size: 38px; font-weight: 800; line-height: 1.15; max-width: 520px; letter-spacing: -.02em; }
.auth-visual p { color: rgba(255, 255, 255, .78); max-width: 500px; font-size: 15px; }
.auth-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 560px; margin-top: 28px; }
.auth-feature { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .14); font-weight: 600; font-size: 13px; backdrop-filter: blur(6px); }
.auth-stats { display: flex; gap: 28px; }
.auth-stats strong { font-size: 24px; display: block; }
.auth-stats span { color: rgba(255, 255, 255, .7); font-size: 12px; }
.auth-orb { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .5; z-index: 0 !important; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 28px; font-weight: 800; }
.auth-card .lead { color: var(--text-2); margin: 6px 0 26px; }
.btn-google { width: 100%; background: var(--google-bg); border: 1px solid var(--border); color: var(--text); padding: 11px 16px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.btn-google:hover { background: var(--surface-2); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.password-wrap { position: relative; }
.password-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; }
.auth-simple { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

/* ---------- Receipt / print ---------- */
.receipt { max-width: 420px; margin: 0 auto; }
@media print {
  .sidebar, .topbar, .footer, .no-print, .acting-banner, .billing-banner, .page-head .actions { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .grid-2, .kiosk { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .topbar .search { display: none; }
}
@media (max-width: 640px) {
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .grid-3, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .user-menu .meta { display: none; }
  .alerts-panel { width: calc(100vw - 32px); }
  .page-head h1 { font-size: 20px; }
}

/* ---------- Registration ---------- */
.auth-card.wide { max-width: 580px; }
.trial-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: rgba(var(--primary-rgb), .09); color: var(--primary); font-weight: 700; font-size: 12px; margin-bottom: 14px; }
.trial-pill svg, .trial-pill i { width: 14px; height: 14px; }
.form-section { border: 1px solid var(--border); border-radius: 18px; padding: 18px 18px 2px; margin-bottom: 14px; background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, .03); }
.form-section-title { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; margin-bottom: 14px; }
.form-section-title .step-no { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; font-size: 12px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.form-section-title small { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.input-icon { position: relative; }
.input-icon > svg, .input-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; transition: color .15s; }
.input-icon input { padding-left: 40px; }
.input-icon:focus-within > svg, .input-icon:focus-within > i { color: var(--primary); }
.input-icon .password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; }
.input-icon .password-toggle:hover { color: var(--text); background: var(--surface-2); }
.input-icon .match-mark { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; display: none; }
.input-icon.matched .match-mark { display: block; color: var(--success); }
.strength { display: flex; gap: 5px; margin-top: 8px; }
.strength span { flex: 1; height: 4px; border-radius: 99px; background: var(--track); transition: background .25s; }
.strength-label { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 5px; min-height: 16px; }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--warning); }
.strength[data-score="3"] span:nth-child(-n+3) { background: #84cc16; }
.strength[data-score="4"] span { background: var(--success); }
.plan-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.plan-option { position: relative; display: block; margin: 0; cursor: pointer; border: 1.5px solid var(--border); border-radius: 16px; padding: 14px 12px 12px; background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; color: var(--text); }
.plan-option:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.plan-option input { position: absolute; opacity: 0; pointer-events: none; }
.plan-option:has(input:checked) { border-color: var(--primary); background: rgba(var(--primary-rgb), .04); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .1); }
.plan-option:has(input:focus-visible) { box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .25); }
.plan-option .plan-name { font-weight: 800; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; }
.plan-option .plan-check { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; transition: all .15s; }
.plan-option:has(input:checked) .plan-check { background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 3px var(--surface); }
.plan-option .plan-price { font-size: 17px; font-weight: 800; margin-top: 8px; letter-spacing: -.01em; }
.plan-option .plan-price small { font-size: 11px; color: var(--muted); font-weight: 600; }
.plan-option .plan-meta { font-size: 11.5px; color: var(--text-2); margin-top: 4px; line-height: 1.4; }
.plan-option .popular { position: absolute; top: -9px; left: 12px; padding: 1px 8px; border-radius: 99px; font-size: 10px; font-weight: 800; color: #fff; background: linear-gradient(90deg, var(--primary), var(--accent)); letter-spacing: .02em; }
.btn-cta { padding: 14px; font-size: 14.5px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent))); }
.legal-note { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.reg-steps { list-style: none; margin: 30px 0 0; padding: 0; max-width: 460px; }
.reg-steps li { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.reg-steps li:not(:last-child)::before { content: ''; position: absolute; left: 17px; top: 38px; bottom: 2px; width: 2px; background: rgba(255, 255, 255, .18); }
.reg-steps .dot { width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); font-weight: 800; }
.reg-steps strong { display: block; font-size: 14.5px; }
.reg-steps span { color: rgba(255, 255, 255, .72); font-size: 13px; }
.reg-quote { max-width: 460px; padding: 18px 20px; border-radius: 18px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(8px); }
.reg-quote p { margin: 0 0 12px; color: rgba(255, 255, 255, .92) !important; font-size: 14px !important; line-height: 1.55; }
.reg-quote .who { gap: 10px; }
.reg-quote .avatar { background: rgba(255, 255, 255, .2); }
.reg-quote small { color: rgba(255, 255, 255, .65); }
.reg-stars { color: #fbbf24; letter-spacing: 2px; font-size: 13px; margin-bottom: 8px; }
.reg-trust { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.reg-trust span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); font-size: 12px; font-weight: 600; }
.reg-trust svg, .reg-trust i { width: 14px; height: 14px; }
@media (max-width: 640px) {
  .plan-options { grid-template-columns: minmax(0, 1fr); }
  .form-section { padding: 16px 14px 2px; }
}
.reg-entry { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.reg-entry > div { flex: 1; min-width: 0; line-height: 1.3; }
.reg-entry strong { display: block; font-size: 13px; }
.reg-entry .avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }
.reg-tag { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 99px; }
.reg-tag.ok { background: rgba(16, 185, 129, .22); color: #6ee7b7; }
.reg-tag.no { background: rgba(239, 68, 68, .22); color: #fca5a5; }
.reg-tag.warn { background: rgba(245, 158, 11, .22); color: #fcd34d; }
.reg-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: rgba(255, 255, 255, .7); }
.reg-live span { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: livepulse 1.8s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); } 70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

/* ---------- Demo logins (login page) ---------- */
.demo-logins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.demo-login { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); font: inherit; color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.demo-login.full { grid-column: 1 / -1; }
.demo-login:hover { border-color: rgba(var(--tone-rgb), .45); box-shadow: 0 6px 18px rgba(var(--tone-rgb), .12); transform: translateY(-1px); }
.demo-login:disabled { cursor: wait; opacity: .6; }
.demo-login.loading { opacity: 1; border-color: var(--tone); }
.demo-login .kpi-icon { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; }
.demo-login .kpi-icon svg, .demo-login .kpi-icon i { width: 17px; height: 17px; }
.demo-text { flex: 1; min-width: 0; line-height: 1.25; }
.demo-text strong { display: block; font-size: 13px; }
.demo-text small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-go { width: 15px !important; height: 15px !important; color: var(--muted); transition: transform .15s, color .15s; }
.demo-login:hover .demo-go { color: var(--tone); transform: translateX(2px); }
@media (max-width: 420px) { .demo-logins { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Wide forms & sidebar user ---------- */
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 992px) { .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); } }
.sidebar-foot { display: flex; flex-direction: column; gap: 10px; }
.sidebar-user { display: flex; align-items: flex-start; gap: 11px; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.sidebar-user .avatar { width: 38px; height: 38px; border-radius: 12px; text-decoration: none; }
.sidebar-user-meta { flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-user-name { display: block; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-name:hover { color: var(--primary); text-decoration: none; }
.sidebar-user small { display: block; color: var(--muted); font-size: 11.5px; }
.sidebar-logout { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--danger); cursor: pointer; }
.sidebar-logout svg, .sidebar-logout i { width: 14px; height: 14px; }
.sidebar-logout:hover { text-decoration: underline; }

/* ===========================================================================
   Dark mode — [data-theme=dark], or [data-theme=auto] + OS dark preference
   =========================================================================== */
:root[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #131a2d;
  --surface-2: #19213a;
  --border: #252f4a;
  --text: #e7eaf3;
  --text-2: #aeb5cb;
  --muted: #7f88a3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  --topbar-bg: rgba(11, 16, 32, .82);
  --row-hover: #18203a;
  --track: #252f4a;
  --switch-off: #3a4563;
  --border-strong: #36415f;
  --empty-icon: #3a4563;
  --success-text: #6ee7b7;
  --warning-text: #fcd34d;
  --danger-text: #fca5a5;
  --info-text: #7dd3fc;
  --muted-text: #b4bbd0;
  --success-strong: #34d399;
  --danger-strong: #f87171;
  --flash-success-bg: rgba(16, 185, 129, .12); --flash-success-border: rgba(16, 185, 129, .35); --flash-success-text: #a7f3d0;
  --flash-error-bg: rgba(239, 68, 68, .12); --flash-error-border: rgba(239, 68, 68, .35); --flash-error-text: #fecaca;
  --flash-info-bg: rgba(59, 130, 246, .12); --flash-info-border: rgba(59, 130, 246, .35); --flash-info-text: #bfdbfe;
  --flash-warning-bg: rgba(245, 158, 11, .12); --flash-warning-border: rgba(245, 158, 11, .35); --flash-warning-text: #fde68a;
  --banner-bg: rgba(245, 158, 11, .12); --banner-border: rgba(245, 158, 11, .3); --banner-text: #fdba74;
  --toast-bg: #1f2942; --toast-text: #f1f4fb;
  --google-bg: var(--surface);
  --chart-grid: rgba(148, 163, 184, .14);
  --chart-text: #8f98b3;
  --link: color-mix(in srgb, var(--primary) 60%, #ffffff);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0b1020;
    --surface: #131a2d;
    --surface-2: #19213a;
    --border: #252f4a;
    --text: #e7eaf3;
    --text-2: #aeb5cb;
    --muted: #7f88a3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
    --topbar-bg: rgba(11, 16, 32, .82);
    --row-hover: #18203a;
    --track: #252f4a;
    --switch-off: #3a4563;
    --border-strong: #36415f;
    --empty-icon: #3a4563;
    --success-text: #6ee7b7;
    --warning-text: #fcd34d;
    --danger-text: #fca5a5;
    --info-text: #7dd3fc;
    --muted-text: #b4bbd0;
    --success-strong: #34d399;
    --danger-strong: #f87171;
    --flash-success-bg: rgba(16, 185, 129, .12); --flash-success-border: rgba(16, 185, 129, .35); --flash-success-text: #a7f3d0;
    --flash-error-bg: rgba(239, 68, 68, .12); --flash-error-border: rgba(239, 68, 68, .35); --flash-error-text: #fecaca;
    --flash-info-bg: rgba(59, 130, 246, .12); --flash-info-border: rgba(59, 130, 246, .35); --flash-info-text: #bfdbfe;
    --flash-warning-bg: rgba(245, 158, 11, .12); --flash-warning-border: rgba(245, 158, 11, .35); --flash-warning-text: #fde68a;
    --banner-bg: rgba(245, 158, 11, .12); --banner-border: rgba(245, 158, 11, .3); --banner-text: #fdba74;
    --toast-bg: #1f2942; --toast-text: #f1f4fb;
    --google-bg: var(--surface);
    --chart-grid: rgba(148, 163, 184, .14);
    --chart-text: #8f98b3;
    --link: color-mix(in srgb, var(--primary) 60%, #ffffff);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] .verdict.granted { background: linear-gradient(160deg, rgba(16, 185, 129, .16), rgba(16, 185, 129, .08)); border-color: rgba(16, 185, 129, .4); color: #a7f3d0; }
:root[data-theme="dark"] .verdict.warning { background: linear-gradient(160deg, rgba(245, 158, 11, .16), rgba(245, 158, 11, .08)); border-color: rgba(245, 158, 11, .4); color: #fde68a; }
:root[data-theme="dark"] .verdict.denied { background: linear-gradient(160deg, rgba(239, 68, 68, .18), rgba(239, 68, 68, .08)); border-color: rgba(239, 68, 68, .45); color: #fecaca; }
:root[data-theme="dark"] .verdict .verdict-icon { background: rgba(255, 255, 255, .08); }
:root[data-theme="dark"] .kpi:hover { box-shadow: 0 14px 34px rgba(0, 0, 0, .35); }
:root[data-theme="dark"] .modal-backdrop { background: rgba(2, 6, 18, .7); }
:root[data-theme="dark"] .switch input::after { background: #e7eaf3; }
:root[data-theme="dark"] .log-box { border: 1px solid var(--border); }
:root[data-theme="dark"] img.brand-logo, :root[data-theme="dark"] .auth-card img { filter: none; }
:root[data-theme="dark"] input::placeholder, :root[data-theme="dark"] textarea::placeholder { color: #6b7490; }
:root[data-theme="dark"] select option { background: var(--surface); color: var(--text); }
:root[data-theme="dark"] .badge-primary, :root[data-theme="dark"] .btn-soft, :root[data-theme="dark"] .nav a.active { color: color-mix(in srgb, var(--primary) 55%, #ffffff); }
:root[data-theme="dark"] .tabs a.active, :root[data-theme="dark"] .trial-pill { color: color-mix(in srgb, var(--primary) 55%, #ffffff); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .verdict.granted { background: linear-gradient(160deg, rgba(16, 185, 129, .16), rgba(16, 185, 129, .08)); border-color: rgba(16, 185, 129, .4); color: #a7f3d0; }
  :root[data-theme="auto"] .verdict.warning { background: linear-gradient(160deg, rgba(245, 158, 11, .16), rgba(245, 158, 11, .08)); border-color: rgba(245, 158, 11, .4); color: #fde68a; }
  :root[data-theme="auto"] .verdict.denied { background: linear-gradient(160deg, rgba(239, 68, 68, .18), rgba(239, 68, 68, .08)); border-color: rgba(239, 68, 68, .45); color: #fecaca; }
  :root[data-theme="auto"] .verdict .verdict-icon { background: rgba(255, 255, 255, .08); }
  :root[data-theme="auto"] .kpi:hover { box-shadow: 0 14px 34px rgba(0, 0, 0, .35); }
  :root[data-theme="auto"] .modal-backdrop { background: rgba(2, 6, 18, .7); }
  :root[data-theme="auto"] .switch input::after { background: #e7eaf3; }
  :root[data-theme="auto"] .log-box { border: 1px solid var(--border); }
  :root[data-theme="auto"] img.brand-logo, :root[data-theme="auto"] .auth-card img { filter: none; }
  :root[data-theme="auto"] input::placeholder, :root[data-theme="auto"] textarea::placeholder { color: #6b7490; }
  :root[data-theme="auto"] select option { background: var(--surface); color: var(--text); }
  :root[data-theme="auto"] .badge-primary, :root[data-theme="auto"] .btn-soft, :root[data-theme="auto"] .nav a.active { color: color-mix(in srgb, var(--primary) 55%, #ffffff); }
  :root[data-theme="auto"] .tabs a.active, :root[data-theme="auto"] .trial-pill { color: color-mix(in srgb, var(--primary) 55%, #ffffff); }
}

/* ---------- Theme & language controls ---------- */
.prefs { display: flex; align-items: center; gap: 8px; }
.lang-switch { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); margin: 0; }
.lang-switch button { border: 0; background: none; font: inherit; font-weight: 700; font-size: 12px; color: var(--text-2); padding: 6px 9px; border-radius: 9px; cursor: pointer; line-height: 1.2; }
.lang-switch button[lang="ur"] { font-family: 'Noto Nastaliq Urdu', var(--font); font-size: 12.5px; line-height: 1.1; padding-top: 3px; padding-bottom: 7px; }
.lang-switch button.on { background: rgba(var(--primary-rgb), .12); color: var(--link, var(--primary)); }
.lang-switch button:hover:not(.on) { color: var(--text); }
.theme-menu { position: relative; }
.theme-dd { min-width: 180px; }
.theme-dd form { margin: 0; }
.theme-dd button.on { color: var(--link, var(--primary)); background: rgba(var(--primary-rgb), .08); }
.auth-prefs { position: absolute; top: 18px; right: 22px; z-index: 5; }
.auth-form { position: relative; }
.auth-simple { position: relative; }
.security-banner { display: flex; align-items: center; gap: 10px; }
.security-banner [data-lucide] { width: 16px; height: 16px; }
.security-banner a { font-weight: 700; margin-left: auto; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .topbar { gap: 8px; }
  .lang-switch button { padding: 5px 7px; }
}
@media (max-width: 420px) { .topbar .prefs .theme-menu { display: none; } }

/* ===========================================================================
   Urdu / right-to-left
   =========================================================================== */
html[lang="ur"] body { font-family: 'Plus Jakarta Sans', 'Noto Nastaliq Urdu', system-ui, sans-serif; line-height: 1.85; }
html[lang="ur"] h1, html[lang="ur"] h2, html[lang="ur"] h3, html[lang="ur"] h4 { line-height: 1.7; letter-spacing: 0; }
html[lang="ur"] .nav-label, html[lang="ur"] .table th { text-transform: none; letter-spacing: 0; }
html[lang="ur"] .nav a { padding-top: 5px; padding-bottom: 5px; }
html[lang="ur"] .kpi-value, html[lang="ur"] .num, html[lang="ur"] code, html[lang="ur"] .mono { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
html[lang="ur"] .btn, html[lang="ur"] .badge { line-height: 1.6; padding-top: 6px; padding-bottom: 8px; }
html[lang="ur"] .btn-sm { padding-top: 3px; padding-bottom: 5px; }
html[lang="ur"] .user-menu .meta { line-height: 1.5; }
html[lang="ur"] .demo-text, html[lang="ur"] .sidebar-user-meta, html[lang="ur"] .plan-chip { line-height: 1.7; }
html[lang="ur"] .kpi-label, html[lang="ur"] .kpi-sub { line-height: 1.8; }
html[lang="ur"] input, html[lang="ur"] select, html[lang="ur"] textarea { line-height: 1.6; }

[dir="rtl"] .sidebar { inset: 0 0 0 auto; border-right: 0; border-left: 1px solid var(--border); }
[dir="rtl"] .main { margin-left: 0; margin-right: var(--sidebar-w); }
[dir="rtl"] .nav a .count, [dir="rtl"] .acting-banner form, [dir="rtl"] .form-section-title small, [dir="rtl"] .security-banner a { margin-left: 0; margin-right: auto; }
[dir="rtl"] .topbar .search input { padding-left: 13px; padding-right: 38px; }
[dir="rtl"] .topbar .search [data-lucide] { left: auto; right: 12px; }
[dir="rtl"] .icon-btn .dot { right: auto; left: -4px; }
[dir="rtl"] .user-menu { padding: 5px 5px 5px 12px; }
[dir="rtl"] .dropdown { right: auto; left: 0; }
[dir="rtl"] .dropdown a, [dir="rtl"] .dropdown button { text-align: right; }
[dir="rtl"] .table th { text-align: right; }
[dir="rtl"] .table .num, [dir="rtl"] .right { text-align: left; }
[dir="rtl"] .kpi::after { right: auto; left: -50px; }
[dir="rtl"] .kpi .spark { right: auto; left: 14px; }
[dir="rtl"] .toast-wrap { right: auto; left: 20px; }
[dir="rtl"] .password-wrap button, [dir="rtl"] .input-icon .password-toggle { right: auto; left: 8px; }
[dir="rtl"] .input-icon > svg, [dir="rtl"] .input-icon > i { left: auto; right: 13px; }
[dir="rtl"] .input-icon input { padding-left: 13px; padding-right: 40px; }
[dir="rtl"] .input-icon .match-mark { right: auto; left: 12px; }
[dir="rtl"] .input-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
[dir="rtl"] .input-group .btn { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
[dir="rtl"] .switch input::after { left: auto; right: 3px; }
[dir="rtl"] .switch input:checked::after { transform: translateX(-18px); }
[dir="rtl"] .reg-steps li:not(:last-child)::before { left: auto; right: 17px; }
[dir="rtl"] .plan-option .popular { left: auto; right: 12px; }
[dir="rtl"] .pagination .info { margin-right: 0; margin-left: auto; }
[dir="rtl"] .demo-login, [dir="rtl"] .alerts-panel .alert-row { text-align: right; }
[dir="rtl"] .demo-login:hover .demo-go { transform: scaleX(-1) translateX(2px); }
[dir="rtl"] .auth-prefs { right: auto; left: 22px; }
[dir="rtl"] .auth-visual { background: radial-gradient(1200px 600px at 110% -10%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(215deg, var(--primary) 0%, #312e81 55%, #0f172a 100%); }
[dir="rtl"] .auth-visual.has-image { background-size: cover; background-position: center; }
/* Directional icons point the other way */
[dir="rtl"] [data-lucide="arrow-right"], [dir="rtl"] [data-lucide="arrow-left"], [dir="rtl"] [data-lucide="chevron-right"], [dir="rtl"] [data-lucide="chevron-left"],
[dir="rtl"] [data-lucide="chevrons-right"], [dir="rtl"] [data-lucide="chevrons-left"], [dir="rtl"] [data-lucide="log-out"], [dir="rtl"] [data-lucide="log-in"],
[dir="rtl"] [data-lucide="external-link"], [dir="rtl"] [data-lucide="undo-2"], [dir="rtl"] [data-lucide="redo-2"], [dir="rtl"] [data-lucide="send"],
[dir="rtl"] .lucide-arrow-right, [dir="rtl"] .lucide-arrow-left, [dir="rtl"] .lucide-chevron-right, [dir="rtl"] .lucide-chevron-left,
[dir="rtl"] .lucide-log-out, [dir="rtl"] .lucide-log-in, [dir="rtl"] .lucide-external-link, [dir="rtl"] .lucide-send { transform: scaleX(-1); }
[dir="rtl"] .demo-go.lucide-arrow-right { transform: scaleX(-1); }
@media (max-width: 992px) {
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] body.nav-open .sidebar { transform: none; }
  [dir="rtl"] .main { margin-right: 0; }
}
@media print { [dir="rtl"] .main { margin: 0 !important; } }
:root[data-theme="dark"] .status-hero.granted { background: linear-gradient(160deg, rgba(16, 185, 129, .16), rgba(16, 185, 129, .08)); border-color: rgba(16, 185, 129, .4); color: #a7f3d0; }
:root[data-theme="dark"] .status-hero.warning { background: linear-gradient(160deg, rgba(245, 158, 11, .16), rgba(245, 158, 11, .08)); border-color: rgba(245, 158, 11, .4); color: #fde68a; }
:root[data-theme="dark"] .status-hero.denied { background: linear-gradient(160deg, rgba(239, 68, 68, .18), rgba(239, 68, 68, .08)); border-color: rgba(239, 68, 68, .45); color: #fecaca; }
:root[data-theme="dark"] .status-hero .sh-icon { background: rgba(255, 255, 255, .08); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .status-hero.granted { background: linear-gradient(160deg, rgba(16, 185, 129, .16), rgba(16, 185, 129, .08)); border-color: rgba(16, 185, 129, .4); color: #a7f3d0; }
  :root[data-theme="auto"] .status-hero.warning { background: linear-gradient(160deg, rgba(245, 158, 11, .16), rgba(245, 158, 11, .08)); border-color: rgba(245, 158, 11, .4); color: #fde68a; }
  :root[data-theme="auto"] .status-hero.denied { background: linear-gradient(160deg, rgba(239, 68, 68, .18), rgba(239, 68, 68, .08)); border-color: rgba(239, 68, 68, .45); color: #fecaca; }
  :root[data-theme="auto"] .status-hero .sh-icon { background: rgba(255, 255, 255, .08); }
}
/* Receipts, payslips and ID cards always print on white */
@media print {
  :root[data-theme] { --bg: #fff; --surface: #fff; --surface-2: #f8f9fd; --border: #e8ebf3; --text: #1e2235; --text-2: #5b6178; --muted: #8a90a6; --track: #eef0f5; --link: var(--primary); color-scheme: light; }
}
[dir="rtl"] .demo-text small { direction: ltr; text-align: right; }
@media (max-width: 992px) {
  .auth-form { flex-direction: column; justify-content: flex-start; }
  .auth-prefs { position: static; align-self: flex-end; margin-bottom: 14px; }
  [dir="rtl"] .auth-prefs { align-self: flex-start; }
  .auth-simple .auth-prefs { position: absolute; }
}

/* ---------- Branch switcher (topbar) ---------- */
.branch-switch { position: relative; }
.branch-switch > svg, .branch-switch > i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--primary); pointer-events: none; }
.branch-switch select { padding: 8px 12px 8px 34px; border-radius: 12px; font-weight: 700; font-size: 13px; max-width: 200px; }
.branch-pill { padding: 7px 12px; }
.branch-pill svg { width: 14px; height: 14px; }
[dir="rtl"] .branch-switch > svg, [dir="rtl"] .branch-switch > i { left: auto; right: 11px; }
[dir="rtl"] .branch-switch select { padding: 8px 34px 8px 12px; }
@media (max-width: 640px) { .branch-switch select { max-width: 130px; } }

/* ---------- Phone-width safety net (found in click-testing) ---------- */
input[type=file] { max-width: 100%; }
.flex > *, .list li > * { min-width: 0; }
.mono, code { overflow-wrap: anywhere; }
@media (max-width: 992px) {
  /* inline multi-column layouts (style="grid-template-columns:…") stack like .grid-2/.grid-3 do */
  .grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 640px) {
  .page-head .actions .btn { white-space: normal; text-align: center; }
  .list li { flex-wrap: wrap; }
}
