* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #121212;
    color: #e8e8e8;
    overflow: hidden;
}

body.light-theme {
    background: #F3F3F3;
    color: #1f2937;
}

body.light-theme .month-panel,
body.light-theme .compact-stats-panel,
body.light-theme .tile {
    background: #ffffff;
    border-color: #d4d9e2;
}

body.light-theme .bottom-panel {
    background: #ffffff;
    border-top-color: #d4d9e2;
}

body.light-theme .month-day {
    background: rgba(30, 41, 59, 0.1);
}

body.light-theme .month-day.filled,
body.light-theme .tile-bottom-progress,
body.light-theme .indicator-progress {
    background: #4f7cff;
}

body.light-theme .mic-button {
    color: #334155;
}

body.light-theme .mic-label {
    color: rgba(51, 65, 85, 0.85);
}

body.light-theme .mic-button.is-active .material-icons,
body.light-theme .mic-button.is-active .mic-label {
    color: #4f7cff;
}

body.light-theme .mic-button.is-active::before {
    background: rgba(79, 124, 255, 0.22);
}

body.light-theme .mic-label,
body.light-theme .indicator-label {
    color: rgba(51, 65, 85, 0.8);
}

body.light-theme .indicator-value,
body.light-theme .tile-name,
body.light-theme .tile-budget,
body.light-theme .tile-spent,
body.light-theme .tile-leftover,
body.light-theme .tile-fact-line,
body.light-theme .tile-plan-line {
    color: #1f2937;
}

.budget-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 14px;
}

.budget-table th.budget-table-th-cat {
    width: 60%;
}

.budget-table th.budget-table-th-num {
    width: 13.34%;
}

.budget-table th,
.budget-table td {
    padding: 6px 6px;
    text-align: left;
    border-bottom: 1px solid #2d2d2d;
}

.budget-table th {
    color: rgba(255, 255, 255, 0.65);
    font-weight: 600;
    font-size: 14px;
}

.budget-table th.budget-table-th-num,
.budget-table td.budget-table-td-num {
    text-align: right;
    white-space: nowrap;
    padding-left: 8px;
    padding-right: 6px;
}

.budget-table-td-cat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.budget-table-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.budget-table-name {
    color: #fff;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.budget-table-badge {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 4px;
}

