@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-bg: rgba(99, 102, 241, 0.08);
    --primary-glow: rgba(99, 102, 241, 0.25);
    --accent: #f59e0b;
    --bg: #f1f5f9;
    --bg-elevated: #ffffff;
    --card: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.15);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Auth Page ===== */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -50px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card .subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 36px;
    font-size: 15px;
    font-weight: 500;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
    letter-spacing: 0.01em;
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    background: var(--bg-elevated);
    color: var(--text);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-group input:hover, .form-group select:hover {
    border-color: #cbd5e1;
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 15px;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: #cbd5e1;
    box-shadow: var(--shadow);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px var(--danger-bg);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px var(--success-bg);
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.auth-switch a:hover {
    color: var(--primary-dark);
}

/* Auth Logo */
.auth-logo {
    font-size: 56px;
    text-align: center;
    margin-bottom: 12px;
    animation: bounceIn 0.8s ease;
    filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.3));
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Floating Decorations */
.auth-decor {
    position: absolute;
    font-size: 32px;
    opacity: 0.15;
    animation: floatDecor 15s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.auth-decor-1 { top: 10%; left: 8%; animation-delay: 0s; font-size: 40px; }
.auth-decor-2 { top: 20%; right: 12%; animation-delay: -3s; font-size: 36px; }
.auth-decor-3 { bottom: 25%; left: 15%; animation-delay: -6s; font-size: 28px; }
.auth-decor-4 { bottom: 15%; right: 10%; animation-delay: -9s; font-size: 34px; }
.auth-decor-5 { top: 55%; left: 5%; animation-delay: -12s; font-size: 30px; }

@keyframes floatDecor {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(10deg); }
    50% { transform: translateY(-20px) rotate(-5deg); }
    75% { transform: translateY(-10px) rotate(8deg); }
}

/* Input with Icon */
.input-with-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    z-index: 1;
    pointer-events: none;
}

.input-with-icon input {
    padding-left: 42px !important;
}

/* Login Button Enhancement */
.btn-login {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-login:hover::before {
    left: 100%;
}

.btn-arrow {
    transition: transform 0.3s;
    font-size: 18px;
}

.btn-login:hover .btn-arrow {
    transform: translateX(4px);
}

/* ===== Dashboard Layout ===== */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    font-size: 22px;
    font-weight: 800;
    padding: 4px 14px;
    margin-bottom: 36px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav { flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 8px var(--primary-glow);
}

.main-content {
    flex: 1;
    padding: 36px 40px;
    overflow-y: auto;
    max-width: calc(100vw - 280px);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 28px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before { opacity: 1; }

.stat-card .label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.stat-card .value.expense { color: var(--danger); }
.stat-card .value.income { color: var(--success); }

/* ===== Calendar ===== */
.calendar-container {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

/* FullCalendar overrides */
.fc {
    font-family: inherit !important;
}

.fc .fc-toolbar-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: var(--text) !important;
}

.fc .fc-button-primary {
    background: var(--primary) !important;
    border: none !important;
    border-radius: var(--radius-xs) !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    padding: 6px 14px !important;
    text-transform: capitalize !important;
    box-shadow: none !important;
    transition: var(--transition) !important;
}

.fc .fc-button-primary:hover {
    background: var(--primary-dark) !important;
}

.fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--primary-dark) !important;
}

.fc .fc-daygrid-day-number {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--text) !important;
    padding: 8px !important;
}

.fc .fc-daygrid-day.fc-day-today {
    background: var(--primary-bg) !important;
}

.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    color: var(--primary) !important;
    font-weight: 700 !important;
}

.fc .fc-event {
    border-radius: 6px !important;
    padding: 2px 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border: none !important;
}

.fc .fc-col-header-cell {
    background: var(--bg) !important;
    border-color: var(--border) !important;
    padding: 10px 0 !important;
}

.fc .fc-col-header-cell-cushion {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.fc td, .fc th {
    border-color: var(--border-light) !important;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-elevated);
    border-radius: 20px;
    padding: 36px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.97);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 28px;
}

/* ===== Table ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th, td {
    padding: 14px 18px;
    text-align: left;
    font-size: 14px;
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}

td {
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

tr:hover td {
    background: rgba(241, 245, 249, 0.5);
}

tr:last-child td { border-bottom: none; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-expense { background: var(--danger-bg); color: var(--danger); }
.badge-income { background: var(--success-bg); color: var(--success); }
.badge-admin { background: var(--primary-bg); color: var(--primary); }

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 22px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
}

.toast.success {
    border-left: 4px solid var(--success);
    background: linear-gradient(90deg, rgba(16,185,129,0.04) 0%, var(--bg-elevated) 100%);
}

.toast.error {
    border-left: 4px solid var(--danger);
    background: linear-gradient(90deg, rgba(239,68,68,0.04) 0%, var(--bg-elevated) 100%);
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Admin Page ===== */
.admin-layout {
    max-width: 960px;
    margin: 0 auto;
    padding: 48px 24px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
}

.admin-header h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.config-section {
    margin-bottom: 28px;
}

.config-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ===== Price Config ===== */
.price-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.price-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== Selection ===== */
::selection {
    background: var(--primary-bg);
    color: var(--primary-dark);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        z-index: 500;
        width: 280px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    .sidebar.open {
        left: 0;
        box-shadow: var(--shadow-xl);
    }
    .main-content {
        padding: 20px 16px;
        max-width: 100vw;
        padding-top: 72px;
    }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header h2 { font-size: 22px; }
    .auth-card { padding: 32px 24px; }
    .admin-layout { padding: 24px 16px; }
    .modal { padding: 24px; margin: 16px; }
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 400;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    padding: 0;
}

