/* app.css — mobile_first dark theme for financier */

/* load_fonts — jetbrains mono primary, fira code fallback */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Fira+Code:wght@300;400;500;600;700&display=swap');

/* reset_and_base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0b0d10;
    --bg-card: #13161b;
    --bg-input: #1a1d24;
    --border: #262a33;
    --text: #c8ccd4;
    --text-muted: #6b7280;
    --accent: #8b95a5;
    --accent-hover: #a0aab8;
    --danger: #c0392b;
    --success: #5a7a6a;
    --warning: #b8860b;
    --radius: 4px;
    --transition: 0.15s ease;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-display: 'Fira Code', 'JetBrains Mono', monospace;
}

html { font-size: 16px; }
body {
    font-family: var(--font-mono);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    font-variant-ligatures: common-ligatures;
}

/* header_styles */
#app-header {
    text-align: center;
    padding: 14px 0 10px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
}
.logo {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 300;
    letter-spacing: 8px;
    color: var(--text);
}

/* top_navigation_bar — below header, scrolls with page */
#app-nav {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    height: 48px;
}
.nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    padding: 0;
    transition: color var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-icon { font-size: 1.1rem; line-height: 1; }
.nav-label { font-size: 0.48rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* more_sheet — dropdown from top nav */
.more-sheet { position: fixed; inset: 0; z-index: 150; }
.more-sheet.hidden { display: none; }
.more-sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.more-sheet-panel {
    position: absolute;
    top: 96px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    animation: slide-down 0.15s ease;
}
@keyframes slide-down {
    from { transform: translateY(-10px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.more-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 440px;
    margin: 0 auto;
}
.more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px 10px;
    border-radius: var(--radius);
    background: var(--bg-input);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}
.more-item:hover, .more-item.active { color: var(--text); border-color: var(--text-muted); }
.more-item-icon { font-size: 1.1rem; line-height: 1; }

/* main_content */
#app-content {
    flex: 1;
    padding: 16px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}


/* card_component */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.card-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 400;
}
.card-value {
    font-family: var(--font-display);
    font-size: clamp(1rem, 4.5vw, 1.6rem);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* form_elements */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 400;
}
.form-input, .form-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.88rem;
    transition: border-color var(--transition);
    outline: none;
}
.form-input:focus, .form-select:focus {
    border-color: var(--text-muted);
}
.form-input::placeholder { color: var(--text-muted); opacity: 0.6; }

/* button_styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.btn-primary {
    background: var(--accent);
    color: var(--bg);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #ddd; }
.btn-danger:hover { opacity: 0.85; }
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 0.68rem; }
.btn-block { width: 100%; }

/* list_items */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item-left { flex: 1; min-width: 0; }
.list-item-title {
    font-size: 0.85rem;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.list-item-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.list-item-amount {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 12px;
}
.amount-positive { color: var(--success); }
.amount-negative { color: var(--danger); }

/* grid_layout for dashboard cards */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* bar_chart — pure css */
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    width: 80px;
    flex-shrink: 0;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-track {
    flex: 1;
    height: 18px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.4s ease;
    min-width: 2px;
}
.bar-value {
    font-size: 0.68rem;
    width: 64px;
    text-align: right;
    flex-shrink: 0;
}

/* progress_ring for savings goals */
.progress-ring {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-fill {
    height: 100%;
    background: var(--text-muted);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* tab_component */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 8px 14px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 1px solid transparent;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color var(--transition), border-color var(--transition);
}
.tab:hover, .tab.active { color: var(--text); border-bottom-color: var(--text-muted); }

/* modal_overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 16px;
}
.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}

/* auth_page centered layout */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 20px;
}
.auth-form {
    width: 100%;
    max-width: 360px;
}
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
}
.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    border: none;
    background: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}
.auth-tab.active { color: var(--text); border-bottom-color: var(--text-muted); }

/* message_toast */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.78rem;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.toast.show { opacity: 1; }
.toast-success { background: var(--success); color: #e0e0e0; }
.toast-error { background: var(--danger); color: #e0e0e0; }

/* utility_classes */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }

/* nav_is_no_longer_fixed — no bottom padding needed */

/* strategy_cards */
.strategy-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.strategy-title {
    font-size: 0.78rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text);
}
.strategy-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.82rem;
}
.strategy-label { color: var(--text-muted); }

/* scenario_form */
.scenario-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* sinking_fund styles */
.fund-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}
.fund-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* page_enter animation */
@keyframes page-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.page-enter { animation: page-in 0.22s ease forwards; }

/* page_form — full_page edit view replacing modal */
.page-form { max-width: 520px; margin: 0 auto; }
.page-form-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.page-form-title { font-size: 0.9rem; font-weight: 500; }

/* alert_cards */
.alert-card {
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    font-size: 0.78rem;
    border-left: 3px solid;
    background: var(--bg-card);
}
.alert-warning { border-color: var(--warning); }
.alert-danger  { border-color: var(--danger); }

/* responsive_desktop */
@media (min-width: 768px) {
    .logo { font-size: 1.5rem; }
    #app-content { padding: 24px; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .auth-container { min-height: 70vh; }
    .modal { max-width: 480px; }
    .bar-label { width: 120px; }
}

@media (min-width: 1024px) {
    #app-content { max-width: 960px; }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* segmented_control — pill-style tab switcher */
.segmented-control {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
    margin-bottom: 16px;
}
.segment {
    flex: 1;
    padding: 7px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.segment.active {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
}
.segment:not(.active):hover { color: var(--text); }

/* expense_card — card layout for expense list items */
.expense-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
}
.expense-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.expense-card-title {
    font-size: 0.85rem;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
}
.expense-card-type {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.expense-card-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.expense-card-note {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.expense-card-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.expense-card-amount {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    margin-right: auto;
}
.expense-card-amount-sub {
    font-size: 0.62rem;
    color: var(--text-muted);
}
