/* ═══ VIKING FINANCE — DARK THEME ═══ */

:root {
    --bg: #0f0f1a;
    --card: #1a1a2e;
    --card-border: #2a2a4a;
    --accent: #f59e0b;
    --accent-dim: rgba(245, 158, 11, 0.15);
    --red: #e94560;
    --green: #22c55e;
    --blue: #3b82f6;
    --purple: #a855f7;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
}

/* ── Top Bar ────────────────────────────── */

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
    border-bottom: 1px solid var(--card-border);
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}
.logo span { color: var(--text); }

.month-badge {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.logout-btn {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s;
}
.logout-btn:hover { color: var(--red); }

/* ── Content ────────────────────────────── */

.content {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px;
    overflow-y: auto;
}

/* ── Cards ────────────────────────────── */

.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.card-header h2 { font-size: 20px; }

/* ── Summary Cards ────────────────────────── */

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

.summary-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
}

.summary-icon { font-size: 24px; margin-bottom: 4px; }
.summary-value { font-size: 22px; font-weight: 800; line-height: 1.2; }
.summary-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.summary-positive { color: var(--green); }
.summary-negative { color: var(--red); }
.summary-neutral { color: var(--accent); }

/* ── Budget Progress Bar ────────────────── */

.budget-bar-container {
    margin-bottom: 12px;
}

.budget-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.budget-bar {
    height: 8px;
    background: var(--card-border);
    border-radius: 4px;
    overflow: hidden;
}

.budget-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    background: var(--accent);
}

.budget-bar-fill.over { background: var(--red); }
.budget-bar-fill.warn { background: #f97316; }

/* ── Today's Expenses ────────────────────── */

.expense-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--card-border);
}
.expense-item:last-child { border-bottom: none; }

.expense-icon {
    font-size: 20px;
    width: 36px;
    text-align: center;
}

.expense-details { flex: 1; }
.expense-cat { font-size: 13px; color: var(--text-muted); }
.expense-desc { font-size: 14px; font-weight: 500; }

.expense-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--red);
    white-space: nowrap;
}

.expense-recurring {
    font-size: 10px;
    color: var(--purple);
    background: rgba(168,85,247,0.15);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

/* ── Category Budget Items ────────────────── */

.cat-item {
    margin-bottom: 10px;
}

.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 14px;
}

.cat-budget-bar {
    height: 6px;
    background: var(--card-border);
    border-radius: 3px;
    overflow: hidden;
}

.cat-budget-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.cat-over { color: var(--red); }

/* ── Weekly Chart ────────────────────────── */

.weekly-chart {
    display: flex;
    gap: 6px;
    align-items: flex-end;
    height: 80px;
    margin-bottom: 8px;
}

.chart-bar {
    flex: 1;
    height: 80px;
    background: var(--card-border);
    border-radius: 4px 4px 0 0;
    position: relative;
    overflow: hidden;
}

.chart-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: var(--accent);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s;
}

.chart-label {
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.chart-day {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
}

/* ── Streak Card ────────────────────────── */

.streak-card {
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s;
}
.streak-card:hover { transform: scale(1.02); }

.streak-number {
    font-size: 48px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}
.streak-label {
    color: var(--text-muted);
    font-size: 14px;
    margin: 4px 0 12px;
}

/* ── Buttons ────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--bg);
    flex: 1;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #d97706; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-green { background: var(--green); color: #000; }
.btn-red { background: var(--red); color: #fff; }

.btn-large { width: 100%; padding: 16px; font-size: 16px; margin-top: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-fab {
    position: fixed;
    bottom: 80px;
    right: calc(50% - 240px + 16px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    font-size: 28px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(245,158,11,0.4);
    z-index: 50;
    transition: transform 0.2s;
}
.btn-fab:hover { transform: scale(1.1); }

@media (max-width: 480px) {
    .btn-fab { right: 16px; }
}

/* ── Bottom Nav ────────────────────────── */

.bottom-nav {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    background: var(--bg);
    border-top: 1px solid var(--card-border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 11px;
    gap: 2px;
    transition: color 0.2s;
}
.nav-item.active { color: var(--accent); }

/* ── Forms ────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

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

.form-input {
    width: 100%;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--accent); }

.form-select {
    width: 100%;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    outline: none;
    appearance: none;
}

.form-row {
    display: flex;
    gap: 10px;
}

.amount-input-group {
    position: relative;
}

.currency-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 600;
}

.amount-input {
    padding-left: 44px !important;
}

/* ── Category Grid ────────────────────────── */

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.category-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 4px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
}

.category-chip:hover, .category-chip.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.category-chip .cat-icon { font-size: 24px; margin-bottom: 4px; }
.category-chip .cat-name { font-size: 11px; text-align: center; line-height: 1.2; }

/* ── Quick Links ────────────────────────── */

.quick-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
}
.quick-link:last-child { border-bottom: none; }
.quick-link span:first-child { font-size: 20px; }

/* ── History ────────────────────────────── */

.date-group { margin-bottom: 20px; }
.date-header { 
    font-size: 13px; 
    color: var(--text-muted); 
    font-weight: 600; 
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}
.date-total { color: var(--red); font-weight: 700; }

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* ── Filter Bar ────────────────────────── */

.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--card);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.filter-chip:hover, .filter-chip.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

/* ── Goals ────────────────────────────── */

.goal-card {
    margin-bottom: 12px;
}

.goal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.goal-icon { font-size: 28px; }
.goal-name { font-size: 16px; font-weight: 600; flex: 1; }

.goal-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.goal-bar {
    height: 10px;
    background: var(--card-border);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}
.goal-bar-fill {
    height: 100%;
    background: var(--green);
    border-radius: 5px;
    transition: width 0.5s;
}

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

.goal-deadline {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}

.goal-form {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

/* ── Subscriptions ────────────────────────── */

.sub-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
}
.sub-item:last-child { border-bottom: none; }

.sub-icon { font-size: 20px; margin-right: 10px; }
.sub-name { flex: 1; font-size: 14px; }
.sub-cycle { font-size: 11px; color: var(--text-dim); }
.sub-amount { font-size: 16px; font-weight: 700; color: var(--accent); }

/* ── Settings ────────────────────────────── */

.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
}
.setting-row:last-child { border-bottom: none; }

.setting-label { font-size: 14px; }
.setting-value { color: var(--accent); font-weight: 600; font-size: 14px; }

/* ── Responsive ────────────────────────── */

@media (min-width: 481px) {
    .app {
        border-left: 1px solid var(--card-border);
        border-right: 1px solid var(--card-border);
    }
}

/* ── Empty State ────────────────────────── */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 8px; font-size: 18px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* ── Delete Form ────────────────────────── */

.inline-form { display: inline; }