/* ═══════════════════════════════════════════════════════════
   Payroll System — Apple Frosted Glass Design
   ═══════════════════════════════════════════════════════════ */

:root, [data-theme="light"] {
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --text-xs: clamp(0.6875rem, 0.65rem + 0.2vw, 0.8125rem);
    --text-sm: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
    --text-base: clamp(0.875rem, 0.85rem + 0.15vw, 0.9375rem);
    --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
    --text-xl: clamp(1.5rem, 1.2rem + 1vw, 2rem);

    --color-bg: #f5f5f7;
    --color-surface: rgba(255, 255, 255, 0.72);
    --color-surface-solid: #ffffff;
    --color-surface-hover: rgba(255, 255, 255, 0.85);
    --color-border: rgba(0, 0, 0, 0.08);
    --color-border-strong: rgba(0, 0, 0, 0.12);
    --color-text: #1d1d1f;
    --color-text-muted: #86868b;
    --color-text-faint: #aeaeb2;
    --color-primary: #007aff;
    --color-primary-hover: #0063d1;
    --color-success: #34c759;
    --color-success-bg: rgba(52, 199, 89, 0.1);
    --color-warning: #ff9500;
    --color-warning-bg: rgba(255, 149, 0, 0.1);
    --color-error: #ff3b30;
    --color-error-bg: rgba(255, 59, 48, 0.1);
    --color-pending: #5856d6;
    --color-pending-bg: rgba(88, 86, 214, 0.1);

    --sidebar-bg: rgba(245, 245, 247, 0.85);
    --sidebar-width: 220px;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);

    --blur-glass: blur(40px) saturate(1.8);

    --transition-fast: 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-smooth: 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-theme="dark"] {
    --color-bg: #0d0d0d;
    --color-surface: rgba(30, 30, 30, 0.72);
    --color-surface-solid: #1c1c1e;
    --color-surface-hover: rgba(44, 44, 46, 0.8);
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-strong: rgba(255, 255, 255, 0.12);
    --color-text: #f5f5f7;
    --color-text-muted: #98989d;
    --color-text-faint: #636366;
    --color-primary: #0a84ff;
    --color-primary-hover: #409cff;
    --color-success: #30d158;
    --color-success-bg: rgba(48, 209, 88, 0.15);
    --color-warning: #ff9f0a;
    --color-warning-bg: rgba(255, 159, 10, 0.15);
    --color-error: #ff453a;
    --color-error-bg: rgba(255, 69, 58, 0.15);
    --color-pending: #5e5ce6;
    --color-pending-bg: rgba(94, 92, 230, 0.15);

    --sidebar-bg: rgba(28, 28, 30, 0.85);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.35);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --color-bg: #0d0d0d;
        --color-surface: rgba(30, 30, 30, 0.72);
        --color-surface-solid: #1c1c1e;
        --color-surface-hover: rgba(44, 44, 46, 0.8);
        --color-border: rgba(255, 255, 255, 0.08);
        --color-border-strong: rgba(255, 255, 255, 0.12);
        --color-text: #f5f5f7;
        --color-text-muted: #98989d;
        --color-text-faint: #636366;
        --color-primary: #0a84ff;
        --color-primary-hover: #409cff;
        --color-success: #30d158;
        --color-success-bg: rgba(48, 209, 88, 0.15);
        --color-warning: #ff9f0a;
        --color-warning-bg: rgba(255, 159, 10, 0.15);
        --color-error: #ff453a;
        --color-error-bg: rgba(255, 69, 58, 0.15);
        --color-pending: #5e5ce6;
        --color-pending-bg: rgba(94, 92, 230, 0.15);
        --sidebar-bg: rgba(28, 28, 30, 0.85);
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
        --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
        --shadow-lg: 0 12px 40px rgba(0,0,0,0.35);
    }
}

/* ─── App Layout ─── */

.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 1fr;
    height: 100dvh;
    overflow: hidden;
}

/* ─── Sidebar ─── */

.sidebar {
    grid-row: 1 / -1;
    background: var(--sidebar-bg);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 20px;
    color: var(--color-text);
}

.logo-text {
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.nav-item.active {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg {
    opacity: 1;
    color: var(--color-primary);
}

.sidebar-footer {
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    margin-top: 8px;
}

.theme-btn {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
}

.theme-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

/* ─── Mobile Header ─── */

.mobile-header {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--sidebar-bg);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-title {
    font-weight: 600;
    font-size: var(--text-base);
}

.hamburger {
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
}

/* ─── Main Content ─── */

.main-content {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 32px;
}

/* ─── Pages ─── */

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--color-text);
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* ─── Glass Cards ─── */

.glass-card {
    background: var(--color-surface);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: -0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ─── KPI Grid ─── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--color-surface);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon.sent { background: rgba(0, 122, 255, 0.1); color: var(--color-primary); }
.kpi-icon.confirmed { background: var(--color-success-bg); color: var(--color-success); }
.kpi-icon.appealed { background: var(--color-warning-bg); color: var(--color-warning); }
.kpi-icon.pending { background: var(--color-pending-bg); color: var(--color-pending); }

.kpi-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums lining-nums;
    line-height: 1.2;
}

