/* ============================================================
   CollectERP — Modern SaaS design system
   Light + Dark themes, responsive sidebar layout, analytics UI
   ============================================================ */

:root {
  --brand: #2783DE;
  --brand-2: #5BA7EC;
  --brand-soft: rgba(39, 131, 222, 0.10);
  --green: #46A171;
  --green-soft: rgba(70, 161, 113, 0.12);
  --orange: #D5803B;
  --orange-soft: rgba(213, 128, 59, 0.12);
  --red: #E56458;
  --red-soft: rgba(229, 100, 88, 0.12);
  --blue: #2783DE;

  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --border: #E7E9EE;
  --text: #1B1F27;
  --text2: #58607A;
  --muted: #8B93A7;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 8px 30px rgba(16, 24, 40, 0.12);
  --radius: 14px;
  --side-w: 236px;
}

[data-theme="dark"] {
  --bg: #0F1218;
  --surface: #161B24;
  --surface-2: #1C2230;
  --border: #262E3F;
  --text: #E7EAF0;
  --text2: #A6AEC2;
  --muted: #6E7891;
  --brand-soft: rgba(91, 167, 236, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 34px rgba(0, 0, 0, 0.5);
}

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

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  transition: background 0.25s ease, color 0.25s ease;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }

/* ---------- App shell: sidebar + main ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  transition: transform 0.25s ease;
}

.side-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 12px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.2px;
}

.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 2px 8px rgba(39, 131, 222, 0.35);
}

.side-role {
  margin: 0 18px 14px;
  display: inline-block;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 3px 10px;
  width: fit-content;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; }

.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text2);
  font-weight: 500;
  font-size: 13.8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.side-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.side-nav a.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.side-nav .nav-ic { width: 20px; text-align: center; font-size: 15px; }

.side-foot { padding: 14px 18px; border-top: 1px solid var(--border); font-size: 13px; }
.side-foot a { color: var(--text2); display: flex; align-items: center; gap: 8px; }
.side-foot a:hover { color: var(--red); text-decoration: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 22px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.crumbs { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs strong { color: var(--text); font-weight: 600; }
.crumbs .sep { opacity: 0.5; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s ease, transform 0.1s ease;
  text-decoration: none !important;
}
.icon-btn:hover { background: var(--surface-2); transform: translateY(-1px); }

.badge-dot {
  position: absolute; top: -5px; right: -5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px;
  background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 13px;
  text-decoration: none !important;
}
.user-chip:hover { background: var(--surface-2); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.hamburger { display: none; }

.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15, 18, 24, 0.5); z-index: 45;
}

/* ---------- Content ---------- */

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

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.3px; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- Cards, KPIs ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
  transition: box-shadow 0.2s ease;
}
.card h2 { font-size: 14.5px; font-weight: 700; margin-bottom: 12px; letter-spacing: -0.1px; }

.h-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.h-row h2 { margin-bottom: 0; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 17px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.k-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.k-value { font-size: 24px; font-weight: 750; letter-spacing: -0.5px; margin: 4px 0 2px; }
.k-sub { font-size: 12.5px; color: var(--muted); }
.k-sub .warn { color: var(--orange); font-weight: 600; }
.k-sub .down { color: var(--red); font-weight: 600; }
.k-sub .up { color: var(--green); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--surface-2); }

th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); font-size: 12.5px; }

/* ---------- Pills / badges ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 10px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 650;
  white-space: nowrap;
}
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.blue { background: var(--brand-soft); color: var(--brand); }
.pill.gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(39, 131, 222, 0.3); }
.btn.primary:hover { background: #1E6FC4; }
.btn.danger { background: var(--red-soft); border-color: transparent; color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.sm { padding: 4.5px 11px; font-size: 12.5px; border-radius: 8px; }

/* ---------- Forms ---------- */

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }

.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 13.8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

.form-row { display: flex; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 150px; }

/* ---------- Progress / charts ---------- */

