:root {
    --bg-primary: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    
    --primary: #ff6550; /* Primary coral orange */
    --primary-hover: #e04f3b;
    --primary-light: rgba(255, 101, 80, 0.08);
    
    --border-color: #e2e8f0;
    --border-focus: #4299e1;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    
    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: 'Outfit', sans-serif;
    
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f7fafc;
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.page-layout {
    display: flex;
    width: 100%;
    flex: 1;
    align-items: flex-start;
}

.page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
}

.menu-submenu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: -4px 0 6px 18px;
    padding-left: 12px;
    border-left: 2px solid #edf2f7;
}

.menu-subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #718096;
    font-family: var(--font-main);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
}

.menu-subitem svg {
    width: 16px;
    height: 16px;
}

.menu-subitem:hover {
    background: #f7fafc;
    color: var(--primary);
}

.menu-subitem.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* Navigation Header */
.nav-header {
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 32px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: flex-start;
}

.nav-logo {
    height: 44px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.hamburger-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    color: #4a5568;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.hamburger-btn svg {
    width: 20px;
    height: 20px;
}

.hamburger-btn:hover {
    background: #f7fafc;
    border-color: var(--primary);
    color: var(--primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 300;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-drawer {
    position: absolute;
    top: 0; left: 0;
    width: 290px; height: 100%;
    background: #ffffff;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
}

.sidebar-overlay.active .sidebar-drawer {
    transform: translateX(0);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo {
    height: 28px;
    width: auto;
}

.sidebar-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: #2d3748;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #a0aec0;
    cursor: pointer;
}

.sidebar-menu {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #4a5568;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
}

.menu-item svg {
    width: 18px;
    height: 18px;
}

.menu-item:hover {
    background: #f7fafc;
    color: var(--primary);
}

.menu-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.nav-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.nav-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
    letter-spacing: -0.2px;
    line-height: 1.2;
}

.nav-tagline {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    color: #718096;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.nav-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.nav-tabs {
    display: flex;
    gap: 8px;
    background: #edf2f7;
    padding: 4px;
    border-radius: 10px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #718096;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab svg {
    width: 18px;
    height: 18px;
}

.nav-tab.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.nav-tab:hover:not(.active) {
    color: #2d3748;
}

/* Tab Contents */
.tab-content {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease-out forwards;
}

.tab-content.active {
    display: flex;
}

#statement-section.tab-content.active {
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#clients-section.tab-content.active {
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#training-section.tab-content.active {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 960px;
    margin: 28px auto 72px;
    padding: 0 24px 48px;
    box-sizing: border-box;
}

.trainer-section .app-header {
    text-align: left;
    width: 100%;
    margin-bottom: 20px;
}

.trainer-section .app-subtitle {
    line-height: 1.55;
    max-width: 100%;
}

.trainer-section .card {
    text-align: left;
    width: 100%;
    padding: 28px 32px;
    box-sizing: border-box;
}

.trainer-section .stats-card-row {
    margin-bottom: 0;
}

.trainer-section .main-form {
    gap: 20px;
}

.trainer-section .trainer-upload-group {
    margin-bottom: 4px;
}

.trainer-section .trainer-dropzone {
    min-height: 72px;
    height: auto;
    padding: 14px 16px;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: #fafbfc;
}

.trainer-section .trainer-dropzone .file-dummy-text {
    white-space: normal;
    word-break: break-word;
    flex: 1;
    min-width: 0;
    line-height: 1.4;
    text-align: left;
}

.trainer-section .column-mapping-panel {
    margin-top: 8px;
    padding: 20px;
}

.trainer-section .column-mapping-grid {
    gap: 16px;
}

.trainer-section #training-preview-table-wrap {
    margin-top: 20px;
}

.trainer-section .upload-progress-box,
.trainer-section .result-box,
.trainer-section .info-box {
    text-align: left;
}

.trainer-section .submit-button {
    margin-top: 8px;
}

