/* ── Balance Widget ── */
.balance-widget {
    background: linear-gradient(135deg, #1a1a3e 0%, #0f0f2a 60%, #1a1040 100%);
    border: 1px solid rgba(108, 99, 255, .22);
    border-radius: 24px;
    padding: 28px 24px;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px
}

.balance-widget::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(108, 99, 255, .18) 0%, transparent 70%)
}

.balance-widget::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -40px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(74, 222, 128, .08) 0%, transparent 70%)
}

.balance-label {
    font-size: .72rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .45);
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: 10px
}

.balance-amount {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -.03em;
    line-height: 1;
    position: relative;
    z-index: 1
}

.balance-currency-sym {
    font-size: 1.3rem;
    font-weight: 500;
    opacity: .6;
    margin-left: 6px
}

.balance-sub {
    font-size: .78rem;
    color: rgba(255, 255, 255, .4);
    margin-top: 10px;
    position: relative;
    z-index: 1
}

/* ── Stats Grid ── */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px
}

.stat-card {
    background: var(--glass);
    border: var(--glass-b);
    border-radius: var(--r);
    padding: 16px;
    position: relative;
    overflow: hidden
}

.stat-card.income-card {
    border-color: rgba(74, 222, 128, .18)
}

.stat-card.expense-card {
    border-color: rgba(248, 113, 113, .18)
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px
}

.stat-icon svg {
    width: 18px;
    height: 18px
}

.stat-icon.inc {
    background: var(--income-l);
    color: var(--income)
}

.stat-icon.exp {
    background: var(--expense-l);
    color: var(--expense)
}

.stat-label {
    font-size: .72rem;
    color: var(--text-sub);
    margin-bottom: 4px
}

.stat-val {
    font-size: 1.05rem;
    font-weight: 700
}

.stat-val.inc {
    color: var(--income)
}

.stat-val.exp {
    color: var(--expense)
}

/* ── Transaction Item ── */
.tx-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all .2s;
    position: relative
}

.tx-item:last-child {
    border-bottom: none
}

.tx-item:active {
    transform: scale(.97)
}

.tx-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.tx-icon svg {
    width: 20px;
    height: 20px
}

.tx-info {
    flex: 1;
    min-width: 0
}

.tx-name {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.tx-meta {
    font-size: .73rem;
    color: var(--text-sub)
}

.tx-amount {
    font-size: .98rem;
    font-weight: 700;
    flex-shrink: 0;
    text-align: right
}

.tx-amount.inc {
    color: var(--income)
}

.tx-amount.exp {
    color: var(--expense)
}

.tx-delete-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    background: var(--expense-l);
    border: none;
    color: var(--expense);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    margin-left: 8px
}

.tx-item:hover .tx-delete-btn {
    opacity: 1
}

.tx-delete-btn svg {
    width: 16px;
    height: 16px;
    display: block
}

/* ── Day Group ── */
.day-group {
    margin-bottom: 4px
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 4px
}

.day-date {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-mut);
    text-transform: uppercase;
    letter-spacing: .06em
}

.day-total {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-sub)
}

/* ── Form ── */
.form-group {
    margin-bottom: 20px
}

.form-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px
}

.form-input {
    width: 100%;
    background: var(--glass);
    border: var(--glass-b);
    border-radius: var(--r-sm);
    padding: 13px 16px;
    font-family: inherit;
    font-size: .95rem;
    color: var(--text);
    outline: none;
    transition: border-color .2s;
    -webkit-appearance: none
}

.form-input:focus {
    border-color: var(--accent);
    background: rgba(108, 99, 255, .06)
}

.form-input::placeholder {
    color: var(--text-mut)
}

.form-select {
    width: 100%;
    background: var(--glass);
    border: var(--glass-b);
    border-radius: var(--r-sm);
    padding: 13px 40px 13px 16px;
    font-family: inherit;
    font-size: .95rem;
    color: var(--text);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px
}

.form-select option {
    background: #1E1E35
}

/* ── Amount Input ── */
.amount-wrap {
    display: flex;
    align-items: center;
    background: var(--glass);
    border: var(--glass-b);
    border-radius: var(--r-sm);
    overflow: hidden;
    transition: border-color .2s
}

.amount-wrap:focus-within {
    border-color: var(--accent)
}

.amount-sym {
    padding: 0 16px;
    color: var(--text-sub);
    font-size: .88rem;
    font-weight: 600;
    border-right: 1px solid var(--border);
    height: 52px;
    display: flex;
    align-items: center;
    flex-shrink: 0
}

.amount-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 16px;
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    outline: none
}

.amount-input::placeholder {
    color: var(--text-mut);
    font-weight: 400;
    font-size: 1rem
}

/* ── Type Toggle ── */
.type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--glass);
    border: var(--glass-b);
    border-radius: var(--r-sm);
    padding: 4px;
    margin-bottom: 24px
}

.type-btn {
    border: none;
    background: transparent;
    padding: 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-mut);
    cursor: pointer;
    transition: all .25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px
}

.type-btn svg {
    width: 16px;
    height: 16px
}

.type-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 12px rgba(108, 99, 255, .4)
}

.type-btn.active.exp-btn {
    background: var(--expense);
    box-shadow: 0 2px 12px rgba(248, 113, 113, .4)
}