.budget-table-td-num {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.budget-table-row {
    cursor: pointer;
}

.budget-table-row:hover {
    background: rgba(91, 141, 239, 0.08);
}

body.light-theme .budget-table th,
body.light-theme .budget-table td {
    border-bottom-color: #e2e8f0;
}

body.light-theme .budget-table th {
    color: #64748b;
}

body.light-theme .budget-table-name { color: #1f2937; }
body.light-theme .budget-table-td-num { color: #334155; font-size: 14px; }
body.light-theme .budget-table-badge { color: #94a3b8; }
body.light-theme .budget-table-row:hover { background: rgba(79, 124, 255, 0.06); }
.container {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    height: 100dvh; /* mobile: visible viewport (address bar accounted) */
    margin: 0 auto;
    padding: 0 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background-color: #121212;
}

body.light-theme .container {
    background-color: #F3F3F3;
}

@media (min-width: 769px) {
    body {
        background-color: #0d0d0d;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='8' cy='8' r='1.5' fill='rgba(255,255,255,0.08)'/%3E%3Ccircle cx='24' cy='8' r='1.5' fill='rgba(255,255,255,0.08)'/%3E%3Ccircle cx='8' cy='24' r='1.5' fill='rgba(255,255,255,0.08)'/%3E%3Ccircle cx='24' cy='24' r='1.5' fill='rgba(255,255,255,0.08)'/%3E%3C/svg%3E");
        background-size: 32px 32px;
    }
    body.light-theme {
        background-color: #e8e8e8;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='8' cy='8' r='1.5' fill='rgba(0,0,0,0.06)'/%3E%3Ccircle cx='24' cy='8' r='1.5' fill='rgba(0,0,0,0.06)'/%3E%3Ccircle cx='8' cy='24' r='1.5' fill='rgba(0,0,0,0.06)'/%3E%3Ccircle cx='24' cy='24' r='1.5' fill='rgba(0,0,0,0.06)'/%3E%3C/svg%3E");
        background-size: 32px 32px;
    }
    .container {
        max-width: 960px;
        background-color: #121212;
    }
    body.light-theme .container {
        background-color: #F3F3F3;
    }
    .main-budget-bar::before {
        content: '';
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: 100vw;
        top: 0;
        bottom: 0;
        background: #121212;
        z-index: -1;
        pointer-events: none;
    }
    body.light-theme .main-budget-bar::before {
        background: #f8fafc;
    }
    .main-budget-bar.main-budget-bar--not-current-month::before {
        background: rgba(220, 53, 69, 0.25);
    }
}

.main-budget-bar-right.main-search-corner,
.main-search-corner {
    position: relative;
    top: auto;
    right: auto;
    z-index: 1;
}

.main-search-corner-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.main-search-corner-btn:hover {
    color: #e2e8f0;
}

.main-search-corner-btn .material-icons {
    font-size: 20px;
}

.main-search-corner-panel {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
}

.main-search-corner-panel[hidden] {
    display: none !important;
}

.main-search-corner-input {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    font-size: 14px;
    line-height: 32px;
    border: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    outline: none;
    box-sizing: border-box;
}

.main-search-corner-input::placeholder {
    color: #64748b;
}

.main-search-corner-input:focus {
    border: none;
    background: rgba(255, 255, 255, 0.12);
}

.main-search-corner-close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.main-search-corner-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.main-search-corner-close .material-icons {
    font-size: 20px;
}

body.light-theme .main-search-corner-btn {
    background: transparent;
    color: #64748b;
}

body.light-theme .main-search-corner-btn:hover {
    color: #334155;
}

body.light-theme .main-search-corner-input {
    background: rgba(0, 0, 0, 0.06);
    border: none;
    color: #1e293b;
}

body.light-theme .main-search-corner-input::placeholder {
    color: #94a3b8;
}

body.light-theme .main-search-corner-input:focus {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .main-search-corner-close {
    color: #64748b;
}

body.light-theme .main-search-corner-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #334155;
}

.main-budget-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: calc(100% + 20px);
    min-height: 56px;
    margin: 0 -10px;
    padding: 0 16px;
    background: #121212;
    position: relative;
    box-sizing: border-box;
}

.main-budget-bar::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100vw;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.main-budget-bar.main-budget-bar--not-current-month {
    background: rgba(220, 53, 69, 0.25);
}

.main-budget-bar.main-budget-bar--not-current-month::after {
    background: rgba(220, 53, 69, 0.35);
}

.main-budget-bar-left {
    flex: 0 0 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.main-budget-bar-center {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
}

.main-budget-bar-right {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
}

.main-budget-bar.search-open .main-budget-bar-left,
.main-budget-bar.search-open .main-budget-bar-center {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}

.main-budget-bar.search-open .main-budget-bar-right {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
}

.main-budget-bar.search-open .main-search-corner-btn,
.main-budget-bar.search-open .main-budget-bar-edit {
    display: none;
}

.main-budget-bar.search-open .main-budget-bar-right .main-search-corner-panel {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.main-budget-bar .freeze-mini-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.main-budget-bar .freeze-mini-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.main-budget-bar .freeze-mini-btn .material-icons {
    font-size: 20px;
    line-height: 1;
}

.main-budget-bar-nav {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
}

.main-budget-bar-nav:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.main-budget-bar-nav .material-icons {
    font-size: 18px;
}

.main-budget-bar-edit {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
}

.main-budget-bar-edit:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.main-budget-bar-edit .material-icons {
    font-size: 18px;
}

.main-budget-bar-name-wrap {
    flex: 1;
    min-width: 0;
    margin: 0 2px 0 0;
    padding: 1px 6px 1px 2px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font: inherit;
    display: flex;
    align-items: center;
    gap: 2px;
}

.main-budget-bar-name-wrap:hover {
    background: rgba(255, 255, 255, 0.06);
}

.main-budget-bar-name {
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-budget-bar-name-arrow {
    flex-shrink: 0;
    font-size: 20px;
    color: #f1f5f9;
}

.main-budget-bar-indicators {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.main-budget-bar-indicators .indicator-label {
    margin: 0;
}

body.light-theme .main-budget-bar {
    background: #f8fafc;
}

body.light-theme .main-budget-bar::after {
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .main-budget-bar.main-budget-bar--not-current-month {
    background: rgba(220, 53, 69, 0.18);
}

body.light-theme .main-budget-bar.main-budget-bar--not-current-month::after {
    background: rgba(220, 53, 69, 0.3);
}

body.light-theme .main-budget-bar-nav {
    color: #64748b;
}

body.light-theme .main-budget-bar-nav:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #334155;
}

body.light-theme .main-budget-bar-edit {
    color: #64748b;
}

body.light-theme .main-budget-bar-edit:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #334155;
}

body.light-theme .main-budget-bar-name-wrap:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-theme .main-budget-bar-name,
body.light-theme .main-budget-bar-name-arrow {
    color: #1e293b;
}

/* Страница «Бюджеты» */
.budgets-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 64px;
    width: 100%;
    background: #121212;
    z-index: 1500;
    overflow: hidden;
    flex-direction: column;
}

.budgets-screen.active {
    display: flex;
}

@media (min-width: 769px) {
    .budgets-screen {
        left: 50%;
        transform: translateX(-50%);
        max-width: 960px;
        width: 960px;
    }
}

body.budgets-open {
    overflow: hidden;
}

body.light-theme .budgets-screen {
    background: #f8fafc;
}

.budgets-screen-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
    background: #121212;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-theme .budgets-screen-header {
    background: #f8fafc;
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.budgets-screen-header-row {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 0 8px 0 4px;
}

.budgets-screen-back {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.budgets-screen-back:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.budgets-screen-back .material-icons {
    font-size: 24px;
}

body.light-theme .budgets-screen-back:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #334155;
}

.budgets-screen-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
    flex: 1;
    min-width: 0;
}

body.light-theme .budgets-screen-title {
    color: #1e293b;
}

.budgets-screen-phone {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
}

.budgets-screen-phone-inner {
    padding: 20px;
    padding-bottom: 96px;
    min-height: 100%;
}

.budget-switcher-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.budgets-fab {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #5b8def;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(91, 141, 239, 0.4);
    z-index: 10;
}

.budgets-fab:hover {
    background: #4a7ad4;
}

.budgets-fab .material-icons {
    font-size: 28px;
}

body.light-theme .budgets-fab {
    background: #4f7cff;
    box-shadow: 0 4px 14px rgba(79, 124, 255, 0.35);
}

body.light-theme .budgets-fab:hover {
    background: #3d6ae6;
}

.categories-fab {
    position: fixed;
    right: 20px;
    bottom: 80px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #5b8def;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(91, 141, 239, 0.4);
    transition: background 0.2s, transform 0.2s;
    z-index: 100;
}

.categories-fab:hover {
    background: #4a7ad4;
    transform: scale(1.05);
}

.categories-fab .material-icons {
    font-size: 28px;
}

body.light-theme .categories-fab {
    background: #4f7cff;
    box-shadow: 0 4px 14px rgba(79, 124, 255, 0.35);
}

body.light-theme .categories-fab:hover {
    background: #3d6ae6;
}

@media (min-width: 769px) {
    .categories-fab {
        right: calc((100vw - 960px) / 2 + 20px);
    }
}

body.settings-open .categories-fab,
body.history-open .categories-fab,
body.budgets-open .categories-fab {
    display: none;
}

.budget-switcher-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 4px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    gap: 8px;
}

.budget-switcher-row:hover {
    background: rgba(255, 255, 255, 0.1);
}

.budget-switcher-row.active {
    background: rgba(91, 141, 239, 0.2);
    color: #93c5fd;
}

.budget-switcher-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.budget-switcher-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.budget-switcher-row-badge {
    flex-shrink: 0;
    font-size: 12px;
    color: #94a3b8;
}

.budget-switcher-row.active .budget-switcher-row-badge {
    color: #93c5fd;
}

.budget-switcher-row-activate {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.budget-switcher-row-activate:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #93c5fd;
}

.budget-switcher-row-activate .material-icons {
    font-size: 22px;
}

.budget-switcher-row-edit {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.budget-switcher-row-edit:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #93c5fd;
}

.budget-switcher-row-edit .material-icons {
    font-size: 22px;
}

.budget-switcher-row-delete {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.budget-switcher-row-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.budget-switcher-row-delete .material-icons {
    font-size: 22px;
}

.budget-switcher-row-create-demo {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    color: #94a3b8;
}

.budget-switcher-row-create-demo:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.35);
    color: #cbd5e1;
}

.budget-switcher-row-create-demo .material-icons {
    font-size: 22px;
}

.budget-switcher-row-create-demo-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.budget-switcher-row-create-demo-disabled:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.25);
    color: #94a3b8;
}

