/* mPokket dashboard. Tokens, cards, badges and table follow the SIDBI collections dashboard. */
:root {
  --bg-base: #f1f5f9; --bg-card: #ffffff; --bg-card-hover: #f8fafc;
  --sidebar-bg: #1e293b; --sidebar-hover: rgba(255, 255, 255, 0.06); --sidebar-border: rgba(255, 255, 255, 0.08);
  --border: #e2e8f0; --border-strong: #cbd5e1;
  --accent-indigo: #6366f1; --accent-indigo-light: #ede9fe;
  --accent-green: #16a34a; --accent-green-light: #dcfce7;
  --accent-amber: #d97706; --accent-amber-light: #fef3c7;
  --accent-red: #dc2626; --accent-red-light: #fee2e2;
  --accent-blue: #0284c7; --accent-blue-light: #e0f2fe;
  --accent-purple: #7c3aed; --accent-purple-light: #ede9fe;
  --text-primary: #0f172a; --text-secondary: #475569; --text-muted: #94a3b8;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px;
  --sidebar-width: 228px; --detail-width: 400px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --fast: 0.15s ease;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg-base); color: var(--text-primary); -webkit-font-smoothing: antialiased; }
.is-hidden { display: none !important; }
.muted { color: var(--text-muted); }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; }
.material-icons-round { font-size: 18px; line-height: 1; }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; transition: all var(--fast); }
.btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn .material-icons-round { font-size: 16px; }
.btn-primary { background: var(--accent-indigo); border-color: var(--accent-indigo); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
.btn-primary:hover { background: #4f46e5; color: #fff; }
.btn-small { padding: 4px 9px; font-size: 11.5px; }
.btn-small .material-icons-round { font-size: 14px; }
.input { font: inherit; font-size: 12.5px; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-primary); }
.input:focus { outline: none; border-color: var(--accent-indigo); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 50% -10%, #334155 0%, var(--sidebar-bg) 60%); }
.login-card { width: 380px; background: var(--bg-card); border-radius: var(--radius-lg); padding: 34px 32px 30px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.login-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent-indigo); }
.login-logo { height: 22px; display: block; margin-bottom: 14px; }
.login-card h1 { font-family: 'Outfit', sans-serif; font-size: 1.45rem; font-weight: 700; }
.login-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 0.07em; text-transform: uppercase; margin: 3px 0 18px; }
.login-card label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 14px 0 5px; }
.login-card .input { width: 100%; padding: 10px 12px; font-size: 13.5px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 22px; padding: 11px; font-size: 13.5px; }
.login-error { margin-top: 14px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--accent-red-light); color: var(--accent-red); font-size: 12.5px; border: 1px solid rgba(220,38,38,0.2); }

