/* ========================================
   Tulis Digital — Material Design 3
   ======================================== */

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

:root {
    /* MD3 Primary — Emerald Green */
    --md-primary: #1A7F37;
    --md-on-primary: #FFFFFF;
    --md-primary-container: #A5F5B5;
    --md-on-primary-container: #002108;
    --md-primary-hover: rgba(26,127,55,0.08);
    --md-primary-active: rgba(26,127,55,0.12);
    
    /* MD3 Secondary */
    --md-secondary: #526352;
    --md-on-secondary: #FFFFFF;
    --md-secondary-container: #D5E8D4;
    --md-on-secondary-container: #101F11;
    
    /* MD3 Tertiary */
    --md-tertiary: #596377;
    --md-on-tertiary: #FFFFFF;
    --md-tertiary-container: #DDE1F7;
    
    /* MD3 Surface */
    --md-surface: #F8FBF5;
    --md-on-surface: #191D18;
    --md-surface-variant: #DDE5D9;
    --md-on-surface-variant: #414941;
    --md-surface-dim: #D8DAD3;
    --md-surface-bright: #F8FBF5;
    --md-surface-container: #ECEEEA;
    --md-surface-container-low: #F2F4EF;
    --md-surface-container-high: #E6E8E4;
    --md-surface-container-highest: #E1E3DE;
    
    /* MD3 Outline */
    --md-outline: #717970;
    --md-outline-variant: #C1C9BD;
    
    /* MD3 Inverse */
    --md-inverse-surface: #2E322D;
    --md-inverse-on-surface: #EFF1EA;
    
    /* MD3 Error */
    --md-error: #B3261E;
    --md-on-error: #FFFFFF;
    --md-error-container: #F9DEDC;
    --md-on-error-container: #410E0B;
    
    /* Semantic */
    --income: #10B981;
    --income-container: #D1FAE5;
    --income-on-container: #064E3B;
    --expense: #EF4444;
    --expense-container: #FEE2E2;
    --expense-on-container: #7F1D1D;
    
    /* Shape */
    --shape-xs: 4px;
    --shape-s: 8px;
    --shape-m: 12px;
    --shape-l: 16px;
    --shape-xl: 28px;
    --shape-full: 9999px;
    
    /* Elevation */
    --elev-1: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px 1px rgba(0,0,0,0.15);
    --elev-2: 0 2px 4px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
    --elev-3: 0 4px 8px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
    
    /* Sizing */
    --bottom-nav-h: 80px;
    --header-h: 56px;
    --touch: 48px;
    
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: var(--md-surface);
    color: var(--md-on-surface);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: var(--md-surface);
}

