/* =============================================
   KASA — Premium Personal Finance App
   ============================================= */

/* ─── Tokens ─── */
:root {
    --bg: #0F0F10;
    --bg2: #141415;
    --surface: #1C1C1E;
    --surface2: #242426;
    --glass: rgba(28, 28, 30, 0.75);
    --glass2: rgba(36, 36, 38, 0.6);
    --input-bg: #2C2C2E;

    --text: #ffffff;
    --text2: #a1a1aa;
    --text3: #71717a;
    --white: #ffffff;

    --accent: #fb8500;
    --accent2: #ffb703;
    --accent-bg: rgba(251, 133, 0, 0.1);
    --accent-glow: rgba(251, 133, 0, 0.25);

    --green: #2dd4a8;
    --green-bg: rgba(45, 212, 168, 0.1);
    --red: #f06060;
    --red-bg: rgba(240, 96, 96, 0.1);

    --border: rgba(255, 255, 255, 0.05);
    --border2: rgba(255, 255, 255, 0.08);

    --r: 14px;
    --r2: 20px;
    --r3: 28px;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
    --shadow2: 0 8px 32px rgba(0, 0, 0, 0.4);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --nav-h: 68px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] {
    --bg: #f4f4f9;
    --bg2: #ededf3;
    --surface: #ffffff;
    --surface2: #f8f8fd;
    --glass: rgba(255, 255, 255, 0.82);
    --glass2: rgba(248, 248, 255, 0.7);
    --input-bg: #eeeef5;
    --text: #18182a;
    --text2: #6e6e8e;
    --text3: #a0a0ba;
    --border: rgba(0, 0, 0, 0.05);
    --border2: rgba(0, 0, 0, 0.08);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow2: 0 8px 28px rgba(0, 0, 0, 0.08);
}

[data-theme="midnight"] {
    --bg: #0a0f1a;
    --bg2: #0f1525;
    --surface: #141d30;
    --surface2: #1a2540;
    --glass: rgba(20, 29, 48, 0.78);
    --input-bg: #1a2540;
    --accent: #5b9cf5;
    --accent2: #7db4ff;
    --accent-bg: rgba(91, 156, 245, 0.1);
    --accent-glow: rgba(91, 156, 245, 0.2);
    --green: #34d399;
    --red: #f87171;
}

/* ─── Reset ─── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

input,
button,
textarea {
    font-family: inherit;
    color: inherit;
    border: none;
    outline: none;
    background: none;
}

button {
    cursor: pointer;
    user-select: none;
}

::-webkit-scrollbar {
    width: 0;
}

/* ─── App Shell ─── */
#app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100dvh;
    position: relative;
}

@media (min-width: 431px) {
    body {
        background: var(--bg2);
    }

    #app {
        background: var(--bg);
        box-shadow: var(--shadow2);
        border-inline: 1px solid var(--border);
    }
}

/* ─── Views ─── */
.view {
    display: none;
    height: 100dvh;
    flex-direction: column;
}

.view.active {
    display: flex;
    animation: viewIn 0.35s var(--ease) forwards;
}

@keyframes viewIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 16px 100px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    -webkit-overflow-scrolling: touch;
}

