:root {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Kanit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 480px; /* Mobile focused max-width */
    padding: 20px;
}

/* Glassmorphism Utilities */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin-bottom: 25px;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary), var(--accent));
}

/* Typography */
.hero-text {
    text-align: center;
    margin-bottom: 30px;
}

.hero-text h1 {
    font-size: 1.8rem;
    line-height: 1.3;
    margin-bottom: 10px;
}

.gradient-text {
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Upload Form */
.file-drop-area {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
}

.file-drop-area:active {
    background: rgba(59, 130, 246, 0.1);
}

.icon-large {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

input[type="password"]:focus {
    border-color: var(--primary);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-icon {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.w-100 { width: 100%; }
.mt-4 { margin-top: 20px; }
.mb-3 { margin-bottom: 15px; }

/* Views */
.hidden-view { display: none !important; }
.active-view { display: block; animation: fadeIn 0.4s ease; }

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

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-header h2 {
    font-size: 1.4rem;
}

.summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.ai-insights-box {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    border-radius: 16px;
}

.ai-insights-box i {
    font-size: 24px;
    color: #a78bfa;
    animation: pulse 2s infinite;
}

#ai-insights-text {
    font-size: 14px;
    color: #e2e8f0;
    line-height: 1.5;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

.stats-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.stat-icon {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.income-icon { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.expense-icon { background: rgba(244, 63, 94, 0.2); color: var(--danger); }

.stat-details p { font-size: 0.75rem; color: var(--text-muted); }
.stat-details h3 { font-size: 1.1rem; }

.charts-container {
    margin-bottom: 25px;
    padding: 15px;
    display: flex;
    justify-content: center;
}

/* Category Cards (Mobile First Grid) */
.category-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 15px;
}

.cat-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 15px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    min-height: 110px;
}

.cat-card:active {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(0.96);
}

.cat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.cat-card-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.cat-card-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 10px;
}

.cat-card-info h4 {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 5px;
    line-height: 1.2;
}

.cat-card-amount {
    font-weight: 600;
    font-size: 1.05rem;
}
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* Bulk Tagging List */
.bulk-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bulk-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(255,255,255,0.05);
}

.bulk-info {
    margin-bottom: 12px;
}

.bulk-info h4 {
    font-size: 0.95rem;
    font-weight: 500;
    word-break: break-all;
}

.bulk-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Bulk Action Grid Boxes */
.tx-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-top: 5px;
}
.tx-example {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    margin-top: 5px;
}
.font-bold { font-weight: 600; }

.quick-tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 15px;
}

.tag-chip {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    padding: 10px 5px;
    border-radius: 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.tag-chip:active {
    transform: scale(0.95);
}

.tag-chip.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-color: transparent;
    font-weight: 600;
}

/* Category Manage Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    width: 90%;
    max-width: 400px;
}

.tag-edit-list {
    max-height: 50vh;
    overflow-y: auto;
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tag-edit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.05);
    padding: 10px 15px;
    border-radius: 10px;
}

.tag-edit-actions i {
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 10px;
}
.tag-edit-actions .delete { color: var(--danger); }
.tag-edit-actions .edit { color: var(--primary); }

/* Loading Spinner */
#loading-spinner {
    text-align: center;
    margin-top: 20px;
    color: var(--primary);
}
.spinner {
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
