/* ================================
   CSS Variables & Theme
================================ */
:root {
    /* Colors - Premium Palette */
    /* Colors - Backgrounds & Surfaces */
    --bg-primary: #f0f2f5;
    --bg-gradient-start: #e0e7ff;
    --bg-gradient-mid: #f3e8ff;
    --bg-gradient-end: #f0fdf4;

    /* Clean Glass Effect */
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-secondary: #f8fafc;
    --glass-border: rgba(255, 255, 255, 0.6);
    --border-color: rgba(226, 232, 240, 0.8);
    --border-glow: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-light: #ffffff;

    /* Brand Colors - Sophisticated & Vibrant */
    --accent-income: #059669;
    /* Emerald 600 */
    --accent-income-light: #34d399;
    --accent-income-bg: #d1fae5;
    --accent-income-glow: rgba(5, 150, 105, 0.2);

    --accent-expense: #e11d48;
    /* Rose 600 */
    --accent-expense-light: #fb7185;
    --accent-expense-bg: #ffe4e6;
    --accent-expense-glow: rgba(225, 29, 72, 0.2);

    --accent-profit: #2563eb;
    /* Royal Blue */
    --accent-profit-light: #60a5fa;
    --accent-profit-bg: #dbeafe;
    --accent-profit-glow: rgba(37, 99, 235, 0.2);

    --accent-purple: #7c3aed;
    /* Violet 600 */
    --accent-purple-light: #a78bfa;

    /* Gradients */
    --gradient-income: linear-gradient(135deg, #10b981 0%, #047857 100%);
    --gradient-expense: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    --gradient-profit: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);

    /* Dynamic Mesh Gradient Background */
    --main-bg-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(34, 197, 94, 0.15) 0px, transparent 50%);

    /* Spacing - Relaxed */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2.5rem;
    --spacing-2xl: 4rem;

    /* Border Radius - Squircles-ish */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;

    /* Shadows - Soft & Diffused */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.03);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ================================
   Reset & Base Styles
================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-image: var(--main-bg-image);
    background-color: var(--bg-primary);
    background-attachment: fixed;
    background-size: cover;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* body::before removed as we use background-image on body */

/* ================================
   Layout
================================ */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    min-height: 100vh;
}

/* ================================
   Header
================================ */
/* ================================
   Header
================================ */
.header {
    margin-bottom: var(--spacing-lg);
}

.date-picker-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: white;
    border: 1px solid white;
    border-radius: var(--radius-full);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 2px 4px -1px rgba(0, 0, 0, 0.03);
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.date-nav-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.date-nav-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.date-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.date-nav-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.date-display {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0 var(--spacing-sm);
}

.date-input {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.date-input:hover {
    background: rgba(0, 0, 0, 0.03);
}

.date-input:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 0 2px var(--accent-profit-light);
}

.date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.date-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.date-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
}

.date-today-btn {
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--accent-profit-bg);
    color: var(--accent-profit);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.date-today-btn:hover {
    background: var(--accent-profit);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.date-today-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo-icon-wrapper {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-income);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow-income);
    transform: rotate(-5deg);
    transition: transform 0.3s ease;
}

.logo:hover .logo-icon-wrapper {
    transform: rotate(0deg) scale(1.05);
}

.logo-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: white;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: var(--spacing-xs);
    background: rgba(0, 0, 0, 0.03);
    padding: 4px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-lg) - 4px);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-tab svg {
    width: 1.125rem;
    height: 1.125rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
}

.nav-tab.active {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.nav-tab.active svg {
    opacity: 1;
    color: var(--accent-profit);
}

.nav-tab[data-page="income"].active svg {
    color: var(--accent-income);
}

.nav-tab[data-page="expense"].active svg {
    color: var(--accent-expense);
}

/* ================================
   Stats Cards
================================ */
/* ================================
   Stats Cards
================================ */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: var(--bg-card);
    /* Now high opacity white */
    border: 1px solid white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 2px 4px -1px rgba(0, 0, 0, 0.03),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.05),
        0 10px 10px -5px rgba(0, 0, 0, 0.01);
}

.stat-card::after {
    /* Removed the large blur blob to clean up the look */
    display: none;
}

.stat-card.income {
    border-left: 4px solid var(--accent-income);
}

.stat-card.expense {
    border-left: 4px solid var(--accent-expense);
}

