/* ==========================================================
   LeadDesk — modern responsive UI
   ========================================================== */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e6e8f0;
  --text: #171a2c;
  --text-2: #5b6178;
  --muted: #8a90a6;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --success: #10b981;
  --success-soft: #e7f8f1;
  --warning: #f59e0b;
  --warning-soft: #fff6e5;
  --danger: #ef4444;
  --danger-soft: #fdecec;
  --info: #0ea5e9;
  --info-soft: #e6f6fd;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --shadow-lg: 0 10px 40px rgba(16, 24, 40, .16);
  --sidebar: 264px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Hind Siliguri', sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0d0f1a;
  --surface: #151829;
  --surface-2: #1b1f34;
  --border: #262b45;
  --text: #e9ebf5;
  --text-2: #b2b7cc;
  --muted: #7c829c;
  --primary: #7c74ff;
  --primary-2: #8b85ff;
  --primary-soft: #232552;
  --success-soft: #0f2e27;
  --warning-soft: #33280f;
  --danger-soft: #3a1a1e;
  --info-soft: #0f2a39;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 650; display: flex; align-items: center; gap: 8px; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
p { margin: 0; }
code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .86em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); }
.ico { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 18px; }
.mt-sm { margin-top: 8px; }
.mt-lg { margin-top: 32px; }
.m { margin: 16px; }
.pad { padding: 16px 20px; }
.text-danger { color: var(--danger) !important; }
.text-primary { color: var(--primary) !important; }
.plain { margin: 0; padding-left: 18px; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.inline { display: inline; }
.left { text-align: left; }

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease;
}
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.content { padding: 24px 28px 40px; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }
.app-foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 18px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; color: var(--text); text-decoration: none !important; }
.brand-logo { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6 60%, #ec4899); box-shadow: 0 6px 18px rgba(99, 102, 241, .35); flex-shrink: 0; }
.brand-logo .ico { width: 20px; height: 20px; }
.brand-logo.lg { width: 56px; height: 56px; border-radius: 16px; }
.brand-logo.lg .ico { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: .74rem; }

.nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--text-2); font-weight: 500; text-decoration: none !important; margin-bottom: 2px; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link span { flex: 1; }
.nav-badge { flex: 0 !important; background: var(--warning); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; display: grid; gap: 8px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.me-card:hover { background: var(--surface-2); }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text strong, .me-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: .74rem; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); min-height: 62px; }
.topbar-title { font-size: 1.05rem; font-weight: 650; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.sidebar-backdrop { display: none; }
.only-mobile, .only-mobile-inline { display: none !important; }

/* ---------------- Components ---------------- */
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #a5b4fc, #c4b5fd); color: #312e81; font-weight: 700; font-size: .8rem; flex-shrink: 0; text-decoration: none !important; }
.avatar-sm { width: 32px; height: 32px; font-size: .74rem; }
.avatar-xs { width: 26px; height: 26px; font-size: .66rem; }
.avatar-lg { width: 60px; height: 60px; font-size: 1.15rem; }
.user-cell { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.user-cell.big { gap: 16px; }
a.user-cell:hover strong, a.user-cell:hover { color: var(--primary); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn-primary:hover { background: var(--primary-2); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.06); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); }
.btn-sm { height: 32px; padding: 0 11px; font-size: .8rem; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: .95rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; text-decoration: none !important; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn .ico { width: 17px; height: 17px; }
[data-theme="dark"] .when-light, :root:not([data-theme="dark"]) .when-dark { display: none; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card.flush .card-head { margin-bottom: 0; border-bottom: 1px solid var(--border); }
.card-warn { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); background: linear-gradient(0deg, var(--surface), var(--warning-soft)); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; margin: 22px 0 10px; }
.section-title.nomargin { margin: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.stack { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 6px; }
.narrow { max-width: 720px; margin: 0 auto; }
.narrow-lg { max-width: 960px; margin: 0 auto; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); min-width: 0; }
.stat > div:last-child { min-width: 0; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon .ico { width: 21px; height: 21px; }
.c-indigo { background: #eef0ff; color: #4f46e5; } .c-green { background: #e7f8f1; color: #059669; } .c-blue { background: #e6f2fe; color: #2563eb; }
.c-amber { background: #fff4e0; color: #d97706; } .c-pink { background: #fdecf5; color: #db2777; }
[data-theme="dark"] .c-indigo { background: #252a5c; color: #a5b4fc; } [data-theme="dark"] .c-green { background: #0f3329; color: #6ee7b7; }
[data-theme="dark"] .c-blue { background: #132c4e; color: #93c5fd; } [data-theme="dark"] .c-amber { background: #3a2a0c; color: #fcd34d; } [data-theme="dark"] .c-pink { background: #3d1530; color: #f9a8d4; }
.stat-label { color: var(--muted); font-size: .78rem; font-weight: 550; }
.stat-value { font-size: 1.42rem; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.delta { font-weight: 700; } .delta.up { color: var(--success); } .delta.down { color: var(--danger); }

/* forms */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--text-2); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  height: 40px; padding: 0 12px; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
select[multiple] { height: auto; padding: 6px; }
input[type="color"] { padding: 4px; cursor: pointer; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
input[readonly] { background: var(--surface-2); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input { background: var(--surface-2); color: var(--text-2); }
.input-sm { height: 34px; max-width: 140px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
.input-group { display: flex; }
.input-group input { border-radius: 10px 0 0 10px; }
.input-addon { border: 1px solid var(--border); border-left: 0; border-radius: 0 10px 10px 0; background: var(--surface-2); color: var(--text-2); padding: 0 14px; font: inherit; font-size: .82rem; cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.form-actions .muted { margin-right: auto; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.w-xs { width: 80px; } .w-sm { width: 130px; } .w-md { max-width: 320px; }
.file-input { height: auto; padding: 10px; border-style: dashed; cursor: pointer; }
.copy-field { display: flex; gap: 6px; align-items: center; min-width: 220px; }
.copy-field input { height: 34px; font-size: .8rem; font-family: ui-monospace, Consolas, monospace; }
.hint-box { height: 40px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 10px; background: var(--primary-soft); color: var(--text-2); font-size: .85rem; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px; }
.filters .field { flex: 1 1 150px; }
.range-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.range-filter select, .range-filter input { height: 38px; width: auto; }
.month-nav { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 2px; }
.month-nav input { border: 0; height: 32px; width: 150px; background: transparent; box-shadow: none !important; }

/* entry rows */
.rows { display: grid; gap: 12px; }
.row-item { display: flex; gap: 12px; align-items: flex-end; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); position: relative; flex-wrap: wrap; }
.row-item .field { flex: 1 1 160px; }
.row-item .field.w-sm { flex: 0 1 130px; }
.row-item .field.grow { flex: 2 1 200px; }
.row-x { margin-bottom: 3px; }
.rate-tag { font-size: .72rem; color: var(--muted); min-height: 1em; }
.step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: .78rem; font-weight: 700; }
.section-hint { margin: -6px 0 12px; }
.rows-total {margin-top: 12px; text-align: right; color: var(--text-2); font-size: .88rem; }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); padding: 14px 0; margin-top: 12px; z-index: 5; }

/* tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 11px 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 tbody tr:last-child td { border-bottom: 0; }
.table tfoot th { background: var(--surface-2); color: var(--text); font-size: .85rem; text-transform: none; letter-spacing: 0; border-top: 1px solid var(--border); border-bottom: 0; }
.table-hover tbody tr:hover { background: var(--surface-2); }
.table-compact td, .table-compact th { padding: 9px 14px; }
.table .r { text-align: right; }
.card:not(.flush) .table th:first-child, .card:not(.flush) .table td:first-child { padding-left: 4px; }
.row-muted { opacity: .55; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }

.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 650; text-transform: capitalize; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge-active, .badge-paid { background: var(--success-soft); color: #059669; border-color: transparent; }
.badge-pending, .badge-draft { background: var(--warning-soft); color: #b45309; border-color: transparent; }
.badge-suspended, .badge-rejected { background: var(--danger-soft); color: #dc2626; border-color: transparent; }
.badge-finalized { background: var(--info-soft); color: #0284c7; border-color: transparent; }
.badge-admin { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
[data-theme="dark"] .badge-active, [data-theme="dark"] .badge-paid { color: #6ee7b7; }
[data-theme="dark"] .badge-pending, [data-theme="dark"] .badge-draft { color: #fcd34d; }
[data-theme="dark"] .badge-suspended, [data-theme="dark"] .badge-rejected { color: #fca5a5; }
[data-theme="dark"] .badge-finalized { color: #7dd3fc; }
.chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: .74rem; font-weight: 650; border: 1px solid var(--border); text-decoration: none !important; }
.chip-warn { background: var(--warning); color: #fff; border-color: transparent; }

.alert { position: relative; padding: 12px 40px 12px 16px; border-radius: 12px; margin-bottom: 14px; border: 1px solid transparent; font-size: .9rem; }
.alert > .ico { margin-right: 6px; vertical-align: -4px; }
.alert.row-between { display: flex; }
.alert-success { background: var(--success-soft); color: #047857; } [data-theme="dark"] .alert-success { color: #6ee7b7; }
.alert-danger { background: var(--danger-soft); color: #b91c1c; } [data-theme="dark"] .alert-danger { color: #fca5a5; }
.alert-warning { background: var(--warning-soft); color: #92400e; } [data-theme="dark"] .alert-warning { color: #fcd34d; }
.alert-info { background: var(--info-soft); color: #0369a1; } [data-theme="dark"] .alert-info { color: #7dd3fc; }
.alert-x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: inherit; font-size: 1.3rem; cursor: pointer; opacity: .6; line-height: 1; padding: 4px 8px; }
.alert-x:hover { opacity: 1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--text-2); font-weight: 600; font-size: .88rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .ico { width: 16px; height: 16px; }

.empty { text-align: center; padding: 38px 20px; color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.empty .ico { width: 36px; height: 36px; opacity: .55; }
.empty.small { padding: 22px 10px; }
.empty.small .ico { width: 26px; height: 26px; }

.chart-box { position: relative; height: 290px; }
.chart-sm { height: 210px; }
.mini-list { display: grid; gap: 6px; margin-top: 14px; font-size: .86rem; }
.mini-list > div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); }

.progress-row { display: grid; gap: 6px; }
.progress-label { display: flex; justify-content: space-between; font-size: .84rem; color: var(--text-2); }
.progress { height: 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6366f1, #8b5cf6); transition: width .6s ease; }
.progress-bar.done { background: linear-gradient(90deg, #10b981, #34d399); }
.rank-box { display: flex; gap: 12px; align-items: center; margin-top: 20px; padding: 14px; border-radius: 12px; background: var(--primary-soft); }
.rank-box > .ico { width: 30px; height: 30px; color: var(--primary); }
.rank-num { font-size: 1.5rem; }

.leaderboard { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.leaderboard li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.leaderboard li.me { background: var(--primary-soft); }
.lb-rank { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.lb-rank.r1 { background: #fde68a; color: #92400e; } .lb-rank.r2 { background: #e5e7eb; color: #374151; } .lb-rank.r3 { background: #fed7aa; color: #9a3412; }
.lb-name { flex: 1; font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-val { font-weight: 700; }

.announce { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; margin-bottom: 10px; background: linear-gradient(90deg, var(--primary-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); }
.announce > .ico { color: var(--primary); margin-top: 2px; }
.announce p { margin: 3px 0; color: var(--text-2); }
.announce-admin { display: flex; gap: 14px; align-items: flex-start; }
.announce-admin.inactive, .source-card.inactive { opacity: .6; }

.pending-list { display: grid; gap: 8px; }
.pending-item { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 5px 11px; border-radius: 999px; background: var(--warning-soft); color: #92400e; font-size: .8rem; font-weight: 600; }
[data-theme="dark"] .tag { color: #fcd34d; }
.share { display: flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 120px; }
.share-bar { height: 6px; border-radius: 99px; background: var(--primary); max-width: 70px; }
.share span { font-size: .78rem; color: var(--muted); width: 44px; text-align: right; }

/* sources */
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.source-top { display: flex; gap: 12px; align-items: center; }
.source-swatch { width: 14px; height: 40px; border-radius: 6px; flex-shrink: 0; }
.source-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 16px 0 12px; }
.source-stats > div { display: grid; gap: 2px; }
.source-stats small { color: var(--muted); font-size: .7rem; }
.source-stats strong { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-edit summary { cursor: pointer; color: var(--text-2); font-size: .84rem; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; list-style: none; }
.source-edit summary::-webkit-details-marker { display: none; }
.source-edit[open] summary { margin-bottom: 12px; }

/* payroll */
.payroll-list { display: grid; gap: 14px; }
.pr-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pr-head .user-cell { flex: 1 1 200px; }
.pr-perf { display: flex; gap: 6px; flex-wrap: wrap; }
.pr-perf span { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px 9px; font-size: .78rem; font-weight: 600; color: var(--text-2); }
.pr-total { text-align: right; display: grid; }
.pr-total strong { font-size: 1.3rem; color: var(--primary); }
.pr-form { margin-top: 14px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.pr-form fieldset { display: flex; gap: 12px; flex-wrap: wrap; flex: 1; }
.pr-form .field { flex: 1 1 110px; }
.pr-form .field.grow { flex: 2 1 180px; }
.pr-actions { display: flex; gap: 8px; }
.pr-status { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
select.multi { min-height: 92px; }

/* slips */
.slip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.slip-card { color: var(--text); text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
.slip-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.slip-top { display: flex; justify-content: space-between; align-items: center; }
.slip-amount { font-size: 1.7rem; font-weight: 800; margin: 12px 0; color: var(--primary); }
.slip-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.payslip { max-width: 760px; margin: 0 auto; padding: 32px; }
.ps-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 18px; border-bottom: 2px solid var(--border); }
.ps-head h2 { margin-top: 10px; }
.ps-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.ps-info > div { display: grid; gap: 2px; }
.ps-perf { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ps-perf > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: grid; gap: 2px; }
.ps-perf small { color: var(--muted); font-size: .74rem; }
.ps-table td:first-child, .ps-table th:first-child { padding-left: 0 !important; }
.ps-table td:last-child, .ps-table th:last-child { padding-right: 0; }
.ps-total { font-size: 1.35rem; color: var(--primary); }
.profile-head { display: flex; gap: 18px; align-items: center; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.kv span { color: var(--text-2); }
.steps { margin: 0; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; font-size: .9rem; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

/* modal */
.modal { border: 0; border-radius: 18px; padding: 24px; width: min(640px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(10, 12, 25, .55); backdrop-filter: blur(3px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }

/* auth */
.auth-shell { min-height: 100vh; }
.auth-grid { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at -10% -10%, #8b5cf6 0%, transparent 55%), radial-gradient(900px 500px at 110% 110%, #ec4899 0%, transparent 50%), linear-gradient(135deg, #312e81, #4f46e5); color: #fff; display: flex; align-items: center; padding: 48px; }
.auth-hero::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); }
.auth-hero-inner { position: relative; z-index: 1; max-width: 460px; margin: 0 auto; display: grid; gap: 18px; }
.auth-hero h2 { font-size: 2.1rem; font-weight: 800; }
.auth-hero p { font-size: 1.05rem; opacity: .9; line-height: 1.6; }
.auth-hero .brand-logo { background: rgba(255, 255, 255, .16); box-shadow: none; border: 1px solid rgba(255, 255, 255, .25); }
.auth-points { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 10px; }
.auth-points li { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.auth-points .ico { background: rgba(255, 255, 255, .18); border-radius: 50%; padding: 4px; width: 24px; height: 24px; }
.auth-card-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 34px; box-shadow: var(--shadow); }
.auth-head { margin-bottom: 22px; display: grid; gap: 6px; }
.auth-head h1 { font-size: 1.6rem; font-weight: 750; }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.message-card { text-align: center; display: grid; gap: 14px; justify-items: center; }
.msg-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; }
.msg-icon .ico { width: 30px; height: 30px; }
.msg-success { background: var(--success-soft); color: var(--success); }
.msg-danger { background: var(--danger-soft); color: var(--danger); }
.msg-info { background: var(--info-soft); color: var(--info); }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--primary-soft); border-top-color: var(--primary); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Responsive ---------------- */
@media (max-width: 1280px) {
  .stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 12, 25, .45); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-grid !important; }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 32px; }
}
@media (max-width: 860px) {
  .auth-grid { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .only-mobile-inline { display: inline-grid !important; margin-bottom: 8px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-info { grid-template-columns: 1fr; }
  .ps-perf { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  body { font-size: 14px; }
  .stats, .stats-5 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-icon { display: none; }
  .stat-value { font-size: 1.12rem; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; border-radius: 12px; }
  .page-head { align-items: stretch; }
  .page-head .actions { width: 100%; }
  .page-head .actions > .btn { flex: 1; }
  .hide-xs { display: none !important; }
  .row-item { padding: 12px; }
  .row-item .field, .row-item .field.w-sm, .row-item .field.grow { flex: 1 1 100%; }
  .row-item .row-x { position: absolute; top: 6px; right: 6px; }
  .row-item .field:first-child { padding-right: 36px; }
  .range-filter { width: 100%; }
  .range-filter select, .range-filter input { flex: 1 1 120px; }
  .page-head .actions .month-nav { flex: 1 1 100%; }
  .month-nav input { width: auto; flex: 1; text-align: center; }
  .auth-card { padding: 24px; border-radius: 16px; }
  .payslip { padding: 18px; }
  .source-stats { grid-template-columns: repeat(3, 1fr); }
  .pr-total { text-align: left; }
  .form-actions .btn { flex: 1; }
  .topbar-title { font-size: .98rem; }
}

/* ---------------- Print ---------------- */
@media print {
  .sidebar, .topbar, .no-print, .app-foot, .alert-x, .sidebar-backdrop { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
  .chart-box { height: 220px; }
}

/* ---------- Roles, dollar desk ---------- */
.text-warning { color: #d97706 !important; }
.mb { margin-bottom: 14px; }
.chip-on { background: var(--primary); color: #fff; border-color: transparent; }
.badge-role-admin { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge-role-manager { background: var(--info-soft); color: #0284c7; border-color: transparent; }
.badge-role-supporter { background: var(--success-soft); color: #059669; border-color: transparent; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; }
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.done-form { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.done-form select, .bulk-bar select { height: 32px; padding: 0 6px; max-width: 190px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .82rem; }
.done-form input { height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .82rem; }
.done-form input[type="number"] { width: 86px; }
.done-form input[type="date"] { width: 132px; }
.dollar-strip { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; text-decoration: none !important; color: var(--text); }
.dollar-strip .ico { width: 17px; height: 17px; vertical-align: -3px; }
.dollar-strip:hover { border-color: var(--primary); }
[hidden] { display: none !important; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 12px 16px; }
.bulk-bar input[type="number"], .bulk-bar input[type="date"] { height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .85rem; }
.bulk-bar input[type="number"] { width: 210px; }
