/* ============================================================
   FeePayment.css  —  Fee Processing Terminal
   Telerik RadGridView-inspired grid + Premium UI
   ============================================================ */

/* ---- Utility ---- */
.hidden { display: none !important; }
.mt-2  { margin-top: 0.5rem; }
.mt-4  { margin-top: 1rem; }
.text-primary { color: var(--primary); }
.text-neutral { color: var(--text-muted); }
.text-danger  { color: #f87171; }
.text-success { color: #4ade80; }

/* Global font-size floor: everything inherits from here */
body {
    font-size: 15px;
    line-height: 1.6;
}

/* ---- Layout ---- */
.app-container {
    flex: 1 1 auto;
    width: min(1680px, calc(100% - 24px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    grid-template-areas: "sidebar workspace";
    align-items: stretch;
    gap: 1.5rem;
    padding: 1.5rem;
    min-height: calc(100vh - 70px);
    box-sizing: border-box;
    overflow: hidden;
}

.sidebar {
    grid-area: sidebar;
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 1.25rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    align-self: stretch;
    min-height: 0;
    height: 100%;
}

.sidebar,
.dues-panel,
.history-panel,
.student-header,
.receipt-card,
.receipt-note-box,
.receipt-summary-box {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sidebar h3 {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 1rem 0 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
}

.filter-group,
.fee-sms-group,
.fee-year-lock {
    background-color: rgba(255, 255, 255, 0.045);
    border-radius: 8px;
}

.filter-group label {
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.fee-year-lock {
    padding: 0.8rem 0.9rem;
    border-radius: 16px;
    border: 1px solid rgba(59, 130, 246, 0.28);
    background:
        radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.18), transparent 34%),
        rgba(59, 130, 246, 0.08);
}

.fee-year-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 44px;
    padding: 0.72rem 0.85rem;
    border-radius: 13px;
    border: 1px solid rgba(96, 165, 250, 0.34);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.24), rgba(14, 165, 233, 0.12));
    color: #dbeafe;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.fee-year-badge i {
    color: #93c5fd;
    font-size: 1.1rem;
}

.fee-year-badge.is-missing {
    border-color: rgba(248, 113, 113, 0.42);
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
}

.fee-sms-group {
    padding: 0.8rem 0.9rem;
    border-radius: 14px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    gap: 0.55rem;
}

.fee-sms-toggle {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: var(--text-main) !important;
    cursor: pointer;
}

.fee-sms-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.fee-sms-toggle span {
    font-size: 0.93rem;
    font-weight: 600;
}

.fee-photo-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.7rem;
    padding: 0.72rem 0.8rem;
    border-radius: 14px;
    border: 1px solid rgba(var(--primary-rgb, 59,130,246), 0.24);
    background:
        linear-gradient(135deg, rgba(var(--primary-rgb, 59,130,246), 0.12), rgba(255,255,255,0.045));
    color: var(--text-main) !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    cursor: pointer;
}

.fee-photo-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.fee-photo-toggle span {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
}

.fee-photo-helper {
    padding: 0.1rem 0.2rem 0;
    margin: 0;
    line-height: 1.45;
}

.fee-sms-helper {
    padding: 0;
    margin: 0;
    align-items: flex-start;
}

.fee-sms-manage {
    align-self: flex-start;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-glass);
    margin: 1rem 0;
}

.main-workspace {
    grid-area: workspace;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-self: stretch;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.fee-shortcuts-bar {
    width: min(1680px, calc(100% - 24px));
    margin: 0 auto 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.68);
    color: var(--text-muted);
    font-size: 0.78rem;
    flex-shrink: 0;
}

.fee-shortcuts-bar span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 28px;
    padding: 0.15rem 0.45rem;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.fee-shortcuts-bar kbd {
    min-width: 22px;
    min-height: 20px;
    display: inline-grid;
    place-items: center;
    padding: 0 0.28rem;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-main);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
}

.dues-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: auto;
    overflow: hidden;
}

.history-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: auto;
    overflow: hidden;
}

.student-header,
.dues-panel,
.history-panel {
    margin-bottom: 1rem;
}

/* ---- Student Header ---- */
.student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.2rem;
    padding: 1.2rem 1.6rem;
    border-left: 4px solid var(--primary);
    flex-shrink: 0;
    border-radius: 10px;
}

.s-info {
    flex: 1 1 auto;
    min-width: 0;
}

.student-photo-confirm {
    width: 122px;
    min-width: 122px;
    display: grid;
    gap: 0.48rem;
    justify-items: center;
    padding: 0.75rem;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.18);
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.20), transparent 58%),
        rgba(255,255,255,0.08);
    box-shadow: 0 18px 34px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.16);
}

.student-photo-confirm img {
    width: 92px;
    height: 92px;
    border-radius: 16px;
    object-fit: cover;
    background: #fff;
    border: 3px solid rgba(var(--primary-rgb, 59,130,246), 0.48);
    box-shadow: 0 12px 24px rgba(0,0,0,0.24);
}

.student-photo-confirm span {
    max-width: 100%;
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.25;
    text-align: center;
    text-transform: uppercase;
}

.student-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
}

.student-header p {
    margin: 0.28rem 0 0;
    font-size: 0.98rem;
    color: #cbd5e1;
}

.student-meta {
    font-size: 1rem !important;
    font-weight: 600;
    color: #e2e8f0 !important;
}

