/* SchoolFee Manager - Corporate Theme
   Modern, polished design system */

:root {
    /* Brand */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-50: #eff6ff;

    /* Accents */
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;

    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Sidebar (dark) */
    --sidebar-bg: #0f172a;
    --sidebar-bg-2: #1e293b;
    --sidebar-fg: #cbd5e1;
    --sidebar-fg-2: #94a3b8;
    --sidebar-active: #3b82f6;
    --sidebar-hover: #1e293b;
    --sidebar-border: #1e293b;

    /* Layout */
    --sidebar-w: 240px;
    --topbar-h: 64px;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .08), 0 2px 4px -1px rgba(15, 23, 42, .04);
    --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, .08), 0 4px 6px -2px rgba(15, 23, 42, .04);

    /* Body */
    --body-bg: #f8fafc;
    --body-fg: #0f172a;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--body-bg);
    color: var(--body-fg);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--gray-900); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 13px; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Layout */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform .3s;
    border-right: 1px solid var(--sidebar-border);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 3px; }

.sidebar-header {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    background: linear-gradient(180deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 100%);
}
.sidebar-logo { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.sidebar-logo-placeholder {
    width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px; box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.sidebar-title { font-size: 14px; font-weight: 600; line-height: 1.2; color: #fff; }
.sidebar-subtitle { font-size: 11px; color: var(--sidebar-fg-2); margin-top: 2px; }

.sidebar-nav { padding: 8px 0 16px; }
.sidebar-nav .nav-section {
    padding: 14px 18px 6px;
    font-size: 10.5px;
    color: var(--sidebar-fg-2);
    text-transform: uppercase;
    letter-spacing: .8px;
    font-weight: 600;
}
.sidebar-nav .nav-link {
    color: var(--sidebar-fg);
    padding: 9px 18px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-left: 3px solid transparent;
    text-decoration: none;
    font-size: 13.5px;
    transition: all .15s;
    font-weight: 500;
}
.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 15px; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, .18) 0%, rgba(59, 130, 246, .05) 100%);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

/* Main */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--body-bg);
}

/* Topbar */
.topbar {
    background: #fff;
    padding: 0 24px;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.topbar-title { font-weight: 600; font-size: 16px; color: var(--gray-900); }
.topbar-user a { color: var(--gray-700); text-decoration: none; display: flex; align-items: center; gap: 6px; }
.topbar-user a:hover { color: var(--primary); }
.topbar-user .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
}
.topbar-user .role-badge {
    font-size: 10.5px; padding: 2px 8px; border-radius: 10px;
    background: var(--primary-50); color: var(--primary-dark);
    font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
}

/* Content */
.content { padding: 24px 28px; flex: 1; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.page-header h1 { margin: 0 0 4px; }
.page-header .subtitle { color: var(--gray-500); font-size: 13px; }
.page-actions { display: flex; gap: 8px; }

/* Cards */
.card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--gray-900);
    font-size: 14px;
}
.card-header h5, .card-header h6 { margin: 0; font-size: 14px; }
.card-body { padding: 20px; }
.card-footer { background: var(--gray-50); border-top: 1px solid var(--gray-200); padding: 12px 20px; }
.card-flush { box-shadow: none; }

/* Stat cards */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-sm);
    transition: all .2s;
    height: 100%;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: var(--info); }
.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-50); color: var(--primary);
    font-size: 18px; margin-bottom: 12px;
}
.stat-card.success .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.danger .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card.info .stat-icon { background: var(--info-light); color: var(--info); }
.stat-card .stat-label { color: var(--gray-500); font-size: 11.5px; text-transform: uppercase; font-weight: 600; letter-spacing: .5px; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-card .stat-meta { color: var(--gray-400); font-size: 12px; margin-top: 4px; }
.stat-card .stat-trend { font-size: 12px; margin-top: 6px; }
.stat-card .stat-trend.up { color: var(--success); }
.stat-card .stat-trend.down { color: var(--danger); }

/* Tables */
.table { width: 100%; margin: 0; color: var(--gray-700); font-size: 13.5px; }
.table > :not(caption) > * > * { padding: 12px 16px; }
.table thead th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-size: 11.5px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: .4px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody td { border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }

/* Buttons */
.btn {
    font-size: 13px; font-weight: 500;
    padding: 7px 14px; border-radius: var(--radius-sm);
    border: 1px solid transparent; transition: all .15s;
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #047857; border-color: #047857; color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; border-color: #b45309; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-info { background: var(--info); border-color: var(--info); color: #fff; }
.btn-info:hover { background: #0e7490; border-color: #0e7490; color: #fff; }
.btn-outline-primary { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-50); color: var(--primary-dark); }
.btn-outline-secondary { background: transparent; border-color: var(--gray-300); color: var(--gray-700); }
.btn-outline-secondary:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-light); }
.btn-outline-success { background: transparent; border-color: var(--success); color: var(--success); }
.btn-outline-success:hover { background: var(--success-light); }