/* ============ UPDATE BANNER ============ */
.update-banner {
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    width: 100%;
    z-index: 100;
    box-shadow: var(--elev-2);
    border-radius: 0 0 var(--shape-l) var(--shape-l);
    animation: slideDown 0.35s cubic-bezier(0.2, 0, 0, 1);
}
.update-banner.hidden { display: none; }
.update-banner .update-icon { font-size: 20px; }
.update-banner .update-text { flex: 1; }
.update-banner .update-text strong { display: block; font-size: 14px; font-weight: 600; }
.update-banner .update-text small { font-size: 12px; opacity: 0.7; }
.update-banner .update-btn {
    background: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    padding: 8px 20px;
    border-radius: var(--shape-full);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.update-banner .update-btn:active { transform: scale(0.95); }
.update-banner .update-close {
    background: none; border: none; color: var(--md-on-primary-container);
    font-size: 20px; cursor: pointer; padding: 4px; opacity: 0.6;
}

/* ============ HEADER ============ */
.header {
    height: var(--header-h);
    background: var(--md-surface);
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-top { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-mark {
    width: 36px; height: 36px;
    background: var(--md-primary);
    color: var(--md-on-primary);
    border-radius: var(--shape-m);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800; letter-spacing: -0.5px;
}
.logo-text { font-size: 18px; font-weight: 700; display: block; color: var(--md-on-surface); }
.logo-sub { font-size: 11px; color: var(--md-on-surface-variant); display: block; font-weight: 400; }

/* ============ PAGES ============ */
.page {
    display: none;
    padding: 8px 16px calc(var(--bottom-nav-h) + 24px);
    animation: pageIn 0.3s cubic-bezier(0.2, 0, 0, 1);
}
.page.active { display: block; }

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

/* ============ PAGE TITLE ============ */
.page-title {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 20px; padding-top: 4px;
}
.page-title h2 { font-size: 22px; font-weight: 600; }
.btn-back {
    width: 40px; height: 40px;
    border: none; background: none;
    border-radius: var(--shape-full);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.15s;
    color: var(--md-on-surface);
}
.btn-back:active { background: var(--md-primary-active); }

/* ============ BALANCE CARD ============ */
.balance-card {
    background: linear-gradient(135deg, #1A7F37 0%, #2EA44F 50%, #3EBD5E 100%);
    color: var(--md-on-primary);
    border-radius: var(--shape-xl);
    padding: 28px 24px 24px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}
.balance-card::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}
.balance-card::after {
    content: '';
    position: absolute;
    bottom: -30px; left: -20px;
    width: 80px; height: 80px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}
.balance-label {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.85;
    margin-bottom: 4px;
}
.balance-amount {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 20px;
    word-break: break-all;
}
.balance-row {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255,255,255,0.12);
    border-radius: var(--shape-l);
    padding: 14px 0;
    position: relative;
    z-index: 1;
}
.balance-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
}
.balance-item small { font-size: 11px; opacity: 0.8; }
.balance-item p { font-size: 15px; font-weight: 700; }
.balance-divider {
    width: 1px; height: 32px;
    background: rgba(255,255,255,0.2);
}
.balance-icon-wrap {
    width: 36px; height: 36px;
    border-radius: var(--shape-full);
    display: flex; align-items: center; justify-content: center;
}
.balance-icon-wrap.inc { background: rgba(16,185,129,0.25); color: #6EE7B7; }
.balance-icon-wrap.exp { background: rgba(239,68,68,0.25); color: #FCA5A5; }

/* ============ QUICK STATS ROW ============ */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.quick-stat-item {
    background: var(--md-surface-container-low);
    border-radius: var(--shape-m);
    padding: 14px 10px;
    text-align: center;
}
.quick-stat-item .qs-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--md-on-surface);
    margin-bottom: 2px;
}
.quick-stat-item .qs-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============ SECTIONS ============ */
.section { margin-bottom: 20px; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--md-on-surface);
}
.btn-link {
    background: none; border: none;
    color: var(--md-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--shape-full);
}
.btn-link:active { background: var(--md-primary-active); }

/* ============ TRANSACTION ITEMS ============ */
.transaction-list { display: flex; flex-direction: column; }

.tx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--md-outline-variant);
    position: relative;
    animation: fadeIn 0.2s ease;
}
.tx-item:last-child { border-bottom: none; }