body.light-theme .budget-switcher-row {
    background: rgba(0, 0, 0, 0.04);
    color: #1e293b;
}

body.light-theme .budget-switcher-row:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .budget-switcher-row.active {
    background: rgba(79, 124, 255, 0.12);
    color: #4f7cff;
}

body.light-theme .budget-switcher-row.active .budget-switcher-row-badge {
    color: #4f7cff;
}

body.light-theme .budget-switcher-row-activate {
    color: #64748b;
}

body.light-theme .budget-switcher-row-activate:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #4f7cff;
}

body.light-theme .budget-switcher-row-edit {
    color: #64748b;
}

body.light-theme .budget-switcher-row-edit:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #4f7cff;
}

body.light-theme .budget-switcher-row-create-demo {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.12);
    color: #64748b;
}

body.light-theme .budget-switcher-row-create-demo:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.2);
    color: #475569;
}

body.light-theme .budget-switcher-row-create-demo-disabled {
    opacity: 0.5;
}

body.light-theme .budget-switcher-row-delete:hover {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626;
}

/* Диалог «Новый бюджет»: поверх всего экрана, не обрезается родителем */
.budget-new-dialog.settings-dialog {
    position: fixed;
    inset: 0;
    z-index: 1600;
}

.budget-new-dialog .settings-dialog-box {
    width: 100%;
    max-height: min(85vh, 520px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.budget-new-dialog .settings-dialog-actions {
    margin-top: 8px;
    flex-shrink: 0;
}

.budget-new-dialog-error {
    margin: 0 0 12px;
    font-size: 13px;
    color: #f87171;
}

body.light-theme .budget-new-dialog-error {
    color: #dc2626;
}

.budget-new-dialog-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.budget-new-dialog-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
    flex: 1;
    min-width: 0;
}

body.light-theme .budget-new-dialog-title {
    color: #1e293b;
}

.budget-new-dialog-close {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.budget-new-dialog-close .material-icons {
    font-size: 22px;
    line-height: 1;
}

.budget-new-dialog-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

body.light-theme .budget-new-dialog-close {
    color: #64748b;
}

body.light-theme .budget-new-dialog-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1e293b;
}

.budget-new-dialog .budget-new-dialog-checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #e2e8f0;
}