/* Forms */
.form-label { font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.form-control, .form-select {
    font-size: 13.5px; padding: 8px 12px;
    border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
    color: var(--gray-800); background: #fff; transition: all .15s;
}
.form-control:focus, .form-select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}
.form-text { color: var(--gray-500); font-size: 12px; }
.input-group-text { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-600); font-size: 13px; }

/* Badges */
.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 10px; letter-spacing: .3px; }
.badge-paid, .badge-success { background: var(--success-light); color: var(--success); }
.badge-pending, .badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-partial, .badge-info { background: var(--info-light); color: var(--info); }
.badge-cancelled, .badge-secondary { background: var(--gray-200); color: var(--gray-600); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-primary { background: var(--primary-50); color: var(--primary-dark); }

/* Alerts */
.alert {
    border: none; border-radius: var(--radius);
    padding: 12px 16px; font-size: 13.5px; margin-bottom: 16px;
    border-left: 4px solid;
}
.alert-success { background: var(--success-light); color: #065f46; border-left-color: var(--success); }
.alert-danger { background: var(--danger-light); color: #991b1b; border-left-color: var(--danger); }
.alert-warning { background: var(--warning-light); color: #92400e; border-left-color: var(--warning); }
.alert-info { background: var(--info-light); color: #155e75; border-left-color: var(--info); }
.alert .btn-close { padding: 12px; }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #312e81 50%, #4c1d95 100%);
    background-image:
        radial-gradient(at 20% 30%, rgba(37, 99, 235, .35) 0, transparent 50%),
        radial-gradient(at 80% 70%, rgba(139, 92, 246, .35) 0, transparent 50%),
        linear-gradient(135deg, #1e3a8a 0%, #312e81 50%, #4c1d95 100%);
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 16px;
    box-shadow: 0 25px 70px rgba(0,0,0,.25);
    padding: 40px 36px; width: 100%; max-width: 440px;
    border: 1px solid rgba(255,255,255,.2);
}
.login-card h1 { font-size: 22px; text-align: center; margin-bottom: 4px; }
.login-card .subtitle { text-align: center; color: var(--gray-500); margin-bottom: 28px; font-size: 14px; }
.login-card .login-logo {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 18px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 30px; margin: 0 auto 18px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}
.login-card .login-logo img { width: 100%; height: 100%; border-radius: 18px; object-fit: cover; }
.login-card .btn-primary { padding: 10px; font-size: 14px; font-weight: 600; }
.login-card .demo-creds {
    background: var(--gray-50); border-radius: 10px;
    padding: 14px; margin-top: 20px; font-size: 12px;
    border: 1px solid var(--gray-200);
}
.login-card .demo-creds code { background: #fff; padding: 2px 6px; border-radius: 4px; font-size: 11px; border: 1px solid var(--gray-200); }

/* Footer */
.footer {
    padding: 16px 28px;
    border-top: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-500);
    text-align: center;
    font-size: 12.5px;
}

/* Avatars */
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--gray-200); display: flex; align-items: center; justify-content: center; color: var(--gray-500); font-weight: 600; font-size: 12px; }
.avatar-md { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--gray-200); display: flex; align-items: center; justify-content: center; color: var(--gray-500); font-weight: 600; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: var(--gray-200); display: flex; align-items: center; justify-content: center; color: var(--gray-500); font-weight: 600; font-size: 32px; }

/* Empty states */
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-500); }
.empty-state i { font-size: 40px; color: var(--gray-300); display: block; margin-bottom: 12px; }

/* Mobile */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .stat-card { margin-bottom: 12px; }
}