/* Shell */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); flex: none; background: var(--sidebar-bg); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 18px 16px 14px; border-bottom: 1px solid var(--sidebar-border); }
.brand-logo { height: 18px; filter: brightness(0) invert(1); display: block; }
.brand-sub { margin-top: 6px; font-size: 10px; color: rgba(255,255,255,0.4); letter-spacing: 0.07em; text-transform: uppercase; }
.nav { padding: 6px 8px; flex: 1; }
.nav-section-label { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.3); letter-spacing: 0.09em; text-transform: uppercase; padding: 12px 10px 5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: rgba(255,255,255,0.55); font-size: 13px; font-weight: 500; border: 1px solid transparent; }
.nav-item.active { background: rgba(99,102,241,0.2); color: #a5b4fc; border-color: rgba(99,102,241,0.3); }
.nav-icon { font-size: 17px; }
.sidebar-foot { padding: 14px 12px 16px; border-top: 1px solid var(--sidebar-border); }
.env-badge { display: inline-flex; align-items: center; gap: 5px; background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: #86efac; padding: 4px 8px; border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.env-badge .material-icons-round { font-size: 11px; }
.env-badge.uat { background: rgba(217,119,6,0.18); border-color: rgba(217,119,6,0.4); color: #fcd34d; }
.env-project { margin-top: 6px; font-size: 10.5px; color: rgba(255,255,255,0.3); }
.user-email { margin-top: 10px; font-size: 11px; color: rgba(255,255,255,0.5); word-break: break-all; }
.btn-logout { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px; padding: 9px 12px; font: inherit; font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.75); background: transparent; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; cursor: pointer; transition: all var(--fast); }
.btn-logout:hover { background: var(--sidebar-hover); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; transition: margin-right var(--fast); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 24px; background: #fff; border-bottom: 1px solid var(--border); }
.topbar-title { font-family: 'Outfit', sans-serif; font-size: 17px; font-weight: 700; }
.topbar-subtitle { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.last-updated { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.search-box { display: flex; align-items: center; gap: 4px; width: 260px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 99px; background: #f8fafc; transition: all var(--fast); }
.search-box:focus-within { border-color: var(--accent-indigo); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); background: #fff; }
.search-box .material-icons-round { color: var(--text-muted); }
.search-box input { border: none; outline: none; background: transparent; font: inherit; font-size: 12.5px; color: var(--text-primary); flex: 1; min-width: 0; padding: 2px 4px; }
.search-box input::placeholder { color: var(--text-muted); }
.page { padding: 22px 24px 40px; }

/* Banners */
.banner, .notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 12.5px; }
.banner { background: var(--accent-red-light); color: var(--accent-red); border: 1px solid rgba(220,38,38,0.2); }
.notice { background: var(--accent-amber-light); color: var(--accent-amber); border: 1px solid rgba(217,119,6,0.2); }

/* Count cards */
.kpi-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi-card { position: relative; overflow: hidden; text-align: left; font: inherit; color: inherit; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 18px 16px; box-shadow: var(--shadow-sm); cursor: pointer; transition: all 0.25s ease; --kpi-accent: var(--accent-indigo); }
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--kpi-accent); }
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-card.selected { border-color: var(--kpi-accent); box-shadow: 0 0 0 2px var(--kpi-accent); }
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 32px; }
.kpi-value { font-family: 'Outfit', sans-serif; font-size: 28px; font-weight: 700; color: var(--kpi-accent); line-height: 1; margin-bottom: 5px; }
.kpi-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-icon { position: absolute; top: 14px; right: 14px; font-size: 26px; opacity: 0.12; color: var(--kpi-accent); }
.kpi-indigo { --kpi-accent: var(--accent-indigo); }
.kpi-blue { --kpi-accent: var(--accent-blue); }
.kpi-purple { --kpi-accent: var(--accent-purple); }
.kpi-amber { --kpi-accent: var(--accent-amber); }
.kpi-green { --kpi-accent: var(--accent-green); }

/* DeDupe breakdown chips */
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.chip-row-label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); margin-right: 2px; }
.chip { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 12px; font-weight: 500; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border); border-radius: 99px; padding: 4px 6px 4px 11px; cursor: pointer; transition: all var(--fast); }
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip-count { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 12px; min-width: 22px; text-align: center; padding: 1px 6px; border-radius: 99px; background: #f1f5f9; color: var(--text-secondary); }
.chip.selected { background: var(--accent-indigo); border-color: var(--accent-indigo); color: #fff; }
.chip.selected .chip-count { background: rgba(255,255,255,0.22); color: #fff; }
.chip.zero { opacity: 0.55; }

/* Merchants tab */
.nav-item[data-view] { cursor: pointer; transition: all var(--fast); margin-bottom: 1px; }
.nav-item[data-view]:hover { background: var(--sidebar-hover); color: rgba(255,255,255,0.85); }
.nav-item.active[data-view]:hover { background: rgba(99,102,241,0.2); color: #a5b4fc; }
.run-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; }
.run-line .material-icons-round { font-size: 16px; color: var(--text-muted); }
.run-line.on { border-color: rgba(22,163,74,0.3); background: var(--accent-green-light); color: var(--accent-green); }
.run-line.on .material-icons-round { color: var(--accent-green); }
.kpi-card.kpi-red { --kpi-accent: var(--accent-red); }
.kpi-card.kpi-grey { --kpi-accent: #64748b; }
.cell-reason { white-space: normal; max-width: 340px; font-size: 12px; color: var(--text-secondary); }

/* Table card */
.table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table-title { display: flex; align-items: center; gap: 8px; font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 700; }
.table-title .material-icons-round { font-size: 17px; color: var(--accent-indigo); }
.table-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-tools label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.table-count { font-size: 11px; color: var(--text-muted); margin-left: 6px; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); padding: 10px 16px; text-align: left; background: #f8fafc; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody tr { border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background var(--fast); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr.open { background: #f5f3ff; }
.data-table td { padding: 11px 16px; font-size: 13px; vertical-align: middle; white-space: nowrap; }
.data-table .num { text-align: right; }
.data-table td.num { font-family: 'Outfit', sans-serif; font-weight: 600; }
.col-sno { width: 44px; text-align: right; font-size: 11px; color: var(--text-muted); }
.data-table tr.accent-red td:first-child { box-shadow: inset 3px 0 0 var(--accent-red); }
.data-table tr.accent-amber td:first-child { box-shadow: inset 3px 0 0 var(--accent-amber); }
/* Names arrive in whatever case the borrower typed; show them all in capitals. */
.borrower-name { font-weight: 600; font-size: 12.5px; letter-spacing: 0.01em; text-transform: uppercase; }
.borrower-mobile { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.cell-strong { font-weight: 500; }
.cell-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.row-chevron { color: var(--text-muted); font-size: 18px; vertical-align: middle; }
.row-error { color: var(--accent-red); font-size: 11.5px; white-space: normal; max-width: 240px; margin-top: 5px; }
.skeleton td { color: transparent; }
.skeleton td::after { content: ''; display: block; height: 12px; border-radius: 4px; background: var(--border); }
.empty { padding: 44px 20px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.empty h2 { font-family: 'Outfit', sans-serif; margin-bottom: 8px; color: var(--text-primary); }
.empty .btn { margin-top: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 0.9s linear infinite; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; margin-right: 4px; }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.badge-green { background: var(--accent-green-light); color: var(--accent-green); border: 1px solid rgba(22,163,74,0.2); }
.badge-red { background: var(--accent-red-light); color: var(--accent-red); border: 1px solid rgba(220,38,38,0.2); }
.badge-amber { background: var(--accent-amber-light); color: var(--accent-amber); border: 1px solid rgba(217,119,6,0.2); }
.badge-blue { background: var(--accent-blue-light); color: var(--accent-blue); border: 1px solid rgba(2,132,199,0.2); }
.badge-indigo { background: var(--accent-indigo-light); color: var(--accent-indigo); border: 1px solid rgba(99,102,241,0.2); }
.badge-purple { background: var(--accent-purple-light); color: var(--accent-purple); border: 1px solid rgba(124,58,237,0.2); }
.badge-grey { background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border); }

/* Detail panel */
.detail { position: fixed; top: 0; right: 0; z-index: 10; width: var(--detail-width); max-width: 100vw; height: 100vh; background: var(--bg-card); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); padding: 18px 22px 30px; overflow-y: auto; }
.detail-open .main { margin-right: var(--detail-width); }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.detail-head h2 { font-family: 'Outfit', sans-serif; font-size: 17px; font-weight: 700; text-transform: uppercase; }
.detail-sub { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; color: var(--text-muted); margin-bottom: 14px; }
.detail h3 { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 20px 0 9px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 8px 10px; font-size: 12.5px; }
.kv dt { color: var(--text-secondary); }
.kv dd { word-break: break-all; }
.timeline { list-style: none; display: grid; gap: 8px; font-size: 12.5px; }
.timeline li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

@media (max-width: 1400px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .detail-open .main { margin-right: 0; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-actions { flex-wrap: wrap; }
  .search-box { flex: 1 1 200px; width: auto; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: 14px 12px 30px; }
  .data-table td, .data-table thead th { padding: 8px 10px; font-size: 12px; }
}
