:root {
    --navy: #13204a;
    --navy-2: #1c2c61;
    --orange: #f47920;
    --orange-2: #e06a12;
    --orange-soft: #fff1e6;
    --bg: #f4f5f9;
    --card: #ffffff;
    --ink: #172033;
    --muted: #64708a;
    --line: #e3e6ee;
    --green: #15803d;  --green-soft: #e7f6ec;
    --red: #c2410c;    --red-soft: #fdece4;
    --amber: #a16207;  --amber-soft: #fdf5dc;
    --blue: #1d4ed8;   --blue-soft: #e8eefd;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(19, 32, 74, .06), 0 4px 16px rgba(19, 32, 74, .05);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-head: 'Poppins', var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--navy-2); }
h1, h2, h3 { font-family: var(--font-head); color: var(--navy); margin: 0; font-weight: 600; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ------------------------------------------------ Shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 252px; flex: none; background: var(--navy); color: #c9d0e6;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 14px; color: #fff; text-decoration: none; }
.brand span { font-family: var(--font-head); font-size: 16px; line-height: 1.15; }
.brand small { display: block; font-family: var(--font); font-size: 11.5px; color: #8f9bc2; font-weight: 500; }
.sidebar nav { padding: 6px 10px; flex: 1; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #7482ad; padding: 14px 10px 6px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
    color: #c9d0e6; text-decoration: none; font-weight: 500; margin-bottom: 2px;
}
.sidebar nav a span { flex: 1; display: flex; justify-content: space-between; align-items: center; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--orange); color: #fff; }
.pill { background: var(--orange); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 600; }
.sidebar nav a.active .pill { background: #fff; color: var(--orange-2); }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding: 12px 14px; }
.who { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.who b { display: block; color: #fff; font-weight: 600; font-size: 13px; }
.who small { color: #8f9bc2; font-size: 11.5px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--navy-2); color: #fff;
    display: grid; place-items: center; font-weight: 600; flex: none; border: 1px solid rgba(255,255,255,.15);
}
.logout { display: flex; gap: 8px; align-items: center; color: #c9d0e6; text-decoration: none; padding: 6px 4px; font-size: 13px; }
.logout:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 22px 28px 6px; }
.topbar h1 { font-size: 22px; }
.topbar .sub { margin: 2px 0 0; color: var(--muted); }
.menu-btn { display: none; background: none; border: 0; padding: 6px; color: var(--navy); cursor: pointer; }
.content { padding: 14px 28px 28px; flex: 1; }
.foot { padding: 16px 28px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.scrim { display: none; }

/* ------------------------------------------------ Cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-body { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .value { font-family: var(--font-head); font-size: 24px; font-weight: 600; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent { background: var(--navy); border-color: var(--navy); }
.stat.accent .label, .stat.accent .hint { color: #a9b3d4; }
.stat.accent .value { color: #fff; }
.stat.warn .value { color: var(--red); }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }

.hero {
    background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff;
    border-radius: var(--radius); padding: 22px 24px; display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.hero h2 { color: #fff; font-size: 20px; }
.hero p { margin: 4px 0 0; color: #b8c1df; }
.hero .due { text-align: right; }
.hero .due .amt { font-family: var(--font-head); font-size: 28px; font-weight: 600; color: #fff; }
.hero .due .amt.zero { color: #86efac; }

/* ------------------------------------------------ Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfd; white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: #fafbff; }
.t tfoot td { font-weight: 600; background: #fafbfd; border-top: 1px solid var(--line); }
.t td.actions { white-space: nowrap; text-align: right; }
.t .sub { display: block; color: var(--muted); font-size: 12px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ------------------------------------------------ Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-paid, .badge-approved, .badge-active { background: var(--green-soft); color: var(--green); }
.badge-overdue, .badge-rejected, .badge-inactive { background: var(--red-soft); color: var(--red); }
.badge-pending { background: var(--amber-soft); color: var(--amber); }
.badge-partial { background: var(--blue-soft); color: var(--blue); }
.badge-void { background: #eef0f4; color: var(--muted); }

/* Month strip on the student dashboard */
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.month { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.month b { display: block; font-family: var(--font-head); color: var(--navy); font-weight: 600; }
.month .amt { font-size: 12.5px; color: var(--muted); }
.month.paid { border-color: #bfe5cb; background: var(--green-soft); }
.month.overdue { border-color: #f6c8b2; background: var(--red-soft); }
.month.pending, .month.partial { border-color: #f1dc9c; background: var(--amber-soft); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ------------------------------------------------ Forms & buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
    font: 600 13px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.3;
}
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-2); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-2); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: #c8cede; background: #fafbfd; }
.btn-danger { background: #fff; color: var(--red); border-color: #f3c9b5; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
label { font-weight: 600; font-size: 12.5px; color: #3b4660; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=month], input[type=search], select, textarea {
    font: 14px var(--font); padding: 8px 11px; border: 1px solid #d3d8e4; border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(244,121,32,.25); border-color: var(--orange); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.toolbar .field { min-width: 150px; }
.toolbar .field.grow { flex: 1; min-width: 200px; }

.flash { margin: 10px 28px 0; padding: 11px 14px; border-radius: 10px; font-weight: 500; }
.flash-success { background: var(--green-soft); color: var(--green); border: 1px solid #bfe5cb; }
.flash-error { background: var(--red-soft); color: var(--red); border: 1px solid #f6c8b2; }
.flash-info { background: var(--blue-soft); color: var(--blue); border: 1px solid #c9d6fa; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.pager span { margin-right: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--navy); border-color: var(--orange); }

.bar { height: 8px; background: #edf0f6; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 99px; }

details.inline summary { cursor: pointer; list-style: none; }
details.inline summary::-webkit-details-marker { display: none; }
details.inline[open] { background: #fafbfd; }

dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(19,32,74,.45); }

/* ------------------------------------------------ Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.auth-art {
    background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
.auth-art::after {
    content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%;
    border: 60px solid rgba(244,121,32,.18);
}
.auth-art h1 { color: #fff; font-size: 34px; line-height: 1.2; max-width: 460px; }
.auth-art p { color: #b8c1df; max-width: 440px; font-size: 15px; }
.auth-logo { background: #fff; border-radius: 12px; padding: 10px 16px; display: inline-block; }
.auth-logo img { height: 42px; display: block; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-size: 22px; margin-bottom: 4px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #eef0f6; border-radius: 10px; padding: 4px; margin: 20px 0; }
.seg a { text-align: center; padding: 8px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; }
.seg a.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.portal-cards { display: grid; gap: 14px; margin-top: 22px; }
.portal-card { display: flex; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.portal-card:hover { border-color: var(--orange); background: var(--orange-soft); }
.portal-card .ic { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--orange-soft); color: var(--orange-2); flex: none; }
.portal-card b { display: block; color: var(--navy); font-family: var(--font-head); font-weight: 600; }
.portal-card small { color: var(--muted); }
.feature-list { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; }
.feature-list li { display: flex; gap: 10px; color: #dfe4f3; }
.feature-list .ico { color: var(--orange); }

/* ------------------------------------------------ Printable documents (challan / receipt) */
.doc-page { background: #e9ebf1; min-height: 100vh; padding: 24px 16px; }
.doc-actions { max-width: 960px; margin: 0 auto 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.doc { background: #fff; max-width: 960px; margin: 0 auto; padding: 24px; box-shadow: var(--shadow); }
.copies { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.copy { padding: 14px; border-right: 1px dashed #9aa3b8; font-size: 12px; }
.copy:last-child { border-right: 0; }
.copy-head { text-align: center; border-bottom: 2px solid var(--orange); padding-bottom: 8px; margin-bottom: 8px; }
.copy-head img { height: 30px; }
.copy-head .tag { display: inline-block; margin-top: 4px; background: var(--navy); color: #fff; font-size: 10px; padding: 1px 8px; border-radius: 4px; letter-spacing: .05em; }
.copy table { width: 100%; border-collapse: collapse; }
.copy td { padding: 3px 0; vertical-align: top; }
.copy td:last-child { text-align: right; font-weight: 600; }
.copy .lines td { border-bottom: 1px solid #eceef3; }
.copy .grand td { font-size: 13px; border-top: 2px solid var(--navy); padding-top: 6px; }
.copy .sig { margin-top: 30px; display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }
.copy .sig span { border-top: 1px solid #9aa3b8; padding-top: 2px; }
.receipt { max-width: 620px; }
.receipt-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--orange); padding-bottom: 12px; margin-bottom: 16px; gap: 12px; }
.receipt-head img { height: 44px; }
.receipt { position: relative; }
.received-stamp {
    display: flex; flex-direction: column; align-items: center; gap: 1px; width: max-content; margin: 22px 8px 0 auto;
    padding: 8px 18px; color: var(--green); border: 3px solid var(--green); outline: 1px solid var(--green); outline-offset: -7px;
    border-radius: 8px; transform: rotate(-9deg); opacity: .9; text-transform: uppercase; line-height: 1.2;
}
.received-stamp b { font-family: var(--font-head); font-size: 26px; letter-spacing: .14em; }
.received-stamp small { font-size: 10px; font-weight: 600; letter-spacing: .06em; }
.received-stamp span { font-size: 14px; font-weight: 700; letter-spacing: .08em; }
.stamp { display: inline-block; border: 2px solid var(--green); color: var(--green); padding: 4px 12px; border-radius: 6px; font-weight: 700; letter-spacing: .1em; transform: rotate(-4deg); }

@media print {
    body, .doc-page { background: #fff !important; padding: 0 !important; }
    .doc-actions, .sidebar, .topbar, .foot, .no-print { display: none !important; }
    .doc { box-shadow: none; padding: 0; max-width: none; }
    @page { size: A4 landscape; margin: 10mm; }
}

/* ------------------------------------------------ Responsive */
@media (max-width: 1100px) {
    .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
    .nav-open .sidebar { transform: none; }
    .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
    .menu-btn { display: block; }
    .topbar { padding: 16px 16px 4px; }
    .topbar h1 { font-size: 19px; }
    .content { padding: 12px 16px 24px; }
    .flash { margin: 10px 16px 0; }
    .foot { padding: 14px 16px; }
    .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
    .auth { grid-template-columns: 1fr; }
    .auth-art { padding: 28px 20px; }
    .auth-art h1 { font-size: 24px; }
    .auth-art .feature-list { display: none; }
    .copies { grid-template-columns: 1fr; }
    .copy { border-right: 0; border-bottom: 1px dashed #9aa3b8; }
    .dl { grid-template-columns: 120px 1fr; }
}
@media (max-width: 520px) {
    .g4 { grid-template-columns: minmax(0, 1fr); }
    .hero .due { text-align: left; }
}