.stat-card.profit {
    border-left: 4px solid var(--accent-profit);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Colors for left border indicator */
.stat-card.income::before {
    background: var(--accent-income);
}

/* Removed redundant stat-card pseudo-elements */

/* ================================
   Main Content
================================ */
.main-content {
    position: relative;
    padding-bottom: var(--spacing-2xl);
}

.page {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.page.active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ================================
   Dashboard
================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
}

.dashboard-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.dashboard-card:hover {
    border-color: var(--glass-border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    animation: slideUp 0.4s ease-out backwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.dashboard-card.daily-history {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.4);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stats-range-select {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.stats-range-select:hover {
    border-color: var(--accent-profit-light);
    color: var(--text-primary);
}

/* Profit Chart */
.profit-chart {
    padding: var(--spacing-lg) var(--spacing-xl);
    min-height: 240px;
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-md);
}

.chart-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    height: 100%;
    justify-content: flex-end;
}

.chart-bar-fill {
    width: 80%;
    max-width: 64px;
    min-height: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-bounce);
    position: relative;
    cursor: pointer;
}

.chart-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s;
}

.chart-bar:hover .chart-bar-fill {
    transform: scaleY(1.05) translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chart-bar:hover .chart-bar-fill::after {
    opacity: 1;
}

.chart-bar-fill.positive {
    background: var(--accent-income);
}

.chart-bar-fill.negative {
    background: var(--accent-expense);
}

.chart-bar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.chart-bar-value {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.chart-bar:hover .chart-bar-value {
    opacity: 1;
    transform: translateY(0);
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.summary-item:hover {
    background: white;
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

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

.summary-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.summary-value.income {
    color: var(--accent-income);
}

.summary-value.expense {
    color: var(--accent-expense);
}

.summary-value.profit {
    color: var(--accent-profit);
}

/* Daily List */
.daily-list {
    max-height: 450px;
    overflow-y: auto;
    padding: 0 var(--spacing-sm) var(--spacing-sm);
}

.daily-header {
    top: 0;
    position: sticky;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    margin: 0 -8px;
    padding: 12px 24px !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.daily-item {
    display: grid;
    grid-template-columns: 100px 1fr 1fr 1fr;
    align-items: center;
    padding: var(--spacing-md);
    margin: 4px 0;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: 1px solid transparent;
}

.daily-item:not(.daily-header):hover {
    background: white;
    box-shadow: var(--shadow-sm);
    border-color: var(--border-color);
    transform: translateX(4px);
}

.daily-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background var(--transition-fast);
}

.daily-item:hover::before {
    background: var(--accent-profit);
}

.daily-item:last-child {
    border-bottom: none;
}

.daily-item:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
}

.daily-date {
    font-size: 0.875rem;
    font-weight: 500;
}

.daily-income,
.daily-expense,
.daily-profit {
    text-align: right;
    font-weight: 600;
}

.daily-income {
    color: var(--accent-income);
}

.daily-expense {
    color: var(--accent-expense);
}

.daily-profit.positive {
    color: var(--accent-profit);
}

.daily-profit.negative {
    color: var(--accent-expense);
}

.daily-header {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.03);
}

.daily-header .daily-date,
.daily-header .daily-income,
.daily-header .daily-expense,
.daily-header .daily-profit {
    color: var(--text-muted);
    font-weight: 500;
}

.daily-empty {
    padding: var(--spacing-2xl);
    text-align: center;
    color: var(--text-muted);
}

/* Detail Section Styles */
.detail-section {
    margin-top: var(--spacing-lg);
}

.detail-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
}

.detail-section-title.income-title {
    color: var(--accent-income);
    background: var(--accent-income-glow);
}

.detail-section-title.expense-title {
    color: var(--accent-expense);
    background: var(--accent-expense-glow);
}

.detail-empty {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ================================
   Page Header & Buttons
================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.btn-add {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--gradient-purple);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-add::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-add:hover::before {
    left: 100%;
}

.btn-add svg {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
    filter: brightness(1.1);
}

.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-md) var(--spacing-xl);
    border: none;
    border-radius: var(--radius-xl);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.btn-submit::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.6s;
}

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

.btn-submit svg {
    width: 1.5rem;
    height: 1.5rem;
}

.btn-submit.income {
    background: var(--gradient-income);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.btn-submit.expense {
    background: var(--gradient-expense);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.btn-submit:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-submit:active {
    transform: translateY(0);
}

/* ================================
   Items Grid
================================ */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.item-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.item-card:hover {
    border-color: var(--glass-border);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.item-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
    background: var(--bg-secondary);
    display: block;
}

.item-image.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.5));
}