/* ─── Buttons ─── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-ghost {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover {
    background: var(--color-surface-hover);
}

.btn-sm { padding: 6px 12px; font-size: var(--text-xs); }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Badge ─── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-error { background: var(--color-error-bg); color: var(--color-error); }
.badge-pending { background: var(--color-pending-bg); color: var(--color-pending); }
.badge-primary { background: rgba(0,122,255,0.1); color: var(--color-primary); }

/* ─── Upload Zone ─── */

.upload-zone {
    border: 2px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upload-zone:hover {
    border-color: var(--color-primary);
    background: rgba(0, 122, 255, 0.03);
}

.upload-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(0, 122, 255, 0.06);
}

.upload-icon {
    margin: 0 auto 12px;
    color: var(--color-text-faint);
}

.upload-text {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* ─── Tables ─── */

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    background: var(--color-surface-solid);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--color-surface-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ─── Filter Bar ─── */

.filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 7px 16px;
    border-radius: 100px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.filter-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ─── Batch List ─── */

.batch-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.batch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.batch-item:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-strong);
}

.batch-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.batch-item-name {
    font-weight: 600;
    font-size: var(--text-sm);
}

.batch-item-meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.batch-item-stats {
    display: flex;
    gap: 8px;
}

/* ─── Settings Form ─── */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    padding: 10px 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface-solid);
    font-size: var(--text-sm);
    transition: border-color var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.form-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    display: none;
}

.form-status.success {
    display: block;
    background: var(--color-success-bg);
    color: var(--color-success);
}

.form-status.error {
    display: block;
    background: var(--color-error-bg);
    color: var(--color-error);
}

/* ─── Modal ─── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal {
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
}

.btn-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-text-muted);
}

.btn-close:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.appeal-content-box {
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: var(--text-sm);
    line-height: 1.6;
    white-space: pre-wrap;
    margin-top: 12px;
}

/* ─── Empty State ─── */

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.empty-state p {
    margin-top: 12px;
    font-size: var(--text-sm);
    max-width: 100%;
}

/* ─── Result ─── */

.result-content {
    text-align: center;
    padding: 20px;
}

.result-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.result-icon.success { background: var(--color-success-bg); color: var(--color-success); }
.result-icon.error { background: var(--color-error-bg); color: var(--color-error); }

.result-content h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: 6px;
}

.result-content p {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    max-width: 100%;
}

/* ─── Toast ─── */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-error); }
.toast.info { border-left: 3px solid var(--color-primary); }

/* ─── Footer ─── */

.site-footer {
    position: fixed;
    bottom: 8px;
    right: 16px;
    z-index: 5;
}

.site-footer a {
    font-size: 10px;
    color: var(--color-text-faint);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--color-text-muted);
}

/* ─── Status Dot ─── */

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.sent { background: var(--color-pending); }
.status-dot.confirmed { background: var(--color-success); }
.status-dot.appealed { background: var(--color-warning); }

/* ─── Responsive ─── */

@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 260px;
        transition: left var(--transition-smooth);
        z-index: 200;
    }

    .sidebar.open {
        left: 0;
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        padding: 20px 16px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .kpi-card {
        padding: 14px;
    }

    .kpi-value {
        font-size: 22px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .glass-card {
        padding: 16px;
        border-radius: var(--radius-lg);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .rc-payslip-preview {
        grid-template-columns: repeat(2, 1fr);
    }

    .rc-header {
        flex-direction: column;
        gap: 8px;
    }

    .records-layout {
        grid-template-columns: 1fr;
    }

    .recipient-list-panel {
        position: static;
        max-height: 300px;
    }

    .timeline-card-header {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .rc-payslip-preview {
        grid-template-columns: 1fr;
    }
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
}

.sidebar-overlay.show {
    display: block;
}

/* ─── Records Page: Summary ─── */

.records-summary {
    margin-bottom: 16px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.summary-stat {
    text-align: center;
}

.summary-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums lining-nums;
    line-height: 1.2;
    color: var(--color-text);
}

.summary-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.summary-confirmed .summary-number { color: var(--color-success); }
.summary-appealed .summary-number { color: var(--color-warning); }
.summary-pending .summary-number { color: var(--color-pending); }

/* Progress bar */
.summary-progress {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--color-border);
    gap: 2px;
}

.progress-seg {
    height: 100%;
    border-radius: 3px;
    min-width: 4px;
    transition: width 0.4s ease;
}

.progress-confirmed { background: var(--color-success); }
.progress-appealed { background: var(--color-warning); }
.progress-pending { background: var(--color-pending); }

/* ─── Records Page: Filter Tabs ─── */

.records-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.records-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 100px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.records-tab:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.records-tab.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(0,0,0,0.06);
    color: inherit;
}

.records-tab.active .tab-count {
    background: rgba(255,255,255,0.25);
}

/* ─── Records Page: Card List ─── */

.records-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.record-card {
    background: var(--color-surface);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.record-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.record-card.rc-sent::before { background: var(--color-primary); }
.record-card.rc-confirmed::before { background: var(--color-success); }
.record-card.rc-appealed::before { background: var(--color-warning); }
.record-card.rc-pending::before { background: var(--color-pending); }

.record-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-strong);
}