.progress {
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress > * , .progress .fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  transition: width 0.5s ease;
}
.progress .fill.green { background: var(--green); }
.progress .fill.red { background: var(--red); }
.progress .fill.orange { background: var(--orange); }

.chart { display: flex; align-items: flex-end; gap: 7px; height: 170px; padding-top: 10px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; min-width: 0; }
.bar {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-radius: 6px 6px 2px 2px;
  min-height: 3px;
  transition: height 0.4s ease, opacity 0.15s ease;
}
.bar-wrap:hover .bar { opacity: 0.75; }
.bar-label { font-size: 10px; color: var(--muted); text-align: center; margin-top: 6px; white-space: nowrap; overflow: hidden; }
.bar-value { font-size: 10px; color: var(--text2); text-align: center; margin-bottom: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }

.stack { display: flex; height: 12px; border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--text2); }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

/* ---------- Flash / toasts ---------- */

.flash {
  padding: 11px 15px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent;
}
.flash.success { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.flash.error { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, transparent); }

.toast {
  position: fixed; top: 18px; right: 18px; z-index: 100;
  max-width: 380px;
  padding: 13px 18px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500;
  display: flex; align-items: flex-start; gap: 9px;
  animation: toast-in 0.3s ease;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.hide { opacity: 0; transform: translateX(30px); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- Skeleton loader ---------- */

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs a {
  padding: 8px 14px;
  font-size: 13.5px; font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-decoration: none !important;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Login screens ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(800px 400px at 15% 0%, var(--brand-soft), transparent),
    radial-gradient(700px 380px at 90% 100%, rgba(70, 161, 113, 0.09), transparent),
    var(--bg);
}

.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 34px 32px;
}
.login-card .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin-bottom: 20px; }
.login-card h1 { font-size: 21px; font-weight: 750; letter-spacing: -0.3px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

/* ---------- Responsive ---------- */

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

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-105%);
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .overlay { display: block; }
  .hamburger { display: inline-flex; }
  .container { padding: 16px 14px; }
  .topbar { padding: 10px 14px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; }
  .k-value { font-size: 20px; }
  .chart { height: 130px; gap: 4px; }
  .bar-value { display: none; }
  .user-chip span.uname { display: none; }
}

@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr !important; }
  .crumbs .crumb-root { display: none; }
}

@media print {
  .sidebar, .topbar, .overlay, .btn, .toast { display: none !important; }
  .main, .container { margin: 0; padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ===== Branding logo image ===== */
.logo-img { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; vertical-align: middle; }

/* ===== Toggle switch (gateway enable/disable) ===== */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .sl { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background .2s ease; cursor: pointer; }
.switch .sl:before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #FFFFFF; transition: transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .sl { background: var(--brand); }
.switch input:checked + .sl:before { transform: translateX(20px); }
.switch input:focus-visible + .sl { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ===== Gateway cards ===== */
.gw-card { display: flex; flex-direction: column; }
.gw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.gw-head h2 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gw-desc { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.45; }
.btn-block { width: 100%; display: block; text-align: center; padding: 10px 16px; }

/* ===== Advanced collapsible ===== */
details.adv { margin: 4px 0 12px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--bg); }
details.adv summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); user-select: none; }
details.adv[open] summary { margin-bottom: 10px; }

/* ===== File inputs ===== */
input[type="file"] { width: 100%; padding: 9px 10px; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 13px; cursor: pointer; }
input[type="file"]:hover { border-color: var(--brand); }

/* ===== Global polish ===== */
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: var(--bg); }
.card { transition: box-shadow .15s ease; }
.card:hover { box-shadow: var(--shadow-lg); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); outline: none; }

/* ---------- Login page improvements ---------- */

.login-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid var(--red);
  border-radius: 10px;
  animation: slideIn 0.25s ease;
}

.login-error .error-icon {
  font-size: 18px;
  margin-top: 1px;
}

.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-wrap input { flex: 1; padding-right: 40px; }

