/* ─── DESIGN SYSTEM (2026 refresh) ─────────────────────── */
:root {
  --primary: #00008B;
  --primary-hover: #000066;
  --primary-soft: rgba(0, 0, 139, 0.10);
  --primary-gradient: linear-gradient(135deg, #000066 0%, #00008B 55%, #2a3fd0 100%);
  --secondary: #FF6D00;
  --secondary-hover: #e66200;
  --secondary-soft: rgba(255, 109, 0, 0.14);
  --secondary-gradient: linear-gradient(135deg, #FF6D00 0%, #ff8a3d 100%);

  --bg-color: #eef0fa;
  --sidebar-bg: #00004d;
  --sidebar-hover: #000066;
  --sidebar-active: rgba(255, 109, 0, 0.15);
  --topbar-bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-glass: rgba(255, 255, 255, 0.72);

  --text-main: #1c1130;
  --text-muted: #5b5470;
  --text-on-primary: #ffffff;

  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;

  --border-color: #e6e9f2;
  --border-color-strong: #d5d9ec;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 11px;
  --radius-sm: 7px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 8px 24px -4px rgba(16, 24, 40, 0.10), 0 2px 6px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 20px 40px -8px rgba(16, 24, 40, 0.16), 0 6px 12px -4px rgba(16, 24, 40, 0.08);
  --shadow-glow-primary: 0 6px 20px rgba(0, 0, 139, 0.25);
  --shadow-glow-secondary: 0 6px 20px rgba(255, 109, 0, 0.28);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

::selection { background: #4d5bf9; color: #ffffff; }

/* ─── RESET & BASE ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  /* Matches the original compact sizing across the app */
  zoom: 80%;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(0,0,139,0.05), transparent 55%),
    var(--bg-color);
  color: var(--text-main);
  line-height: 1.55;
  transition: background var(--transition-base), color var(--transition-base);
}
input, select, textarea, button { font-family: inherit; }
a { text-decoration: none; color: inherit; }
/*::selection { background: var(--secondary-soft); color: var(--text-main); }*/

/* Scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── UTILITIES ────────────────────────────────────────── */
.material-icons { font-size: 20px; vertical-align: middle; }

/* ═══════════════════════════════════════════════════════
   LOGIN — "Ledger Split"
   Editorial dark panel (identity) + clean paper panel (form)
   Signature: numbered ledger lines on the brand side
   ═══════════════════════════════════════════════════════ */

#login-page { zoom: 125%; }

.login-bg {
  min-height: 100vh;
  width: 100%;
  background: #f4f3ef;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  box-sizing: border-box;
}

.login-split {
  width: 100%;
  max-width: 880px;
  min-height: 560px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 70px -24px rgba(16, 17, 40, 0.28);
  animation: shellRise 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes shellRise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── LEFT: brand / editorial panel ─────────────────────── */
.login-panel-brand {
  position: relative;
  background: #00004d;
  background-image:
    radial-gradient(420px 320px at 85% 0%, rgba(255, 109, 0, 0.22), transparent 60%),
    radial-gradient(500px 400px at -10% 100%, rgba(0, 0, 139, 0.55), transparent 60%),
    radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: auto, auto, 22px 22px;
  background-position: 0 0, 0 0, 0 0;
  color: #fff;
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.login-panel-brand::before {
  /* soft glowing orb, bottom-left, sits behind the illustration */
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  left: -80px; bottom: -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 109, 0, 0.20), transparent 70%);
  filter: blur(4px);
  pointer-events: none;
}

.login-panel-brand::after {
  /* fine vertical rule motif — like a ledger's margin line */
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 28px;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.brand-mark { display: flex; }

.brand-ledger {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 40px 0;
}

.ledger-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.16);
}

.ledger-no {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--secondary);
  min-width: 22px;
}

.ledger-txt {
  font-size: 15.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.01em;
}

.brand-quote {
  position: relative;
  padding-left: 16px;
}

.brand-quote-line {
  position: absolute;
  left: 0; top: 2px; bottom: 2px;
  width: 3px;
  border-radius: 3px;
  background: var(--secondary);
}

.brand-quote p {
  font-size: 15px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.5;
  font-style: italic;
}

.brand-foot {
  margin-top: 32px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.03em;
}

