@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-2: #f8f9fb;
    --text: #1a1d29;
    --muted: #6b7280;
    --border: #e6e8ee;
    --primary: #4f6ef7;
    --primary-dark: #3a54d6;
    --primary-light: #eef1ff;
    --accent: #7c5cff;
    --danger: #e5484d;
    --warning: #d9a02b;
    --success: #22a06b;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.04);
    --shadow-md: 0 4px 14px rgba(20, 24, 40, 0.07);
    --shadow-lg: 0 12px 32px rgba(20, 24, 40, 0.12);
    --gradient: linear-gradient(135deg, #4f6ef7 0%, #7c5cff 100%);
}

:root[data-theme="dark"] {
    --bg: #10121a;
    --surface: #171a26;
    --surface-2: #1d2130;
    --text: #edeef5;
    --muted: #9498a8;
    --border: #2a2e40;
    --primary: #6d84ff;
    --primary-dark: #566dfa;
    --primary-light: #232a4d;
    --accent: #9c85ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    transition: background .25s ease, color .25s ease;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--primary-dark); }

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    margin-bottom: 28px;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.navbar .brand {
    font-weight: 800;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}
.navbar .brand .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--gradient);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.navbar nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.navbar nav a {
    padding: 7px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.92rem;
    transition: background .15s ease, color .15s ease;
}
.navbar nav a:hover { background: var(--surface-2); color: var(--text); }
.navbar nav a.active { color: var(--primary); background: var(--primary-light); }

.navbar .right { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: transform .2s ease, background .2s ease;
}
.theme-toggle:hover { transform: scale(1.08); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.card.hoverable:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.grid {
    display: grid;
    gap: 20px;
}

@media (min-width: 700px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

h1 { font-size: 1.7rem; margin: 0 0 18px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 0 0 14px; font-weight: 700; }

.stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
}
.stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: var(--gradient);
    opacity: .9;
}
.stat .value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.stat .label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .icon { font-size: 1.4rem; margin-bottom: 2px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}
th, td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 700; font-size: 0.74rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background .15s ease; }
tbody tr:hover td { background: var(--surface-2); }

.table-wrap { overflow-x: auto; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
}
.badge.status-active { background: var(--success); }
.badge.status-paused { background: var(--warning); }
.badge.status-cancelled { background: var(--muted); }

.category-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 15%, transparent);
}

.alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-success { background: color-mix(in srgb, var(--success) 12%, var(--surface)); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-warning { background: color-mix(in srgb, var(--warning) 14%, var(--surface)); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }

form .field {
    margin-bottom: 16px;
}
label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.83rem;
    color: var(--text);
}
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-light);
}
input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }
input[type="checkbox"] { width: auto; display: inline-block; margin-right: 6px; vertical-align: middle; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--gradient);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none; filter: brightness(1.04); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); box-shadow: none; }
.btn.secondary:hover { background: var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 0.8rem; }

.filters {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    align-items: end;
}
.filters .field { margin-bottom: 0; min-width: 170px; }

.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.month-nav .current { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; }

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 230px;
    padding-top: 10px;
}
.chart-bars .bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}
.chart-bars .bar {
    width: 100%;
    max-width: 42px;
    background: var(--gradient);
    border-radius: 6px 6px 2px 2px;
    transition: height .4s cubic-bezier(.4,0,.2,1), filter .15s ease;
}
.chart-bars .bar-col:hover .bar { filter: brightness(1.1); }
.chart-bars .bar-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 8px;
    font-weight: 600;
}
.chart-bars .bar-value {
    font-size: 0.7rem;
    color: var(--text);
    margin-bottom: 4px;
    font-weight: 700;
}

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

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
}
@media (min-width: 900px) {
    .auth-page { grid-template-columns: 1fr 1fr; }
}
.auth-hero {
    background: var(--gradient);
    color: #fff;
    display: none;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}
@media (min-width: 900px) { .auth-hero { display: flex; } }
.auth-hero::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    top: -150px; right: -150px;
}
.auth-hero::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    bottom: -100px; left: -80px;
}
.auth-hero h2 { color: #fff; font-size: 2rem; margin-bottom: 12px; position: relative; }
.auth-hero p { color: rgba(255,255,255,0.85); font-size: 1rem; max-width: 380px; position: relative; }
.auth-hero ul { list-style: none; padding: 0; margin: 24px 0 0; position: relative; }
.auth-hero li { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,0.92); }

.auth-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-wrap {
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: fadeUp .4s ease both;
}
.auth-wrap h1 { margin-bottom: 6px; }
.auth-wrap .subtitle { color: var(--muted); margin-bottom: 22px; font-size: 0.92rem; }

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

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.remember-row label { display: inline-flex; align-items: center; margin: 0; font-weight: 500; color: var(--muted); }

footer.hint {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 10px;
    text-align: center;
}

.progress-bar {
    height: 8px;
    border-radius: 20px;
    background: var(--surface-2);
    overflow: hidden;
    margin-top: 8px;
}
.progress-bar .fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 20px;
    transition: width .4s ease;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.empty-state .emoji { font-size: 2.2rem; margin-bottom: 10px; }