/* Print */
@media print {
    .sidebar, .topbar, .footer, .no-print { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff !important; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; page-break-inside: avoid; }
    a { color: #000 !important; text-decoration: none !important; }
    .table { font-size: 11px; }
    .table thead th { background: #f0f0f0 !important; }
}

/* Receipt styles */
.receipt-container { max-width: 800px; margin: 0 auto; padding: 20px; background: #fff; }
.receipt-header { display: flex; align-items: center; gap: 20px; padding-bottom: 16px; border-bottom: 3px double #000; margin-bottom: 20px; }
.receipt-logo { max-height: 70px; max-width: 70px; object-fit: contain; }
.receipt-school-name { font-size: 22px; font-weight: 700; line-height: 1.1; }
.receipt-school-meta { font-size: 12px; color: #555; margin-top: 4px; line-height: 1.4; }
.receipt-title { text-align: center; font-size: 16px; font-weight: 700; letter-spacing: 3px; margin: 16px 0; padding: 8px; background: var(--gray-100); border: 1px solid var(--gray-300); }
.receipt-qr { width: 100px; height: 100px; }
.receipt-info-row { display: flex; gap: 30px; margin-bottom: 16px; }
.receipt-info-row table { flex: 1; }
.receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.receipt-table th { background: #f0f0f0; padding: 8px 10px; text-align: left; border: 1px solid #ccc; font-size: 12px; }
.receipt-table td { padding: 8px 10px; border: 1px solid #ccc; font-size: 12px; }
.receipt-totals td { font-weight: 600; background: #f8f8f8; }
.receipt-totals tr.grand td { font-size: 14px; background: #2563eb; color: #fff; }
.receipt-footer { margin-top: 30px; padding-top: 16px; border-top: 1px solid #ddd; }
.receipt-sig { display: flex; justify-content: space-between; margin-top: 40px; }
.receipt-sig-block { text-align: center; min-width: 200px; }
.receipt-sig-line { border-top: 1px solid #000; padding-top: 6px; font-size: 12px; }
.receipt-watermark {
    position: absolute; opacity: .08; font-size: 80px;
    transform: rotate(-30deg); top: 35%; left: 25%;
    pointer-events: none; font-weight: 900; color: #2563eb;
    z-index: 0;
}
.receipt-relative { position: relative; }
.receipt-content { position: relative; z-index: 1; }
.receipt-no-print { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding: 12px 16px; background: var(--primary-50); border-radius: 8px; border: 1px solid var(--primary-light); }
@media print {
    .receipt-no-print, .no-print { display: none !important; }
    .receipt-watermark { opacity: .06; }
    .receipt-totals tr.grand td { background: #1e40af !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== Branch switcher (multi-branch) ===== */
.branch-switcher { position: relative; }
.branch-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: 999px;
    background: var(--primary-50, #eff6ff);
    border: 1px solid var(--primary-light, #bfdbfe);
    color: var(--primary, #2563eb);
    font-size: 13px; font-weight: 600; text-decoration: none;
    max-width: 260px; white-space: nowrap;
    transition: background .15s ease, border-color .15s ease;
}
.branch-pill:hover { background: #dbeafe; color: var(--primary, #2563eb); }
.branch-pill-name { overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.branch-pill-static { background: var(--gray-100, #f1f3f5); border-color: var(--gray-300, #dee2e6); color: var(--gray-700, #495057); cursor: default; }
.branch-menu { min-width: 280px; max-height: 70vh; overflow-y: auto; }
.branch-menu .dropdown-item { white-space: normal; padding: 8px 14px; }
.branch-menu .dropdown-item.active,
.branch-menu .dropdown-item.active .text-muted { background: var(--primary, #2563eb); color: #fff !important; }
.branch-menu form { margin: 0; }
.branch-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--gray-100, #f1f3f5); color: var(--gray-700, #495057); font-weight: 600; }
@media (max-width: 768px) {
    .branch-pill-name { max-width: 90px; }
    .branch-pill { padding: 5px 10px; font-size: 12px; }
}

/* ===== Pagination (Bootstrap 5 paginator) ===== */
.card-footer .pagination { margin: 0; }
/* Only paginated footers become flex rows. Making EVERY .card-footer a flex
   container collapsed footers that hold a Bootstrap .row (e.g. the Collect Fee
   footer squeezed its button down to ~110px). */
.card-footer:has(.pagination) {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px; padding: 12px 16px;
}
.card-footer .pagination .page-link { padding: 5px 11px; font-size: 13px; }
.card-footer > nav:only-child { margin-left: auto; }
/* the paginator's "Showing x to y" line */
.card-footer .pagination-info, .card-footer p.small { margin: 0; color: var(--gray-500, #64748b); }

/* ===== Student header strip ===== */
.student-header-photo {
    width: 62px; height: 62px; border-radius: 12px; object-fit: cover;
    border: 2px solid var(--primary-light, #bfdbfe); background: #f1f5f9;
}
.student-header-meta {
    display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px;
    font-size: 12.5px; color: var(--gray-600, #475569);
}
.student-header-meta i { color: var(--gray-400, #94a3b8); margin-right: 3px; }

/* ===== Fee summary cards ===== */
.fee-summary .fs-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
    color: var(--gray-500, #64748b); font-weight: 600;
}
.fee-summary .fs-value { font-size: 18px; font-weight: 700; margin-top: 3px; line-height: 1.2; }
.fee-summary .fs-meta { font-size: 11px; color: var(--gray-400, #94a3b8); margin-top: 2px; }

/* ===== Assigned fees table ===== */
.fee-table th {
    font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
    color: var(--gray-500, #64748b); white-space: nowrap;
    background: var(--gray-50, #f8fafc);
}
.fee-table td { font-size: 13px; }
.fee-table tfoot td { border-top: 2px solid var(--gray-300, #cbd5e1); }
tr.table-danger-subtle > td { background: #fff5f5; }
.info-table th { font-weight: 500; color: var(--gray-500, #64748b); font-size: 12.5px; width: 42%; }
.info-table td { font-size: 13px; font-weight: 500; }

/* Buttons: fill and center content properly (Collect Fee etc.) */
.btn { justify-content: center; text-align: center; }
.btn.w-100, .d-grid .btn { display: flex; width: 100%; }
.btn-lg.btn-success, button.btn-success[type="submit"] {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: #fff !important;
}
.btn-lg.btn-success:hover { background: #047857 !important; border-color: #047857 !important; }

/* ===== Collect Fee footer: totals + one unmissable action button ===== */
.collect-footer {
    display: flex; flex-wrap: wrap; gap: 18px;
    align-items: flex-end; justify-content: space-between;
    padding: 16px 18px;
}
.collect-totals { flex: 1 1 260px; min-width: 240px; }
.collect-totals .ct-line {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 13px; padding: 4px 0; color: var(--gray-600, #475569);
    border-bottom: 1px dashed var(--gray-200, #e2e8f0);
}
.collect-totals .ct-line b { font-weight: 600; color: var(--gray-900, #0f172a); }
.collect-totals .ct-disc b { color: var(--success, #059669); }
.collect-totals .ct-fine b { color: var(--warning, #d97706); }
/* advance is cash on this receipt, but it settles no fee row yet */
.collect-totals .ct-adv b { color: var(--primary, #1d4ed8); }
.collect-totals .ct-total {
    border-bottom: 0; margin-top: 6px; padding-top: 8px;
    border-top: 2px solid var(--gray-300, #cbd5e1);
    font-size: 15px; font-weight: 600; color: var(--gray-700, #334155);
}
.collect-totals .ct-total b { font-size: 22px; color: var(--primary, #1d4ed8); }

/* button never wraps, so the fill always covers the whole control */
.btn-collect {
    flex: 0 0 auto;
    display: inline-flex !important; align-items: center; justify-content: center; gap: 8px;
    white-space: nowrap; padding: 14px 26px; font-size: 15px; font-weight: 600;
    min-width: 260px; border-radius: var(--radius-sm, 8px);
    background: var(--success, #059669) !important;
    border: 1px solid var(--success, #059669) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, .28);
}
.btn-collect:hover { background: #047857 !important; border-color: #047857 !important; }
.btn-collect i { font-size: 18px; }
@media (max-width: 640px) {
    .btn-collect { width: 100%; min-width: 0; }
}

/* ===== Collect Fee: amount-received allocator ===== */
.quickpay-card { border-color: var(--primary-light, #bfdbfe); background: var(--primary-50, #eff6ff); }
.quickpay-card .input-group-text { background: #fff; font-weight: 600; }
.quickpay-card .form-control { font-size: 18px; font-weight: 600; }

/* ===== Session bar + outstanding chips ===== */
.session-bar { border-color: var(--primary-light, #bfdbfe); }
.due-chip {
    border: 1px solid var(--gray-200, #e2e8f0); border-radius: 10px;
    padding: 8px 14px; min-width: 150px; background: #fff;
}
.due-chip .due-k {
    display: block; font-size: 10.5px; text-transform: uppercase;
    letter-spacing: .5px; color: var(--gray-500, #64748b); font-weight: 600;
}
.due-chip .due-v { display: block; font-size: 17px; font-weight: 700; margin-top: 2px; }
.due-chip-warn { border-color: #fcd34d; background: #fffbeb; }
.due-chip-total { border-color: var(--primary, #1d4ed8); background: var(--primary-50, #eff6ff); }
.due-chip-total .due-v { color: var(--primary-dark, #1e40af); }

/* session chip in the student header — makes it obvious which year you're on */
.session-tag {
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    padding: 1px 10px;
    font-weight: 600;
}

/* collect footer: the balance line closes the Assigned → Due story */
.collect-totals .ct-balance { border-top: 1px dashed #cbd5e1; padding-top: 4px; margin-top: 2px; }
.collect-totals .ct-balance b { color: #b91c1c; }

/* ---------------------------------------------------------------------------
   Toasts.
   The Collect Fee page used to answer a button press with one line of small
   grey text under it, which the office simply did not see — so pressing
   "Allocate" felt like pressing nothing. A press now gets an answer that
   arrives where the eye already is.
--------------------------------------------------------------------------- */
.sb-toasts {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: min(24rem, calc(100vw - 2rem));
    pointer-events: none;
}

.sb-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .7rem .85rem;
    border-radius: 8px;
    border-left: 4px solid currentColor;
    background: #fff;
    box-shadow: 0 6px 24px rgba(15, 23, 42, .16), 0 1px 3px rgba(15, 23, 42, .1);
    font-size: .9rem;
    line-height: 1.35;
    animation: sb-toast-in .18s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .sb-toast { animation: none; }
}

@keyframes sb-toast-in {
    from { opacity: 0; transform: translateX(1rem); }
    to   { opacity: 1; transform: none; }
}

.sb-toast.leaving { opacity: 0; transition: opacity .18s ease-in; }

.sb-toast i.sb-toast-icon { font-size: 1.05rem; line-height: 1.2; flex: 0 0 auto; }
.sb-toast .sb-toast-body { flex: 1 1 auto; color: #1e293b; }
.sb-toast .sb-toast-body strong { display: block; }
.sb-toast .sb-toast-close {
    flex: 0 0 auto; border: 0; background: none; color: #94a3b8;
    font-size: 1.1rem; line-height: 1; padding: 0 .1rem; cursor: pointer;
}
.sb-toast .sb-toast-close:hover { color: #475569; }

.sb-toast.is-success { color: #15803d; }
.sb-toast.is-warning { color: #b45309; }
.sb-toast.is-danger  { color: #b91c1c; }
.sb-toast.is-info    { color: #1d4ed8; }

/* ---------------------------------------------------------------------------
   Collect Fee: what THIS receipt will do.
   Green = the amount entered clears that month in full.
   Amber = it only part-pays it.
   Distinct from .table-success, which means "was already paid before today".
--------------------------------------------------------------------------- */
tr.will-clear   { background: #dcfce7 !important; }
tr.will-partial { background: #fef3c7 !important; }

tr.will-clear td, tr.will-partial td { border-bottom-color: rgba(0, 0, 0, .06); }

tr.will-clear .fee-verdict,
tr.will-partial .fee-verdict {
    display: inline-block;
    margin-top: .2rem;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .02em;
    padding: .1rem .4rem;
    border-radius: 3px;
}
tr.will-clear .fee-verdict   { background: #15803d; color: #fff; }
tr.will-partial .fee-verdict { background: #b45309; color: #fff; }

/* Money typed at the counter that no selected month can take. A toast said so
   and then vanished; this stays until it is dealt with. */
.collect-totals .ct-unplaced b { color: #b45309; }
.collect-totals .ct-unplaced span { color: #b45309; }