.tx-icon {
    width: 44px; height: 44px;
    border-radius: var(--shape-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.tx-icon.income { background: var(--income-container); }
.tx-icon.expense { background: var(--expense-container); }

.tx-info { flex: 1; min-width: 0; }
.tx-desc {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tx-cat {
    font-size: 12px;
    color: var(--md-on-surface-variant);
    margin-top: 2px;
}

.tx-amount {
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    white-space: nowrap;
}
.tx-amount.income { color: var(--income); }
.tx-amount.expense { color: var(--expense); }

.tx-delete {
    width: 32px; height: 32px;
    border: none; background: none;
    color: var(--md-on-surface-variant);
    font-size: 18px;
    border-radius: var(--shape-full);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    opacity: 0;
}
.tx-item:hover .tx-delete,
.tx-item:active .tx-delete { opacity: 1; }
.tx-delete:active { background: var(--md-error-container); color: var(--md-error); }

/* ============ CHART ============ */
.chart-container { display: flex; flex-direction: column; gap: 10px; }

.chart-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chart-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
    width: 90px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chart-track {
    flex: 1;
    height: 24px;
    background: var(--md-surface-container);
    border-radius: var(--shape-full);
    overflow: hidden;
}
.chart-fill {
    height: 100%;
    border-radius: var(--shape-full);
    display: flex;
    align-items: center;
    padding-left: 10px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    transition: width 0.5s cubic-bezier(0.2, 0, 0, 1);
    min-width: 0;
}
.chart-amount {
    font-size: 12px;
    font-weight: 600;
    color: var(--md-on-surface);
    width: 70px;
    text-align: right;
    flex-shrink: 0;
}

/* ============ TYPE TOGGLE (Segmented Button) ============ */
.type-toggle {
    display: flex;
    background: var(--md-surface-container);
    border-radius: var(--shape-full);
    padding: 3px;
    margin-bottom: 20px;
}
.toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: var(--shape-full);
    font-size: 14px;
    font-weight: 600;
    color: var(--md-on-surface-variant);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.toggle-btn.active {
    background: var(--md-primary);
    color: var(--md-on-primary);
    box-shadow: var(--elev-1);
}
.toggle-btn:active { transform: scale(0.97); }
.toggle-btn svg { transition: color 0.2s; }

/* ============ CATEGORY CHIPS ============ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 4px;
    border: 1.5px solid var(--md-outline-variant);
    background: var(--md-surface);
    border-radius: var(--shape-m);
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);
    min-height: var(--touch);
}
.cat-btn span:first-child { font-size: 22px; }
.cat-btn span:last-child { font-size: 10px; font-weight: 500; color: var(--md-on-surface-variant); }
.cat-btn.active {
    background: var(--md-primary-container);
    border-color: var(--md-primary);
    transform: scale(0.95);
}
.cat-btn.active span:last-child { color: var(--md-on-primary-container); font-weight: 600; }
.cat-btn:active { transform: scale(0.92); }

/* ============ FORM ============ */
.form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--md-on-surface-variant);
    padding-left: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--md-outline-variant);
    border-radius: var(--shape-m);
    font-size: 15px;
    background: var(--md-surface);
    color: var(--md-on-surface);
    outline: none;
    transition: all 0.2s;
    min-height: var(--touch);
}
.form-group input:focus,
.form-group select:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px var(--md-primary-hover);
}

.input-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--md-outline-variant);
    border-radius: var(--shape-m);
    background: var(--md-surface);
    overflow: hidden;
    transition: all 0.2s;
}
.input-wrap:focus-within {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px var(--md-primary-hover);
}
.input-prefix {
    padding: 0 0 0 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--md-on-surface-variant);
}
.input-wrap input {
    border: none;
    box-shadow: none;
    flex: 1;
}

/* Custom category input */
#customCategoryWrap { animation: slideDown 0.2s ease; }
#customCategory {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--md-primary);
    border-radius: var(--shape-m);
    font-size: 15px;
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    outline: none;
    transition: all 0.2s;
}
#customCategory::placeholder { color: var(--md-on-surface-variant); }

/* ============ BUTTONS ============ */
.btn-primary {
    background: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    padding: 14px 24px;
    border-radius: var(--shape-full);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--elev-1);
    min-height: var(--touch);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-primary:active { transform: scale(0.97); box-shadow: none; }
.btn-full { width: 100%; }

.btn-secondary {
    background: transparent;
    color: var(--md-primary);
    border: 1.5px solid var(--md-outline);
    padding: 12px 24px;
    border-radius: var(--shape-full);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    min-height: var(--touch);
}
.btn-secondary:active { background: var(--md-primary-active); }