/* Card header */
.rc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.rc-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rc-name {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-email {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status badge in card */
.rc-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.rc-status-badge.rc-sent {
    background: rgba(0, 122, 255, 0.1);
    color: var(--color-primary);
}

.rc-status-badge.rc-confirmed {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.rc-status-badge.rc-appealed {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.rc-status-badge.rc-pending {
    background: var(--color-pending-bg);
    color: var(--color-pending);
}

/* Payslip preview grid */
.rc-payslip-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 16px;
    padding: 12px 14px;
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.rc-field {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.rc-field-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-field-value {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-more {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    align-self: center;
    justify-self: center;
}

/* Footer with timestamps */
.rc-footer {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.rc-time {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
}

/* Appeal content box inside card */
.rc-appeal-box {
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 12px 14px;
    background: var(--color-warning-bg);
    border: 1px solid rgba(255, 149, 0, 0.2);
    border-radius: var(--radius-md);
}

.rc-appeal-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-warning);
    margin-bottom: 4px;
}

.rc-appeal-text {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--color-text);
    white-space: pre-wrap;
}

/* Card actions */
.rc-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Active batch item */
.batch-item-active {
    background: rgba(0, 122, 255, 0.06);
    border-color: var(--color-primary) !important;
}

/* ─── Records Page: Two-Panel Layout ─── */

.records-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}

.recipient-list-panel {
    position: sticky;
    top: 20px;
    max-height: calc(100dvh - 140px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.recipient-search {
    margin-bottom: 12px;
}

.recipient-search input {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface-solid);
    font-size: var(--text-sm);
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}

.recipient-search input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.recipient-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
}

.recipient-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.recipient-item:hover {
    background: var(--color-surface-hover);
}

.recipient-item-active {
    background: rgba(0, 122, 255, 0.06);
    border-color: var(--color-primary);
}

.recipient-item-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.recipient-item-name {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recipient-item-email {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recipient-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 8px;
}

.recipient-item-date {
    font-size: 10px;
    color: var(--color-text-faint);
}

/* History Panel */
.recipient-history-panel {
    min-height: 300px;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.history-person {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #5856d6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.history-person-name {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--color-text);
}

.history-person-email {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* Timeline */
.history-timeline {
    position: relative;
    padding-left: 24px;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--color-border-strong);
    border-radius: 1px;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 14px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid var(--color-surface-solid);
    box-shadow: 0 0 0 2px var(--color-border);
    z-index: 1;
}

.timeline-card {
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: box-shadow var(--transition-fast);
}

.timeline-card:hover {
    box-shadow: var(--shadow-sm);
}

.timeline-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.timeline-date {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
}

.timeline-file {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
}

.timeline-actions {
    flex-shrink: 0;
}

/* Email Preview Modal */
.email-preview-modal {
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.email-preview-modal .modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.email-preview-iframe {
    width: 100%;
    height: 60vh;
    border: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: #fff;
}

/* Loading State */
.loading-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.loading-state p {
    font-size: var(--text-sm);
}

/* ─── Hero Upload Button ─── */

.btn-upload-hero {
    padding: 12px 24px;
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 12px rgba(0, 122, 255, 0.25);
}

.btn-upload-hero:hover {
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.35);
    transform: translateY(-1px);
}

.btn-upload-hero:active {
    transform: translateY(0) scale(0.98);
}

/* ─── Scrollbar ─── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-faint);
}

/* ─── Login Screen ─── */

.login-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 32px;
    box-sizing: border-box;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header svg {
    margin-bottom: 16px;
    color: var(--color-primary);
}

.login-header h1 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 4px;
}

.login-header p {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: 0;
}