.s-summary p {
    font-size: 1.02rem;
    color: #e2e8f0;
    text-align: right;
    font-weight: 600;
}

/* ---- Panel Headers ---- */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.glass-panel.flex-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.pay-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.receipt-style-select {
    min-width: 170px;
    padding: 0.62rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: rgba(255,255,255,0.06);
    color: var(--text-main);
    font-weight: 600;
}

.receipt-style-select option {
    color: #0f172a;
}

.total-bar {
    font-size: 0.95rem;
    background: rgba(255,255,255,0.06);
    padding: 0.45rem 1rem;
    border-radius: 6px;
    color: var(--text-main);
    border: 1px solid var(--border-glass);
    font-weight: 500;
}

.total-bar strong {
    color: var(--primary);
    font-weight: 700;
}

.helper-text {
    font-size: 0.84rem;
    color: var(--text-muted);
    padding: 0.4rem 1rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* ============================================================
   PROCESS PAYMENT BUTTON  (Premium + Theme-aware)
   ============================================================ */
.btn-process {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.6rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    white-space: nowrap;

    /* Default: vivid accent gradient */
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 4px 18px rgba(22, 163, 74, 0.45), 0 1px 4px rgba(0,0,0,0.3);
}

.btn-process i { font-size: 1.1rem; }

/* Animated shimmer stripe */
.btn-process-glow {
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

.btn-process:hover .btn-process-glow { left: 150%; }

.btn-process:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(22, 163, 74, 0.55), 0 2px 6px rgba(0,0,0,0.3);
}

.btn-process:active:not(:disabled) {
    transform: translateY(0);
}

.btn-process:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* --- Theme-specific Process Payment colors --- */
body.theme-slate .btn-process {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.55);
}
body.theme-slate .btn-process:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.7);
}

body.theme-dark .btn-process {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.5);
}
body.theme-dark .btn-process:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.65);
}

body.theme-ocean .btn-process {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.5);
}
body.theme-ocean .btn-process:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(14, 165, 233, 0.65);
}

body.theme-emerald .btn-process {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 18px rgba(5, 150, 105, 0.5);
}

body.theme-purple .btn-process {
    background: linear-gradient(135deg, #7e22ce 0%, #6b21a8 100%);
    box-shadow: 0 4px 18px rgba(126, 34, 206, 0.5);
}
body.theme-purple .btn-process:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(126, 34, 206, 0.65);
}

body.theme-ruby .btn-process {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 18px rgba(220, 38, 38, 0.5);
}
body.theme-ruby .btn-process:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(220, 38, 38, 0.65);
}

body.theme-neo .btn-process {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.45);
}

/* ============================================================
   TELERIK RADGRIDVIEW-INSPIRED AG-GRID THEME
   ============================================================ */

/* Grid container fills panel */
.fp-grid-wrap {
    min-height: 190px;
    overflow: hidden;
    position: relative;
}

.fee-grid-wrap {
    min-height: 0;
    overflow: visible;
    height: auto;
    margin-bottom: 0.5rem;
}

.fee-grid-wrap .ag-root-wrapper,
.fee-grid-wrap .ag-root-wrapper-body {
    min-height: 0 !important;
    overflow: visible !important;
    height: auto !important;
}

.fee-grid-wrap .ag-layout-auto-height,
.fee-grid-wrap .ag-center-cols-viewport,
.fee-grid-wrap .ag-center-cols-container,
.fee-grid-wrap .ag-body-viewport,
.fee-grid-wrap .ag-body-horizontal-scroll,
.fee-grid-wrap .ag-body-horizontal-scroll-viewport {
    overflow: visible !important;
}

.history-grid-wrap {
    min-height: 360px;
    height: 360px;
    overflow: hidden;
    display: block;
}

/* Override AG-Grid base */
.history-grid-wrap .ag-theme-alpine,
.history-grid-wrap > div {
    height: 100% !important;
}

.fee-grid-wrap .ag-theme-alpine,
.fee-grid-wrap > div {
    height: auto !important;
}

/* ---- Header Band ---- */
.fp-grid-wrap .ag-header {
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.04) 100%);
    border-bottom: 2px solid var(--primary) !important;
    min-height: 40px !important;
}

.fp-grid-wrap .ag-header-row {
    height: 40px !important;
}

.fp-grid-wrap .ag-header-cell {
    padding: 0 12px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-right: 1px solid var(--border-glass) !important;
    transition: background 0.15s;
}

.fp-grid-wrap .ag-header-cell:hover {
    background: rgba(255,255,255,0.06) !important;
}

.fp-grid-wrap .ag-header-cell-label {
    color: var(--primary);
    gap: 6px;
}

.fp-grid-wrap .ag-header-cell.paying-amount-header {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(251, 191, 36, 0.12)) !important;
    border-right-color: rgba(217, 119, 6, 0.35) !important;
}

.fp-grid-wrap .ag-header-cell.paying-amount-header .ag-header-cell-label {
    color: #b45309 !important;
}

/* Sort icons colored */
.fp-grid-wrap .ag-sort-indicator-icon {
    color: var(--primary);
    opacity: 0.7;
}

/* ---- Rows ---- */
.fp-grid-wrap .ag-row {
    border-bottom: 1px solid var(--border-glass) !important;
    transition: background 0.1s ease;
    font-size: 0.94rem;
    color: #0f172a !important;
    min-height: 48px !important;
}

.fp-grid-wrap .ag-row-even {
    background: #ffffff;
}