/* ============ SEARCH BAR ============ */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--md-surface-container);
    border-radius: var(--shape-full);
    padding: 0 16px;
    margin-bottom: 10px;
    min-height: var(--touch);
}
.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--md-on-surface);
    outline: none;
    padding: 12px 0;
}
.search-bar input::placeholder { color: var(--md-on-surface-variant); }

/* ============ FILTER BAR ============ */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.filter-bar select {
    flex: 1;
    appearance: none;
    background: var(--md-surface-container-low) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2349454F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    padding: 12px 32px 12px 14px;
    border: 1.5px solid var(--md-outline-variant);
    border-radius: var(--shape-m);
    font-size: 13px;
    font-weight: 500;
    color: var(--md-on-surface);
    cursor: pointer;
    outline: none;
    min-height: var(--touch);
    transition: all 0.15s;
}
.filter-bar select:focus {
    border-color: var(--md-primary);
}

/* ============ HISTORY SUMMARY ============ */
.history-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
    padding: 14px;
    background: var(--md-surface-container-low);
    border-radius: var(--shape-m);
}
.history-summary .hs-item { text-align: center; }
.history-summary .hs-value {
    font-size: 14px;
    font-weight: 700;
    display: block;
}
.history-summary .hs-value.inc { color: var(--income); }
.history-summary .hs-value.exp { color: var(--expense); }
.history-summary .hs-value.net { color: var(--md-primary); }
.history-summary .hs-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ============ DATE HEADER ============ */
.date-header {
    padding: 10px 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--md-on-surface-variant);
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============ STATS ============ */
.stats-period {
    display: flex;
    background: var(--md-surface-container);
    border-radius: var(--shape-full);
    padding: 3px;
    margin-bottom: 16px;
}
.period-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: var(--shape-full);
    font-size: 13px;
    font-weight: 600;
    color: var(--md-on-surface-variant);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.period-btn.active {
    background: var(--md-primary);
    color: var(--md-on-primary);
    box-shadow: var(--elev-1);
}
.period-btn:active { transform: scale(0.97); }

.stats-content { display: flex; flex-direction: column; gap: 10px; }

.stat-card {
    background: var(--md-surface-container-low);
    border-radius: var(--shape-l);
    padding: 18px;
}
.stat-card h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--md-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--md-on-surface);
}
.stat-value.green { color: var(--income); }
.stat-value.red { color: var(--expense); }

.stat-bar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--md-on-surface-variant);
    margin-bottom: 8px;
}
.stat-bar-track {
    height: 8px;
    background: var(--md-surface-container-highest);
    border-radius: var(--shape-full);
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    border-radius: var(--shape-full);
    transition: width 0.5s cubic-bezier(0.2, 0, 0, 1);
}

/* ============ SETTINGS ============ */
.settings-list { display: flex; flex-direction: column; gap: 20px; }

.settings-group {
    background: var(--md-surface-container-low);
    border-radius: var(--shape-l);
    overflow: hidden;
}
.settings-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--md-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 16px 8px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 12px;
}
.setting-item.clickable { cursor: pointer; transition: background 0.15s; }
.setting-item.clickable:active { background: var(--md-primary-active); }