@media (max-width: 900px) {
    .trainer-section .column-mapping-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #training-section.tab-content.active {
        padding: 0 16px 40px;
        margin-top: 20px;
    }

    .trainer-section .card {
        padding: 20px 18px;
    }
}

.statement-workflow {
    margin: 40px auto;
}

.clients-workflow {
    margin: 32px auto;
}

/* App Containers */
.app-container {
    max-width: 540px;
    margin: 40px auto;
    flex-direction: column;
    gap: 24px;
    padding: 0 20px;
}

.wide-container {
    max-width: 1100px;
    margin: 32px auto;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    padding: 0 24px;
}

/* Header */
.app-header, .section-header {
    margin-bottom: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.app-title, .section-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 6px;
}

.app-subtitle, .section-subtitle {
    color: #718096;
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.primary-btn, .secondary-btn, .cancel-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn {
    background: var(--primary);
    color: #ffffff;
    border: none;
}

.primary-btn:hover {
    background: var(--primary-hover);
}

.secondary-btn {
    background: #ffffff;
    color: #4a5568;
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.cancel-btn {
    background: #edf2f7;
    color: #4a5568;
    border: none;
}

.cancel-btn:hover {
    background: #e2e8f0;
}

.small-btn {
    height: 42px;
    font-size: 0.95rem;
    padding: 0 20px;
    width: auto;
}

/* Views */
.view-state {
    display: none;
    flex-direction: column;
    width: 100%;
    animation: fadeIn 0.3s ease-out forwards;
}

.view-state.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Layout */
.main-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #4a5568;
}

.required {
    color: var(--primary);
}

.opt-label {
    font-weight: 400;
    color: #a0aec0;
}

/* Inputs */
.custom-file-input-wrapper {
    position: relative;
    width: 100%;
    height: 50px;
    background: #ffffff;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-file-input-wrapper:hover {
    border-color: var(--primary);
}

.real-file-input {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.file-dummy-btn {
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    color: #2d3748;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-family: inherit;
    margin-right: 12px;
    pointer-events: none;
    z-index: 1;
}

.file-dummy-text {
    font-size: 0.95rem;
    color: #4a5568;
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 160px;
    overflow-y: auto;
}

.invoice-file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.85rem;
    color: #4a5568;
    padding: 6px 12px;
    border-bottom: 1px solid #edf2f7;
}

.invoice-file-list li:last-child {
    border-bottom: none;
}

.invoice-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-file-remove {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #edf2f7;
    color: #718096;
    font-size: 1rem;
    cursor: pointer;
}

.invoice-file-remove:hover {
    background: #fed7d7;
    color: #c53030;
}

.email-input-field {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    background: #ffffff;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.email-input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.submit-button {
    width: 100%;
    height: 52px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.submit-button:hover {
    background: var(--primary-hover);
}

/* Toolbar & Client Grid */
.toolbar-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
}

.search-box {
    position: relative;
    width: 360px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #a0aec0;
}

.search-box input {
    width: 100%;
    height: 42px;
    padding-left: 42px;
    padding-right: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.stats-badge {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: 20px;
}

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    width: 100%;
}

.client-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.client-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}

.client-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.client-avatar {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ff6550, #ff8c7a);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
}

.client-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.client-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.client-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7fafc;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #edf2f7;
}

.key-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.key-row label {
    color: #718096;
    font-weight: 500;
}

.copy-key-btn {
    font-family: monospace;
    font-size: 0.8rem;
    background: #ffffff;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #4a5568;
}

.copy-key-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.txn-badge {
    background: #ebf8ff;
    color: #2b6cb0;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 12px;
}

.client-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: #4a5568;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.danger-btn:hover {
    background: #fff5f5 !important;
    border-color: #feb2b2 !important;
    color: #e53e3e !important;
}

/* Cards & Modals */
.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 32px;
    text-align: center;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: #ffffff;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: modalSlide 0.25s ease-out forwards;
}

.wide-modal {
    max-width: 900px;
    overflow: visible;
}