.fp-grid-wrap .ag-row-odd {
    background: #f8fafc;
}

.fp-grid-wrap .ag-row-hover {
    background: rgba(var(--primary-rgb, 59,130,246), 0.08) !important;
    border-left: 3px solid var(--primary) !important;
}

.fp-grid-wrap .ag-row-pinned,
.fp-grid-wrap .ag-floating-bottom,
.fp-grid-wrap .ag-pinned-bottom-row {
    background: #dbeafe !important;
    border-top: 1px solid rgba(var(--primary-rgb, 59,130,246), 0.38) !important;
    font-weight: 800;
}

.fp-grid-wrap .ag-row-selected {
    background: rgba(var(--primary-rgb, 59,130,246), 0.14) !important;
    border-left: 3px solid var(--primary) !important;
}

/* ---- Cells ---- */
.fp-grid-wrap .ag-cell {
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-right: 1px solid rgba(15,23,42,0.08) !important;
    font-feature-settings: 'tnum';
    color: #0f172a !important;
    line-height: 1.25;
}

.fp-grid-wrap .ag-cell.amount-cell,
.fp-grid-wrap .ag-cell[col-id*="Amount"],
.fp-grid-wrap .ag-cell[col-id*="Paid"],
.fp-grid-wrap .ag-cell[col-id*="Balance"],
.fp-grid-wrap .ag-cell[col-id*="Total"],
.fp-grid-wrap .ag-cell[col-id*="Concession"],
.receipt-table th:nth-child(n + 2),
.receipt-table td:nth-child(n + 2) {
    justify-content: flex-end !important;
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.fee-grid-overlay {
    min-width: 260px;
    display: grid;
    justify-items: center;
    gap: 0.55rem;
    padding: 1.2rem;
    color: #64748b;
    text-align: center;
}

.fee-grid-overlay i {
    width: 56px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(var(--primary-rgb, 59,130,246), 0.1);
    color: var(--primary);
    font-size: 1.7rem;
}

.fee-grid-overlay strong {
    color: #0f172a;
    font-size: 0.98rem;
}

.fee-grid-overlay .erp-loading-skeleton {
    width: 220px;
    height: 12px;
}

.fp-grid-wrap .ag-cell-value {
    color: inherit !important;
    font-weight: 600;
}

.fp-grid-wrap .ag-row-hover .ag-cell,
.fp-grid-wrap .ag-row-selected .ag-cell,
.fp-grid-wrap .ag-row-hover .ag-cell-value,
.fp-grid-wrap .ag-row-selected .ag-cell-value {
    color: #0f172a !important;
}

/* Revert for specific colored data cells */
.fp-grid-wrap .ag-cell[col-id="Paid"],
.fp-grid-wrap .ag-cell[col-id="Amount_Paid"] {
    color: #4ade80 !important;
    font-weight: 700;
}

.fp-grid-wrap .ag-cell[col-id="Concession"] {
    color: #a78bfa !important;
    font-weight: 700;
}

.fp-grid-wrap .ag-cell[col-id="Balance"] {
    font-weight: 700;
}


/* Editable cell highlight */
.fp-grid-wrap .ag-cell.editable-cell,
.fp-grid-wrap .ag-cell[col-id="PayingAmount"] {
    background: linear-gradient(135deg, rgba(255, 247, 237, 0.98), rgba(254, 243, 199, 0.92));
    border: 1px solid rgba(217, 119, 6, 0.32) !important;
    border-radius: 4px;
    font-weight: 800;
    cursor: text;
    color: #92400e !important;
    box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.88);
}

.fp-grid-wrap .ag-cell[col-id="PayingAmount"]:hover {
    background: linear-gradient(135deg, rgba(254, 243, 199, 1), rgba(253, 230, 138, 0.95));
    color: #78350f !important;
}

/* ---- Checkbox ---- */
.fp-grid-wrap .ag-checkbox-input-wrapper {
    box-shadow: none !important;
}

.fp-grid-wrap .ag-checkbox-input-wrapper::after {
    color: var(--primary);
}

/* ---- Pagination ---- */
.fp-grid-wrap .ag-paging-panel {
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-glass) !important;
    background: rgba(255,255,255,0.025);
    height: 36px !important;
    min-height: 36px !important;
}

.fp-grid-wrap .ag-icon { color: var(--primary); }

/* ---- No rows overlay ---- */
.fp-grid-wrap .ag-overlay-no-rows-wrapper {
    background: transparent;
}

.fp-grid-wrap .ag-overlay-no-rows-center {
    color: #64748b !important;
}

/* ---- Primary-RGB helper for themes that need it ---- */
:root { --primary-rgb: 59,130,246; }
body.theme-slate   { --primary-rgb: 15,23,42; }
body.theme-dark    { --primary-rgb: 59,130,246; }
body.theme-ocean   { --primary-rgb: 14,165,233; }
body.theme-emerald { --primary-rgb: 5,150,105; }
body.theme-purple  { --primary-rgb: 126,34,206; }
body.theme-ruby    { --primary-rgb: 220,38,38; }
body.theme-neo     { --primary-rgb: 59,130,246; }

/* ============================================================
   STUDENT MINI-GRID  (inline 3-col AG-Grid inside sidebar)
   ============================================================ */
.student-mini-grid {
    width: 100%;
    height: 200px;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    margin-top: 0.4rem;
    flex-shrink: 0;
}