.brand-illustration {
  position: relative;
  margin-top: 22px;
  width: 100%;
  max-width: 260px;
  z-index: 1;
}
.brand-illustration svg { width: 100%; height: auto; display: block; position: relative; z-index: 1; }
.brand-illustration::before {
  content: "";
  position: absolute;
  inset: -14px -20px -14px -14px;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.05), transparent 70%);
  border-radius: 28px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  z-index: 0;
}

@media (max-width: 860px) {
  .brand-illustration { display: none; }
}

/* Text selection on the dark panel — override the global dark-on-orange
   selection so selected text stays readable (light text, deep blue bg) */
/*.login-panel-brand ::selection {*/
/*  background: #4d5bf9;*/
/*  color: #ffffff;*/
/*}*/

/* ── RIGHT: form panel ─────────────────────────────────── */
.login-panel-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 48px;
  background: var(--surface);
}

.login-shell {
  width: 100%;
  max-width: 320px;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  text-align: left;
}

.login-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 5px;
  margin-bottom: 28px;
  text-align: left;
}

.login-footer {
  text-align: left;
  margin-top: 24px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute; left: 13px; font-size: 19px; color: var(--text-muted); pointer-events: none;
  transition: color var(--transition-fast);
}
.form-input.has-icon { padding-left: 40px; padding-right: 40px; }
.input-icon-wrap:focus-within .input-icon { color: var(--primary); }
.input-toggle-btn {
  position: absolute; right: 8px; background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px; display: flex; border-radius: 6px;
}
.input-toggle-btn:hover { color: var(--primary); }
.input-toggle-btn .material-icons { font-size: 19px; }

.login-submit {
  margin-top: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  position: relative; overflow: hidden;
  background: #00004d;
  box-shadow: none;
  border-radius: 10px;
}
.login-submit::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--secondary);
  transform: translateX(-101%);
  transition: transform 0.28s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 0;
}
.login-submit .btn-label, .login-submit .btn-arrow { position: relative; z-index: 1; }
.login-submit:hover::before { transform: translateX(0); }
.login-submit:hover { box-shadow: 0 10px 24px -6px rgba(255, 109, 0, 0.4); }
.login-submit .btn-arrow { font-size: 18px; transition: transform var(--transition-fast); }
.login-submit:hover .btn-arrow { transform: translateX(3px); }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 860px) {
  .login-split {
    grid-template-columns: 1fr;
    max-width: 440px;
  }
  .login-panel-brand {
    padding: 32px 32px 28px;
  }
  .login-panel-brand::after { display: none; }
  .brand-ledger { margin: 24px 0; gap: 12px; }
  .ledger-row { padding-bottom: 10px; }
  .brand-quote { display: none; }
  .brand-foot { margin-top: 18px; }
  .login-panel-form { padding: 36px 32px; }
}