.wide-modal .modal-body {
    overflow: visible;
}

@keyframes modalSlide {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #a0aec0;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f7fafc;
}

/* Info & Result Boxes */
.info-box {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 8px;
    padding: 12px 14px;
    color: #2b6cb0;
    font-size: 0.85rem;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.info-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.column-mapping-panel {
    margin-top: 20px;
    padding: 18px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.column-mapping-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.column-mapping-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.column-mapping-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

@media (max-width: 768px) {
    .column-mapping-grid {
        grid-template-columns: 1fr;
    }
}

.column-mapping-panel .mapped-col {
    background: #fffbeb;
    font-weight: 600;
}

/* Category Picker */
.category-picker {
    position: relative;
    display: inline-block;
    min-width: 180px;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #bee3f8;
    background: #ebf8ff;
    color: #2b6cb0;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 100%;
}

.category-pill:hover {
    border-color: #4299e1;
    background: #e6f4ff;
}

.category-pill-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.category-pill-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.cat-conf-badge {
    background: #ffffff;
    color: #4a5568;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

.cat-verified-badge {
    background: #c6f6d5;
    color: #22543d;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 700;
}

.category-menu {
    position: fixed;
    z-index: 1200;
    min-width: 300px;
    max-width: 360px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    padding: 8px;
}

.cat-menu-section + .cat-menu-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #edf2f7;
}

.cat-menu-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 8px 6px;
}

.cat-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.cat-option:hover {
    background: #f7fafc;
}

.cat-option.selected {
    background: #ebf8ff;
}

.cat-option-rank {
    font-size: 0.72rem;
    font-weight: 700;
    color: #a0aec0;
    min-width: 20px;
}

.cat-option-name {
    flex: 1;
    font-size: 0.84rem;
    color: #2d3748;
    font-weight: 600;
}

.cat-option-conf {
    font-size: 0.75rem;
    font-weight: 700;
    color: #718096;
}

.other-category-panel {
    margin-top: 8px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 8px;
}

.other-category-search,
.other-category-new {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.84rem;
    margin-bottom: 8px;
}

.other-category-results {
    max-height: 160px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.cat-search-item {
    width: 100%;
    text-align: left;
    padding: 7px 8px;
    border: none;
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #2d3748;
}

.cat-search-item:hover {
    background: #edf2f7;
}

.add-category-row {
    display: flex;
    gap: 8px;
}

.add-category-row .other-category-new {
    margin-bottom: 0;
}

.add-category-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.add-category-btn:hover {
    background: var(--primary-hover);
}

.other-loading,
.other-empty {
    font-size: 0.8rem;
    color: #718096;
    padding: 6px 4px;
}

.data-table td {
    vertical-align: top;
}

/* Full-screen transaction review */
.txn-screen {
    max-width: none;
    width: 100%;
    min-height: calc(100vh - 64px);
    margin: 0;
    padding: 24px 32px 40px;
    flex-direction: column;
    gap: 16px;
    background: #f7fafc;
}

.txn-screen-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.txn-screen-header-left {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.txn-back-btn {
    margin-top: 4px;
    white-space: nowrap;
}

.txn-screen-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.txn-screen-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 10px;
    color: #2b6cb0;
    font-size: 0.88rem;
}

.txn-screen-table-wrap {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: auto;
    max-height: calc(100vh - 220px);
}

.txn-data-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 2;
    padding: 14px 16px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #718096;
}

.txn-data-table td {
    padding: 14px 16px;
    font-size: 0.92rem;
    border-bottom: 1px solid #edf2f7;
}

.txn-desc-cell strong {
    color: #1a202c;
    line-height: 1.4;
}

.txn-memo-cell {
    color: #4a5568;
    line-height: 1.4;
}

.txn-amt-cell {
    font-weight: 700;
    color: #2d3748;
    white-space: nowrap;
}

.txn-cat-cell {
    min-width: 220px;
}

@media (max-width: 900px) {
    .txn-screen {
        padding: 16px;
    }

    .txn-screen-header {
        flex-direction: column;
    }

    .txn-screen-header-left {
        flex-direction: column;
    }
}

.txn-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #22543d;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    max-width: 360px;
}