/* Mini-grid header */
.student-mini-grid .ag-header {
    background: linear-gradient(180deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.04) 100%);
    border-bottom: 2px solid var(--primary) !important;
    min-height: 34px !important;
}

.student-mini-grid .ag-header-row {
    height: 34px !important;
}

.student-mini-grid .ag-header-cell {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary);
    padding: 0 8px;
    border-right: 1px solid var(--border-glass) !important;
}

/* Mini-grid rows */
.student-mini-grid .ag-row {
    font-size: 0.84rem;
    color: #0f172a !important;
    cursor: pointer;
    border-bottom: 1px solid var(--border-glass) !important;
    min-height: 48px !important;
}

.student-mini-grid .ag-row-even  { background: #ffffff; }
.student-mini-grid .ag-row-odd   { background: #f8fafc; }

.student-mini-grid .ag-row-hover {
    background: rgba(var(--primary-rgb, 59,130,246), 0.12) !important;
}

.student-mini-grid .ag-row-selected {
    background: rgba(var(--primary-rgb, 59,130,246), 0.20) !important;
    border-left: 3px solid var(--primary) !important;
}

.student-mini-grid .ag-cell {
    font-size: 0.84rem;
    color: #0f172a !important;
    padding: 0 8px;
    display: flex;
    align-items: center;
    border-right: 1px solid rgba(15,23,42,0.08) !important;
}

.student-mini-grid .ag-cell-value {
    color: inherit !important;
    font-weight: 600;
}

.student-mini-grid .ag-row-hover .ag-cell,
.student-mini-grid .ag-row-selected .ag-cell {
    color: #0f172a !important;
}

.student-mini-grid .ag-cell[col-id="Stud_ID"] {
    font-weight: 700;
    color: var(--primary) !important;
    font-size: 0.78rem;
    font-family: monospace;
}

.student-mini-photo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: cover;
    background: #fff;
    border: 2px solid rgba(var(--primary-rgb, 59,130,246), 0.28);
    box-shadow: 0 5px 12px rgba(15,23,42,0.14);
}

/* Row count badge */
.student-count-badge {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    padding: 0 2px;
}

/* ============================================================
   LOADING DOTS (4-dot spinner inside sidebar)
   ============================================================ */
.student-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    animation: dot-pulse 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
.loading-dots span:nth-child(4) { animation-delay: 0.6s; }

@keyframes dot-pulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
    40%            { transform: scale(1);   opacity: 1;   }
}

