* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

body {
    font-family: Arial, sans-serif;
    background: #f4f6fa;
    color: #172033;
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #14243c;
    color: white;
    padding: 24px 18px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    font-size: 26px;
    margin-bottom: 6px;
}

.sidebar p {
    color: #aabbd0;
    font-size: 13px;
    margin-bottom: 30px;
}

.nav-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-bottom: 6px;
    background: transparent;
    color: #d5deeb;
    border: none;
    border-radius: 8px;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
}

.nav-btn:hover,
.nav-btn.active {
    background: #345784;
    color: white;
}

.sidebar footer {
    margin-top: auto;
    padding-top: 30px;
    font-size: 12px;
    color: #aabbd0;
}

.main {
    flex: 1;
    min-width: 0;
    padding: 30px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

header p {
    color: #64748b;
    font-size: 14px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0;
}

.card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 20px;
}

.stats .card {
    margin-bottom: 0;
}

.card p {
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.5;
}

.card h2 {
    margin-bottom: 14px;
}

.stats h2 {
    font-size: 28px;
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.recovery {
    background: #fff8ed;
    border-color: #efdbb8;
}

.recovery h2 {
    color: #92550e;
}

button, input, select, textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.primary-btn {
    background: #14243c;
    color: white;
    border: none;
    border-radius: 7px;
    padding: 12px 18px;
}

.primary-btn:hover {
    background: #345784;
}

.secondary-btn {
    background: white;
    color: #172033;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 11px 16px;
}

.secondary-btn:hover {
    background: #f1f5f9;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
}

input, select, textarea {
    width: 100%;
    min-width: 0;
    padding: 11px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: white;
    color: #172033;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid #93b4e0;
    outline-offset: 1px;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

#student-search {
    flex: 1;
    min-width: 160px;
}

#status-filter {
    width: auto;
    max-width: 100%;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 13px 10px;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background: #f1f5f9;
    white-space: nowrap;
}

td {
    overflow-wrap: anywhere;
}

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 12px;
}

.status.active {
    background: #dcfce7;
    color: #166534;
}

.status.archived {
    background: #e2e8f0;
    color: #475569;
}

.action-btn {
    background: white;
    color: #172033;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    padding: 7px 10px;
    margin: 3px;
    font-size: 12px;
}

.action-btn:hover {
    background: #f1f5f9;
}

#notice {
    background: #dcfce7;
    color: #166534;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 18px;
}

#notice.error {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 900px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .main {
        padding: 16px;
    }

    .stats, .form-grid {
        grid-template-columns: 1fr;
    }
}
/* TuitionFlow V0.3 Batch Management */

#batch-search {
    flex: 1;
    min-width: 160px;
}

#batch-filter {
    width: auto;
    max-width: 100%;
}

#batch-list {
    display: grid;
    grid-template-columns: repeat(
        2, minmax(0, 1fr)
    );
    gap: 18px;
}

.batch-card {
    min-width: 0;
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.batch-schedule {
    margin-top: 15px;
}

.batch-progress {
    width: 100%;
    height: 14px;
    accent-color: #25866a;
    margin: 5px 0 12px;
}

.capacity-warning {
    color: #a16207 !important;
    background: #fff8ed;
    border-radius: 6px;
    padding: 10px;
    font-weight: bold;
}

.batch-subheading {
    margin-top: 22px;
    margin-bottom: 12px;
    font-size: 16px;
}

.enrollment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}

.assignment-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.assignment-row select {
    flex: 1;
    min-width: 120px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 1100px) {
    #batch-list {
        grid-template-columns: 1fr;
    }
}

/* TuitionFlow V0.4 Fee Management */

.fee-stats {
    grid-template-columns: repeat(
        4, minmax(0, 1fr)
    );
}

#fee-search {
    flex: 1;
    min-width: 160px;
}

#fee-filter {
    width: auto;
    max-width: 100%;
}

.invoice-total {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.invoice-total h2 {
    font-size: 28px;
    margin-bottom: 0;
}

.fee-unpaid {
    background: #fef3c7;
    color: #92400e;
}

.fee-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.fee-cancelled {
    background: #e2e8f0;
    color: #475569;
}

.fee-no-payment-due {
    background: #dcfce7;
    color: #166534;
}

#missing-students {
    padding-left: 22px;
    line-height: 1.8;
    font-size: 14px;
}