.mobile-menu-btn:hover {
    background: var(--bg);
    box-shadow: var(--shadow-lg);
}

.mobile-menu-btn .bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
    position: absolute;
    left: 12px;
}

.mobile-menu-btn .bar:nth-child(1) { top: 14px; }
.mobile-menu-btn .bar:nth-child(2) { top: 21px; }
.mobile-menu-btn .bar:nth-child(3) { top: 28px; }

.mobile-menu-btn.active .bar:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}
.mobile-menu-btn.active .bar:nth-child(2) {
    opacity: 0;
}
.mobile-menu-btn.active .bar:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 450;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 900px) {
    .mobile-menu-btn {
        display: flex;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card, .stat-card {
    animation: fadeIn 0.3s ease;
}

/* ===== Focus Visible ===== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== Loading States ===== */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ===== Multi-item Transaction Modal ===== */
.tx-section {
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.tx-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--bg-elevated);
    color: var(--primary);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1;
    padding: 0;
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
}

.tx-items {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 20px;
}

.tx-items:empty::after {
    content: '点击 + 添加';
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 8px;
}

.tx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    animation: fadeIn 0.2s ease;
}

.tx-item select,
.tx-item input {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    background: var(--bg-elevated);
    transition: var(--transition);
}

.tx-item select:focus,
.tx-item input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.tx-item select {
    flex: 2;
    min-width: 0;
}

.tx-item input {
    flex: 1;
    min-width: 0;
}

.tx-item .tx-item-amount {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    min-width: 65px;
    text-align: right;
}

.btn-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}

.btn-remove:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

/* Summary */
.tx-summary {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-top: 16px;
}

.tx-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.tx-summary-total {
    border-top: 2px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}


/* ===== Today Summary ===== */
.today-summary {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.today-summary-header {
    margin-bottom: 16px;
}

.today-date {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.today-summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.today-stat {
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.today-stat.expense {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.today-stat.income {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.today-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.today-stat-value {
    font-size: 24px;
    font-weight: 700;
}

.today-stat.expense .today-stat-value {
    color: var(--danger);
}

.today-stat.income .today-stat-value {
    color: var(--success);
}

.today-items {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.today-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.today-item:last-child {
    border-bottom: none;
}

.today-item-text {
    font-size: 14px;
    color: var(--text);
}

.today-item-amount {
    font-size: 14px;
    font-weight: 600;
}



/* ===== Admin Page ===== */
.admin-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 24px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    color: white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-header-icon {
    font-size: 36px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.admin-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: white;
}

.admin-header-subtitle {
    font-size: 13px;
    opacity: 0.8;
    margin-top: 4px;
}

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

.admin-header-actions .btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
}

.admin-header-actions .btn-secondary:hover {
    background: rgba(255,255,255,0.3);
}

.admin-header-actions .btn-danger {
    background: rgba(239, 68, 68, 0.8);
    border: 1px solid rgba(239, 68, 68, 0.5);
}

/* Admin Cards */
.admin-card {
    background: var(--card);
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition);
}

.admin-card:hover {
    box-shadow: var(--shadow-md);
}

.admin-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg);
}

.admin-card-icon {
    font-size: 24px;
}

.admin-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.admin-card-badge {
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
}

.admin-card-body {
    padding: 24px;
}

/* Admin Form Grid */
.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.admin-form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.admin-form-field .required {
    color: var(--danger);
}

.admin-form-field .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    background: var(--bg-elevated);
}

.admin-form-field .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    padding: 12px 28px;
    font-size: 15px;
}

.admin-btn-sm {
    width: auto;
    padding: 10px 20px;
    font-size: 13px;
}

/* Admin Toolbar */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-toolbar-left,
.admin-toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-toolbar .form-control {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    min-width: 160px;
}

/* Admin Table */
.admin-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg);
}

th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

tr:hover {
    background: var(--bg);
}

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

.table-id {
    color: var(--text-muted);
    font-size: 13px;
    font-family: monospace;
}

.table-amount {
    font-weight: 600;
    font-size: 15px;
}

.table-amount.expense { color: var(--danger); }
.table-amount.income { color: var(--success); }

.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 16px !important;
    font-size: 14px;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-action-edit {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.btn-action-edit:hover {
    background: var(--primary);
    color: white;
}

.btn-action-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.btn-action-delete:hover {
    background: var(--danger);
    color: white;
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.role-admin {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.role-user {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-expense {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-income {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* Admin Modal */
.admin-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.admin-modal {
    background: var(--card);
    border-radius: 20px;
    max-width: 440px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

.admin-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.admin-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    transition: var(--transition);
}

.admin-modal-close:hover {
    color: var(--text);
}

.admin-modal-body {
    padding: 24px;
}

.admin-modal-desc {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.admin-modal-body .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 20px;
    outline: none;
    transition: var(--transition);
}

.admin-modal-body .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

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

.admin-modal-actions .btn {
    flex: 1;
    justify-content: center;
}

/* Admin Toast */
#toast.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

#toast.toast.show {
    opacity: 1;
}

#toast.toast.show.success {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#toast.toast.show.error {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Admin Responsive */
@media (max-width: 768px) {
    .admin-layout { padding: 16px; }
    .admin-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 20px;
    }
    .admin-header-left { flex-direction: column; }
    .admin-header-actions { width: 100%; justify-content: center; }
    .admin-toolbar { flex-direction: column; }
    .admin-toolbar-left, .admin-toolbar-right { width: 100%; justify-content: center; }
    .admin-form-grid { grid-template-columns: 1fr; }
}


