*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --bg: #f6f9fc;
    --surface: #ffffff;
    --surface-soft: #dbeafe;
    --text: #0f172a;
    --muted: #64748b;
    --line: #d8e2ef;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --income: #2563eb;
    --expense: #dc2626;
    --balance: #0f172a;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

html {
    min-height: 100%;
    width: 100%;
    max-width: 100%;
    background: var(--bg);
    overflow-x: hidden;
}

body {
    min-height: 100%;
    width: 100%;
    max-width: 100%;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

input,
select,
textarea,
button {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font: inherit;
    font-size: 16px;
}

input[type="date"],
input[type="month"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    -webkit-appearance: none;
    appearance: auto;
}

select {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--text);
    background-color: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color-scheme: light;
    font: inherit;
    font-size: 16px;
}

select option {
    color: var(--text);
    background-color: #fff;
}

.app-shell {
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
    padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 58%;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

.brand i {
    flex: 0 0 auto;
}

.user-pill {
    padding: 5px 9px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.header-actions {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.lang-switch {
    display: inline-flex;
    padding: 2px;
    background: var(--surface-soft);
    border-radius: 8px;
}

.lang-switch a {
    min-width: 34px;
    padding: 5px 7px;
    color: var(--muted);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.lang-switch a.active {
    color: #fff;
    background: var(--primary);
}

.content {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 16px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 160ms ease, transform 160ms ease;
}

body.is-ready .content {
    opacity: 1;
    transform: translateY(0);
}

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    background: rgba(246, 249, 252, 0.82);
    backdrop-filter: blur(6px);
    transition: opacity 140ms ease, visibility 140ms ease;
}

.page-loader.active {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.page-loader__box {
    display: grid;
    gap: 10px;
    justify-items: center;
    min-width: 132px;
    padding: 18px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.page-loader__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #dbeafe;
    border-top-color: var(--primary);
    border-radius: 999px;
    animation: spin 0.75s linear infinite;
}

.page-loader__text {
    font-weight: 800;
}

.auth-wrap {
    min-height: calc(100vh - 80px);
    display: grid;
    align-content: center;
}

.panel,
.card,
.transaction-row {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 16px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.page-head h1,
.panel h1,
.section-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
}

.muted {
    color: var(--muted);
}

.form-stack {
    display: grid;
    gap: 13px;
}

.field {
    display: grid;
    gap: 6px;
}

.field label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.field-label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 11px 12px;
    color: var(--text);
    background: #fff;
    border: 1px solid #cfd9d3;
    border-radius: 8px;
}

.field select {
    -webkit-appearance: menulist;
    appearance: auto;
    background-color: #fff;
    color: var(--text);
    color-scheme: light;
}

.field select option {
    background: #fff;
    color: var(--text);
}

.field textarea {
    min-height: 92px;
    resize: vertical;
}

.field-error {
    color: var(--danger);
    font-size: 13px;
}

.two-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
}

.form-stack,
.field {
    min-width: 0;
}

.type-segment {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    min-width: 0;
    padding: 4px;
    background: var(--surface-soft);
    border-radius: 8px;
}

.type-segment__button {
    width: 100%;
    min-width: 0;
    color: var(--primary-dark);
    background: #fff;
    border: 1px solid transparent;
    white-space: nowrap;
}

.type-segment__button.active {
    color: #fff;
    background: var(--primary);
}

.type-segment__button:focus-visible {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    color: #fff;
    background: var(--primary);
    border: 0;
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    gap: 8px;
    white-space: nowrap;
}

.btn i,
button i {
    flex: 0 0 auto;
}

.btn.secondary {
    color: var(--primary-dark);
    background: var(--surface-soft);
}

.btn.danger {
    background: var(--danger);
}

.btn.full {
    width: 100%;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.success-actions {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 12px;
}

.flash {
    width: min(100% - 28px, 760px);
    margin: 14px auto 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 700;
}

.flash.success {
    color: var(--primary-dark);
    background: var(--surface-soft);
}

.flash.error {
    color: #991b1b;
    background: #fee2e2;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.card {
    padding: 14px;
}

.metric-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric-value {
    display: block;
    margin-top: 7px;
    font-size: 18px;
    font-weight: 900;
}

.income {
    color: var(--income);
}

.expense {
    color: var(--expense);
}

.transaction-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.transaction-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 13px;
    text-decoration: none;
}

.transaction-row > div {
    min-width: 0;
}

.transaction-title {
    margin: 0;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.transaction-meta {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.transaction-amount {
    white-space: nowrap;
    font-weight: 900;
}

.filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    max-width: 100%;
}

.filter-form button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.filter-form input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 8px;
    border: 1px solid #cfd9d3;
    border-radius: 8px;
}

.filter-card {
    display: grid;
    gap: 14px;
    max-width: 100%;
    margin: 10px 0 14px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.filter-panel {
    margin-bottom: 14px;
}

.filter-panel summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    color: var(--primary-dark);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    list-style: none;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.filter-panel summary::-webkit-details-marker {
    display: none;
}

.filter-panel summary i {
    flex: 0 0 auto;
}

.filter-label-open {
    display: none;
}

.filter-panel[open] .filter-label-closed {
    display: none;
}

.filter-panel[open] .filter-label-open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-badge {
    display: inline-flex;
    width: fit-content;
    margin-top: 6px;
    padding: 4px 8px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.filter-active-badge {
    padding: 3px 7px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.filter-card .field {
    min-width: 0;
}

.filter-actions {
    display: flex;
    align-items: end;
    gap: 8px;
    min-width: 0;
}

.filter-actions .btn,
.filter-actions button {
    flex: 1 1 0;
    white-space: nowrap;
}

.empty-state {
    padding: 22px;
    color: var(--muted);
    text-align: center;
    background: var(--surface);
    border: 1px dashed #cfd9d3;
    border-radius: 8px;
}

.pagination {
    display: grid;
    grid-template-columns: minmax(82px, auto) minmax(0, 1fr) minmax(82px, auto);
    gap: 10px;
    align-items: center;
    margin-top: 16px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 12px;
    color: var(--primary);
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    background: var(--surface-soft);
    border: 1px solid var(--primary-soft);
    border-radius: 10px;
}

.pagination-button:hover {
    color: #fff;
    background: var(--primary);
}

.pagination-button.disabled {
    color: var(--muted);
    pointer-events: none;
    background: #f1f5f9;
    border-color: var(--line);
    opacity: 0.62;
}

.pagination-status {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: var(--text);
    text-align: center;
}

.pagination-status span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.ocr-panel {
    display: grid;
    gap: 13px;
    padding: 14px;
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.slip-ocr-card {
    display: grid;
    gap: 13px;
    min-width: 0;
    padding: 14px;
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.slip-ocr-card .section-title {
    margin-bottom: 4px;
}

.slip-preview-grid {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.slip-preview-box {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.slip-preview-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.slip-preview-box img {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 260px;
    object-fit: contain;
    background: #eef5ff;
    border-radius: 8px;
}

.slip-preview-placeholder {
    display: grid;
    min-height: 150px;
    padding: 16px;
    place-items: center;
    color: var(--muted);
    text-align: center;
    background: #eef5ff;
    border: 1px dashed var(--line);
    border-radius: 8px;
    font-weight: 700;
}

.slip-empty {
    padding: 16px;
    color: var(--muted);
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: 8px;
}

.ocr-panel h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 18px;
}

.ocr-message {
    color: var(--muted);
}

.ocr-message.error {
    color: var(--danger);
    font-weight: 700;
}

.ocr-message small {
    display: block;
    margin-top: 4px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.ocr-result-grid {
    display: grid;
    gap: 12px;
}

.ocr-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 7px;
}

.ocr-option {
    min-height: 38px;
    padding: 8px 10px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    cursor: pointer;
}

.ocr-option.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.ocr-value {
    margin-top: 7px;
    color: var(--text);
    overflow-wrap: anywhere;
}

.ocr-raw summary {
    color: var(--primary-dark);
    cursor: pointer;
    font-weight: 800;
}

.ocr-raw pre {
    max-height: 220px;
    margin: 10px 0 0;
    padding: 10px;
    overflow: auto;
    color: var(--text);
    background: #eef5ff;
    border-radius: 8px;
    white-space: pre-wrap;
}

.settings-section {
    margin-top: 18px;
}

.option-list {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}

.option-list h3 {
    margin: 8px 0 0;
    font-size: 16px;
}

.option-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.option-edit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.option-edit input {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 10px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 16px;
}

.option-row strong,
.option-row span {
    display: block;
    overflow-wrap: anywhere;
}

.option-row span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.loaded-content {
    display: none;
}

body.is-skeleton-loading .loaded-content {
    display: none;
}

body.is-ready .loaded-content {
    display: block;
}

body.is-ready .loaded-content.summary-grid,
body.is-ready .loaded-content.charts-grid {
    display: grid;
}

body.is-ready .skeleton-wrap {
    display: none;
}

body.is-skeleton-loading .skeleton-wrap {
    display: grid;
}

.skeleton-wrap {
    display: grid;
    gap: 10px;
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: #eaf1f8;
    border-radius: 8px;
}

.skeleton::after {
    position: absolute;
    inset: 0;
    content: "";
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, #f8fbff, transparent);
    animation: skeleton-shimmer 1.3s infinite;
}

.skeleton-card {
    min-height: 86px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.skeleton-title {
    width: 42%;
    height: 14px;
    margin-bottom: 14px;
}

.skeleton-line {
    width: 100%;
    height: 14px;
}

.skeleton-line.short {
    width: 62%;
}

.skeleton-line.amount {
    width: 74%;
    height: 24px;
}

.skeleton-pill {
    width: 74px;
    height: 26px;
    border-radius: 999px;
}

.skeleton-button {
    width: 118px;
    height: 42px;
    border-radius: 8px;
}

.skeleton-table-row {
    height: 54px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.skeleton-list-item {
    height: 64px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.skeleton-chart {
    height: 220px;
}

button.is-loading,
.btn.is-loading {
    pointer-events: none;
    opacity: 0.78;
}

button.is-loading::before,
.btn.is-loading::before {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-top-color: #fff;
    border-radius: 999px;
    content: "";
    animation: spin 0.8s linear infinite;
}

@keyframes skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.bottom-nav {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    width: min(calc(100% - 24px), 760px);
    min-height: auto;
    margin: 0 auto;
    padding: 8px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 6px 4px;
    color: var(--muted);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.bottom-nav a span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bottom-nav i {
    font-size: 18px;
    line-height: 1;
}

.title-icon {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.bottom-nav a.active {
    color: #fff;
    background: var(--primary);
}

.bottom-nav a.add {
    color: var(--muted);
    background: transparent;
}

.bottom-nav a.add.active {
    color: #fff;
    background: var(--primary);
}

.report-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    overflow: hidden;
    background: var(--surface);
    border-radius: 8px;
}

.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

.report-table th,
.report-table td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.report-table th:last-child,
.report-table td:last-child {
    text-align: right;
}

.report-category-table .type-cell,
.report-category-table .category-cell {
    min-width: 0;
}

.report-category-table .category-cell {
    overflow-wrap: anywhere;
}

.report-category-table .amount-cell {
    white-space: nowrap;
}

.report-link-row {
    cursor: pointer;
    transition: background-color 140ms ease, transform 140ms ease;
}

.report-link-row:hover {
    background: #f8fbff;
}

.report-link-row:active {
    transform: translateY(1px);
}

.report-cell-link {
    display: block;
    width: 100%;
    color: inherit;
    text-decoration: none;
}

.report-cell-link:hover,
.report-cell-link:focus,
.report-cell-link:active,
.report-cell-link:visited {
    color: inherit;
    text-decoration: none;
}

.report-cell-link:focus-visible {
    border-radius: 6px;
    outline: 2px solid var(--primary-soft);
    outline-offset: 2px;
}

.report-cell-link--amount {
    font-weight: inherit;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.chart-panel {
    min-width: 0;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.chart-panel h2 {
    margin: 0 0 10px;
    font-size: 17px;
}

.chart-box {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 260px;
    overflow: hidden;
}

.chart-box canvas {
    display: block;
    max-width: 100%;
}

.chart-empty {
    display: grid;
    min-height: 180px;
    place-items: center;
    color: var(--muted);
    text-align: center;
}

.auth-links {
    margin-top: 14px;
    color: var(--muted);
    text-align: center;
}

.reset-debug-link {
    display: grid;
    gap: 6px;
    margin: 12px 0;
    padding: 10px 12px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    border-radius: 8px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.reset-debug-link span {
    font-weight: 800;
}

@media (max-width: 430px) {
    .brand {
        max-width: 46%;
        font-size: 15px;
        line-height: 1.15;
    }

    .brand i {
        display: none;
    }

    .topbar {
        gap: 6px;
    }

    .header-actions {
        gap: 6px;
    }

    .user-pill {
        padding: 5px 7px;
        font-size: 12px;
    }

    .lang-switch a {
        min-width: 31px;
        padding: 5px 6px;
    }

    .summary-grid,
    .charts-grid,
    .two-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding-top: 14px;
        padding-right: 16px;
        padding-bottom: calc(118px + env(safe-area-inset-bottom));
        padding-left: 16px;
    }

    .panel,
    .card,
    .chart-panel {
        padding: 14px;
    }

    .page-head h1,
    .panel h1,
    .section-title {
        font-size: 22px;
    }

    .chart-box {
        height: 238px;
    }

    .transaction-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .option-row {
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
    }

    .option-edit {
        grid-template-columns: minmax(0, 1fr);
    }

    .transaction-amount {
        white-space: normal;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-form {
        width: 100%;
    }

    .filter-form input {
        flex: 1;
    }

    .filter-card {
        padding: 12px;
    }

    .filter-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .filter-actions {
        align-items: stretch;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .bottom-nav a {
        font-size: 11px;
        min-height: 50px;
        padding: 5px 2px;
    }

    .bottom-nav i {
        font-size: 16px;
    }
}

@media (max-width: 640px) {
    .report-category-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0;
    }

    .report-category-table thead {
        display: none;
    }

    .report-category-table,
    .report-category-table tbody,
    .report-category-table tr,
    .report-category-table td {
        display: block;
        width: 100%;
    }

    .report-category-table tbody {
        display: grid;
        gap: 10px;
    }

    .report-category-table tr {
        display: grid;
        grid-template-columns: minmax(62px, auto) minmax(0, 1fr);
        gap: 4px 10px;
        padding: 12px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 8px;
    }

    .report-category-table td {
        min-width: 0;
        padding: 0;
        border-bottom: 0;
    }

    .report-category-table .type-cell {
        grid-row: 1 / span 2;
        align-self: start;
        width: auto;
        padding: 4px 7px;
        color: var(--primary-dark);
        background: var(--surface-soft);
        border-radius: 999px;
        font-size: 12px;
        font-weight: 800;
        text-align: center;
        white-space: nowrap;
    }

    .report-category-table .category-cell {
        font-weight: 800;
        line-height: 1.3;
    }

    .report-category-table .amount-cell {
        text-align: right;
        font-weight: 900;
        white-space: nowrap;
    }
}

@media (max-width: 390px) {
    .brand {
        max-width: 42%;
        font-size: 14px;
    }

    .lang-switch a {
        min-width: 29px;
        padding: 5px;
    }

    .bottom-nav {
        right: 8px;
        left: 8px;
        width: calc(100% - 16px);
        padding: 7px 6px;
        border-radius: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton::after,
    button.is-loading::before,
    .btn.is-loading::before,
    .page-loader__spinner {
        animation: none;
    }

    .content,
    .page-loader {
        transition: none;
    }
}

.swal2-popup.expense-swal {
    width: min(92vw, 420px);
    border-radius: 16px;
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.swal2-popup.expense-swal .swal2-title {
    font-size: 22px;
}

.swal2-popup.expense-swal .swal2-html-container {
    color: var(--muted);
    font-size: 15px;
}

.swal2-popup.expense-swal .swal2-confirm,
.swal2-popup.expense-swal .swal2-cancel {
    border-radius: 8px;
    font-weight: 800;
}