/* ============================================================
   LOADER OVERLAY (full-screen)
   ============================================================ */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    gap: 1rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.loader-text {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal {
    width: 420px;
    padding: 2.5rem 2rem;
    text-align: center;
    border-radius: 16px;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes popIn {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.modal h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0;
    font-size: 1.4rem;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.receipt-modal-actions {
    flex-wrap: wrap;
    gap: 0.55rem;
}

.receipt-modal-actions .btn {
    min-height: 36px;
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.1;
}

.receipt-modal-actions .btn i {
    font-size: 0.95rem;
}

.receipt-shell {
    width: min(960px, 94vw);
    max-height: 92vh;
    overflow: auto;
    padding: 1.5rem;
    text-align: left;
}

.receipt-success {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.receipt-success h2 {
    justify-content: flex-start;
    margin-bottom: 0.35rem;
}

.receipt-sheet {
    position: relative;
    overflow: hidden;
    padding: 1.6rem;
    border-radius: 20px;
    background:
        radial-gradient(circle at top right, rgba(59,130,246,0.15), transparent 26%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    color: #0f172a;
    border: 1px solid rgba(59,130,246,0.15);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.receipt-sheet.pdf-compact {
    padding: 0.85rem;
    border-radius: 14px;
}

.receipt-sheet.pdf-compact .receipt-watermark {
    top: 10px;
    right: -6px;
    font-size: 2.8rem;
}

.receipt-sheet.pdf-compact .receipt-top {
    gap: 0.85rem;
    padding-bottom: 0.6rem;
}

.receipt-sheet.pdf-compact .receipt-logo-box {
    width: 72px;
    height: 72px;
    border-radius: 14px;
}

.receipt-sheet.pdf-compact .receipt-kicker {
    margin-bottom: 0.2rem;
    font-size: 0.66rem;
}

.receipt-sheet.pdf-compact .receipt-org h1 {
    font-size: 1.45rem;
}

.receipt-sheet.pdf-compact .receipt-tagline,
.receipt-sheet.pdf-compact .receipt-address {
    margin-top: 0.2rem;
    font-size: 0.82rem;
    line-height: 1.3;
}

.receipt-sheet.pdf-compact .receipt-badge-box {
    gap: 0.45rem;
    min-width: 150px;
}

.receipt-sheet.pdf-compact .receipt-badge {
    padding: 0.3rem 0.7rem;
    font-size: 0.72rem;
}

.receipt-sheet.pdf-compact .receipt-meta-chip {
    min-width: 150px;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
}

.receipt-sheet.pdf-compact .receipt-meta-chip strong {
    font-size: 1rem;
}

.receipt-sheet.pdf-compact .receipt-grid {
    margin-top: 0.7rem;
    gap: 0.7rem;
}

.receipt-sheet.pdf-compact .receipt-card,
.receipt-sheet.pdf-compact .receipt-note-box,
.receipt-sheet.pdf-compact .receipt-summary-box {
    padding: 0.75rem 0.8rem 0.7rem;
    border-radius: 12px;
}

.receipt-sheet.pdf-compact .receipt-card h4,
.receipt-sheet.pdf-compact .receipt-note-box h4 {
    margin-bottom: 0.5rem;
    font-size: 0.76rem;
}

.receipt-sheet.pdf-compact .receipt-info-list {
    gap: 0.45rem 0.75rem;
}

.receipt-sheet.pdf-compact .receipt-info-list span,
.receipt-sheet.pdf-compact .receipt-summary-box span,
.receipt-sheet.pdf-compact .receipt-signatures span {
    font-size: 0.62rem;
}

.receipt-sheet.pdf-compact .receipt-info-list strong,
.receipt-sheet.pdf-compact .receipt-summary-box strong,
.receipt-sheet.pdf-compact .receipt-signatures strong {
    font-size: 0.84rem;
}

.receipt-sheet.pdf-compact .receipt-table-wrap {
    margin-top: 0.65rem;
    border-radius: 12px;
}

.receipt-sheet.pdf-compact .receipt-table {
    min-width: 0;
    font-size: 0.82rem;
}

.receipt-sheet.pdf-compact .receipt-table th,
.receipt-sheet.pdf-compact .receipt-table td {
    padding: 0.5rem 0.65rem;
}

.receipt-sheet.pdf-compact .receipt-table th {
    font-size: 0.62rem;
}

.receipt-sheet.pdf-compact .receipt-footer-grid {
    margin-top: 0.7rem;
    gap: 0.7rem;
}

.receipt-sheet.pdf-compact .receipt-note-box p {
    font-size: 0.82rem;
    line-height: 1.45;
}

.receipt-sheet.pdf-compact .receipt-summary-box {
    gap: 0.45rem;
}

.receipt-sheet.pdf-compact .receipt-summary-box .grand {
    padding-top: 0.45rem;
}

.receipt-sheet.pdf-compact .receipt-summary-box .grand strong {
    font-size: 1rem;
}

.receipt-sheet.pdf-compact .receipt-signatures {
    margin-top: 0.75rem;
    padding-top: 0.7rem;
}

.receipt-sheet.pdf-compact .receipt-signatures div {
    min-width: 140px;
    gap: 0.2rem;
}

.receipt-sheet.receipt-half-page-fill-copy {
    padding: 0.92rem;
}

.receipt-sheet.receipt-half-page-fill-copy .receipt-logo-box {
    width: 78px;
    height: 78px;
}

.receipt-sheet.receipt-half-page-fill-copy .receipt-org h1 {
    font-size: 1.62rem;
}

.receipt-sheet.receipt-half-page-fill-copy .receipt-tagline,
.receipt-sheet.receipt-half-page-fill-copy .receipt-address {
    font-size: 0.9rem;
}

.receipt-sheet.receipt-half-page-fill-copy .receipt-info-list span,
.receipt-sheet.receipt-half-page-fill-copy .receipt-summary-box span,
.receipt-sheet.receipt-half-page-fill-copy .receipt-signatures span,
.receipt-sheet.receipt-half-page-fill-copy .receipt-table th {
    font-size: 0.7rem;
}

.receipt-sheet.receipt-half-page-fill-copy .receipt-info-list strong,
.receipt-sheet.receipt-half-page-fill-copy .receipt-summary-box strong,
.receipt-sheet.receipt-half-page-fill-copy .receipt-signatures strong,
.receipt-sheet.receipt-half-page-fill-copy .receipt-table td {
    font-size: 0.94rem;
}

.receipt-sheet.receipt-half-page-fill-copy .receipt-card h4,
.receipt-sheet.receipt-half-page-fill-copy .receipt-note-box h4 {
    font-size: 0.84rem;
}

.receipt-sheet.receipt-half-page-fill-copy .receipt-note-box p {
    font-size: 0.9rem;
}

.receipt-sheet.style-classic {
    background:
        linear-gradient(180deg, #fffdf7 0%, #fff9eb 100%);
    border-color: rgba(146, 64, 14, 0.18);
}

.receipt-sheet.style-classic .receipt-kicker,
.receipt-sheet.style-classic .receipt-card h4,
.receipt-sheet.style-classic .receipt-note-box h4,
.receipt-sheet.style-classic .receipt-table th {
    color: #92400e;
}

.receipt-sheet.style-classic .receipt-badge {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.receipt-sheet.style-royal {
    background:
        radial-gradient(circle at top left, rgba(129,140,248,0.2), transparent 28%),
        linear-gradient(180deg, #f6f5ff 0%, #eef2ff 100%);
    border-color: rgba(79, 70, 229, 0.2);
}

.receipt-sheet.style-royal .receipt-kicker,
.receipt-sheet.style-royal .receipt-card h4,
.receipt-sheet.style-royal .receipt-note-box h4,
.receipt-sheet.style-royal .receipt-table th {
    color: #4338ca;
}

.receipt-sheet.style-royal .receipt-meta-chip {
    background: linear-gradient(135deg, #312e81, #4338ca);
}

.receipt-sheet.style-emerald {
    background:
        radial-gradient(circle at top right, rgba(16,185,129,0.18), transparent 30%),
        linear-gradient(180deg, #f3fff9 0%, #ecfdf5 100%);
    border-color: rgba(5, 150, 105, 0.2);
}

.receipt-sheet.style-emerald .receipt-kicker,
.receipt-sheet.style-emerald .receipt-card h4,
.receipt-sheet.style-emerald .receipt-note-box h4,
.receipt-sheet.style-emerald .receipt-table th {
    color: #047857;
}

.receipt-sheet.style-emerald .receipt-badge {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #047857;
}

.receipt-sheet.style-sunset {
    background:
        radial-gradient(circle at top left, rgba(251,146,60,0.18), transparent 26%),
        linear-gradient(180deg, #fff8f2 0%, #fff1f2 100%);
    border-color: rgba(234, 88, 12, 0.18);
}

.receipt-sheet.style-sunset .receipt-kicker,
.receipt-sheet.style-sunset .receipt-card h4,
.receipt-sheet.style-sunset .receipt-note-box h4,
.receipt-sheet.style-sunset .receipt-table th {
    color: #c2410c;
}

.receipt-sheet.style-sunset .receipt-badge {
    background: linear-gradient(135deg, #ffedd5, #fecdd3);
    color: #c2410c;
}

.receipt-watermark {
    position: absolute;
    right: -14px;
    top: 24px;
    transform: rotate(20deg);
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    color: rgba(22,163,74,0.08);
    pointer-events: none;
}

.receipt-top {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: flex-start;
    padding-bottom: 1rem;
    border-bottom: 2px dashed rgba(15,23,42,0.12);
}

.receipt-logo-box {
    width: 92px;
    height: 92px;
    border-radius: 18px;
    border: 1px solid rgba(15,23,42,0.08);
    background: rgba(255,255,255,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    flex-shrink: 0;
}

.receipt-org-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.receipt-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.76rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #2563eb;
    font-weight: 800;
}

.receipt-org h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
    color: #0f172a;
}

.receipt-tagline,
.receipt-address {
    margin: 0.35rem 0 0;
    color: #475569;
    line-height: 1.45;
}

.receipt-badge-box {
    min-width: 180px;
    display: grid;
    gap: 0.7rem;
    justify-items: end;
}

.receipt-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.receipt-meta-chip {
    display: grid;
    gap: 0.15rem;
    padding: 0.9rem 1rem;
    min-width: 180px;
    border-radius: 16px;
    background: #0f172a;
    color: #e2e8f0;
}

.receipt-meta-chip span {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #93c5fd;
}

.receipt-meta-chip strong {
    font-size: 1.2rem;
    color: #fff;
}

.receipt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.1rem;
}

.receipt-card,
.receipt-note-box,
.receipt-summary-box {
    border-radius: 16px;
    border: 1px solid rgba(15,23,42,0.08);
    background: rgba(255,255,255,0.9);
    padding: 1rem 1rem 0.95rem;
}

.receipt-card h4,
.receipt-note-box h4 {
    margin: 0 0 0.8rem;
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1d4ed8;
}

.receipt-info-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem 1rem;
}

.receipt-info-list div,
.receipt-summary-box div {
    display: grid;
    gap: 0.2rem;
}

.receipt-info-list span,
.receipt-summary-box span,
.receipt-signatures span {
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.receipt-info-list strong,
.receipt-summary-box strong,
.receipt-signatures strong {
    color: #0f172a;
    font-size: 0.98rem;
}

.receipt-table-wrap {
    margin-top: 1rem;
    overflow: auto;
    border: 1px solid rgba(15,23,42,0.08);
    border-radius: 16px;
    background: rgba(255,255,255,0.92);
}

.receipt-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
}

.receipt-table th,
.receipt-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(15,23,42,0.08);
    text-align: left;
}

.receipt-table th {
    background: #eff6ff;
    color: #1d4ed8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 600;
}

.receipt-table td {
    color: #0f172a;
    font-weight: 600;
}

.receipt-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.receipt-table tbody tr:hover td {
    background: #eff6ff;
}

.receipt-table .total-row td {
    background: #dbeafe !important;
    border-top: 1px solid rgba(37, 99, 235, 0.34);
    font-weight: 800;
}

.receipt-footer-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    gap: 1rem;
    margin-top: 1rem;
}

.receipt-note-box p {
    margin: 0;
    color: #334155;
    line-height: 1.6;
}

.receipt-summary-box {
    display: grid;
    gap: 0.7rem;
}

.receipt-summary-box .grand {
    padding-top: 0.7rem;
    border-top: 1px dashed rgba(15,23,42,0.14);
}

.receipt-summary-box .grand strong {
    font-size: 1.2rem;
    color: #dc2626;
}

.receipt-signatures {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 2px dashed rgba(15,23,42,0.12);
}

.receipt-signatures div {
    min-width: 180px;
    display: grid;
    gap: 0.3rem;
}

@media (max-width: 900px) {
    .app-container {
        width: min(100%, calc(100% - 18px));
        margin: 0 auto;
        grid-template-columns: 1fr;
        grid-template-areas:
            "sidebar"
            "workspace";
        height: auto;
        overflow: visible;
    }

    .sidebar {
        grid-area: sidebar;
        width: 100%;
        max-width: none;
        height: auto;
    }

    .main-workspace {
        grid-area: workspace;
        height: auto;
        overflow: visible;
    }

    .student-header {
        align-items: stretch;
        flex-direction: column;
    }

    .student-photo-confirm {
        width: 100%;
        min-width: 0;
        grid-template-columns: auto 1fr;
        justify-items: start;
        text-align: left;
    }

    .student-photo-confirm img {
        width: 76px;
        height: 76px;
    }

    .receipt-success {
        flex-direction: column;
    }
}

/* Receipt output is a print/PDF contract. Keep it in desktop receipt layout
   on mobile too, so Print Receipt, Save PDF, and Duplicate Receipt match. */
@media (max-width: 900px) {
    #receipt-modal .receipt-shell {
        width: min(960px, 94vw) !important;
        max-width: 94vw !important;
        overflow: auto !important;
    }

    #receipt-modal .receipt-sheet {
        width: 200mm !important;
        max-width: 200mm !important;
        min-width: 200mm !important;
        margin: 0 auto !important;
    }

    #receipt-modal .receipt-top {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
    }

    #receipt-modal .receipt-badge-box {
        justify-items: end !important;
    }

    #receipt-modal .receipt-grid,
    #receipt-modal .receipt-info-list {
        grid-template-columns: 1fr 1fr !important;
    }

    #receipt-modal .receipt-footer-grid {
        grid-template-columns: 1.15fr 0.85fr !important;
    }

    #receipt-modal .receipt-signatures {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
    }

    #receipt-modal .receipt-table {
        min-width: 0 !important;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 5mm;
    }

    html,
    body {
        width: 210mm !important;
        min-height: 0 !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        background: #fff !important;
    }

    body * {
        visibility: hidden !important;
    }

    #receipt-modal,
    #receipt-modal * {
        visibility: visible !important;
    }

    #receipt-modal {
        position: fixed !important;
        inset: auto !important;
        top: 0 !important;
        left: 0 !important;
        width: 200mm !important;
        min-height: 0 !important;
        height: auto !important;
        background: #fff !important;
        backdrop-filter: none !important;
        display: block !important;
        overflow: hidden !important;
    }

    .receipt-shell {
        width: 200mm !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        background: #fff !important;
        animation: none !important;
    }

    .receipt-success,
    .modal-actions {
        display: none !important;
    }

    .receipt-sheet {
        width: 200mm !important;
        max-height: 286mm !important;
        overflow: hidden !important;
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        background: #fff !important;
        page-break-before: avoid !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        padding: 4mm !important;
        border-radius: 0 !important;
        transform: none !important;
        color: #0f172a !important;
    }

    body.receipt-output-mode .receipt-sheet {
        background:
            radial-gradient(circle at top right, rgba(59,130,246,0.15), transparent 26%),
            linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
        border-color: rgba(59,130,246,0.15) !important;
    }

    body.receipt-output-mode .receipt-sheet.style-classic {
        background: linear-gradient(180deg, #fffdf7 0%, #fff9eb 100%) !important;
        border-color: rgba(146, 64, 14, 0.18) !important;
    }

    body.receipt-output-mode .receipt-sheet.style-royal {
        background:
            radial-gradient(circle at top left, rgba(129,140,248,0.2), transparent 28%),
            linear-gradient(180deg, #f6f5ff 0%, #eef2ff 100%) !important;
        border-color: rgba(79, 70, 229, 0.2) !important;
    }

    body.receipt-output-mode .receipt-sheet.style-emerald {
        background:
            radial-gradient(circle at top right, rgba(16,185,129,0.18), transparent 30%),
            linear-gradient(180deg, #f3fff9 0%, #ecfdf5 100%) !important;
        border-color: rgba(5, 150, 105, 0.2) !important;
    }

    body.receipt-output-mode .receipt-sheet.style-sunset {
        background:
            radial-gradient(circle at top left, rgba(251,146,60,0.18), transparent 26%),
            linear-gradient(180deg, #fff8f2 0%, #fff1f2 100%) !important;
        border-color: rgba(234, 88, 12, 0.18) !important;
    }

    .receipt-sheet.pdf-compact {
        padding: 4mm !important;
    }

    .receipt-sheet.pdf-compact .receipt-logo-box {
        width: 16mm;
        height: 16mm;
        padding: 1.2mm;
        border-radius: 3mm;
    }

    .receipt-sheet.pdf-compact .receipt-top {
        gap: 3mm;
        padding-bottom: 2.5mm;
    }

    .receipt-sheet.pdf-compact .receipt-kicker {
        font-size: 2.1mm;
        margin-bottom: 1mm;
    }

    .receipt-sheet.pdf-compact .receipt-org h1 {
        font-size: 4.5mm;
        line-height: 1.05;
    }

    .receipt-sheet.pdf-compact .receipt-tagline,
    .receipt-sheet.pdf-compact .receipt-address {
        font-size: 2.7mm;
        line-height: 1.18;
        margin-top: 0.8mm;
    }

    .receipt-sheet.pdf-compact .receipt-badge-box {
        min-width: 34mm;
        gap: 1.5mm;
    }

    .receipt-sheet.pdf-compact .receipt-badge {
        padding: 1.2mm 2.5mm;
        font-size: 2.1mm;
    }

    .receipt-sheet.pdf-compact .receipt-meta-chip {
        min-width: 34mm;
        padding: 2mm 2.5mm;
        border-radius: 3mm;
    }

    .receipt-sheet.pdf-compact .receipt-meta-chip strong {
        font-size: 3.4mm;
    }

    .receipt-sheet.pdf-compact .receipt-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 3mm;
        margin-top: 3mm;
    }

    .receipt-sheet.pdf-compact .receipt-card,
    .receipt-sheet.pdf-compact .receipt-note-box,
    .receipt-sheet.pdf-compact .receipt-summary-box {
        padding: 2.4mm 3mm;
        border-radius: 3mm;
    }

    .receipt-sheet.pdf-compact .receipt-card h4,
    .receipt-sheet.pdf-compact .receipt-note-box h4 {
        margin-bottom: 1.8mm;
        font-size: 2.2mm;
    }

    .receipt-sheet.pdf-compact .receipt-info-list {
        gap: 1.8mm 3mm;
    }

    .receipt-sheet.pdf-compact .receipt-info-list span,
    .receipt-sheet.pdf-compact .receipt-summary-box span,
    .receipt-sheet.pdf-compact .receipt-signatures span,
    .receipt-sheet.pdf-compact .receipt-table th {
        font-size: 1.9mm;
        letter-spacing: 0.04em;
    }

    .receipt-sheet.pdf-compact .receipt-info-list strong,
    .receipt-sheet.pdf-compact .receipt-summary-box strong,
    .receipt-sheet.pdf-compact .receipt-signatures strong,
    .receipt-sheet.pdf-compact .receipt-table td {
        font-size: 2.55mm;
        line-height: 1.15;
    }

    .receipt-sheet.pdf-compact .receipt-table-wrap {
        margin-top: 3mm;
        border-radius: 3mm;
        overflow: hidden !important;
    }

    .receipt-sheet.pdf-compact .receipt-table {
        min-width: 0 !important;
        font-size: 2.5mm;
    }

    .receipt-sheet.pdf-compact .receipt-table th,
    .receipt-sheet.pdf-compact .receipt-table td {
        padding: 1.8mm 2.2mm;
    }

    .receipt-sheet.pdf-compact .receipt-footer-grid {
        grid-template-columns: 1.15fr 0.85fr !important;
        gap: 3mm;
        margin-top: 3mm;
    }

    .receipt-sheet.pdf-compact .receipt-note-box p {
        font-size: 2.45mm;
        line-height: 1.25;
    }

    .receipt-sheet.pdf-compact .receipt-summary-box {
        gap: 1.5mm;
    }

    .receipt-sheet.pdf-compact .receipt-summary-box .grand {
        padding-top: 1.5mm;
    }

    .receipt-sheet.pdf-compact .receipt-summary-box .grand strong {
        font-size: 3.2mm;
    }

    .receipt-sheet.pdf-compact .receipt-signatures {
        margin-top: 3mm;
        padding-top: 2.5mm;
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 3mm;
    }

    .receipt-sheet.pdf-compact .receipt-signatures div {
        min-width: 0;
        gap: 0.8mm;
    }

    .receipt-watermark {
        display: none !important;
    }

    body.receipt-print-mode {
        background: #fff !important;
    }

    body.receipt-print-mode > *:not(#fee-receipt-print-root) {
        visibility: hidden !important;
    }

    body.receipt-print-mode #fee-receipt-print-root,
    body.receipt-print-mode #fee-receipt-print-root * {
        visibility: visible !important;
    }

    body.receipt-print-mode #fee-receipt-print-root {
        position: static !important;
        left: auto !important;
        top: auto !important;
        width: 200mm !important;
        min-height: 0 !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    body.receipt-print-mode #fee-receipt-print-root .receipt-sheet {
        width: 200mm !important;
        max-width: 200mm !important;
        margin: 0 auto !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    body.receipt-print-mode #fee-receipt-print-root .receipt-sheet.pdf-compact {
        padding: 4mm !important;
    }

    body.receipt-print-mode #receipt-modal {
        display: none !important;
    }
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.fee-page-header.top-nav {
    display: block;
    width: min(1680px, calc(100% - 24px));
    margin: 0.75rem auto 0 !important;
    padding: 0 !important;
    height: auto;
    background: transparent;
    backdrop-filter: none;
    border: 0;
    flex-shrink: 0;
}