/* ─── Top Bar ─── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 10px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.month-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent-bg);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
}

.back-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--text2);
    font-size: 0.9rem;
    transition: 0.2s;
}

.back-btn:active {
    transform: scale(0.9);
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
}

/* ─── Hero Balance Card ─── */
.hero-card {
    position: relative;
    background: linear-gradient(155deg, #1c1c38, #111124);
    border: 1px solid var(--border2);
    border-radius: var(--r3);
    padding: 28px 22px 22px;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(124, 110, 240, 0.08);
}

[data-theme="light"] .hero-card {
    background: linear-gradient(155deg, #f0edff, #e6e2ff);
}

[data-theme="midnight"] .hero-card {
    background: linear-gradient(155deg, #152040, #0e1830);
}

.hero-glow {
    position: absolute;
    width: 180px;
    height: 180px;
    top: -50%;
    right: -20%;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-label {
    text-align: center;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text3);
    font-weight: 600;
    margin-bottom: 4px;
}

.hero-amount {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1.1;
    margin-bottom: 22px;
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.income-dot {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.expense-dot {
    background: var(--red);
    box-shadow: 0 0 8px var(--red);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text3);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-val {
    font-size: 1rem;
    font-weight: 700;
}

.income-val {
    color: var(--green);
}

.expense-val {
    color: var(--red);
}

.hero-divider {
    width: 1px;
    height: 30px;
    background: var(--border2);
    margin: 0 10px;
}

/* ─── Health Score ─── */
.health-card {
    /* removed overflow: hidden to allow the ring outer edge to show if needed or just keep wrapper clean */
}

.health-card .card-head {
    justify-content: space-between;
}

.health-body {
    display: flex;
    align-items: center;
    gap: 20px;
}

.health-ring-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    padding: 4px;
    /* give room for stroke */
}

.health-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
}

.health-ring-bg {
    fill: none;
    stroke: var(--input-bg);
    stroke-width: 8;
}

.health-ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 1.2s var(--ease), stroke 0.5s;
}

.health-score-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.health-score-num {
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1;
}

.health-score-label {
    font-size: 0.6rem;
    color: var(--text3);
    font-weight: 600;
}

.health-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.health-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hd-label {
    font-size: 0.72rem;
    color: var(--text3);
    font-weight: 500;
}

.hd-val {
    font-size: 0.78rem;
    font-weight: 700;
}

.health-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

.health-badge.excellent {
    background: rgba(45, 212, 168, 0.12);
    color: var(--green);
}

.health-badge.good {
    background: rgba(240, 192, 64, 0.12);
    color: #f0c040;
}

.health-badge.warning {
    background: rgba(240, 160, 112, 0.12);
    color: #f0a070;
}

.health-badge.danger {
    background: rgba(240, 96, 96, 0.12);
    color: var(--red);
}

/* ─── Smart Input ─── */
.smart-input-card {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--r2);
    padding: 4px;
    box-shadow: var(--shadow);
    transition: border-color 0.3s;
}

.smart-input-card:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.smart-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.smart-icon {
    color: var(--accent);
    font-size: 0.9rem;
}

.smart-input-row input {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    background: transparent;
}

.smart-input-row input::placeholder {
    color: var(--text3);
}

.smart-send {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--accent);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: 0.2s var(--spring);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.smart-send:active {
    transform: scale(0.88);
}

.smart-preview {
    padding: 0 14px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--ease), padding 0.3s;
    font-size: 0.78rem;
    color: var(--text2);
}

.smart-preview.visible {
    max-height: 60px;
    padding: 8px 14px 10px;
}

.smart-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-bg);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.72rem;
    margin-right: 6px;
}

/* ─── Cards ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r2);
    padding: 18px;
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.card-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text2);
}

.see-all {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
}

/* ─── Charts ─── */
.chart-wrap {
    position: relative;
    height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bar-wrap {
    height: 200px;
}

.chart-center {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.chart-center-amount {
    font-size: 1.2rem;
    font-weight: 800;
}

.chart-center-sub {
    font-size: 0.65rem;
    color: var(--text3);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text2);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ─── Category Bars ─── */
.cat-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cat-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.3s var(--ease) forwards;
    opacity: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.cat-bar-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.cat-bar-info {
    flex: 1;
}

.cat-bar-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.cat-bar-name {
    font-size: 0.82rem;
    font-weight: 600;
}

.cat-bar-val {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--red);
}

.cat-bar-track {
    height: 5px;
    background: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
}

.cat-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.7s var(--ease);
}

/* ─── Transaction Items ─── */
.tx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    animation: fadeSlide 0.3s var(--ease) forwards;
    opacity: 0;
    cursor: pointer;
    transition: background 0.15s;
}

.tx-item:last-child {
    border-bottom: none;
}

.tx-item:active {
    background: var(--accent-bg);
    border-radius: var(--r);
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.tx-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.tx-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tx-cat {
    font-size: 0.88rem;
    font-weight: 600;
}

.tx-note {
    font-size: 0.72rem;
    color: var(--text3);
}

.tx-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tx-amt {
    font-size: 0.95rem;
    font-weight: 700;
}

.tx-amt.is-income {
    color: var(--green);
}

.tx-amt.is-expense {
    color: var(--red);
}

.tx-date {
    font-size: 0.62rem;
    color: var(--text3);
}

/* ─── Search ─── */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    transition: border-color 0.3s;
}

.search-bar:focus-within {
    border-color: var(--accent);
}

.search-icon {
    color: var(--text3);
    font-size: 0.85rem;
}

.search-bar input {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 500;
    background: transparent;
}

.search-bar input::placeholder {
    color: var(--text3);
}

/* Timeline */
.day-group {
    margin-bottom: 4px;
}

.day-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 14px 0 6px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 5;
}

.day-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r2);
    padding: 4px 16px;
    box-shadow: var(--shadow);
}