.pw-toggle {
  position: absolute;
  right: 0;
  top: 0; bottom: 0;
  width: 38px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 9px 9px 0;
  transition: color 0.15s;
}
.pw-toggle:hover { color: var(--brand); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Header improvements ---------- */

.user-chip .role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 2px;
}

.logout-btn {
  color: var(--text2) !important;
  border-color: var(--border);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.logout-btn:hover {
  background: var(--red-soft) !important;
  color: var(--red) !important;
  border-color: var(--red) !important;
  transform: none;
}

/* ---------- Callout / info boxes ---------- */

.callout-info {
  background: var(--brand-soft);
  border: 1px solid rgba(39, 131, 222, 0.25);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text2);
  margin-bottom: 14px;
  line-height: 1.6;
}

.callout-warn {
  background: var(--orange-soft);
  border: 1px solid rgba(213, 128, 59, 0.25);
  border-left: 4px solid var(--orange);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text2);
  margin-bottom: 14px;
  line-height: 1.6;
}

/* ---------- UTR Verify / payment summary ---------- */

.verify-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.verify-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.verify-row:last-child { border-bottom: none; }
.verify-row span:first-child { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }

/* ---------- Gateway cards ---------- */

.gw-card {
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.gw-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.gw-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}

.gw-desc {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 3px;
  line-height: 1.5;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.sl {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.sl:before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .sl { background: var(--green); }
.switch input:checked + .sl:before { transform: translateX(18px); }

/* Advanced gateway details */
.adv summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--brand);
  font-weight: 600;
  padding: 8px 0;
  user-select: none;
}

/* Billing table enhancements */
.billing-days-left {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ---- Progress bar ---- */
.progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 99px;
  transition: width 0.4s ease;
}
.progress .fill.green { background: linear-gradient(90deg, var(--green), #67c48a); }
.progress .fill.orange { background: linear-gradient(90deg, var(--orange), #e8a060); }

/* ---- Chart bars ---- */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding-top: 24px;
}
.bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  position: relative;
}
.bar-value {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  position: absolute;
  top: -16px;
}
.bar {
  width: 100%;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}
.bar-label {
  font-size: 9.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* Stack bar (cash vs online) */
.stack {
  display: flex;
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0;
  gap: 2px;
}
.stack span { border-radius: 99px; transition: width 0.4s ease; }
.legend {
  display: flex;
  gap: 16px;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

/* ---- Mobile responsive ---- */
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .top-actions .user-chip .uname { display: none; }
  .top-actions .user-chip .role-badge { display: none; }
}

@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr; }
  .container { padding: 14px; }
  .topbar { padding: 8px 14px; }
  .hamburger { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 100;
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .overlay.show { display: block; }
  .form-row { flex-direction: column; }
  table { font-size: 12.5px; }
  thead th { font-size: 10px; }
}

/* ---- btn-block ---- */
.btn-block { width: 100%; }

/* ---- inline-form ---- */
.inline-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.inline-form input, .inline-form select {
  font-size: 13px;
  padding: 5px 8px;
}

/* ---- Toast notification ---- */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  min-width: 280px;
  max-width: 500px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-align: center;
}
.toast.success { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.toast.error   { background: var(--red-soft);   border-color: var(--red);   color: var(--red); }
@keyframes toastIn {
  from { opacity: 0; top: 50px; }
  to   { opacity: 1; top: 70px; }
}

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text2); letter-spacing: 0.1px; }

.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.form-row .field { flex: 1; min-width: 160px; }

input, select, textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input:read-only, input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

/* ---- btn sizes ---- */
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.primary {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(39,131,222,0.25);
}
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 85%, #000); }
.btn.danger { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.green { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.btn.green:hover { background: var(--green); color: #fff; }

/* Logout button in topbar */
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 9px;
  border: 1px solid var(--red);
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn-logout:hover {
  background: var(--red);
  color: #fff;
  transform: translateY(-1px);
}