.fee-school-topline {
    min-height: 42px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.76);
}

.fee-school-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.fee-school-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    overflow: hidden;
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #dbeafe;
    font-size: 0.78rem;
    font-weight: 800;
}

.fee-school-logo--image {
    background: rgba(255, 255, 255, 0.94);
}

.fee-school-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fee-school-name {
    min-width: 0;
    margin: 0;
    color: var(--text-main);
    font-size: 1rem !important;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fee-back-dashboard {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.07);
    font-size: 0.86rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.fee-back-dashboard:hover {
    border-color: rgba(96, 165, 250, 0.42);
    background: rgba(59, 130, 246, 0.14);
}

.fee-purpose-line {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.55rem 0.15rem 0;
}

.fee-purpose-line h1 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.25rem;
    line-height: 1.2;
}

.fee-purpose-line p {
    margin: 0;
    min-width: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 720px) {
    .fee-page-header.top-nav {
        width: min(100% - 16px, 1680px);
        margin-top: 0.5rem !important;
    }

    .fee-school-topline {
        align-items: stretch;
        flex-direction: column;
        gap: 0.55rem;
    }

    .fee-back-dashboard {
        width: 100%;
    }

    .fee-purpose-line {
        display: block;
        padding-top: 0.5rem;
    }

    .fee-purpose-line h1 {
        font-size: 1.12rem;
    }

    .fee-purpose-line p {
        margin-top: 0.12rem;
        white-space: normal;
    }

    .fee-shortcuts-bar {
        width: min(100% - 16px, 1680px);
        justify-content: flex-start;
    }
}

.logo-area { display: flex; align-items: center; gap: 0.7rem; }
.logo-area h2 { font-size: 1.1rem; font-weight: 700; color: var(--text-main); }

.actions { display: flex; align-items: center; gap: 0.5rem; }

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-main);
}
