body.compact-mode .tiles-container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 88px;
    padding: 8px 10px;
    gap: 6px;
}

body.compact-mode .tile {
    padding: 2px 4px;
}

body.compact-mode .tile-icon {
    font-size: 22px;
    margin-bottom: 0;
}

body.compact-mode .tile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

body.compact-mode .tile-bottom-progress {
    display: none;
}

body.compact-mode .tile-name {
    font-size: 11px;
    margin-bottom: 1px;
}

body.compact-mode .tile-budget,
body.compact-mode .tile-spent {
    font-size: 11px;
}

body.compact-mode .tile-budget-preview {
    font-size: 12px;
}

body.compact-mode .tile-budget-old {
    font-size: 11px;
    margin-bottom: 1px;
}

body.compact-mode .tile-amounts {
    gap: 3px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.compact-mode .tile-separator {
    font-size: 10px;
    opacity: 0.6;
}

body.compact-mode .tile-fixed-badge {
    display: none;
}

body.compact-mode .tile-done-badge {
    right: 4px;
    top: 4px;
}

body.compact-mode .tile-done-badge .material-icons {
    font-size: 14px;
}

body.list-view .tiles-container {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    align-items: start;
    gap: 6px;
    padding: 8px 10px;
}

body.list-view .tile.tile-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    min-height: 56px;
    width: 100%;
    box-sizing: border-box;
}

body.list-view .tile-list .tile-list-icon {
    font-size: 28px;
    flex-shrink: 0;
}

body.list-view .tile-list .tile-list-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

body.list-view .tile-list .tile-list-row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

body.list-view .tile-list .tile-list-name-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

body.list-view .tile-list .tile-list-name {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.list-view .tile-list .tile-list-name-wrap .tile-fixed-badge {
    position: static;
    flex-shrink: 0;
}

body.list-view .tile-list .tile-list-name-wrap .tile-fixed-badge .material-icons {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
}

body.list-view .tile-list .tile-list-remainder {
    font-size: 15px;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
}

body.list-view .tile-list .tile-list-row2-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

body.list-view .tile-list .tile-list-row2 {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
}

body.list-view .tile-list .tile-list-row2 .tile-list-fact,
body.list-view .tile-list .tile-list-row2 .tile-list-plan {
    color: rgba(255, 255, 255, 0.85);
    font-weight: normal;
}

body.list-view .tile-list .tile-list-badges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

body.list-view .tile-list .tile-list-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.list-view .tile-list .tile-list-badge .material-icons {
    font-size: 14px;
    line-height: 1;
}

body.list-view .tile-list .tile-list-badges .tile-fixed-badge {
    color: rgba(255, 255, 255, 0.65);
}

body.list-view .tile-list .tile-bottom-progress,
body.list-view .tile-list > .tile-fixed-badge {
    display: none;
}

body.light-theme .tile-list .tile-list-name { color: #1f2937; }
body.light-theme .tile-list .tile-list-remainder { color: #334155; }
body.light-theme .tile-list .tile-list-row2 { color: #64748b; }
body.light-theme .tile-list .tile-list-row2 .tile-list-fact,
body.light-theme .tile-list .tile-list-row2 .tile-list-plan { color: #334155; }
body.light-theme .tile-list .tile-list-name-wrap .tile-fixed-badge .material-icons { color: #64748b; }

body.table-view .tiles-container {
    display: block;
    overflow: auto;
    padding: 8px 10px;
}

.tile {
    position: relative;
    border: 1px solid #2d2d2d;
    border-radius: 16px;
    background: #171717;
    box-shadow: none;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2px 5px;
    width: 100%;
    height: 100%;
}

.tile:hover {
    background: rgba(91, 141, 239, 0.06);
    transform: translateY(-1px);
    z-index: 10;
}

.tile.preview-selected {
    border-color: #5b8def;
    box-shadow: inset 0 0 0 1px rgba(91, 141, 239, 0.45);
}

.tile.preview-unselected {
    opacity: 0.55;
}

.tile-fixed-badge {
    position: absolute;
    left: 6px;
    top: 6px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.65);
}

.tile-fixed-badge .material-icons {
    font-size: 16px;
    line-height: 1;
}

body.light-theme .tile-fixed-badge {
    color: #64748b;
}

.tile-done-badge {
    position: absolute;
    right: 6px;
    top: 6px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #22c55e;
}

.tile-done-badge .material-icons {
    font-size: 18px;
    line-height: 1;
}

.tile-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #f2f2f2;
    width: 100%;
}

.tile-icon {
    font-size: 24px;
    margin-bottom: 3px;
    line-height: 1;
}

.tile-name {
    font-weight: 400;
    font-size: 14px;
    margin-bottom: 3px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-budget {
    font-size: 14px;
}

.tile-budget-old {
    font-size: 12px;
    color: #ef4444;
    margin-bottom: 2px;
}

.tile-amounts.tile-budget-old {
    font-size: 13px;
    margin-bottom: 4px;
}

.tile-amounts {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.tile-amounts-stack {
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.tile-fact-line {
    font-size: 14px;
    opacity: 0.9;
}

.tile-plan-line {
    font-size: 14px;
}

.tile-separator {
    opacity: 0.65;
    font-size: 12px;
}

body.light-theme .tile-done-badge {
    color: #16a34a;
}

body.light-theme .tile-budget-old {
    color: #dc2626;
}

body.light-theme .tile-separator {
    color: #334155;
    opacity: 0.9;
}

.tile-spent {
    font-size: 14px;
    opacity: 0.85;
}

.tile-leftover {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.1;
}

.tile-done-inline .material-icons {
    font-size: 18px;
    color: #22c55e;
}

body.light-theme .tile-done-inline .material-icons {
    color: #16a34a;
}

.tile-bottom-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0%;
    height: 3px;
    background: #7ba3d4;
    z-index: 2;
    transition: width 0.35s ease;
}

.tile-bottom-progress.is-done {
    background: #95c9a5;
}

.tile-bottom-progress.is-over {
    background: #d4a5a5;
}

body.light-theme .tile-bottom-progress {
    background: #7ba3d4;
}

body.light-theme .tile-bottom-progress.is-done {
    background: #8bc49a;
}

body.light-theme .tile-bottom-progress.is-over {
    background: #c97b7b;
}