/* ─── Segments ─── */
.seg-toggle {
    display: flex;
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 4px;
    box-shadow: var(--shadow);
}

.seg {
    flex: 1;
    padding: 11px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    z-index: 2;
    transition: color 0.3s;
}

.seg.active {
    color: var(--white);
}

.seg-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    border-radius: 10px;
    background: var(--accent);
    z-index: 1;
    transition: transform 0.35s var(--spring);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.seg-indicator.right {
    transform: translateX(100%);
}

/* ─── Amount Input ─── */
.amount-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 16px 0;
}

.amt-currency {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text3);
}

.amt-field {
    font-size: 3.2rem;
    font-weight: 900;
    width: 200px;
    text-align: left;
    letter-spacing: -1.5px;
    caret-color: var(--accent);
    appearance: textfield;
    -moz-appearance: textfield;
}

.amt-field::placeholder {
    color: var(--text3);
    opacity: 0.3;
}

.amt-field::-webkit-inner-spin-button,
.amt-field::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

/* ─── Category Grid ─── */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.cat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 4px;
    border-radius: 12px;
    background: var(--input-bg);
    border: 2px solid transparent;
    transition: all 0.25s var(--ease);
}

.cat-chip:active {
    transform: scale(0.9);
}

.cat-chip.picked {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.cat-chip-icon {
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cat-chip-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text2);
    text-align: center;
    line-height: 1.2;
}

.cat-chip.picked .cat-chip-label {
    color: var(--accent);
}

/* ─── Form Rows ─── */
.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.form-row:last-child {
    border-bottom: none;
}

.row-icon {
    color: var(--text3);
    font-size: 0.88rem;
    width: 18px;
    text-align: center;
}

.form-row input {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 500;
}

.form-row input::placeholder {
    color: var(--text3);
}

input[type="date"] {
    color: var(--text);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.5);
    cursor: pointer;
}

[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
}

/* ─── Primary Button ─── */
.primary-btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--r);
    background: var(--accent);
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 20px var(--accent-glow);
    transition: all 0.25s var(--ease);
    letter-spacing: 0.3px;
}

.primary-btn:active {
    transform: scale(0.97);
}

.primary-btn.done {
    background: var(--green);
}

/* ─── Filters ─── */
.filter-pills {
    display: flex;
    gap: 6px;
}

.fpill {
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text3);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.fpill.active {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

/* ─── Analytics ─── */
.month-nav-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mnav {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text2);
    font-size: 0.7rem;
    transition: 0.15s;
}

.mnav:active {
    transform: scale(0.88);
    background: var(--accent-bg);
    color: var(--accent);
}

.mnav-label {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

.summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sum-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r2);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow);
}

.sum-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
}

.income-box .sum-icon {
    background: var(--green-bg);
    color: var(--green);
}

.expense-box .sum-icon {
    background: var(--red-bg);
    color: var(--red);
}

.sum-label {
    font-size: 0.62rem;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sum-val {
    font-size: 1.1rem;
    font-weight: 800;
}

.income-box .sum-val {
    color: var(--green);
}

.expense-box .sum-val {
    color: var(--red);
}

.net-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px;
}

.net-label {
    font-size: 0.7rem;
    color: var(--text3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.net-val {
    font-size: 1.8rem;
    font-weight: 900;
}

.net-val.pos {
    color: var(--green);
}

.net-val.neg {
    color: var(--red);
}

.top-spend-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.top-spend-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.top-spend-name {
    font-size: 0.95rem;
    font-weight: 700;
}

.top-spend-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--red);
}

.top-spend-pct {
    font-size: 0.72rem;
    color: var(--text3);
}

/* ─── Settings ─── */
.settings-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0 6px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--white);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.profile-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.profile-info p {
    font-size: 0.75rem;
    color: var(--text3);
    margin-top: 2px;
}

.settings-card {
    padding: 16px 18px;
}

.settings-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    font-weight: 600;
}

.settings-head-icon {
    color: var(--accent);
    font-size: 0.9rem;
}

.theme-picker {
    display: flex;
    gap: 8px;
}

.theme-opt {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    border-radius: 14px;
    background: var(--input-bg);
    border: 2px solid transparent;
    transition: all 0.25s var(--ease);
}

.theme-opt:active {
    transform: scale(0.94);
}

.theme-opt.active {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.theme-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border2);
}

