/* ============================== */
/*  Authorization System Styles   */
/* ============================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-dark: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.1);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --purple: #8b5cf6;
    --purple-light: rgba(139, 92, 246, 0.1);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── SIDEBAR ─── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: var(--bg-dark);
    padding: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-brand {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand img {
    height: 28px;
    min-width: 28px;
    filter: brightness(0) invert(1);
}

.sidebar-brand span {
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.3;
    opacity: 1;
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-brand span {
    opacity: 0;
    pointer-events: none;
}

.sidebar-nav {
    padding: 12px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-align: left;
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
}

.nav-btn i {
    font-size: 1.1rem;
    min-width: 22px;
    text-align: center;
}

.nav-btn .nav-label {
    opacity: 1;
    transition: opacity 0.2s;
}

.sidebar.collapsed .nav-btn .nav-label {
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .nav-btn {
    justify-content: center;
    padding: 10px 0;
}

.sidebar.collapsed .nav-btn i {
    margin: 0;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.nav-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.65rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-footer {
    opacity: 0;
}

/* ─── MAIN CONTENT ─── */
.main-content {
    margin-left: 240px;
    min-height: 100vh;
    padding: 0;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 64px;
}

.top-bar {
    background: var(--bg-card);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    gap: 12px;
}

.top-bar > div:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.top-bar .breadcrumb-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* Sidebar collapse toggle in top bar */
.sidebar-collapse-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-collapse-btn:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.page-body {
    padding: 20px 24px;
}

