/* Consultancy fee-management — UI theme (self-contained, no external assets) */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #1f2733;
  --muted: #6b7688;
  --line: #e3e8f0;
  --brand: #1f5fbf;
  --brand-dark: #17408a;
  --accent: #0d9488;
  --good: #16794a;
  --good-bg: #e6f5ee;
  --warn: #a15c00;
  --danger: #b42318;
  --danger-bg: #fdeceb;
  --sidebar: #16233b;
  --sidebar-ink: #c7d2e2;
  --sidebar-active: #24457e;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h2, h3 { margin: 0 0 .6rem; }
.muted { color: var(--muted); }
.mt { margin-top: 1rem; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--sidebar);
  color: var(--sidebar-ink); padding: 0 0 2rem; position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: .55rem; padding: 1.1rem 1.1rem;
  font-weight: 700; color: #fff; font-size: 1.02rem; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  background: var(--brand); color: #fff; width: 28px; height: 28px; border-radius: 7px;
  display: inline-grid; place-items: center; font-weight: 800;
}
.brand-logo {
  height: 30px; width: auto; max-width: 130px; border-radius: 6px;
  background: #fff; padding: 2px; object-fit: contain; flex: none;
}
.brand-logo-lg { height: 44px; max-width: 180px; }
.nav { display: flex; flex-direction: column; padding: .6rem .6rem; gap: 2px; }
.nav-group {
  text-transform: uppercase; font-size: .68rem; letter-spacing: .06em;
  color: #7f8db0; margin: .9rem .6rem .25rem;
}
.nav-item {
  color: var(--sidebar-ink); padding: .5rem .7rem; border-radius: 8px;
  font-size: .93rem; display: flex; justify-content: space-between; align-items: center;
}
.nav-item:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-item .hint { font-size: .68rem; color: #8595b8; }
.nav-item.active .hint { color: #cdd8ee; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .7rem 1.4rem;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.page-title { font-weight: 600; font-size: 1.05rem; flex: 1; }
.user-menu { display: flex; align-items: center; gap: .8rem; }
.user-name { color: var(--muted); font-size: .9rem; }
.hamburger { display: none; background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.content { padding: 1.4rem; max-width: 1180px; width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1.2rem;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .grid-2 { margin-top: 1.2rem; }

/* ---------- Stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: .82rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; margin-top: .2rem; letter-spacing: -.01em; }
.stat-value.good { color: var(--good); }
.stat-value.neg { color: var(--danger); }
.stat-sub { color: var(--muted); font-size: .76rem; margin-top: .15rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.table th, table.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; }
table.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
table.table tbody tr:hover { background: #fafbfe; }
table.table tr:hover { background: #fafbfe; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }

table.kv { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.kv td { padding: .4rem .2rem; border-bottom: 1px dashed var(--line); }
table.kv td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.kv tr.total td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); padding: .5rem .9rem; border-radius: 8px; cursor: pointer;
  font-size: .9rem; font-weight: 500; line-height: 1.2;
}
.btn:hover { text-decoration: none; border-color: #c9d2e2; background: #f7f9fc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #90140c; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn-block { width: 100%; text-align: center; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* ---------- Sort bar ---------- */
.sortbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  padding: .55rem .7rem; margin-bottom: .8rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.sortbar-label { font-size: .82rem; font-weight: 600; color: var(--muted); margin-right: .2rem; }
.sortbar button {
  border: 1px solid var(--line); background: #f7f9fc; color: var(--ink);
  padding: .32rem .66rem; border-radius: 999px; cursor: pointer;
  font-size: .82rem; font-weight: 500; line-height: 1.2; white-space: nowrap;
}
.sortbar button:hover { border-color: #c9d2e2; background: #eef3fb; }
.sortbar button.active {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600;
}
.sortbar .sort-arrow { font-size: .74rem; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: .8rem; }
label { font-size: .85rem; color: var(--muted); display: block; }
input, select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  font-size: .95rem; font-family: inherit; color: var(--ink); background: #fff; margin-top: .2rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe0fb; border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
.field-help { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.required::after { content: " *"; color: var(--danger); }

/* ---------- Flash / badges ---------- */
.flashes { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.flash { padding: .6rem .85rem; border-radius: 8px; font-size: .9rem; border: 1px solid transparent; }
.flash-success { background: var(--good-bg); color: var(--good); border-color: #bfe6d2; }
.flash-info { background: #eaf2fd; color: var(--brand-dark); border-color: #cfe0fb; }
.flash-warning { background: #fdf3e2; color: var(--warn); border-color: #f4dcae; }
.flash-danger { background: var(--danger-bg); color: var(--danger); border-color: #f6cfcb; }

.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.badge-green { background: var(--good-bg); color: var(--good); }
.badge-amber { background: #fdf3e2; color: var(--warn); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: #eef1f6; color: var(--muted); }
.badge-blue { background: #eaf2fd; color: var(--brand-dark); }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap; }
.page-head h2 { margin: 0; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.filters label { font-size: .78rem; }
.filters input, .filters select { margin-top: .15rem; padding: .4rem .5rem; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #16233b, #24457e); padding: 1rem; }
.login-card { background: #fff; padding: 2rem; border-radius: 14px; width: 100%; max-width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-brand { display: flex; align-items: center; gap: .5rem; font-size: 1.25rem; font-weight: 700; }
.login-card .muted { margin: .2rem 0 1.2rem; }

/* ---------- Utility ---------- */
.text-good { color: var(--good); }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.small { font-size: .82rem; }
.divider { height: 1px; background: var(--line); margin: 1rem 0; border: 0; }

/* ---------- Account cards ---------- */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.acct-card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow);
  color: var(--ink);
}
.acct-card:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 4px 14px rgba(31,95,191,.14); }
.acct-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; margin-bottom: .5rem; }
.acct-name { font-weight: 700; font-size: 1.05rem; }
.acct-college { color: var(--muted); font-size: .8rem; }
.acct-metrics td { padding: .28rem .1rem; font-size: .86rem; }
.acct-open { margin-top: .6rem; color: var(--brand); font-size: .85rem; font-weight: 600; }

/* ---------- Student cards ---------- */
.student-cards { display: none; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.view-cards .student-cards { display: grid; }
.view-cards .students-table { display: none; }
.student-card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); color: var(--ink);
}
.student-card:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 4px 14px rgba(31,95,191,.14); }
.student-card .sc-name { font-weight: 700; margin-bottom: .1rem; }
.student-card .sc-sub { color: var(--muted); font-size: .78rem; margin-bottom: .5rem; }
.student-card .kv td { padding: .25rem .1rem; font-size: .85rem; }
.toggle-group { display: inline-flex; gap: 0; }
.toggle-group .btn { border-radius: 0; }
.toggle-group .btn:first-child { border-radius: 8px 0 0 8px; }
.toggle-group .btn:last-child { border-radius: 0 8px 8px 0; }
.toggle-group .btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Sub-navigation tabs ---------- */
.subnav { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.subnav a { padding: .5rem .85rem; border-radius: 8px 8px 0 0; color: var(--muted); font-size: .9rem; font-weight: 500; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--ink); text-decoration: none; background: #fafbfe; }
.subnav a.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- Hub cards ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.hub-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); color: var(--ink); }
.hub-card:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 4px 14px rgba(31,95,191,.12); }
.hub-title { font-weight: 600; margin-bottom: .25rem; display: flex; align-items: center; gap: .4rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hub-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .hub-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; left: -240px; transition: left .2s; z-index: 30; }
  .sidebar.open { left: 0; }
  .hamburger { display: block; }
}

/* ---------- Receipt ---------- */
.receipt { max-width: 620px; margin: 0 auto; }
.receipt-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.receipt-firm { font-size: 1.25rem; font-weight: 700; }
.receipt-title { font-size: 1.05rem; font-weight: 700; letter-spacing: .05em; color: var(--brand-dark); }
.receipt-body td { padding: .45rem .2rem; }
.receipt-amount { font-size: 1.15rem; font-weight: 700; }
.receipt-sign { margin-top: 2rem; text-align: right; }
.void-banner { background: var(--danger-bg); color: var(--danger); border: 1px solid #f6cfcb; text-align: center; font-weight: 700; padding: .4rem; border-radius: 8px; margin-bottom: 1rem; letter-spacing: .1em; }

.is-void td { color: var(--muted); text-decoration: line-through; }
.print-only { display: none; }

/* ---------- Print (receipts / reports) ---------- */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; }
  .print-only { display: block; }
  body { background: #fff; }
}