.dark-dot {
    background: linear-gradient(135deg, #08080c, #1a1a2a);
}

.light-dot {
    background: linear-gradient(135deg, #f4f4f9, #ffffff);
}

.midnight-dot {
    background: linear-gradient(135deg, #0a0f1a, #141d30);
}

.theme-opt span {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text2);
}

.theme-opt.active span {
    color: var(--accent);
}

.currency-selector {
    display: flex;
    gap: 6px;
}

.cur-opt {
    flex: 1;
    padding: 10px 6px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--input-bg);
    color: var(--text2);
    border: 2px solid transparent;
    transition: 0.2s;
    text-align: center;
}

.cur-opt.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

.cur-opt:active {
    transform: scale(0.94);
}

.settings-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text2);
}

.settings-info-row:last-of-type {
    border-bottom: none;
}

.settings-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 3px 10px;
    border-radius: 8px;
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.settings-btn {
    padding: 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}

.settings-btn.export {
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid rgba(124, 110, 240, 0.15);
}

.settings-btn.danger-outline {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(240, 96, 96, 0.15);
}

.settings-btn:active {
    transform: scale(0.97);
}

.about-content {
    text-align: center;
    padding: 8px 0;
}

.about-logo {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
}

.about-ver {
    font-size: 0.72rem;
    color: var(--text3);
    margin-bottom: 10px;
}

.about-desc {
    font-size: 0.78rem;
    color: var(--text2);
    line-height: 1.5;
    margin-bottom: 14px;
}

.about-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.about-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--input-bg);
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text2);
}

/* ─── Bottom Nav ─── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: var(--nav-h);
    background: var(--glass);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 100;
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;
    color: var(--text3);
    transition: color 0.2s;
}

.tab i {
    font-size: 1.05rem;
    transition: transform 0.3s var(--spring);
}

.tab span {
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.tab.active {
    color: var(--accent);
}

.tab.active i {
    transform: scale(1.12);
}

/* ─── Toast ─── */
.toast-bar {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    max-width: 380px;
    width: calc(100% - 40px);
    padding: 12px 18px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    box-shadow: var(--shadow2);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    z-index: 999;
    transition: transform 0.4s var(--spring);
    pointer-events: none;
}

.toast-bar.show {
    transform: translateX(-50%) translateY(0);
}

.toast-bar.ok {
    border-left: 4px solid var(--green);
    color: var(--green);
}

.toast-bar.err {
    border-left: 4px solid var(--red);
    color: var(--red);
}

/* ─── Bottom Sheet ─── */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sheet-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.sheet {
    max-width: 430px;
    width: 100%;
    background: var(--surface);
    border-radius: var(--r3) var(--r3) 0 0;
    padding: 14px 24px 34px;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.4s var(--spring);
}

.sheet-overlay.open .sheet {
    transform: translateY(0);
}

.sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--text3);
    border-radius: 2px;
    margin: 0 auto 18px;
    opacity: 0.4;
}

.sheet-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: var(--red-bg);
    color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin: 0 auto 12px;
}

.sheet h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.sheet p {
    font-size: 0.82rem;
    color: var(--text2);
    margin-bottom: 20px;
}

.sheet-btns {
    display: flex;
    gap: 10px;
}

.sheet-btn {
    flex: 1;
    padding: 13px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.88rem;
    transition: 0.2s;
}

.sheet-btn.cancel {
    background: var(--input-bg);
    color: var(--text2);
}

.sheet-btn.danger {
    background: var(--red);
    color: var(--white);
}

.sheet-btn:active {
    transform: scale(0.96);
}

/* ─── Share ─── */
.share-btn {
    width: 100%;
    padding: 15px;
    border-radius: var(--r);
    background: linear-gradient(135deg, var(--accent), #9d8df7);
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 20px var(--accent-glow);
    transition: all 0.25s var(--ease);
}

.share-btn:active {
    transform: scale(0.97);
}

.share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    padding: 20px;
}

.share-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.share-modal {
    max-width: 400px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--r3);
    padding: 20px;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s var(--spring);
}

.share-overlay.open .share-modal {
    transform: none;
}

.share-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.share-modal-head h3 {
    font-size: 1rem;
    font-weight: 700;
}

.share-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    color: var(--text2);
    transition: 0.2s;
}

.share-close:active {
    transform: scale(0.85);
}

.share-preview-wrap {
    border-radius: var(--r);
    overflow: hidden;
    margin-bottom: 16px;
    background: #0a0a14;
}

.share-preview-wrap canvas {
    width: 100%;
    height: auto;
    display: block;
}

.share-actions {
    display: flex;
    gap: 10px;
}

.share-action-btn {
    flex: 1;
    padding: 13px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}