.txn-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.upload-progress-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #4a5568;
}

.result-box {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-radius: 8px;
    padding: 14px;
    color: #276749;
    font-size: 0.9rem;
}

/* Tables */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: #f7fafc;
    padding: 12px 14px;
    text-align: left;
    color: #4a5568;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf2f7;
    color: #2d3748;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.empty-cell {
    text-align: center;
    color: #a0aec0;
    padding: 24px;
}

.spin-icon {
    animation: rotateSpinner 1s linear infinite;
}

.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #718096;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.txn-stats-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.key-badge {
    font-family: monospace;
    background: #edf2f7;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.count-badge {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* Status Cards & Processing */
.status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.spinner-wrapper {
    position: relative;
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
}

.spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(255, 101, 80, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: rotateSpinner 1s linear infinite;
}

.small-spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
    position: relative;
}

.spinner-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 24px; height: 24px;
    color: var(--primary);
}

@keyframes rotateSpinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 6px;
}

.status-subtitle {
    color: #718096;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.status-info {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 10px;
}

.progress-bar-container {
    width: 80%;
    height: 5px;
    background: #edf2f7;
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.success-icon-wrapper, .error-icon-wrapper {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.success-icon-wrapper { background: var(--success-bg); color: var(--success); }
.error-icon-wrapper { background: var(--error-bg); color: var(--error); }
.success-icon, .error-icon { width: 32px; height: 32px; }

.file-details-card {
    background: #f7fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    padding: 14px 18px;
    width: 100%;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    text-align: left;
}

.excel-icon { width: 24px; height: 24px; color: var(--primary); }
.file-info { display: flex; flex-direction: column; }
.file-info-name { font-weight: 550; font-size: 0.9rem; color: #2d3748; }
.file-info-size { font-size: 0.8rem; color: var(--text-muted); }

/* Training Module Stats */
.stats-card-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-val {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
}

/* Home Landing Page */
.home-container {
    max-width: 820px;
    margin: 32px auto 48px;
    flex-direction: column;
    width: 100%;
    padding: 0 24px;
}

.home-hero {
    background: linear-gradient(145deg, #ffffff 0%, #fff9f8 55%, #fff5f3 100%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    position: relative;
}

.home-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #ff8a75);
}

.home-hero-inner {
    padding: 48px 44px 40px;
    text-align: center;
}

.home-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid rgba(255, 101, 80, 0.18);
    border-radius: 999px;
    padding: 6px 14px;
    margin-bottom: 20px;
}

.home-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 12px;
}

.home-tagline {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.5;
}

.home-intro-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 28px 32px;
    text-align: left;
    margin-bottom: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.home-intro-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 18px;
    line-height: 1.5;
}

.home-feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.home-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 0.92rem;
    color: var(--text-primary);
    line-height: 1.45;
}

.home-feature-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: 10px;
    color: var(--primary);
}

.home-feature-icon svg {
    width: 18px;
    height: 18px;
}

.home-launch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 24px rgba(255, 101, 80, 0.28);
}

.home-launch-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.home-launch-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(255, 101, 80, 0.34);
}

.home-launch-btn:hover svg {
    transform: translateX(3px);
}

body.landing-active {
    overflow: hidden;
}

.app-shell[hidden] {
    display: none !important;
}

/* Site Landing (first page — full screen entry) */
.site-landing {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.48s ease, visibility 0.48s ease;
}

.site-landing:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.site-landing.landing-exit {
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 0.48s ease, transform 0.48s ease, visibility 0.48s ease;
}

.landing-animate {
    opacity: 0;
    animation: landingFadeUp 0.75s ease forwards;
}