@media (max-width: 480px) {
  .login-bg { padding: 0; }
  .login-split { border-radius: 0; min-height: 100vh; box-shadow: none; }
  .login-panel-brand { padding: 28px 24px 22px; }
  .brand-ledger { margin: 18px 0; }
  .login-panel-form { padding: 32px 24px; }
  .login-title { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-split, .login-submit::before { animation: none !important; transition: none !important; }
}

/* ─── LAYOUT ────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 264px; flex-shrink: 0;
  background:
    radial-gradient(500px 300px at 100% 0%, rgba(255,109,0,0.10), transparent 60%),
    linear-gradient(180deg, #00004d 0%, #000038 100%);
  color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 1000;
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: 4px 0 24px rgba(0,0,0,0.16);
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-close {
  display: none; background: none; border: none; color: #fff;
  padding: 8px; cursor: pointer; border-radius: 50%;
  transition: background var(--transition-fast);
}
.sidebar-close:hover { background: rgba(255,255,255,0.12); }
.sidebar-logo {
  padding: 24px; font-size: 26px; font-weight: 800;
  display: flex; flex-direction: column; gap: 4px;
}
@media (max-width: 768px) {
  .sidebar-logo { padding: 16px; }
}
.logo-i { color: var(--secondary); }
.logo-spark { color: #fff; }
.logo-slogan {
  display: block; font-size: 11px; font-weight: 500; color: var(--secondary);
  letter-spacing: 0.5px;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
@media (max-width: 768px) {
  .sidebar-nav { padding: 8px 12px; }
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; color: #b8bcd6;
  cursor: pointer; transition: all var(--transition-fast);
  font-size: 15px; border: none; background: none; width: 100%;
  text-align: left; border-radius: var(--radius-md);
  margin-bottom: 4px;
}
.nav-item { position: relative; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--sidebar-active); color: var(--secondary); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--secondary);
}
.nav-item .material-icons { font-size: 20px; }



/* ─── SUB-MENU (Invoice children) ────────────────────────── */
.nav-parent { position: relative; }
.nav-parent.has-active-child { background: rgba(224, 101, 79, 0.14); color: #fff; }
.nav-chevron {
  font-size: 18px !important; margin-left: auto; flex-shrink: 0;
  transition: transform var(--transition-base);
}
.nav-parent.expanded .nav-chevron { transform: rotate(180deg); }

.nav-sub-list {
  display: flex;
  flex-direction: column;
  padding-left: 8px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, margin-bottom 0.3s ease;
  margin-bottom: 0;
  width: 100%;
  box-sizing: border-box;
}
.nav-sub-list.open { max-height: 300px; margin-bottom: 4px; }

.nav-sub-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px 10px 24px; color: #9095b3;
  cursor: pointer; transition: all var(--transition-fast);
  font-size: 14px; border: none; background: none;
  width: 100%; box-sizing: border-box;
  text-align: left; border-radius: var(--radius-md);
  margin-bottom: 4px;
  white-space: nowrap;
}
.nav-sub-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-sub-item.active { background: var(--secondary); color: #fff; box-shadow: 0 4px 12px rgba(224, 101, 79, 0.3); }
.nav-sub-icon { font-size: 18px; flex-shrink: 0; }
@media (max-width: 768px) {
  .nav-sub-item { padding: 8px 16px 8px 20px; }
}

.sidebar-bottom { padding: 12px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-action {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; color: #b8bcd6; cursor: pointer;
  border-radius: var(--radius-md); font-size: 14px;
  transition: all var(--transition-fast); margin-bottom: 4px;
}
.sidebar-action:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-action.logout:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }

.sidebar-overlay { display: none; }

.main { margin-left: 264px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  background: var(--surface-glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-xs);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--text-main); padding: 8px; border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: var(--surface-muted); }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-main); }
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-muted); padding: 6px 16px 6px 6px; border-radius: 999px;
  border: 1px solid var(--border-color);
  transition: box-shadow 0.2s ease;
}
.topbar-user:hover { box-shadow: var(--shadow-xs); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-gradient, linear-gradient(135deg, var(--primary), var(--secondary, #c9503b)));
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; letter-spacing: 0.02em;
}
.user-info-text { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.user-role { font-size: 11.5px; font-weight: 500; color: var(--text-muted); }

.content { padding: 28px; flex: 1; }

/* ─── PAGE HEADER ────────────────────────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
  animation: riseIn 0.35s ease backwards;
}
.page-title { font-size: 26px; font-weight: 700; color: var(--text-main); letter-spacing: -0.01em; }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ─── CARD ───────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 24px;
  box-shadow: var(--shadow-xs); border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-base);
  animation: riseIn 0.35s ease backwards;
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-title {
  font-size: 17px; font-weight: 700; color: var(--text-main);
  margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
}

/* ─── STAT GRID ──────────────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
.stat-card {
  position: relative; overflow: hidden;
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-xs); border: 1px solid var(--border-color);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  animation: riseIn 0.4s ease backwards;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-color-strong); }
.stat-icon-wrap {
  width: 48px; height: 48px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  transition: transform var(--transition-bounce);
}
.stat-card:hover .stat-icon-wrap { transform: scale(1.08) rotate(-4deg); }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-main); }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* ─── FILTER BAR ─────────────────────────────────────────── */
.filter-bar {
  position: relative; overflow: hidden;
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 16px 20px; margin-bottom: 20px; display: flex; align-items: flex-start;
  gap: 14px 16px; flex-wrap: wrap; box-shadow: var(--shadow-xs); border: 1px solid var(--border-color);
}
.filter-bar::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0.9;
}
.filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1 1 auto; }
.filter-group label { font-size: 13.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

.filter-search-wrap { position: relative; flex: 1 1 260px; min-width: 220px; max-width: 380px; }
.filter-search-wrap .material-icons {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 20px; pointer-events: none;
  transition: color var(--transition-fast);
}
.filter-search-wrap input {
  padding: 11px 16px 11px 42px;
  width: 100%;
  border: 1.5px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 14px;
  outline: none;
  transition: all var(--transition-fast);
}
.filter-search-wrap input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.filter-search-wrap input:focus + .material-icons,
.filter-search-wrap:focus-within .material-icons { color: var(--primary); }
.filter-search-wrap input::placeholder { color: var(--text-muted); opacity: 0.85; }

/* Dropdown filters (type/month/school/invoice#/FY etc.) */
.filter-select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  flex: 0 1 140px; min-width: 108px;
  padding: 10.5px 32px 10.5px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  background-color: var(--surface-muted);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2300008B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  font-size: 13.5px; font-weight: 600; color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.filter-select:hover { border-color: var(--primary); background-color: var(--surface); }
.filter-select:focus {
  outline: none; background-color: var(--surface);
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft);
}
.filter-count {
  margin-left: auto; align-self: center;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--primary); font-size: 12.5px; font-weight: 700; white-space: nowrap;
  background: var(--primary-soft); padding: 7px 14px; border-radius: 999px;
}