/* ─── CARDS ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header-custom {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header-custom h6 {
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.card-body-custom {
    padding: 20px;
}

/* ─── STAT CARDS ─── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card.blue::before {
    background: var(--primary);
}

.stat-card.green::before {
    background: var(--success);
}

.stat-card.purple::before {
    background: var(--purple);
}

.stat-card.orange::before {
    background: var(--warning);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.purple {
    background: var(--purple-light);
    color: var(--purple);
}

.stat-icon.orange {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

/* ─── BUTTONS ─── */
.btn-primary-custom {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary-custom:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-outline-custom {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-outline-custom:hover {
    background: var(--bg-main);
    border-color: var(--text-muted);
}

.btn-sm-custom {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-icon-only {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.btn-icon-only:hover {
    background: var(--bg-main);
}

.btn-icon-only.danger:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-icon-only.primary:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-icon-only.success:hover {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

/* ─── FORM CONTROLS ─── */
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-label-custom {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── TABLE ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: var(--bg-dark);
    color: #fff;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    text-align: left;
    white-space: nowrap;
}

.data-table thead th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.data-table thead th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.data-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .form-input {
    padding: 8px 12px;
    font-size: 0.82rem;
}

/* ─── HISTORY LIST ─── */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table thead th {
    padding: 14px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.history-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    vertical-align: middle;
}

.history-table tbody tr {
    transition: var(--transition);
}

.history-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.04);
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

.history-table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.history-table thead th.sortable:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.history-table thead th.sortable i {
    font-size: 0.7rem;
    margin-left: 4px;
    opacity: 0.5;
}

.history-table thead th.sortable:hover i {
    opacity: 1;
}

/* ─── FILTER BAR ─── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.03), rgba(139, 92, 246, 0.03));
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: var(--transition);
    min-width: 140px;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.quick-filter-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.quick-filter-btn:hover,
.quick-filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ─── BADGES ─── */
.badge-custom {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

/* ─── TOTAL AMOUNT DISPLAY ─── */
.total-display {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    padding: 16px 20px;
    border-radius: var(--radius);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.total-display .label {
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.total-display .value {
    font-size: 1.3rem;
    font-weight: 800;
}

/* ─── EMPTY STATE ─── */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 16px;
    color: var(--border);
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.85rem;
}

/* ─── MODAL ─── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-header-custom {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header-custom h5 {
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.modal-body-custom {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer-custom {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ─── TOAST ─── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-item {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    min-width: 300px;
    font-family: inherit;
}

.toast-item.success {
    background: var(--success);
    color: #fff;
}

.toast-item.danger {
    background: var(--danger);
    color: #fff;
}

/* ─── RECENT ACTIVITY ─── */
.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin: 0 -24px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    cursor: default;
}

.activity-item:first-child {
    margin-top: -8px;
}

.activity-item:last-child {
    border-bottom: none;
    margin-bottom: -8px;
}

.activity-item:hover {
    background: rgba(59, 130, 246, 0.03);
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.activity-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.activity-text strong {
    color: var(--text-primary);
}

.activity-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    background: var(--bg-main);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

/* ─── LOADING SPINNER ─── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner.dark {
    border-color: var(--border);
    border-top-color: var(--primary);
}

/* ─── ANIMATIONS ─── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── PAGE SECTIONS ─── */
.page-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page-section.active {
    display: block;
}

/* ─── RESPONSIVE ─── */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 999;
    transition: opacity 0.25s;
}

.sidebar-overlay.show {
    display: block;
}

/* Tablet */
@media (max-width: 1024px) {
    .filter-bar {
        gap: 10px;
    }

    .filter-group input,
    .filter-group select {
        min-width: 110px;
    }

    .stat-value {
        font-size: 1.05rem;
    }

    .type-cards-row {
        flex-direction: column;
    }

    .page-body {
        padding: 16px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.collapsed {
        width: 260px;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content,
    .sidebar.collapsed ~ .main-content {
        margin-left: 0 !important;
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
    }

    .sidebar-collapse-btn {
        display: none;
    }

    .page-body {
        padding: 14px 12px;
    }

    .top-bar {
        padding: 10px 14px;
        gap: 8px;
    }

    .top-bar h1 {
        font-size: 0.95rem;
    }

    .top-bar .breadcrumb-text {
        font-size: 0.68rem;
    }

    /* Stats: 2-column grid, allow values to wrap */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }

    .stat-card {
        padding: 12px 10px;
        gap: 8px;
    }

    .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .stat-label {
        font-size: 0.6rem;
        letter-spacing: 0.2px;
    }

    .stat-value {
        font-size: 0.88rem;
        white-space: normal;
        word-break: break-all;
        overflow: visible;
        text-overflow: unset;
    }

    .stat-info {
        min-width: 0;
    }

    /* Activity items */
    .activity-item {
        margin: 0 -12px;
        padding: 10px 12px;
        gap: 10px;
    }

    .activity-text {
        font-size: 0.78rem;
    }

    .activity-date {
        font-size: 0.68rem;
        padding: 3px 8px;
        flex-shrink: 0;
    }

    /* Type cards - stack on mobile */
    .type-cards-row {
        flex-direction: column;
    }

    .type-card {
        padding: 10px 12px;
    }

    .type-card .type-card-text strong {
        font-size: 0.78rem;
    }

    .type-card .type-card-text span {
        font-size: 0.65rem;
        white-space: normal;
    }

    .type-card i {
        font-size: 1rem;
    }

    /* Form grid */
    .form-grid-2 {
        grid-template-columns: 1fr !important;
    }

    /* Date + Total row */
    .date-total-row {
        grid-template-columns: 1fr !important;
    }

    /* Card padding */
    .card-body-custom {
        padding: 14px;
    }

    .card-header-custom {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-header-custom h6 {
        font-size: 0.82rem;
    }

    /* Filter bar */
    .filter-bar {
        padding: 12px 14px;
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group input,
    .filter-group select {
        min-width: 100%;
        width: 100%;
    }

    .quick-filters-row {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
        margin-left: 0 !important;
    }

    .quick-filter-btn {
        flex: 1;
        min-width: 60px;
        text-align: center;
        padding: 6px 8px;
        font-size: 0.72rem;
    }

    /* Tables - horizontal scroll with better touch */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
    }

    .data-table,
    .history-table {
        min-width: 580px;
    }

    .data-table tbody td,
    .history-table tbody td {
        padding: 10px 10px;
        font-size: 0.78rem;
    }

    .data-table thead th,
    .history-table thead th {
        padding: 10px 10px;
        font-size: 0.68rem;
    }

    .data-table .form-input {
        padding: 6px 8px;
        font-size: 0.76rem;
        min-width: 90px;
    }

    /* Actions */
    .actions-cell {
        flex-wrap: wrap;
        gap: 4px;
    }

    .btn-icon-only {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    /* Group header */
    .group-card .card-header-custom {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .group-card .card-header-custom > div {
        width: 100%;
        justify-content: space-between;
    }

    /* Total display */
    .total-display {
        padding: 14px 16px;
    }

    .total-display .value {
        font-size: 1.1rem;
    }

    /* Modal */
    .modal-box {
        width: 96%;
        max-height: 92vh;
        border-radius: var(--radius-sm);
    }

    .modal-header-custom {
        padding: 14px 16px;
    }

    .modal-header-custom h5 {
        font-size: 0.95rem;
    }

    .modal-body-custom {
        padding: 14px;
    }

    .modal-footer-custom {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    /* Form buttons */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn-primary-custom,
    .form-actions .btn-outline-custom {
        width: 100%;
        justify-content: center;
    }

    .btn-primary-custom,
    .btn-outline-custom {
        font-size: 0.8rem;
        padding: 9px 16px;
    }

    .btn-sm-custom {
        padding: 6px 10px;
        font-size: 0.74rem;
    }

    /* Beneficiary summary cards - single column */
    .ben-summary-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .ben-summary-card {
        padding: 14px 16px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 14px;
        text-align: left;
    }

    .ben-summary-icon {
        margin-bottom: 0;
        width: 40px;
        height: 40px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .ben-summary-label {
        font-size: 0.68rem;
        margin-bottom: 2px;
    }

    .ben-summary-value {
        font-size: 1.1rem;
        word-break: break-all;
    }

    /* Beneficiary add form */
    .ben-form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Beneficiary search */
    .card-header-custom input[type="text"] {
        min-width: 120px !important;
        font-size: 0.8rem !important;
    }

    /* Form input */
    .form-input {
        padding: 9px 12px;
        font-size: 0.82rem;
    }

    .form-label-custom {
        font-size: 0.72rem;
    }

    /* Toast on mobile */
    .toast-container {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 20px;
    }

    .toast-item {
        min-width: auto;
        font-size: 0.8rem;
        padding: 12px 16px;
    }

    /* Empty state */
    .empty-state {
        padding: 40px 16px;
    }

    .empty-state i {
        font-size: 2.5rem;
    }
}

/* Small phones */
@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
        flex-direction: row;
        gap: 10px;
    }

    .stat-value {
        font-size: 1rem;
        white-space: normal;
        word-break: break-all;
    }

    .page-body {
        padding: 10px 8px;
    }

    .top-bar {
        padding: 8px 10px;
    }

    .top-bar h1 {
        font-size: 0.88rem;
    }

    .card-body-custom {
        padding: 12px;
    }

    .card-header-custom {
        padding: 10px 12px;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ─── GROUP TOTAL ─── */
.group-total {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 4px 12px;
    background: var(--success-light);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-weight: 700;
}

.group-total-label {
    font-weight: 500;
    color: var(--text-muted);
}

.group-card {
    margin-bottom: 20px;
}

/* ─── BENEFICIARY DROPDOWN ─── */
.beneficiary-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    max-height: 220px;
    overflow-y: auto;
}

.beneficiary-option {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-main);
    transition: background 0.15s;
}

.beneficiary-option:last-child {
    border-bottom: none;
}

.beneficiary-option:hover {
    background: var(--primary-light);
}

.b-opt-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.b-opt-name i {
    color: var(--primary);
    margin-right: 4px;
}

.b-opt-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ─── TYPE CARD SELECTOR ─── */
.type-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    text-align: left;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.type-card i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.type-card .type-card-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.type-card .type-card-text strong {
    font-size: 0.82rem;
}

.type-card .type-card-text span {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.type-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.type-card.active,
.type-card.active-bank {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.type-card.active strong,
.type-card.active-bank strong {
    color: var(--primary);
}

.selected-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary);
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.active .selected-indicator,
.active-bank .selected-indicator {
    display: flex;
}

.type-card {
    position: relative;
    overflow: hidden;
}

/* ─── LETTER TYPE BADGE ─── */
.badge-vendor {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-self {
    background: var(--purple-light);
    color: var(--purple);
}

/* ─── BENEFICIARY SUMMARY ─── */
.ben-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.ben-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.ben-summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.ben-summary-card.total-sent::before {
    background: linear-gradient(90deg, var(--success), #34d399);
}

.ben-summary-card.ben-count::before {
    background: linear-gradient(90deg, var(--primary), #60a5fa);
}

.ben-summary-card.avg-per-ben::before {
    background: linear-gradient(90deg, var(--purple), #a78bfa);
}

.ben-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ben-summary-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.ben-summary-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.ben-summary-icon.blue {
    background: var(--primary-light);
    color: var(--primary);
}

.ben-summary-icon.purple {
    background: var(--purple-light);
    color: var(--purple);
}

.ben-summary-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ben-summary-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Beneficiary amount column styling */
.ben-amount {
    font-weight: 700;
    color: var(--success);
    white-space: nowrap;
}

.ben-amount-zero {
    font-weight: 500;
    color: var(--text-muted);
}

.ben-txn-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}