.budget-new-dialog-checkbox {
    width: 18px;
    height: 18px;
}

body.light-theme .budget-new-dialog .budget-new-dialog-checkbox-wrap {
    color: #334155;
}

body.settings-hide-group-filter #groupFilter,
.group-filter.group-filter-empty {
    display: none;
}

body.settings-hide-voice .voice-tab-wrap {
    display: none;
}
body.settings-hide-voice .bottom-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.demo-mini-btn,
.theme-mini-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.demo-mini-btn:hover,
.theme-mini-btn:hover {
    color: #e2e8f0;
}

.demo-mini-btn .material-icons,
.theme-mini-btn .material-icons {
    font-size: 20px;
    line-height: 1;
}

body.light-theme .demo-mini-btn,
body.light-theme .theme-mini-btn {
    background: transparent;
    color: #64748b;
}

body.light-theme .demo-mini-btn:hover,
body.light-theme .theme-mini-btn:hover {
    color: #334155;
}

.month-days {
    display: grid;
    grid-template-columns: repeat(31, minmax(0, 1fr));
    gap: 2px;
}

.month-day {
    height: 6px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.09);
}

.month-day.filled {
    background: #5b8def;
}

.month-day.today {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.compact-stats-panel {
    height: 40px;
    margin: 1px -10px 0;
    width: calc(100% + 20px);
    padding: 0;
    border: none;
    border-radius: 0;
    background: #171717;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    box-sizing: border-box;
    flex-shrink: 0;
}

.compact-stats-panel .indicator {
    min-width: 0;
    border-right: none;
    padding: 4px 6px;
}

.compact-stats-panel .indicator-value {
    font-size: 12px;
}

.compact-stats-panel .indicator-label {
    font-size: 10px;
    margin-bottom: 0;
    line-height: 1.1;
}

.compact-stats-panel .metric {
    text-align: center;
    padding-right: 6px;
}

.compact-stats-panel .metric.metric-plan,
.compact-stats-panel .metric.metric-fact,
.compact-stats-panel .metric.metric-left {
    margin-right: 6px;
}

.compact-stats-panel .metric.metric-over {
    display: none;
}

.compact-stats-panel .metric.metric-left.is-over .indicator-value {
    color: #ef4444;
}

body.light-theme .compact-stats-panel .metric.metric-left.is-over .indicator-value {
    color: #dc2626;
}

.compact-stats-panel .metric.metric-left {
    border-right: none;
    margin-right: 0;
}

.freeze-mini-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: none;
    border-radius: 10px;
    background: #171717;
    color: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.freeze-mini-btn .material-icons {
    font-size: 18px;
    line-height: 1;
}

.freeze-mini-btn.is-active {
    background: rgba(79, 124, 255, 0.2);
}

.freeze-mini-btn.active {
    background: rgba(91, 141, 239, 0.25);
    color: #fff;
}

body.light-theme .freeze-mini-btn {
    background: #ffffff;
    color: #334155;
}

body.light-theme .freeze-mini-btn.is-active {
    background: rgba(79, 124, 255, 0.12);
}

body.light-theme .freeze-mini-btn.active {
    background: rgba(79, 124, 255, 0.15);
    color: #1f2937;
}

body.light-theme .main-budget-bar .freeze-mini-btn {
    background: transparent;
}

body.light-theme .main-budget-bar .freeze-mini-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}