.form-group label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-main); margin-bottom: 8px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px 16px;
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  font-size: 15px; outline: none; transition: all var(--transition-fast);
  background: var(--surface); color: var(--text-main);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-md); border: none;
  font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: all var(--transition-fast); white-space: nowrap;
}
.btn-primary { background: var(--primary-gradient); color: #fff; box-shadow: var(--shadow-glow-primary); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,139,0.32); filter: brightness(1.06); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--surface-muted); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); }
.btn-outline { background: var(--surface); color: var(--text-main); border: 1.5px solid var(--border-color); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(239,68,68,0.3); }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; border-radius: var(--radius-sm); }
.btn-small { padding: 6px; border-radius: var(--radius-sm); min-width: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ─── TAGS ───────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.tag-blue     { background: var(--primary-soft); color: var(--primary); }
.tag-green   { background: #ecfdf5; color: #047857; }
.tag-orange  { background: #fff7ed; color: #c2410c; }
.tag-red     { background: #fef2f2; color: #b91c1c; }
.tag-purple  { background: #f5f3ff; color: #6d28d9; }
.tag-grey    { background: var(--surface-muted); color: var(--text-muted); }
.status-pill { transition: transform var(--transition-fast); }
.status-pill:hover { transform: scale(1.04); }

/* ─── TABLE ──────────────────────────────────────────────── */
.table-wrap { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow-x: auto; border: 1px solid var(--border-color); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th {
  background: var(--surface-muted); color: var(--text-muted); padding: 15px 20px;
  text-align: left; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 2px solid var(--border-color);
  position: sticky; top: 0; z-index: 1;
}
table.data-table td {
  padding: 15px 20px; border-bottom: 1px solid var(--border-color);
  vertical-align: middle; color: var(--text-main);
}
table.data-table tr { transition: background var(--transition-fast); animation: fadeIn 0.35s ease backwards; }
table.data-table tbody tr:nth-child(1) { animation-delay: 0.02s; }
table.data-table tbody tr:nth-child(2) { animation-delay: 0.05s; }
table.data-table tbody tr:nth-child(3) { animation-delay: 0.08s; }
table.data-table tbody tr:nth-child(4) { animation-delay: 0.11s; }
table.data-table tbody tr:nth-child(5) { animation-delay: 0.14s; }
table.data-table tr:hover td { background: var(--surface-muted); }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 30, 0.6); backdrop-filter: blur(6px);
  z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: zoomIn 0.22s var(--transition-base);
  border: 1px solid var(--border-color);
}
@keyframes zoomIn { from { transform: scale(0.96) translateY(8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-header {
  padding: 22px 28px; border-bottom: 1px solid var(--border-color);
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg, var(--surface-muted), var(--surface));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title { font-size: 19px; font-weight: 700; color: var(--text-main); }
.modal-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--surface-muted); color: var(--danger); transform: rotate(90deg); }
.modal-body { padding: 28px; }
.modal-footer { padding: 20px 28px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 12px; }

/* ─── ALERT ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: 13.5px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ─── RESPONSIVE LAYOUT ────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 240px; transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .main { margin-left: 0; width: 100%; overflow-x: hidden; }
  .menu-toggle { display: flex; }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 500;
    display: none; backdrop-filter: blur(2px);
  }
  .sidebar-overlay.active { display: block; }
}
body.sidebar-open { overflow: hidden; }

@media (max-width: 768px) {
  .topbar-title { display: none; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; gap: 16px; }

  .page-header { flex-direction: column; align-items: stretch; gap: 16px; text-align: center; }
  .page-header > div:last-child { display: flex; flex-direction: column; gap: 8px; }
  .page-header .btn { width: 100%; justify-content: center; }
  .page-title { font-size: 23px; }

  .card { padding: 16px; margin-bottom: 20px; }
  .card-title { font-size: 16px; margin-bottom: 16px; flex-wrap: wrap; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .stat-icon-wrap { width: 40px; height: 40px; font-size: 20px; border-radius: 10px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 12px; }

  table.data-table th, table.data-table td { padding: 12px 10px; font-size: 13px; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 16px; }
  .topbar-user { padding: 4px 10px 4px 4px; max-width: 160px; }
  .user-role { display: none; }
  .user-avatar { width: 28px; height: 28px; font-size: 11px; }
  .content { padding: 12px; }

  .card { padding: 12px; margin-bottom: 12px; }
  .card-title { font-size: 14px; gap: 6px; margin-bottom: 12px; }
  .page-title { font-size: 20px; }
  .page-subtitle { font-size: 13px; }

  /* 1 card per row on small screens */
  .stat-grid { grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
  .stat-card { padding: 12px 16px; gap: 12px; flex-direction: row; align-items: center; }
  .stat-icon-wrap { width: 36px; height: 36px; font-size: 18px; border-radius: 9px; flex-shrink: 0; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 12px; }

  .filter-bar { padding: 12px; flex-direction: column; align-items: stretch; }
  .filter-group { flex-direction: column; align-items: stretch; }
  .filter-group select, .filter-group button, .filter-select { width: 100%; }
  .filter-search-wrap { min-width: 100%; max-width: 100%; flex-basis: 100%; }
  .filter-count { margin-left: 0; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; height: auto; margin: 0; width: 100%; }
  .modal-header, .modal-footer { padding: 16px 20px; }
  .modal-body { padding: 20px; }

  .login-card { padding: 32px 20px; border-radius: 0; max-width: 100%; }
  .btn { width: 100%; }
}

/* ─── PAYMENT MODE GRID ──────────────────────────────────── */
.pay-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 768px) {
  .pay-mode-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
}
@media (max-width: 480px) {
  .pay-mode-grid { grid-template-columns: 1fr; gap: 8px; margin-bottom: 16px; }
}

/* ─── DASHBOARD CHART CONTAINER ──────────────────────────── */
.chart-container {
  width: 100%;
  height: 320px;
  padding-top: 8px;
}
@media (max-width: 768px) {
  .chart-container { height: 260px; }
}
@media (max-width: 480px) {
  .chart-container { height: 220px; }
}

/* ─── DASHBOARD STAT INFO POLISH ─────────────────────────── */
.stat-card { align-items: flex-start; }
.stat-info { display: flex; flex-direction: column; gap: 2px; }
.stat-value { line-height: 1.2; }

/* ─── MOBILE TABLE → CARD VIEW ───────────────────────────── */
@media (max-width: 640px) {
  .table-wrap {
    border: none;
    box-shadow: none;
    background: transparent;
    overflow-x: visible;
  }
  .table-wrap table.data-table { display: block; }
  .table-wrap table.data-table thead { display: none; }
  .table-wrap table.data-table tbody { display: block; }

  .table-wrap table.data-table tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }
  .table-wrap table.data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    gap: 12px;
    min-height: 44px;
    text-align: right;
  }
  .table-wrap table.data-table td:last-child { border-bottom: none; }

  /* Label from data-label attribute */
  .table-wrap table.data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    text-align: left;
    min-width: 90px;
  }

  /* Hide the row-number column */
  .table-wrap table.data-table td[data-label="#"] { display: none; }

  /* Actions row — center the buttons */
  .table-wrap table.data-table td[data-label="Actions"] {
    justify-content: flex-end;
  }
  .table-wrap table.data-table td[data-label="Actions"]::before { display: none; }
}