.item-image.placeholder svg {
    width: 3rem;
    height: 3rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.item-info {
    padding: var(--spacing-md);
}

.item-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.item-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-income);
    margin-bottom: var(--spacing-md);
}

.expense-card .item-price {
    color: var(--accent-expense);
}

/* Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 6px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-lg);
}

.qty-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 400;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

cursor: pointer;
transition: all var(--transition-fast);
}

.qty-btn:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-input {
    width: 3.5rem;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Item Actions */
.item-actions {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

.item-action-btn {
    flex: 1;
    padding: var(--spacing-sm);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.item-action-btn svg {
    width: 1rem;
    height: 1rem;
}

.item-action-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.item-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-expense);
}

/* ================================
   Submit Section
================================ */
.submit-section {
    margin-bottom: var(--spacing-2xl);
}

/* ================================
   History Section
================================ */
.history-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.history-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.btn-toggle {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform var(--transition-normal);
}

.btn-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
}

.btn-toggle.collapsed svg {
    transform: rotate(-90deg);
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-list.collapsed {
    display: none;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: var(--spacing-md);
}

.history-main {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    flex: 1;
    min-width: 0;
}

.history-items {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.history-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.history-amount {
    font-size: 1.1rem;
    font-weight: 600;
}

.history-amount.income {
    color: var(--accent-income);
}

.history-amount.expense {
    color: var(--accent-expense);
}

.history-empty {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-muted);
}

/* ================================
   Modals
================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 440px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.modal.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close svg {
    width: 1.25rem;
    height: 1.25rem;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

/* Form Styles */
.form-group {
    padding: 0 var(--spacing-xl);
    margin-top: var(--spacing-lg);
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-profit);
    box-shadow: 0 0 0 3px var(--accent-profit-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Image Upload */
.image-upload {
    position: relative;
    width: 100%;
    height: 160px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.image-upload:hover {
    border-color: var(--accent-profit);
    background: rgba(59, 130, 246, 0.05);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--spacing-sm);
    color: var(--text-muted);
}

.upload-placeholder svg {
    width: 2.5rem;
    height: 2.5rem;
}

.image-preview {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview.active {
    display: block;
}

.image-preview.active+.upload-placeholder {
    display: none;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    margin-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.btn-cancel,
.btn-confirm {
    flex: 1;
    padding: var(--spacing-md);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-cancel {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
}

.btn-confirm {
    background: var(--gradient-profit);
    color: white;
}

.btn-confirm:hover {
    filter: brightness(1.1);
}

/* Detail Modal */
.detail-modal {
    max-width: 520px;
    max-height: 80vh;
}

.detail-content {
    padding: var(--spacing-lg);
    max-height: 60vh;
    overflow-y: auto;
}

.detail-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
}

.detail-summary-label {
    color: var(--text-secondary);
}

.detail-summary-value {
    font-size: 1.75rem;
    font-weight: 800;
}

.detail-summary-value.income {
    color: var(--accent-income);
}

.detail-summary-value.expense {
    color: var(--accent-expense);
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.detail-item-name {
    font-weight: 600;
}

.detail-item-info {
    text-align: right;
}

.detail-item-qty {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.detail-item-amount {
    font-size: 1.1rem;
    font-weight: 700;
}

/* ================================
   Toast
================================ */
.toast {
    position: fixed;
    bottom: var(--spacing-xl);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 2000;
}

.toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-color: var(--accent-income);
    box-shadow: var(--shadow-glow-income);
}

.toast.error {
    border-color: var(--accent-expense);
    box-shadow: var(--shadow-glow-expense);
}

/* ================================
   Empty State
================================ */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    text-align: center;
}

.empty-state svg {
    width: 4rem;
    height: 4rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.empty-state p {
    color: var(--text-secondary);
}

/* ================================
   Scrollbar
================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ================================
   Responsive Design
================================ */
@media (max-width: 1024px) {
    .stats-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: var(--spacing-md);
    }

    .header-top {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }

    .logo {
        justify-content: center;
    }

    .nav-tabs {
        justify-content: center;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: var(--spacing-lg);
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--spacing-md);
    }

    .item-image {
        aspect-ratio: 1 / 1;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
    }

    .page-header h2 {
        text-align: center;
    }

    .daily-item {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-sm);
    }

    .daily-header {
        display: none;
    }
}

@media (max-width: 480px) {
    .nav-tab span {
        display: none;
    }

    .nav-tab svg {
        width: 1.5rem;
        height: 1.5rem;
    }

    .items-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card-value {
        font-size: 1.25rem;
    }
}