.setting-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}
.setting-icon-wrap {
    width: 40px; height: 40px;
    border-radius: var(--shape-full);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.setting-icon-wrap.blue { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.setting-icon-wrap.orange { background: #FFF3E0; color: #E65100; }
.setting-icon-wrap.green { background: var(--income-container); color: var(--income-on-container); }
.setting-icon-wrap.purple { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.setting-icon-wrap.teal { background: #E0F2F1; color: #00695C; }
.setting-icon-wrap.red { background: var(--md-error-container); color: var(--md-error); }

.setting-title { font-size: 14px; font-weight: 500; }
.setting-desc { font-size: 12px; color: var(--md-on-surface-variant); }

.setting-item input {
    width: 120px;
    padding: 8px 12px;
    border: 1.5px solid var(--md-outline-variant);
    border-radius: var(--shape-m);
    font-size: 14px;
    text-align: right;
    background: var(--md-surface);
    color: var(--md-on-surface);
    outline: none;
    transition: all 0.15s;
}
.setting-item input:focus {
    border-color: var(--md-primary);
}

.btn-check-update {
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    border: none;
    padding: 8px 16px;
    border-radius: var(--shape-full);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-check-update:active { transform: scale(0.95); }

.danger-item .setting-title { color: var(--md-error) !important; }

.app-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 12px;
    color: var(--md-on-surface-variant);
}
.app-footer p:first-child { font-weight: 600; }

/* ============ BOTTOM NAVIGATION ============ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    width: 100%;
    height: var(--bottom-nav-h);
    background: var(--md-surface-container);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 90;
    gap: 4px;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--md-on-surface-variant);
    transition: color 0.25s ease;
    flex: 1;
    max-width: 80px;
    height: 64px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.nav-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    transition: transform 0.2s ease;
}
.nav-btn span {
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    display: block;
    text-align: center;
    transition: font-weight 0.2s ease;
}

/* Active indicator pill */
.nav-btn::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 56px;
    height: 30px;
    border-radius: var(--shape-full);
    background: var(--md-primary-container);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
    z-index: 0;
}
.nav-btn.active { color: var(--md-primary); }
.nav-btn.active span { font-weight: 700; }
.nav-btn.active::before {
    opacity: 1;
    transform: translateX(-50%) scaleX(1);
}
.nav-btn:active svg { transform: scale(0.88); }
.nav-btn svg { position: relative; z-index: 1; }
.nav-btn span { position: relative; z-index: 1; }

/* FAB Center Button */
.nav-btn.add-center {
    flex: 0 0 56px;
    max-width: 56px;
    height: 56px;
    margin-top: -20px;
    gap: 0;
}
.nav-btn.add-center::before { display: none; }
.nav-add-circle {
    width: 52px;
    height: 52px;
    background: linear-gradient(145deg, #1A7F37, #2EA44F);
    color: var(--md-on-primary);
    border-radius: var(--shape-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(26,127,55,0.35);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.nav-btn.add-center:active .nav-add-circle {
    transform: scale(0.88);
    box-shadow: 0 1px 4px rgba(26,127,55,0.3);
}

/* ============ EMPTY STATES ============ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 20px;
    gap: 8px;
}
.empty-icon { margin-bottom: 8px; opacity: 0.8; }
.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--md-on-surface);
}
.empty-desc {
    font-size: 13px;
    color: var(--md-on-surface-variant);
    margin-bottom: 8px;
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--md-inverse-surface);
    color: var(--md-inverse-on-surface);
    padding: 14px 24px;
    border-radius: var(--shape-m);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--elev-3);
    z-index: 200;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
    max-width: calc(100% - 32px);
    text-align: center;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============ MODAL ============ */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal.hidden { display: none; }
.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
}
.modal-content {
    position: relative;
    background: var(--md-surface);
    border-radius: var(--shape-xl);
    padding: 28px;
    max-width: 360px;
    width: 100%;
    box-shadow: var(--elev-3);
    animation: modalIn 0.3s cubic-bezier(0.2, 0, 0, 1);
}
.modal-icon { font-size: 40px; text-align: center; margin-bottom: 12px; }
.modal-content h3 { font-size: 20px; font-weight: 600; text-align: center; margin-bottom: 8px; }
.modal-content p { font-size: 14px; color: var(--md-on-surface-variant); text-align: center; margin-bottom: 16px; }
.changelog {
    background: var(--md-surface-container-low);
    border-radius: var(--shape-m);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--md-on-surface);
}
.changelog div { padding: 2px 0; }
.modal-actions {
    display: flex;
    gap: 10px;
}
.modal-actions .btn-secondary,
.modal-actions .btn-primary { flex: 1; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ============ ANIMATIONS ============ */
@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 0; }