.tiles-container {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 110px;
    grid-auto-flow: row;
    width: calc(100% + 20px);
    margin-left: -10px;
    margin-right: -10px;
    padding: 8px 10px 152px 10px;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
    justify-items: stretch;
    align-items: stretch;
    box-sizing: border-box;
}

.bottom-panel {
    height: 64px;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    width: calc(100% + 20px);
    margin-left: -10px;
    margin-right: -10px;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 0;
    border-top: 1px solid #2d2d2d;
    background: #121212;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
    box-sizing: border-box;
    flex-shrink: 0;
}

#mainScreen.hidden {
    display: none;
}

.indicator {
    flex: 1;
    position: relative;
    border: none;
    border-right: 1px solid #2d2d2d;
    border-radius: 0;
    background: transparent;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    justify-content: space-between;
    padding: 8px 12px;
    height: 100%;
    overflow: hidden;
}

.indicator-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0%;
    height: 2px;
    background: #5b8def;
    z-index: 0;
    transition: width 0.35s ease;
}

.metric {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
    padding-right: 10px;
}

.metric.metric-plan {
    border-right: 1px solid #2d2d2d;
    margin-right: 10px;
}

.metric.metric-fact {
    border-right: 1px solid #2d2d2d;
    margin-right: 10px;
}

.metric.metric-left {
    border-right: 1px solid #2d2d2d;
    margin-right: 10px;
}

.metric.metric-over {
    margin-right: 10px;
}

.metric.metric-over.is-over .indicator-value {
    color: #f87171;
}

body.light-theme .metric.metric-over.is-over .indicator-value {
    color: #dc2626;
}

body.light-theme .metric.metric-plan,
body.light-theme .metric.metric-fact,
body.light-theme .metric.metric-left {
    border-right-color: #e2e8f0;
}

.indicator-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 2px;
}

.indicator-value {
    font-size: 14px;
    color: #ffffff;
    font-weight: 600;
}

.mic-button {
    position: relative;
    width: 100%;
    min-width: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #f2f2f2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mic-button:hover {
    background: rgba(91, 141, 239, 0.12);
}

.mic-button-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mic-button .material-icons {
    font-size: 20px;
}

.mic-button-badge {
    display: none;
    position: absolute;
    top: -2px;
    right: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    pointer-events: none;
}

.mic-button.has-unsaved .mic-button-badge {
    display: block;
}

body.light-theme .mic-button-badge {
    background: #dc2626;
}

.mic-label {
    font-size: 10px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.8);
}

.mic-button.is-active {
    background: transparent;
}

.mic-button.is-active::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 40px;
    border-radius: 12px;
    background: rgba(123, 163, 212, 0.28);
    pointer-events: none;
}

.mic-button.is-active .material-icons,
.mic-button.is-active .mic-label {
    color: #7ba3d4;
}

.group-filter {
    width: calc(100% + 20px);
    margin: 4px -10px 0;
    padding: 8px 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid #2d2d2d;
    background: #171717;
}

.group-filter-groups {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.group-filter::-webkit-scrollbar {
    height: 0;
}

.group-filter-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 32px;
    min-height: 32px;
    padding: 6px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.group-filter-btn .material-icons {
    font-size: 18px;
    line-height: 1;
}

.group-filter-btn--text {
    border-radius: 16px;
    padding-left: 12px;
    padding-right: 12px;
    min-width: 0;
}

.group-filter-btn-text {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.group-filter-btn:hover {
    background: rgba(91, 141, 239, 0.12);
}

.group-filter-btn.active {
    background: rgba(91, 141, 239, 0.25);
    color: #fff;
}

.group-filter-btn.active .material-icons {
    color: inherit;
}

body.light-theme .group-filter {
    border-bottom-color: #d4d9e2;
    background: #ffffff;
}

body.light-theme .group-filter-btn {
    color: #334155;
}

body.light-theme .group-filter-btn:hover {
    background: rgba(79, 124, 255, 0.08);
}

body.light-theme .group-filter-btn.active {
    background: rgba(79, 124, 255, 0.15);
    color: #1f2937;
}