/* ── Category Grid ── */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px
}

.cat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 11px 6px;
    border-radius: var(--r-sm);
    background: var(--glass);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .2s
}

.cat-chip.sel {
    border-color: var(--accent);
    background: var(--accent-l)
}

.cat-chip-ico {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center
}

.cat-chip-ico svg {
    width: 17px;
    height: 17px
}

.cat-chip-name {
    font-size: .62rem;
    font-weight: 500;
    text-align: center;
    color: var(--text-sub);
    line-height: 1.2
}

/* ── Buttons ── */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 24px;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    border: none;
    width: 100%
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #9c95ff);
    color: #fff;
    box-shadow: 0 4px 20px rgba(108, 99, 255, .38)
}

.btn-primary:active {
    transform: scale(.97)
}

.btn-primary:hover {
    box-shadow: 0 4px 30px rgba(108, 99, 255, .6)
}

.btn-danger {
    background: var(--expense-l);
    color: var(--expense);
    border: 1px solid rgba(248, 113, 113, .2)
}

.btn-secondary {
    background: var(--glass);
    color: var(--text);
    border: var(--glass-b)
}

.btn svg {
    width: 18px;
    height: 18px
}

/* ── Filter / Period ── */
.filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 16px;
    scrollbar-width: none
}

.filter-bar::-webkit-scrollbar {
    display: none
}

.filter-chip {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 100px;
    background: var(--glass);
    border: var(--glass-b);
    font-family: inherit;
    font-size: .78rem;
    font-weight: 500;
    color: var(--text-sub);
    cursor: pointer;
    transition: all .2s
}

.filter-chip.active {
    background: var(--accent-l);
    border-color: rgba(108, 99, 255, .4);
    color: var(--accent)
}

.period-sel {
    display: flex;
    background: var(--glass);
    border: var(--glass-b);
    border-radius: var(--r-sm);
    padding: 4px;
    margin-bottom: 20px
}

.period-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px;
    border-radius: 6px;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 500;
    color: var(--text-mut);
    cursor: pointer;
    transition: all .2s
}

.period-btn.active {
    background: var(--accent);
    color: #fff
}

/* ── Search ── */
.search-bar {
    display: flex;
    align-items: center;
    background: var(--glass);
    border: var(--glass-b);
    border-radius: var(--r-sm);
    padding: 0 14px;
    gap: 10px;
    margin-bottom: 16px;
    transition: border-color .2s
}

.search-bar:focus-within {
    border-color: var(--accent)
}

.search-bar svg {
    width: 16px;
    height: 16px;
    color: var(--text-mut);
    flex-shrink: 0
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 0;
    font-family: inherit;
    font-size: .9rem;
    color: var(--text);
    outline: none
}

.search-input::placeholder {
    color: var(--text-mut)
}

/* ── Chart Cards ── */
.chart-card {
    background: var(--glass);
    border: var(--glass-b);
    border-radius: var(--r);
    padding: 20px;
    margin-bottom: 16px
}

.chart-title {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 16px
}

.chart-box {
    position: relative;
    height: 220px
}

.mini-chart-box {
    height: 72px;
    position: relative;
    margin-top: 16px
}

/* ── Analytics stats row ── */
.a-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px
}

.a-stat {
    background: var(--glass);
    border: var(--glass-b);
    border-radius: var(--r-sm);
    padding: 14px 12px;
    text-align: center
}

.a-stat-label {
    font-size: .64rem;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 6px
}

.a-stat-val {
    font-size: .95rem;
    font-weight: 700
}

/* ── Top categories ── */
.top-cat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border)
}

.top-cat:last-child {
    border-bottom: none
}

.top-rank {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    font-weight: 700;
    color: var(--text-sub);
    flex-shrink: 0
}

.top-cat-ico {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.top-cat-ico svg {
    width: 16px;
    height: 16px
}

.top-cat-info {
    flex: 1
}

.top-cat-name {
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 4px
}

.top-cat-bar-bg {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden
}

.top-cat-bar {
    height: 100%;
    border-radius: 2px;
    transition: width .7s ease
}

.top-cat-amt {
    font-size: .88rem;
    font-weight: 700;
    color: var(--expense);
    flex-shrink: 0
}

/* ── Settings ── */
.settings-sec {
    margin-bottom: 8px
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border)
}

.settings-item:last-child {
    border-bottom: none
}

.settings-lbl {
    font-size: .9rem;
    font-weight: 500
}

.settings-sub {
    font-size: .73rem;
    color: var(--text-sub);
    margin-top: 2px
}

.settings-action {
    color: var(--text-sub);
    cursor: pointer
}

.settings-action svg {
    width: 18px;
    height: 18px
}

/* ── Category list ── */
.cat-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border)
}

.cat-list-item:last-child {
    border-bottom: none
}

.cat-list-ico {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.cat-list-ico svg {
    width: 20px;
    height: 20px
}

.cat-list-info {
    flex: 1
}

.cat-list-name {
    font-size: .9rem;
    font-weight: 600
}

.cat-list-type {
    font-size: .73rem;
    color: var(--text-sub);
    margin-top: 2px
}

/* ── Color swatches ── */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all .2s
}

.color-swatch.sel {
    border-color: #fff;
    transform: scale(1.15)
}