.budget-card {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

body.light-theme .budget-card {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
}

.budget-card .budget-card-name,
.budget-card .budget-card-budget {
    min-width: 0;
    width: 100%;
}

.budget-card-icon-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background 0.2s;
}

.budget-card-icon-btn:hover {
    background: rgba(0, 0, 0, 0.35);
}

body.light-theme .budget-card-icon-btn {
    background: #e2e8f0;
}

body.light-theme .budget-card-icon-btn:hover {
    background: #cbd5e1;
}

.budget-card-icon-btn .material-icons {
    font-size: 22px;
}

.budget-card-color-swatch {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}

.budget-card-color-swatch:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

body.light-theme .budget-card-color-swatch {
    border-color: rgba(0, 0, 0, 0.2);
}

body.light-theme .budget-card-color-swatch:hover {
    border-color: rgba(0, 0, 0, 0.35);
}

/* Диалог выбора цвета из палитры */
.budget-color-picker-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.budget-color-picker-overlay.active {
    display: flex;
}

.budget-color-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.budget-color-picker-box {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    padding: 16px;
}

body.light-theme .budget-color-picker-box {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.budget-color-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.budget-color-picker-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
}

body.light-theme .budget-color-picker-title {
    color: #1e293b;
}

.budget-color-picker-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.budget-color-picker-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.light-theme .budget-color-picker-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #334155;
}

.budget-color-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.budget-color-picker-swatch {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.2s;
}

.budget-color-picker-swatch:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

body.light-theme .budget-color-picker-swatch {
    border-color: rgba(0, 0, 0, 0.15);
}

body.light-theme .budget-color-picker-swatch:hover {
    border-color: rgba(0, 0, 0, 0.4);
}

.budget-card-fixed-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #64748b;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.budget-card-fixed-btn .material-icons {
    font-size: 18px;
}

.budget-card-fixed-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #94a3b8;
}

.budget-card-fixed-btn.active {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.budget-card-fixed-btn.active:hover {
    background: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

body.light-theme .budget-card-fixed-btn {
    background: rgba(0, 0, 0, 0.06);
    color: #94a3b8;
}

body.light-theme .budget-card-fixed-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #64748b;
}

body.light-theme .budget-card-fixed-btn.active {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

body.light-theme .budget-card-fixed-btn.active:hover {
    background: rgba(239, 68, 68, 0.22);
    color: #b91c1c;
}


.budget-card-name {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-size: 14px;
    color: #f1f5f9;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-radius: 8px;
}

.budget-card-name:focus {
    outline: none;
    border-color: #5b8def;
}

body.light-theme .budget-card-name {
    color: #1e293b;
    background: #f1f5f9;
}

body.light-theme .budget-card-name:focus {
    border-color: #4f7cff;
}

.budget-card-budget {
    width: 72px;
    padding: 8px 10px;
    font-size: 14px;
    text-align: right;
    color: #f1f5f9;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-radius: 8px;
}

.budget-card-budget:focus {
    outline: none;
    border-color: #5b8def;
}

body.light-theme .budget-card-budget {
    color: #1e293b;
    background: #f1f5f9;
}

body.light-theme .budget-card-budget:focus {
    border-color: #4f7cff;
}

.budget-card-delete {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.budget-card-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Полноэкранный оверлей выбора иконки */
.icon-picker-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.icon-picker-overlay.active {
    display: flex;
}

.icon-picker-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.icon-picker-overlay-box {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 360px;
    height: 85vh;
    min-height: 400px;
    max-height: 85vh;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

body.light-theme .icon-picker-overlay-box {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.icon-picker-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 16px 16px 0;
    padding-bottom: 12px;
}

.icon-picker-overlay-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
}

body.light-theme .icon-picker-overlay-title {
    color: #1e293b;
}

.icon-picker-overlay-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.icon-picker-overlay-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.light-theme .icon-picker-overlay-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #334155;
}

.icon-picker-overlay-search {
    flex-shrink: 0;
    margin: 0 16px 12px;
    padding: 10px 14px;
    font-size: 15px;
    color: #f1f5f9;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.icon-picker-overlay-search::placeholder {
    color: #94a3b8;
}

.icon-picker-overlay-search:focus {
    outline: none;
    border-color: #5b8def;
}

body.light-theme .icon-picker-overlay-search {
    color: #1e293b;
    background: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .icon-picker-overlay-search::placeholder {
    color: #64748b;
}

body.light-theme .icon-picker-overlay-search:focus {
    border-color: #4f7cff;
}

.icon-picker-overlay-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 8px;
    padding: 0 16px 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    align-content: start;
}

.icon-picker-overlay-item {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #e2e8f0;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.icon-picker-overlay-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.icon-picker-overlay-item .material-icons {
    font-size: 24px;
}

body.light-theme .icon-picker-overlay-item {
    color: #475569;
}

body.light-theme .icon-picker-overlay-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