#fee-table .status {
    white-space: nowrap;
    text-transform: capitalize;
}

#fee-table td {
    min-width: 85px;
}

@media (max-width: 1100px) {
    .fee-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .fee-stats {
        grid-template-columns: 1fr;
    }
}

/* TuitionFlow V0.5 Payment Management */

.fee-paid {
    background: #dcfce7;
    color: #166534;
}

.fee-partially-paid {
    background: #dbeafe;
    color: #1e40af;
}

.fee-partially-paid-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.payment-filters {
    margin-bottom: 24px;
}

.pay-full-wrapper {
    display: flex;
    align-items: flex-end;
}

.pay-full-wrapper button {
    width: 100%;
}

#payment-table td {
    min-width: 85px;
}

#payment-table .status {
    white-space: nowrap;
}

.recent-payment-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #e2e8f0;
}

.recent-payment-row span {
    font-size: 13px;
    color: #64748b;
}

.recent-payment-row strong:last-child {
    color: #166534;
}

@media (max-width: 600px) {

    .recent-payment-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* TuitionFlow V0.6 Revenue Leakage Detector */

.recovery-hero {
    background: #14243c;
    color: white;
    border-radius: 12px;
    padding: 26px;
    margin-bottom: 24px;
}

.recovery-hero p {
    color: #cbd5e1;
    line-height: 1.6;
}

.recovery-hero h2 {
    font-size: 36px;
    margin: 12px 0;
    overflow-wrap: anywhere;
}

.recovery-stats {
    grid-template-columns: repeat(
        4, minmax(0, 1fr)
    );
}

#recovery-search {
    flex: 1;
    min-width: 160px;
}

#recovery-filter {
    width: auto;
    max-width: 100%;
}

#recovery-month {
    display: block;
    margin-top: 8px;
}

#recovery-table td {
    min-width: 85px;
}

#recovery-table .action-btn {
    margin: 3px;
}

.recovery-priority-critical {
    background: #7f1d1d;
    color: #ffffff;
}

.recovery-priority-high {
    background: #fee2e2;
    color: #991b1b;
}

.recovery-priority-medium {
    background: #ffedd5;
    color: #9a3412;
}

.recovery-priority-low {
    background: #fef3c7;
    color: #92400e;
}

.recovery-priority-review {
    background: #dbeafe;
    color: #1e40af;
}

.recovery-priority-monitor {
    background: #e2e8f0;
    color: #475569;
}

.ageing-row {
    margin: 20px 0;
}

.ageing-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 14px;
}

.recovery-track {
    height: 12px;
    background: #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
}

.recovery-bar {
    height: 100%;
    width: 0;
    background: #d97706;
    border-radius: 20px;
    transition: width 0.3s ease;
}

.capacity-bar {
    background: #25866a;
}

#opportunity-fill {
    width: 100%;
    accent-color: #14243c;
}

#opportunity-percent {
    margin-left: 10px;
}

/* Dashboard layout correction */

#dashboard {
    display: block;
}

#dashboard[hidden] {
    display: none !important;
}

#dashboard .stats {
    display: grid;
    grid-template-columns: repeat(
        3, minmax(0, 1fr)
    );
    width: 100%;
}

#dashboard .stats .stats {
    grid-column: 1 / -1;
    margin: 0;
}

#dashboard .stats > .recovery {
    grid-column: 1 / -1;
}

#dashboard .stats > .card:has(#recent-payments) {
    grid-column: 1 / -1;
}

#dashboard .stats h2,
.recovery-stats h2 {
    font-size: clamp(18px, 2vw, 28px);
    overflow-wrap: anywhere;
}

@media (max-width: 1100px) {

    .recovery-stats {
        grid-template-columns: repeat(
            2, minmax(0, 1fr)
        );
    }
}

@media (max-width: 900px) {

    #dashboard .stats {
        grid-template-columns: repeat(
            2, minmax(0, 1fr)
        );
    }
}

@media (max-width: 600px) {

    #dashboard .stats,
    .recovery-stats {
        grid-template-columns: 1fr;
    }

    .recovery-hero h2 {
        font-size: 28px;
    }
}