:root {
    /* Color Palette */
    --primary: #6D28D9; /* Deep Purple */
    --primary-light: #8B5CF6;
    --primary-gradient: linear-gradient(135deg, #A78BFA 0%, #7C3AED 100%);
    
    --secondary-gradient: linear-gradient(135deg, #F9A8D4 0%, #EC4899 100%);
    --tertiary-gradient: linear-gradient(135deg, #FDBA74 0%, #F97316 100%);
    --quaternary-gradient: linear-gradient(135deg, #6EE7B7 0%, #10B981 100%);
    --blue-gradient: linear-gradient(135deg, #93C5FD 0%, #3B82F6 100%);

    --bg-color: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;

    /* Typography */
    --font-family: 'Inter', sans-serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Radii */
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography Utilities */
.text-green { color: var(--success); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.font-semibold { font-weight: 600; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

/* Layout */
.mobile-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--bg-color);
    position: relative;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

/* Background aesthetic blobs */
.mobile-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 300px;
    background: radial-gradient(circle at top left, rgba(167, 139, 250, 0.2), transparent 70%),
                radial-gradient(circle at top right, rgba(249, 168, 212, 0.2), transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* Top Header */
.top-header {
    background: var(--card-bg);
    padding: 16px 20px;
    z-index: 10;
    position: sticky;
    top: 0;
    box-shadow: var(--shadow-sm);
}

.user-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.user-status {
    font-size: 0.75rem;
    display: block;
}

.follow-link {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-color);
}

/* Buttons */
.primary-btn {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
    text-align: center;
    width: 100%;
}

.primary-btn.sm {
    padding: 6px 12px;
    font-size: 0.875rem;
    width: auto;
}

.primary-btn.blue {
    background: #3B82F6;
}

.primary-btn:hover {
    opacity: 0.9;
}

.fab {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 0.2s;
}
.fab:hover { transform: scale(1.05); }

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    z-index: 1;
    padding-bottom: 80px; /* space for bottom nav */
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

/* Gradient Menu Cards */
.gradient-card {
    border-radius: var(--radius-lg);
    padding: 24px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 0.2s;
}

.gradient-card:hover { transform: translateY(-2px); }

.gradient-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.gradient-card i {
    font-size: 3rem;
    opacity: 0.8;
}

.bg-blue { background: var(--blue-gradient); }
.bg-pink { background: var(--secondary-gradient); }
.bg-purple { background: var(--primary-gradient); }
.bg-orange { background: var(--tertiary-gradient); }

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--text-main);
    background: transparent;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
}

.form-row {
    display: flex;
    gap: 12px;
}
.form-row .form-group {
    flex: 1;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-light);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    color: var(--primary-light);
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 16px;
}

.upload-zone:hover {
    background: rgba(139, 92, 246, 0.05);
}

.upload-zone i {
    font-size: 2rem;
    margin-bottom: 8px;
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    box-shadow: 0 -1px 3px rgba(0,0,0,0.05);
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
    z-index: 10;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    gap: 4px;
    transition: color 0.2s;
}

.nav-item i {
    font-size: 1.5rem;
}

.nav-item.active, .nav-item:hover {
    color: var(--primary);
}

/* Data List Items */
.list-item {
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}
.list-item:last-child {
    border-bottom: none;
}
.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.list-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.circle-number {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}
.list-item-amount {
    color: var(--primary);
    font-weight: 600;
}
.list-item-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.list-item-full {
    grid-column: 1 / -1;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-new { background: #E0E7FF; color: #4338CA; }
.badge-completed { background: #D1FAE5; color: #065F46; }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-color);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeIn 0.2s ease-out;
}
.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideUp 0.3s ease-out;
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}
.modal-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}
.modal-body .detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.9rem;
}
.modal-body .detail-label {
    color: var(--text-muted);
    font-weight: 500;
}
.modal-body .detail-val {
    color: var(--text-main);
    font-weight: 600;
    text-align: right;
    max-width: 60%;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
:root { --login-muted: #64748b; }
.google-login-section { margin: 18px 0; }
#googleSignInButton { display: flex; justify-content: center; min-height: 44px; }
#googleSignInButton[hidden], .google-login-retry[hidden] { display: none; }
.google-login-retry { padding: 8px 16px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: var(--primary); font: inherit; cursor: pointer; }
.login-note { color: var(--login-muted); font-size: 13px; line-height: 1.5; margin: 10px 0; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--login-muted); font-size: 13px; }
.login-divider::before, .login-divider::after { content: ''; height: 1px; flex: 1; background: #e2e8f0; }
.login-message { color: #a32921; font-size: 14px; line-height: 1.5; margin-top: 14px; }
.combined-document-download:empty { display: none; }
.combined-document-download { margin-top: 16px; padding: 14px; border: 1px solid #ddd6fe; border-radius: 12px; background: #faf8ff; }
.combined-pdf-button { width: 100%; min-height: 44px; white-space: normal; }
.combined-pdf-button:disabled { opacity: .65; cursor: wait; }
.combined-pdf-button:focus-visible { outline: 3px solid #a78bfa; outline-offset: 3px; }
.combined-pdf-note, .combined-pdf-status { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: #475569; overflow-wrap: anywhere; }
.combined-pdf-status:empty { display: none; }
.combined-pdf-status.is-error { color: #a32921; }

/* Append-only document selection: scoped to the mobile upload editor. */
.c2u-documents { margin: 8px 0 16px; min-width: 0; }
.c2u-documents button { min-height: 44px; padding: 8px 14px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: #334155; font: inherit; font-size: 14px; cursor: pointer; }
.c2u-documents .c2u-documents-add { width: 100%; border: 1px dashed #8b5cf6; color: #6d28d9; background: #faf8ff; font-weight: 600; }
.c2u-documents button:disabled, .c2u-documents select:disabled { opacity: .6; cursor: wait; }
.c2u-documents button:focus-visible, .c2u-documents select:focus-visible { outline: 3px solid #a78bfa; outline-offset: 2px; }
.c2u-documents [hidden] { display: none; }
.c2u-documents-help, .c2u-documents-summary, .c2u-documents-message { font-size: 13px; line-height: 1.5; color: #64748b; margin: 8px 0; overflow-wrap: anywhere; }
.c2u-documents-summary { font-weight: 600; color: #334155; }
.c2u-documents-message:empty { display: none; }
.c2u-documents-message.is-error { color: #a32921; }
.c2u-documents-list { display: grid; gap: 10px; }
.c2u-document-row { padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; min-width: 0; }
.c2u-document-row.is-error { border-color: #efb3ad; background: #fff8f7; }
.c2u-document-name { font-size: 14px; font-weight: 600; color: #1e293b; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
.c2u-document-status { font-size: 12px; line-height: 1.5; color: #64748b; margin: 4px 0 10px; overflow-wrap: anywhere; }
.c2u-document-row.is-error .c2u-document-status { color: #a32921; }
.c2u-document-category { display: grid; gap: 5px; color: #475569; font-size: 12px; font-weight: 600; }
.c2u-document-category select { display: block; width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #1e293b; font: inherit; font-size: 14px; }
.c2u-document-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
@media (max-width: 360px) { .c2u-document-actions button { flex: 1 1 80px; } }

/* Saved-document management is separate from unsaved selections. */
.document-manager { margin: 18px 0; min-width: 0; }
.document-manager h4 { margin: 14px 0 10px; font-size: 16px; color: #1e293b; }
.document-manager [hidden] { display: none; }
.document-manager-status { margin: 8px 0 12px; font-size: 13px; line-height: 1.5; color: #475569; overflow-wrap: anywhere; }
.document-manager-status.is-error { color: #a32921; }
.document-manager .document-saved-list { display: grid; gap: 10px; margin: 12px 0; }
.document-manager .document-saved-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; min-width: 0; align-items: center; }
.document-manager .document-file-name { grid-column: 1 / -1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; font-weight: 600; color: #1e293b; }
.document-manager .document-saved-row label { grid-column: 1 / -1; display: grid; gap: 5px; color: #475569; font-size: 12px; font-weight: 600; min-width: 0; }
.document-manager .document-saved-row small { grid-column: 1 / -1; font-size: 12px; color: #64748b; }
.document-manager .document-action, .document-manager .document-add-area > button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: #334155; font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; text-align: center; overflow-wrap: anywhere; }
.document-manager .document-delete { color: #a32921; border-color: #efb3ad; }
.document-manager button:disabled, .document-manager select:disabled, .document-manager textarea:disabled { opacity: .6; cursor: wait; }
.document-manager .document-action:focus-visible, .document-manager select:focus-visible, .document-manager textarea:focus-visible { outline: 3px solid #a78bfa; outline-offset: 2px; }
.document-manager .document-replacement:not(:empty) { margin: 14px 0; padding: 12px; border: 1px solid #c4b5fd; border-radius: 10px; background: #faf8ff; }
.document-manager .document-replacement > p { margin: 0 0 10px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.document-manager .document-replacement > button { margin: 0 8px 6px 0; }
.document-manager .document-add-area { margin-top: 18px; padding-top: 4px; border-top: 1px solid #e2e8f0; }
.document-manager .document-add-area > label { display: grid; gap: 6px; margin: 12px 0; font-size: 13px; color: #475569; }
.document-manager select, .document-manager textarea { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #1e293b; font: inherit; font-size: 14px; }
.document-manager .document-add-area > button { width: 100%; background: #6d28d9; border-color: #6d28d9; color: #fff; }
@media (max-width: 320px) { .document-manager .document-saved-row { grid-template-columns: minmax(0, 1fr); } }