.landing-delay-1 { animation-delay: 0.05s; }
.landing-delay-2 { animation-delay: 0.15s; }
.landing-delay-3 { animation-delay: 0.25s; }
.landing-delay-4 { animation-delay: 0.35s; }
.landing-delay-5 { animation-delay: 0.45s; }
.landing-delay-6 { animation-delay: 0.55s; }
.landing-delay-7 { animation-delay: 0.7s; }

@keyframes landingFadeUp {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Site Home hero (used on landing) */
.site-home {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.site-home-hero {
    width: 100%;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 24px 72px;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(255, 101, 80, 0.09) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(66, 153, 225, 0.07) 0%, transparent 50%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 48%, #f1f5f9 100%);
    box-sizing: border-box;
}

.site-home-hero-inner {
    max-width: 720px;
    width: 100%;
    text-align: center;
    margin-bottom: 48px;
}

.site-home-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 3.75rem);
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 14px;
}

.site-home-tagline {
    font-family: var(--font-display);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 28px;
    line-height: 1.45;
}

.site-home-divider {
    width: 72px;
    height: 3px;
    margin: 0 auto 28px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #ff8a75);
}

.site-home-lead {
    font-size: clamp(1.05rem, 2.2vw, 1.25rem);
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 16px;
    line-height: 1.5;
}

.site-home-desc {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 620px;
    margin: 0 auto 36px;
}

.site-home-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 16px 36px;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 10px 28px rgba(255, 101, 80, 0.3);
}

.site-home-cta svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.site-home-cta:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(255, 101, 80, 0.36);
}

.site-home-cta:hover svg {
    transform: translateX(4px);
}

/* Agent picker popup */
.agent-picker-overlay {
    z-index: 400;
}

.agent-picker-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    padding: 36px 32px 32px;
    max-width: 720px;
    width: 100%;
    text-align: center;
    position: relative;
    animation: agentPickerIn 0.35s ease forwards;
}

@keyframes agentPickerIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.agent-picker-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: #a0aec0;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.agent-picker-close:hover {
    color: #4a5568;
    background: #f7fafc;
}

.agent-picker-title {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
}

.agent-picker-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.5;
}

.agent-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    text-align: left;
}

.agent-picker-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 22px 20px;
    background: #fafbfc;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s ease;
    text-align: left;
}

.agent-picker-option:hover {
    border-color: var(--primary);
    background: #fff9f8;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(255, 101, 80, 0.12);
}

.agent-picker-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: 12px;
    color: var(--primary);
}

.agent-picker-icon svg {
    width: 22px;
    height: 22px;
}

.agent-picker-name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: #2d3748;
}

.agent-picker-desc {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.45;
}

@media (max-width: 900px) {
    .agent-picker-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .agent-picker-card {
        padding: 28px 20px 24px;
    }
    .agent-picker-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive adjustments */

@media (max-width: 768px) {
    .nav-header {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 14px 16px;
    }
    .nav-left, .nav-center, .nav-right {
        justify-content: center;
        width: 100%;
    }
    .nav-tabs {
        width: 100%;
        justify-content: center;
    }
    .home-hero-inner {
        padding: 32px 22px 28px;
    }
    .home-intro-card {
        padding: 20px 18px;
    }
    .site-home-hero {
        min-height: auto;
        padding: 40px 18px 56px;
    }
}

/* Auth / Login */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at top left, rgba(80, 70, 140, 0.12), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(148, 148, 148, 0.1), transparent 45%),
        #f7f8fb;
}

.login-container {
    max-width: 420px;
    width: 100%;
    margin: 24px;
    padding: 36px 32px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(45, 55, 72, 0.08);
}

.login-header {
    text-align: center;
    margin-bottom: 8px;
}

.login-logo {
    height: 48px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    margin-bottom: 18px;
}

.login-error {
    color: var(--error);
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.9rem;
    text-align: center;
}

.logout-button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 8px 14px;
    font-family: var(--font-main);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.logout-button:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    color: var(--text-primary);
}

.submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