.share-action-btn.download {
    background: var(--input-bg);
    color: var(--text);
}

.share-action-btn.send {
    background: var(--accent);
    color: var(--white);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.share-action-btn:active {
    transform: scale(0.96);
}

/* ─── Empty States ─── */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 44px 20px;
    color: var(--text3);
    gap: 6px;
    text-align: center;
}

.empty i {
    font-size: 2.2rem;
    opacity: 0.3;
    margin-bottom: 6px;
}

.empty p {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text2);
}

.empty span {
    font-size: 0.78rem;
}

.empty-sm {
    text-align: center;
    padding: 14px;
    font-size: 0.78rem;
    color: var(--text3);
}

/* ─── Onboarding ─── */
.onboarding {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.5s var(--ease);
}

.onboarding.show {
    display: flex;
    opacity: 1;
    pointer-events: all;
}

.ob-step {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 40px 24px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(40px);
    transition: all 0.5s var(--spring);
}

.ob-step.active {
    opacity: 1;
    pointer-events: all;
    transform: none;
}

.ob-step.exit-left {
    transform: translateX(-40px);
    opacity: 0;
}

.ob-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

.ob-glow {
    position: absolute;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, var(--accent-glow), transparent 60%);
    top: 50%;
    transform: translateY(-50%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    animation: pulseGlow 4s infinite alternate;
}

@keyframes pulseGlow {
    from {
        transform: translateY(-50%) scale(0.9);
        opacity: 0.6;
    }

    to {
        transform: translateY(-50%) scale(1.1);
        opacity: 1;
    }
}

.ob-logo {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.ob-tagline {
    font-size: 1.15rem;
    color: var(--text2);
    line-height: 1.5;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.ob-icon-row {
    display: flex;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.ob-feat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow);
}

.ob-feat i {
    color: var(--accent);
}

.ob-step-icon {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin-bottom: 24px;
    position: relative;
}

.income-glow {
    background: var(--green-bg);
    color: var(--green);
    box-shadow: 0 8px 32px rgba(45, 212, 168, 0.2);
}

.expense-glow {
    background: var(--accent-bg);
    color: var(--accent);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.ob-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.ob-sub {
    font-size: 0.9rem;
    color: var(--text3);
    margin-bottom: 40px;
    line-height: 1.4;
}

.ob-input-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--r2);
    padding: 20px;
    width: 100%;
    max-width: 300px;
    transition: border-color 0.3s;
}

.ob-input-wrap:focus-within {
    border-color: var(--accent);
}

.ob-cur {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text2);
}

.ob-input {
    font-size: 2.6rem;
    font-weight: 900;
    width: 180px;
    text-align: left;
    color: var(--text);
}

.ob-input::placeholder {
    color: var(--border);
}

.ob-smart-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--r2);
    padding: 18px 20px;
    width: 100%;
    margin-bottom: 16px;
    transition: border-color 0.3s;
}

.ob-smart-wrap:focus-within {
    border-color: var(--accent);
}

.ob-smart-icon {
    color: var(--accent);
    font-size: 1.2rem;
}

.ob-smart-input {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
}

.ob-smart-input::placeholder {
    color: var(--text3);
}

.ob-hint {
    font-size: 0.78rem;
    color: var(--text3);
}

.ob-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    width: 100%;
}

.ob-dots {
    display: flex;
    gap: 8px;
}

.ob-dot {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: var(--border2);
    transition: 0.3s var(--ease);
}

.ob-dot.active {
    width: 24px;
    background: var(--accent);
}

.ob-btn {
    width: 100%;
    padding: 18px;
    border-radius: var(--r2);
    background: var(--text);
    color: var(--bg);
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: 0.25s var(--spring);
}

.ob-btn:active {
    transform: scale(0.96);
}

.ob-btn.finish {
    background: var(--accent);
    color: var(--white);
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* ─── Insights & Prediction ─── */
.insights-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.insight-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--input-bg);
    border-radius: 12px;
}

.insight-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.insight-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.insight-title {
    font-size: 0.75rem;
    color: var(--text3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.insight-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
}

.insight-text {
    font-size: 0.88rem;
    color: var(--text2);
    line-height: 1.4;
    font-weight: 500;
}

/* ─── Quick Buttons ─── */
.quick-cats {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 0 16px;
    scrollbar-width: none;
}

.quick-cats::-webkit-scrollbar {
    display: none;
}

.quick-btn {
    padding: 10px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: 0.2s var(--ease);
}

.quick-btn:active {
    transform: scale(0.95);
    background: var(--surface2);
}