:root {
    color-scheme: light;
    --slate-950: #0f172a;
    --slate-900: #172033;
    --slate-800: #263249;
    --slate-700: #3f4b61;
    --slate-600: #59677e;
    --slate-500: #718096;
    --slate-400: #94a0b2;
    --slate-300: #cbd3df;
    --slate-200: #dfe5ed;
    --slate-100: #eef2f6;
    --slate-50: #f7f9fc;
    --white: #ffffff;
    --green: #15803d;
    --green-soft: #e8f7ed;
    --blue: #1d4ed8;
    --blue-soft: #eaf0ff;
    --red: #dc2626;
    --red-soft: #ffebeb;
    --orange: #ea580c;
    --orange-soft: #fff0e8;
    --cf-purple: #7c3aed;
    --cf-purple-soft: #f3e8ff;
    --yellow: #facc15;
    --page-background: #eef2f6;
    --header-glass: rgb(255 255 255 / 94%);
    --module-header-glass: rgb(255 255 255 / 96%);
    --header-gradient-start: #fbfcfe;
    --header-gradient-end: #f7f9fc;
    --table-divider: #dfe5ed;
    --module-divider: #e7edf5;
    --row-hover: #f1f6ff;
    --chart-grid: #dfe5ed;
    --chart-zero: #94a3b8;
    --chart-income-start: #60a5fa;
    --chart-income-end: #1d4ed8;
    --chart-expense: #dc2626;
    --chart-balance: #15803d;
    --modal-overlay: rgb(15 23 42 / 62%);
    --modal-border: rgb(255 255 255 / 46%);
    --modal-header-glass: rgb(248 250 252 / 96%);
    --modal-close-background-start: #f7f8fa;
    --modal-close-background-end: #e5e8ed;
    --modal-close-foreground: #4b5563;
    --modal-close-border: rgb(255 255 255 / 88%);
    --modal-close-shadow: 0 1px 2px rgb(15 23 42 / 16%), 0 3px 6px rgb(15 23 42 / 8%);
    --modal-close-focus: #3b82f6;
    --footer-glass: rgb(255 255 255 / 96%);
    --shadow-sm: 0 1px 2px rgb(15 23 42 / 5%), 0 5px 18px rgb(15 23 42 / 5%);
    --shadow-lg: 0 24px 70px rgb(15 23 42 / 22%);
    --radius: 15px;
    --nav-height: 76px;
    --popup-control-height: 48px;
    --popup-control-content-height: 46px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% -12rem, rgb(37 99 235 / 8%), transparent 34rem),
        var(--page-background);
    color: var(--slate-900);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

button,
input,
select {
    color: inherit;
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button {
    border: 0;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    z-index: 200;
    top: 10px;
    left: 10px;
    padding: 10px 14px;
    border-radius: 9px;
    background: var(--white);
    color: var(--slate-950);
    font-weight: 800;
    transform: translateY(-150%);
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid rgb(37 99 235 / 36%);
    outline-offset: 3px;
}

.page-shell {
    width: min(100%, 1200px);
    margin: 0 auto;
    padding: 24px 24px calc(var(--nav-height) + 52px);
}

.auth-gate {
    position: fixed;
    z-index: 220;
    inset: 0;
    display: grid;
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
    place-items: center;
    padding: calc(18px + env(safe-area-inset-top)) 12px calc(18px + env(safe-area-inset-bottom));
    background:
        radial-gradient(circle at 50% 6%, rgb(37 99 235 / 18%), transparent 23rem),
        var(--page-background);
}

.auth-panel {
    width: min(100%, 400px);
    padding: 22px 16px 16px;
    border: 1px solid var(--slate-200);
    border-radius: 22px;
    background: var(--header-glass);
    box-shadow: var(--shadow-lg);
}

.auth-brand {
    display: grid;
    width: 52px;
    height: 52px;
    margin: 0 auto 13px;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #2563eb, #153a9a);
    color: #fff;
    box-shadow: 0 10px 24px rgb(29 78 216 / 25%);
    font-size: 24px;
    font-weight: 950;
}

.auth-heading {
    text-align: center;
}

.auth-heading > span {
    color: var(--blue);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .14em;
}

.auth-heading h1 {
    margin: 3px 0 2px;
    color: var(--slate-950);
    font-size: 27px;
    line-height: 1.2;
}

.auth-heading p {
    min-height: 21px;
    margin: 0;
    color: var(--slate-600);
    font-size: 13px;
}

.login-form {
    display: grid;
    gap: 12px;
    margin-top: 17px;
}

.login-form label {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.login-form label > span {
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 800;
}

.login-form input,
.auth-submit {
    width: 100%;
    height: 48px;
    min-height: 48px;
    border-radius: 12px;
    font-size: 16px;
}

.login-form input {
    padding: 0 13px;
    border: 1px solid var(--slate-300);
    background: var(--white);
    color: var(--slate-950);
    outline: 0;
}

.login-form input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 15%);
}

.auth-submit {
    margin-top: 2px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 900;
    box-shadow: 0 8px 18px rgb(29 78 216 / 20%);
}

.auth-submit:disabled {
    cursor: wait;
    opacity: .68;
}

.auth-error {
    margin: -2px 0 0;
    padding: 8px 10px;
    border: 1px solid rgb(220 38 38 / 24%);
    border-radius: 10px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 12px;
    font-weight: 750;
}

.session-menu {
    position: relative;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
}

.session-menu-trigger {
    display: grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--slate-50);
    color: var(--blue);
}

.session-menu-trigger[data-role="readonly"] {
    border-color: var(--slate-300);
    background: var(--slate-50);
    color: #0f766e;
}

.session-menu-trigger[aria-expanded="true"] {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgb(37 99 235 / 12%);
}

.session-menu-icon {
    display: none;
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.session-menu-trigger[data-role="admin"] .session-menu-icon-admin,
.session-menu-trigger[data-role="readonly"] .session-menu-icon-viewer {
    display: block;
}

.session-popover {
    position: absolute;
    z-index: 90;
    top: calc(100% + 9px);
    right: -20px;
    width: min(224px, calc(100vw - 24px));
    padding: 12px;
    border: 1px solid var(--slate-200);
    border-radius: 15px;
    background: var(--white);
    box-shadow: 0 18px 42px rgb(15 23 42 / 20%);
}

.session-popover-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.session-popover-heading > span:first-child {
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .09em;
}

.session-popover > strong {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    color: var(--slate-950);
    font-size: 16px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-role {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 1px solid rgb(21 128 61 / 22%);
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

body[data-can-write="false"] .session-role {
    border-color: rgb(29 78 216 / 22%);
    background: var(--blue-soft);
    color: var(--blue);
}

.session-logout {
    display: flex;
    width: 100%;
    height: 42px;
    margin-top: 11px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--slate-50);
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 850;
}

.session-logout svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

body[data-can-write="false"] [data-requires-write],
body[data-can-write="false"] [data-write-hint] {
    display: none !important;
}

.app-header {
    position: relative;
    z-index: 20;
    display: flex;
    min-height: 94px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 20px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--header-glass);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.brand-block {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    align-items: center;
    gap: 12px;
}

.brand-dot {
    display: none;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 11px;
    background: var(--slate-950);
    color: var(--white);
    font-weight: 900;
}

.app-header h1 {
    margin: 0;
    overflow: hidden;
    background: linear-gradient(100deg, var(--slate-950) 0 55%, #2563eb 100%);
    color: transparent;
    font-size: clamp(28px, 3.2vw, 42px);
    font-weight: 900;
    letter-spacing: -.055em;
    line-height: 1.15;
    background-clip: text;
    -webkit-background-clip: text;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header h1 span {
    letter-spacing: -.065em;
}

.home-header-controls {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
}

.theme-toggle {
    position: relative;
    display: block;
    width: 26px;
    height: 44px;
    flex: 0 0 26px;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--slate-300);
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--slate-500);
    box-shadow: inset 0 1px 3px rgb(15 23 42 / 10%);
    transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.theme-toggle-sun,
.theme-toggle-moon {
    position: absolute;
    z-index: 3;
    left: 50%;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    transform: translateX(-50%);
    transition: color 180ms ease, opacity 180ms ease;
}

.theme-toggle-sun {
    top: 6px;
    color: #b45309;
}

.theme-toggle-moon {
    bottom: 6px;
    color: var(--slate-500);
}

.theme-toggle i {
    position: absolute;
    z-index: 2;
    top: 3px;
    left: 4px;
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 2px 5px rgb(15 23 42 / 28%);
    transition: transform 190ms ease, background 180ms ease;
}

.theme-toggle[aria-checked="true"] {
    border-color: #475569;
    background: #172033;
}

.theme-toggle[aria-checked="true"] .theme-toggle-sun {
    color: #94a3b8;
    opacity: .62;
}

.theme-toggle[aria-checked="true"] .theme-toggle-moon {
    color: #bfdbfe;
}

.theme-toggle[aria-checked="true"] i {
    background: #60a5fa;
    transform: translateY(20px);
}

.theme-toggle:focus-visible {
    outline: 3px solid rgb(37 99 235 / 36%);
    outline-offset: 3px;
}

.year-picker {
    position: relative;
    display: block;
}

.year-picker::after {
    position: absolute;
    top: 50%;
    right: 13px;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--slate-500);
    border-bottom: 2px solid var(--slate-500);
    content: "";
    pointer-events: none;
    transform: translateY(-65%) rotate(45deg);
}

.year-picker select {
    appearance: none;
    -webkit-appearance: none;
    min-width: 126px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--slate-50);
    color: var(--slate-800);
    font-size: 14px;
    font-weight: 750;
    outline: none;
    text-align: center;
    text-align-last: center;
}

.year-picker select option {
    text-align: center;
}

.year-picker select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgb(37 99 235 / 12%);
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-top: 22px;
}

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

.asset-card {
    --asset-kpi-accent: var(--blue);
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 92px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    overflow: hidden;
    padding: 13px 15px 12px;
    border: 1px solid var(--slate-200);
    border-top: 4px solid var(--asset-kpi-accent);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--slate-900);
    text-align: left;
    box-shadow: var(--shadow-sm);
    transition: border-color 170ms ease, box-shadow 170ms ease, transform 170ms ease, background 170ms ease;
}

.asset-card::after {
    position: absolute;
    right: -27px;
    bottom: -42px;
    width: 104px;
    height: 104px;
    border: 20px solid var(--asset-kpi-accent);
    border-radius: 50%;
    content: "";
    opacity: .045;
    pointer-events: none;
}

button.asset-card:hover {
    border-color: var(--slate-300);
    border-top-color: var(--asset-kpi-accent);
    background: var(--slate-50);
    box-shadow: 0 10px 28px rgb(15 23 42 / 9%);
    transform: translateY(-2px);
}

button.asset-card:active {
    transform: translateY(0) scale(.99);
}

.asset-card-total {
    --asset-kpi-accent: var(--yellow);
    border-color: var(--slate-800);
    border-top-color: var(--asset-kpi-accent);
    background:
        radial-gradient(circle at 98% 0%, rgb(59 130 246 / 22%), transparent 8rem),
        var(--slate-950);
    color: var(--white);
}

.asset-card-cash {
    --asset-kpi-accent: #22c55e;
}

.asset-card-savings {
    --asset-kpi-accent: #3b82f6;
}

.asset-card-debt {
    --asset-kpi-accent: #ef4444;
}

.asset-label {
    position: relative;
    z-index: 1;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
    color: var(--slate-600);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .035em;
    line-height: 1.15;
    white-space: nowrap;
}

.asset-label-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.asset-icon-cash {
    color: #16a34a;
}

.asset-icon-savings {
    color: #2563eb;
}

.asset-icon-debt {
    color: #dc2626;
}

.asset-card-total .asset-label {
    color: #d6deee;
}

.asset-value {
    position: absolute;
    top: 50%;
    right: 15px;
    z-index: 1;
    display: block;
    width: calc(100% - 30px);
    overflow: hidden;
    font-size: clamp(20px, 2.4vw, 30px);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.055em;
    line-height: 1;
    text-align: right;
    text-overflow: clip;
    transform: translateY(-50%);
    white-space: nowrap;
}

.asset-card-total .asset-value {
    color: var(--yellow);
}

.asset-card-cash .asset-value {
    color: var(--green);
}

.asset-card-savings .asset-value {
    color: var(--blue);
}

.asset-card-debt .asset-value {
    color: var(--red);
}

.asset-note {
    position: absolute;
    right: 16px;
    bottom: 7px;
    color: var(--slate-400);
    font-size: 9px;
    font-weight: 650;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 170ms ease, transform 170ms ease;
}

.asset-card-total .asset-note {
    color: #98a4bd;
}

.asset-card:hover .asset-note,
.asset-card:focus-visible .asset-note {
    opacity: 1;
    transform: translateY(0);
}

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.dashboard-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 17px;
    border-bottom: 1px solid var(--slate-200);
    background: linear-gradient(180deg, var(--header-gradient-start), var(--header-gradient-end));
}

.card-header h2 {
    margin: 0;
    color: var(--slate-800);
    font-size: 14px;
    font-weight: 850;
    letter-spacing: .01em;
}

.card-caption {
    flex: 0 0 auto;
    color: var(--slate-500);
    font-size: 10px;
    font-weight: 700;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.cashflow-table,
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.cashflow-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 12px;
}

.cashflow-table th,
.cashflow-table td,
.detail-table th,
.detail-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--slate-100);
    text-align: left;
    white-space: nowrap;
}

.cashflow-table th,
.cashflow-table td {
    padding-right: 10px;
    padding-left: 10px;
}

.detail-table th,
.detail-table td {
    padding-right: 16px;
    padding-left: 16px;
}

.cashflow-table th:nth-child(1),
.cashflow-table td:nth-child(1) {
    width: 10%;
}

.cashflow-table th:nth-child(n + 2),
.cashflow-table td:nth-child(n + 2) {
    width: 22.5%;
}

.cashflow-table thead th,
.detail-table thead th {
    background: var(--slate-100);
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
}

.cashflow-table thead th {
    font-size: 12px;
    text-align: center !important;
}

.cashflow-table tbody th {
    color: var(--slate-700);
    font-weight: 850;
    text-align: center;
}

.cashflow-table tbody td.number-cell {
    letter-spacing: -.02em;
    padding-right: 12px;
    padding-left: 6px;
    text-align: right !important;
}

.cashflow-table tfoot {
    border-top: 2px solid var(--slate-300);
    background: var(--slate-100);
}

.cashflow-table tfoot th,
.cashflow-table tfoot td {
    color: var(--slate-800);
    font-weight: 900;
}

.cashflow-table tfoot th {
    text-align: center;
}

.cashflow-table tfoot td.number-cell {
    letter-spacing: -.025em;
    padding-right: 12px;
    padding-left: 6px;
    text-align: right !important;
}

.cashflow-table th:not(:last-child),
.cashflow-table td:not(:last-child) {
    border-right: 1px solid var(--table-divider);
}

.cashflow-table tbody tr:nth-child(even) {
    background: var(--slate-50);
}

.cashflow-table tbody tr:hover {
    background: var(--row-hover);
}

.cashflow-table td {
    color: var(--slate-700);
    font-variant-numeric: tabular-nums;
}

.cashflow-empty-row td {
    height: 112px;
    color: var(--slate-500);
    font-size: 12px;
    font-style: italic;
    font-weight: 650;
    text-align: center;
}

.expand-table-button {
    width: 100%;
    min-height: 40px;
    padding: 7px 12px;
    border-top: 1px solid var(--slate-100);
    background: var(--white);
    color: var(--slate-500);
    font-size: 10px;
    font-style: italic;
    font-weight: 700;
}

.expand-table-button:hover {
    background: var(--slate-50);
    color: var(--blue);
}

.number-cell {
    text-align: right !important;
}

.income-cell {
    color: var(--green) !important;
    font-weight: 750;
}

.expense-cell {
    color: var(--red) !important;
    font-weight: 750;
}

.balance-cell {
    color: var(--blue) !important;
    font-weight: 850;
}

.cashflow-table tbody td:nth-child(2),
.cashflow-table tfoot td:nth-child(2) {
    color: var(--blue) !important;
}

.cashflow-table tbody td:nth-child(3),
.cashflow-table tfoot td:nth-child(3) {
    color: var(--red) !important;
}

.cashflow-table tbody td:nth-child(4),
.cashflow-table tfoot td:nth-child(4) {
    color: var(--green) !important;
}

.cashflow-table tbody td:nth-child(5),
.cashflow-table tfoot td:nth-child(5) {
    color: var(--slate-950) !important;
}

.chart-card {
    display: flex;
    min-height: 340px;
    flex-direction: column;
}

.overview-chart {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    margin: 16px;
    padding: 13px 12px 8px;
    border: 1px dashed var(--slate-300);
    border-radius: 12px;
    background: var(--slate-50);
}

.chart-legend {
    display: flex;
    min-height: 22px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 18px;
}

.chart-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--slate-600);
    font-size: 10px;
    font-weight: 800;
}

.legend-bar {
    width: 10px;
    height: 10px;
    border-radius: 3px 3px 1px 1px;
    background: linear-gradient(180deg, var(--chart-income-start), var(--chart-income-end));
}

.legend-line {
    width: 16px;
    height: 0;
    border-top: 2px solid;
}

.legend-expense {
    border-color: var(--chart-expense);
    border-top-style: solid;
}

.legend-balance {
    border-color: var(--chart-balance);
}

.mixed-chart {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-grid-row line {
    stroke: var(--chart-grid);
    stroke-dasharray: 4 5;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.chart-grid-row text {
    fill: var(--slate-500);
    font-size: 13px;
    font-weight: 700;
    text-anchor: end;
}

.chart-zero-line {
    stroke: var(--chart-zero);
    stroke-width: 1.4;
    vector-effect: non-scaling-stroke;
}

.chart-income-bar {
    fill: url(#incomeBarGradient);
    opacity: .92;
}

#incomeBarGradient stop:first-child {
    stop-color: var(--chart-income-start);
}

#incomeBarGradient stop:last-child {
    stop-color: var(--chart-income-end);
}

.chart-income-bar:hover {
    opacity: 1;
}

.chart-series-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
    vector-effect: non-scaling-stroke;
}

.chart-expense-line {
    stroke: var(--chart-expense);
    stroke-dasharray: none;
}

.chart-balance-line {
    stroke: var(--chart-balance);
}

.chart-point {
    fill: var(--white);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.chart-expense-point {
    stroke: var(--chart-expense);
}

.chart-balance-point {
    stroke: var(--chart-balance);
}

.chart-month-label {
    fill: var(--slate-600);
    font-size: 14px;
    font-weight: 800;
    text-anchor: middle;
}

.module-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.module-header {
    display: flex;
    min-height: 100px;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 18px 20px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--module-header-glass);
    box-shadow: var(--shadow-sm);
}

.module-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 15px;
}

.module-heading h1 {
    margin: 0;
    color: var(--slate-950);
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 900;
    letter-spacing: -.045em;
    line-height: 1.1;
}

.module-heading .module-accent-title {
    color: #103e78;
    font-size: clamp(20px, 2.45vw, 30px);
    letter-spacing: -.025em;
    text-shadow: 0 2px 2px rgb(15 54 102 / 24%), 0 6px 14px rgb(15 54 102 / 16%);
    white-space: nowrap;
}

.page-number {
    display: block;
    margin-bottom: 2px;
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.period-picker {
    display: flex;
    flex: 0 0 auto;
    align-items: end;
    gap: 9px;
}

.period-picker label {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.period-picker label::after {
    position: absolute;
    right: 13px;
    bottom: 18px;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--slate-500);
    border-bottom: 2px solid var(--slate-500);
    content: "";
    pointer-events: none;
    transform: translateY(50%) rotate(45deg);
}

.period-picker label > span {
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.period-picker select {
    appearance: none;
    -webkit-appearance: none;
    min-width: 112px;
    min-height: 44px;
    padding: 0 30px;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
    color: var(--slate-800);
    font-size: 12px;
    font-weight: 750;
    outline: none;
    text-align: center;
    text-align-last: center;
}

.period-picker select option {
    text-align: center;
}

.period-picker select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgb(37 99 235 / 11%);
}

.transaction-period-picker {
    display: grid;
    width: min(100%, 390px);
    grid-template-columns: repeat(3, minmax(112px, 1fr));
    align-items: stretch;
}

.sales-period-picker {
    display: grid;
    width: min(100%, 520px);
    grid-template-columns: minmax(112px, 1fr) minmax(112px, 1fr) minmax(108px, .8fr) minmax(108px, .8fr);
    align-items: stretch;
}

body[data-can-write="false"] .sales-period-picker {
    width: min(100%, 430px);
    grid-template-columns: minmax(112px, 1fr) minmax(112px, 1fr) minmax(108px, .8fr);
}

.transaction-period-picker label::after,
.sales-period-picker label::after {
    top: 50%;
    bottom: auto;
    transform: translateY(-65%) rotate(45deg);
}

.transaction-summary-button {
    width: 100%;
    min-width: 112px;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid #93c5fd;
    border-radius: 10px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.15;
    white-space: nowrap;
    cursor: pointer;
}

.transaction-summary-button:hover {
    border-color: var(--blue);
    background: #dbeafe;
}

.transaction-summary-button:focus-visible {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgb(37 99 235 / 11%);
}

.transaction-summary-button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.module-header-actions,
.sales-header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: end;
    gap: 10px;
}

.sales-settings-button,
.warehouse-overview-button {
    display: inline-flex;
    width: 100%;
    min-width: 108px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #c4b5fd;
    border-radius: 10px;
    background: #f5f3ff;
    color: #6d28d9;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgb(15 23 42 / 4%);
    cursor: pointer;
}

.warehouse-overview-button {
    border-color: #67e8f9;
    background: #ecfeff;
    color: #0f766e;
}

.warehouse-overview-button:hover {
    border-color: #14b8a6;
    background: #ccfbf1;
    color: #0f766e;
}

.sales-settings-button:hover {
    border-color: #a78bfa;
    background: #faf5ff;
    color: #6d28d9;
}

.sales-settings-button:focus-visible,
.warehouse-overview-button:focus-visible {
    outline: 3px solid rgb(139 92 246 / 24%);
    outline-offset: 2px;
}

.warehouse-overview-button:focus-visible {
    outline-color: rgb(20 184 166 / 24%);
}

.sales-settings-button:disabled,
.warehouse-overview-button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.module-edit-icon-button {
    display: inline-flex;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
    color: var(--slate-700);
    box-shadow: 0 1px 2px rgb(15 23 42 / 4%);
}

.module-edit-icon-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.module-edit-icon-button:hover:not(:disabled) {
    border-color: #60a5fa;
    background: var(--blue-soft);
    color: var(--blue);
}

.module-edit-icon-button:focus-visible {
    outline: 3px solid rgb(59 130 246 / 24%);
    outline-offset: 2px;
}

.module-edit-icon-button:disabled {
    cursor: not-allowed;
    opacity: .44;
}

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

.summary-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 96px;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 14px 16px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.summary-card::after {
    position: absolute;
    right: -24px;
    bottom: -39px;
    width: 105px;
    height: 105px;
    border: 20px solid currentColor;
    border-radius: 50%;
    content: "";
    opacity: .045;
}

.summary-card span {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.summary-card span small {
    color: var(--slate-400);
    font-size: 8px;
    font-weight: 750;
    text-transform: none;
}

.sales-summary .summary-revenue > span,
.sales-summary .summary-salary > span {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 3px;
    white-space: nowrap;
}

#salesUnitPriceLabel,
#salaryRateLabel {
    margin: 0;
}

#salesUnitPriceLabel::before,
#salaryRateLabel::before {
    content: "– ";
}

.summary-card strong {
    position: absolute;
    z-index: 1;
    top: 50%;
    right: 16px;
    max-width: calc(100% - 32px);
    color: var(--slate-950);
    font-size: clamp(25px, 2.8vw, 35px);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.045em;
    text-align: right;
    transform: translateY(-50%);
    white-space: nowrap;
}

.summary-income {
    border-top: 4px solid #3b82f6;
    color: var(--blue);
}

.summary-income strong {
    color: var(--blue);
}

.summary-expense {
    border-top: 4px solid #ef4444;
    color: var(--red);
}

.summary-expense strong {
    color: var(--red);
}

.summary-balance {
    border-top: 4px solid #22c55e;
    color: var(--green);
}

.summary-balance strong {
    color: var(--green);
}

.summary-quantity {
    border-top: 4px solid #f59e0b;
    color: #b45309;
}

.summary-revenue {
    border-top: 4px solid #f97316;
    color: var(--orange);
}

.summary-revenue strong {
    color: var(--orange);
}

.summary-salary {
    border-top: 4px solid #8b5cf6;
    color: #6d28d9;
}

.summary-salary strong {
    color: #6d28d9;
}

.module-table-card {
    overflow: hidden;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.module-table-header {
    position: relative;
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--slate-200);
    background: linear-gradient(180deg, var(--white), var(--slate-50));
    text-align: center;
}

.module-table-header > div {
    display: flex;
    width: 100%;
    min-width: 0;
    flex-direction: column;
    align-items: center;
}

.module-table-header h2 {
    width: 100%;
    margin: 0;
    color: var(--slate-800);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: -.025em;
    text-align: center;
}

.record-count {
    display: inline-flex;
    min-height: 20px;
    align-items: center;
    align-self: flex-start;
    order: -1;
    margin: 0 0 3px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--slate-500);
    font-size: 10px;
    font-weight: 800;
}

.swipe-hint {
    margin-top: 4px;
    color: var(--slate-400);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.2;
}

.swipe-table-cell {
    width: 100% !important;
    overflow: hidden;
    padding: 0 !important;
    border-right: 0 !important;
}

.swipe-row-shell {
    position: relative;
    overflow: hidden;
    background: var(--slate-100);
}

.swipe-row-actions {
    position: absolute;
    z-index: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: grid;
    width: 96px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.swipe-row-actions.single-action {
    width: 48px;
    grid-template-columns: minmax(0, 1fr);
}

.swipe-row-shell.is-open .swipe-row-actions,
.swipe-row-shell.is-swiping .swipe-row-actions {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.swipe-action {
    display: grid;
    min-width: 0;
    min-height: 44px;
    place-items: center;
    padding: 0;
    color: #fff;
}

.swipe-action svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.swipe-action-edit {
    background: #2563eb;
}

.swipe-action-delete {
    background: #dc2626;
}

.swipe-action:hover,
.swipe-action:focus-visible {
    filter: brightness(1.08);
}

.swipe-row-content {
    position: relative;
    z-index: 1;
    display: grid;
    width: 100%;
    min-width: 0;
    background: var(--white);
    -webkit-touch-callout: none;
    touch-action: pan-y;
    transition: transform 190ms cubic-bezier(.2, .75, .25, 1);
    will-change: transform;
}

.swipe-row-content.is-swiping {
    cursor: grabbing;
    -webkit-user-select: none;
    user-select: none;
    transition: none;
}

.swipe-row-shell.is-open .swipe-row-content {
    transform: translateX(calc(-1 * var(--swipe-actions-width, 96px)));
}

.swipe-row-content:focus-visible {
    z-index: 2;
    outline: 3px solid rgb(59 130 246 / 32%);
    outline-offset: -3px;
}

.swipe-table-row:nth-child(even) .swipe-row-content {
    background: var(--slate-50);
}

.swipe-table-row:hover .swipe-row-content {
    background: var(--row-hover);
}

.transaction-swipe-grid {
    grid-template-columns: 140px 160px 180px minmax(0, 1fr);
}

.sales-swipe-grid {
    grid-template-columns: 16fr 36fr 17fr 31fr;
}

.swipe-data-cell {
    display: flex;
    min-width: 0;
    min-height: 51px;
    align-items: center;
    overflow: hidden;
    padding: 13px 16px;
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-700);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
}

.swipe-data-cell:not(:last-child) {
    border-right: 1px solid var(--module-divider);
}

.swipe-date-cell,
.swipe-classification-cell {
    justify-content: center;
    text-align: center;
}

.swipe-amount-cell,
.swipe-quantity-cell,
.swipe-total-cell {
    justify-content: flex-end;
    text-align: right;
    white-space: nowrap;
}

.swipe-note-cell,
.swipe-sale-id-cell {
    justify-content: flex-start;
    padding-right: 20px;
    padding-left: 20px;
    overflow-wrap: anywhere;
    text-align: left;
}

.table-edit-controls {
    position: absolute;
    z-index: 2;
    top: 11px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.table-edit-button {
    display: inline-flex;
    min-width: 52px;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #bfdbfe;
    border-radius: 9px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 10px;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
}

.table-edit-button:hover:not(:disabled) {
    border-color: #60a5fa;
    transform: translateY(-1px);
}

.table-edit-button:disabled {
    cursor: not-allowed;
    opacity: .44;
}

.table-edit-cancel {
    border-color: var(--slate-300);
    background: var(--slate-100);
    color: var(--slate-600);
}

.table-edit-save {
    border-color: #86efac;
    background: var(--green-soft);
    color: var(--green);
}

.inline-edit-row > td {
    width: auto !important;
    padding: 10px !important;
    border-right: 0 !important;
    background: color-mix(in srgb, var(--blue-soft) 42%, var(--white));
}

.record-edit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--slate-200);
    border-radius: 11px;
    background: var(--white);
    box-shadow: 0 4px 15px rgb(15 23 42 / 6%);
}

.record-edit-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .035em;
    text-align: left;
    text-transform: uppercase;
}

.record-edit-wide,
.record-edit-error {
    grid-column: 1 / -1;
}

.record-edit-input {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 7px 9px;
    border: 1px solid var(--slate-300);
    border-radius: 9px;
    background: var(--white);
    color: var(--slate-800);
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: none;
}

.record-edit-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 13%);
    outline: 0;
}

.record-edit-input[aria-invalid="true"] {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgb(220 38 38 / 12%);
}

.number-edit-input {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.record-edit-readonly {
    min-width: 0;
}

.record-edit-readonly output {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
    padding: 7px 9px;
    border: 1px dashed var(--slate-300);
    border-radius: 9px;
    background: var(--slate-50);
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
}

.record-edit-error {
    margin: 0;
    padding: 8px 9px;
    border-radius: 8px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 10px;
    font-weight: 750;
    line-height: 1.35;
    text-align: left;
}

.record-edit-actions {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
    gap: 7px;
}

.record-edit-actions button {
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid var(--slate-300);
    border-radius: 9px;
    font-size: 10px;
    font-weight: 850;
}

.record-edit-cancel {
    background: var(--slate-100);
    color: var(--slate-600);
}

.record-edit-save {
    border-color: #86efac !important;
    background: var(--green-soft);
    color: var(--green);
}

.module-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.mobile-date {
    display: none;
}

.transaction-page-table {
    min-width: 720px;
    table-layout: fixed;
}

.sales-page-table {
    min-width: 500px;
    table-layout: fixed;
}

.transaction-page-table th:nth-child(1),
.transaction-page-table td:nth-child(1) {
    width: 140px;
    text-align: center;
}

.transaction-page-table th:nth-child(2),
.transaction-page-table td:nth-child(2) {
    width: 160px;
    text-align: center;
}

.transaction-page-table th:nth-child(3),
.transaction-page-table td:nth-child(3) {
    width: 180px;
}

.transaction-page-table th:nth-child(4),
.transaction-page-table td:nth-child(4) {
    width: auto;
}

.transaction-page-table tbody td:nth-child(4),
.sales-page-table tbody td:nth-child(2) {
    padding-left: 20px;
    padding-right: 20px;
}

.sales-page-table th:nth-child(1),
.sales-page-table td:nth-child(1) {
    width: 16%;
    text-align: center;
}

.sales-page-table th:nth-child(2),
.sales-page-table td:nth-child(2) {
    width: 36%;
    text-align: left;
}

.sales-page-table th:nth-child(3),
.sales-page-table td:nth-child(3) {
    width: 17%;
}

.sales-page-table th:nth-child(4),
.sales-page-table td:nth-child(4) {
    width: 31%;
}

.transaction-page-table thead th,
.sales-page-table thead th {
    text-align: center !important;
}

.module-table th,
.module-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-700);
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.module-table th:not(:last-child),
.module-table td:not(:last-child) {
    border-right: 1px solid var(--module-divider);
}

.module-table thead th {
    background: var(--slate-100);
    color: var(--slate-600);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.module-table tbody tr:nth-child(even) {
    background: var(--slate-50);
}

.module-table tbody tr:hover {
    background: var(--row-hover);
}

.transaction-rollup-card {
    overflow: hidden;
}

.transaction-rollup-header,
.transaction-detail-header {
    min-height: 52px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.transaction-rollup-header h2,
.transaction-detail-header h2 {
    font-size: 17px;
}

.transaction-rollup-scroll {
    width: 100%;
    overflow-x: hidden;
}

.transaction-rollup-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 11px;
}

.transaction-classification-table th:nth-child(2),
.transaction-classification-table td:nth-child(2),
.transaction-classification-table th:nth-child(4),
.transaction-classification-table td:nth-child(4) {
    width: 170px;
}

.transaction-classification-table th:nth-child(2),
.transaction-classification-table td:nth-child(2) {
    border-right: 2px solid var(--slate-300);
}

.transaction-note-summary-table th:nth-child(2),
.transaction-note-summary-table td:nth-child(2),
.transaction-note-summary-table th:nth-child(3),
.transaction-note-summary-table td:nth-child(3) {
    width: 160px;
}

.transaction-rollup-table thead th {
    text-align: center !important;
}

.transaction-rollup-table tbody td,
.transaction-rollup-table tfoot th,
.transaction-rollup-table tfoot td {
    height: 38px;
    padding: 6px 9px;
    vertical-align: middle;
}

.transaction-note-summary-table tbody tr:not(.transaction-rollup-empty) td,
.transaction-note-summary-table tfoot th,
.transaction-note-summary-table tfoot td {
    height: 42px;
    line-height: 1.3;
}

.transaction-rollup-table tbody td.number-cell,
.transaction-rollup-table tfoot td.number-cell {
    letter-spacing: -.025em;
    white-space: nowrap;
}

.transaction-rollup-name-cell {
    text-align: center !important;
}

.transaction-classification-amount-cell {
    font-variant-numeric: tabular-nums;
}

.classification-zero-cell {
    color: var(--slate-500) !important;
    font-weight: 750;
}

.transaction-rollup-note-cell span {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--slate-800);
    font-weight: 750;
    overflow-wrap: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-rollup-table tfoot {
    border-top: 2px solid var(--slate-300);
    background: var(--slate-100);
}

.transaction-rollup-table tfoot th,
.transaction-rollup-table tfoot td {
    color: var(--slate-800);
    font-weight: 900;
}

.transaction-rollup-table tfoot th {
    text-align: center;
}

.transaction-rollup-empty td {
    height: 76px;
    padding: 16px !important;
    color: var(--slate-500) !important;
    font-style: italic;
    text-align: center !important;
}

.transaction-rollup-modal {
    display: flex;
    max-height: min(90vh, 760px);
    flex-direction: column;
    overflow: hidden;
}

.transaction-rollup-modal-body {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0;
    overscroll-behavior: contain;
}

.transaction-kind {
    display: inline-flex;
    width: 112px;
    max-width: 100%;
    min-height: 25px;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    box-sizing: border-box;
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--slate-700);
    font-size: 10px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.transaction-kind.kind-revenue {
    border: 1px solid #86efac;
    background: #dcfce7;
    color: #15803d;
}

.transaction-kind.kind-infrastructure {
    border: 1px solid #93c5fd;
    background: #dbeafe;
    color: #1d4ed8;
}

.transaction-kind.kind-operations {
    border: 1px solid #fdba74;
    background: #ffedd5;
    color: #c2410c;
}

.transaction-kind.kind-people {
    border: 1px solid #fca5a5;
    background: #fee2e2;
    color: #b91c1c;
}

.transaction-kind.kind-family {
    border: 1px solid #fde047;
    background: #fef9c3;
    color: #a16207;
}

.transaction-kind.kind-investment {
    border: 1px solid #d8b4fe;
    background: #f3e8ff;
    color: #7e22ce;
}

.transaction-kind.kind-contribution {
    border: 1px solid #cbd5e1;
    background: #e2e8f0;
    color: #475569;
}

.transaction-kind.kind-other {
    border: 1px solid #67e8f9;
    background: #cffafe;
    color: #0e7490;
}

.empty-table-cell {
    height: 180px;
    padding: 0 !important;
    color: var(--slate-500) !important;
    text-align: left !important;
}

.empty-table-content {
    position: sticky;
    left: 0;
    display: grid;
    width: min(100%, calc(100vw - 34px));
    min-height: 180px;
    place-items: center;
    padding: 20px;
    text-align: center;
}

.empty-table-content > span {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-table-content small {
    margin-top: 6px;
    color: var(--slate-400);
    font-size: 9px;
    font-weight: 700;
}

.text-action {
    margin-top: 10px;
    min-height: 44px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: var(--blue);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.text-action:hover {
    color: var(--blue-dark);
}

.summary-balance strong.negative-value {
    color: var(--green);
}

.formula-note {
    padding: 11px 16px;
    border-top: 1px solid var(--slate-100);
    background: #fffaf3;
    color: #9a5809;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

.finance-period-picker {
    display: grid;
    width: 132px;
    grid-template-columns: minmax(0, 1fr);
}

.finance-period-picker label::after {
    top: 50%;
    bottom: auto;
    transform: translateY(-65%) rotate(45deg);
}

.finance-period-picker select {
    width: 100%;
    min-width: 0;
}

.cf-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.cf-kpi-card {
    --cf-kpi-accent: var(--blue);
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 92px;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    overflow: hidden;
    padding: 13px 15px 12px;
    border: 1px solid var(--slate-200);
    border-top: 4px solid var(--cf-kpi-accent);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--cf-kpi-accent);
    box-shadow: var(--shadow-sm);
}

.cf-kpi-card::after {
    position: absolute;
    right: -27px;
    bottom: -42px;
    width: 104px;
    height: 104px;
    border: 20px solid currentColor;
    border-radius: 50%;
    content: "";
    opacity: .045;
}

.cf-kpi-card > span {
    position: relative;
    z-index: 1;
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-content: space-between;
    gap: 5px;
    color: var(--slate-600);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .035em;
    line-height: 1.15;
    text-transform: uppercase;
}

.cf-kpi-card > span small {
    min-width: 0;
    max-width: 62%;
    overflow: hidden;
    color: var(--cf-kpi-accent);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cf-kpi-card > strong {
    position: absolute;
    top: 50%;
    right: 15px;
    z-index: 1;
    display: block;
    width: calc(100% - 30px);
    overflow: hidden;
    color: var(--cf-kpi-accent);
    font-size: clamp(20px, 2.4vw, 30px);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.055em;
    line-height: 1;
    text-align: right;
    text-overflow: clip;
    transform: translateY(-50%);
    white-space: nowrap;
}

.cf-kpi-total {
    --cf-kpi-accent: var(--blue);
}

.cf-kpi-available {
    --cf-kpi-accent: var(--red);
}

.cf-kpi-deployed {
    --cf-kpi-accent: var(--cf-purple);
}

.cf-kpi-profit,
.cf-kpi-profit.is-positive,
.cf-kpi-profit.positive-value {
    --cf-kpi-accent: var(--green);
}

.cf-kpi-profit.is-negative,
.cf-kpi-profit.negative-value,
.cf-kpi-profit:has(> #cfProfitValue.negative-value) {
    --cf-kpi-accent: var(--red);
}

#cfProfitValue.negative-value {
    color: var(--red);
}

#cfProfitValue.positive-value {
    color: var(--green);
}

.cf-table-card {
    min-width: 0;
}

.cf-table-header {
    min-height: 54px;
    padding: 9px 14px;
}

.cf-table-header h2 {
    font-size: 16px;
}

.cf-crud-table-header {
    min-height: 70px;
}

.cf-table-scroll {
    width: 100%;
    overflow-x: hidden;
}

.cf-table {
    display: table;
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.cf-table th,
.cf-table td {
    min-width: 0;
    overflow: hidden;
    padding: 10px 12px;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
}

.cf-table .number-cell,
.cf-table td.number-cell {
    text-align: right;
}

.cf-allocation-table th:nth-child(1),
.cf-allocation-table td:nth-child(1) {
    width: 40%;
}

.cf-allocation-table th:nth-child(2),
.cf-allocation-table td:nth-child(2) {
    width: 38%;
    text-align: right;
    white-space: nowrap;
}

.cf-allocation-table th:nth-child(3),
.cf-allocation-table td:nth-child(3) {
    width: 22%;
    text-align: right;
    white-space: nowrap;
}

.cf-allocation-table thead th,
.cf-allocation-table thead th.number-cell {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .025em;
    text-align: center !important;
}

.cf-allocation-table td:first-child {
    text-align: center;
}

.cf-allocation-table .cf-kind-badge {
    width: 112px;
    max-width: 100%;
    min-height: 26px;
    box-sizing: border-box;
    padding: 4px 8px;
    font-size: 10px;
    white-space: nowrap;
}

.cf-performance-table th:nth-child(1),
.cf-performance-table td:nth-child(1) {
    width: 14%;
    text-align: center;
}

.cf-performance-table th:nth-child(2),
.cf-performance-table td:nth-child(2) {
    width: 30%;
    text-align: right;
    white-space: nowrap;
}

.cf-performance-table th:nth-child(3),
.cf-performance-table td:nth-child(3),
.cf-performance-table th:nth-child(4),
.cf-performance-table td:nth-child(4) {
    width: 28%;
    text-align: right;
    white-space: nowrap;
}

.cf-performance-table thead th,
.cf-performance-table thead th.number-cell {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .025em;
    text-align: center !important;
}

.cf-performance-table tfoot th,
.cf-performance-table tfoot td {
    border-top: 2px solid var(--slate-300);
    border-bottom: 0;
    background: var(--slate-100);
    color: var(--slate-800);
    font-weight: 900;
}

.cf-performance-table tbody td:nth-child(2),
.cf-performance-table tfoot td:nth-child(2) {
    color: var(--green);
}

.cf-performance-table tbody td:nth-child(3),
.cf-performance-table tfoot td:nth-child(3) {
    color: var(--red);
}

.cf-performance-table tbody td:nth-child(4),
.cf-performance-table tfoot td:nth-child(4) {
    color: var(--slate-950);
    font-weight: 850;
}

.cf-performance-table .cf-performance-empty td {
    width: 100%;
    height: 42px;
    padding: 10px 8px;
    color: var(--slate-500);
    font-size: 10px;
    font-weight: 750;
    text-align: center;
    white-space: normal;
}

.cf-position-table th:nth-child(1),
.cf-position-table td:nth-child(1) {
    width: 25%;
}

.cf-position-table th:nth-child(2),
.cf-position-table td:nth-child(2) {
    width: 27%;
}

.cf-position-table th:nth-child(3),
.cf-position-table td:nth-child(3),
.cf-position-table th:nth-child(4),
.cf-position-table td:nth-child(4) {
    width: 24%;
    text-align: right;
    white-space: nowrap;
}

.cf-transaction-table th:nth-child(1),
.cf-transaction-table td:nth-child(1) {
    width: 19%;
    text-align: center;
}

.cf-transaction-table th:nth-child(2),
.cf-transaction-table td:nth-child(2) {
    width: 25%;
    text-align: center;
}

.cf-transaction-table th:nth-child(3),
.cf-transaction-table td:nth-child(3) {
    width: 27%;
}

.cf-transaction-table th:nth-child(4),
.cf-transaction-table td:nth-child(4) {
    width: 29%;
    text-align: right;
    white-space: nowrap;
}

.cf-position-swipe-grid {
    grid-template-columns: 25fr 27fr 24fr 24fr;
}

.cf-transaction-swipe-grid {
    grid-template-columns: 19fr 25fr 27fr 29fr;
}

.cf-position-table thead th,
.cf-position-table thead th.number-cell,
.cf-transaction-table thead th,
.cf-transaction-table thead th.number-cell {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .025em;
    text-align: center !important;
}

.cf-position-swipe-grid .swipe-data-cell:nth-child(n + 3),
.cf-transaction-swipe-grid .swipe-data-cell:nth-child(4) {
    justify-content: flex-end;
    text-align: right;
    white-space: nowrap;
}

.cf-transaction-swipe-grid .swipe-data-cell:first-child,
.cf-transaction-swipe-grid .swipe-data-cell:nth-child(2) {
    justify-content: center;
    text-align: center;
}

.cf-position-swipe-grid .swipe-data-cell:first-child {
    justify-content: center;
    text-align: center;
}

.cf-position-table .cf-kind-badge {
    width: 78px;
    max-width: 100%;
    min-height: 24px;
    box-sizing: border-box;
    padding: 3px 4px;
    font-size: 9.5px;
    white-space: nowrap;
}

.cf-transaction-table .cf-transaction-badge {
    width: 88px;
    max-width: 100%;
    min-height: 24px;
    box-sizing: border-box;
    padding: 3px 4px;
    font-size: 9.5px;
    white-space: nowrap;
}

.cf-kind-badge,
.cf-type-badge,
.cf-transaction-badge {
    display: inline-flex;
    max-width: 100%;
    min-height: 22px;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    border: 1px solid var(--slate-300);
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--slate-700);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
}

.cf-kind-loan,
[data-cf-kind="loan"] {
    border-color: #93c5fd;
    background: var(--blue-soft);
    color: var(--blue);
}

.cf-kind-available {
    border-color: #67e8f9;
    background: #ecfeff;
    color: #0e7490;
}

.cf-kind-savings,
[data-cf-kind="savings"] {
    border-color: #86efac;
    background: var(--green-soft);
    color: var(--green);
}

.cf-kind-investment,
[data-cf-kind="investment"] {
    border-color: #fdba74;
    background: var(--orange-soft);
    color: var(--orange);
}

.cf-kind-securities,
[data-cf-kind="securities"] {
    border-color: #c4b5fd;
    background: var(--cf-purple-soft);
    color: var(--cf-purple);
}

.cf-type-profit,
[data-cf-type="profit"] {
    border-color: #86efac;
    background: var(--green-soft);
    color: var(--green);
}

.cf-type-loss,
[data-cf-type="loss"] {
    border-color: #fda4af;
    background: var(--red-soft);
    color: var(--red);
}

.cf-type-fee,
[data-cf-type="fee"] {
    border-color: #fdba74;
    background: var(--orange-soft);
    color: var(--orange);
}

.cf-type-capital-add,
.cf-type-capital_add,
[data-cf-type="capital_add"] {
    border-color: #93c5fd;
    background: var(--blue-soft);
    color: var(--blue);
}

.cf-type-capital-withdraw,
.cf-type-capital_withdraw,
[data-cf-type="capital_withdraw"] {
    border-color: #c4b5fd;
    background: var(--cf-purple-soft);
    color: var(--cf-purple);
}

.cf-position-kind-cell,
.cf-transaction-type-cell {
    justify-content: center;
    text-align: center;
}

.cf-position-name-cell {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
}

.cf-position-name-cell strong,
.cf-position-name-cell small,
.cf-transaction-note-cell {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cf-position-name-cell small {
    color: var(--slate-400);
    font-size: 8px;
    font-weight: 700;
}

.modal-panel.cf-entry-modal {
    display: grid;
    width: min(100%, 680px);
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.cf-entry-form {
    display: grid;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
}

.cf-entry-form .modal-body {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.cf-entry-form .form-grid input,
.cf-entry-form .form-grid select,
.cf-entry-form .date-control-shell,
.cf-entry-form .money-field,
.cf-entry-form .percent-field {
    height: var(--popup-control-height);
    min-height: var(--popup-control-height);
    max-height: var(--popup-control-height);
    box-sizing: border-box;
}

.cf-entry-form .money-field input,
.cf-entry-form .percent-field input,
.cf-entry-form .date-control-shell > input[type="date"] {
    height: var(--popup-control-content-height);
    min-height: var(--popup-control-content-height);
    max-height: var(--popup-control-content-height);
    border: 0;
    box-shadow: none;
}

.cf-entry-form .money-field input {
    min-width: 0;
    font-size: 16px;
}

.cf-entry-form .percent-field input {
    min-width: 0;
    font-size: 16px;
}

.cf-entry-form .modal-footer {
    position: static;
}

.cf-entry-form .modal-footer button {
    min-height: 48px;
}

.fab-wrap {
    position: fixed;
    z-index: 60;
    right: max(18px, calc((100vw - 1200px) / 2 + 24px));
    bottom: calc(var(--nav-height) + 14px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.fab-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 12px;
}

.fab-menu button {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 11px;
    padding: 6px 8px 6px 16px;
    border: 1px solid var(--slate-200);
    border-radius: 999px;
    background: var(--white);
    color: var(--slate-800);
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 12px 30px rgb(15 23 42 / 16%);
}

.fab-menu button:hover {
    background: var(--slate-50);
}

.fab-menu-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: var(--white);
    font-size: 16px;
}

.fab-menu-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fab-menu-icon-money {
    background: #2563eb;
}

.fab-menu-icon-sale {
    background: var(--orange);
}

.fab-menu-icon-saving {
    background: #059669;
}

.fab-menu-icon-debt {
    background: #7c3aed;
}

.fab-menu-icon-cf-position {
    background: var(--cf-purple);
}

.fab-menu-icon-cf-transaction {
    background: #0f766e;
}

.fab-button {
    display: flex;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 4px solid var(--slate-100);
    border-radius: 50%;
    background: var(--slate-950);
    color: var(--white);
    font-size: 30px;
    font-weight: 500;
    line-height: 1;
    box-shadow: 0 15px 34px rgb(15 23 42 / 28%);
}

.fab-button > span {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transform: translateY(-1px);
}

.fab-button:hover {
    background: #24314c;
}

.fab-button.is-open {
    background: #334155;
}

.bottom-nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: var(--nav-height);
    border-top: 1px solid var(--slate-200);
    background: var(--footer-glass);
    box-shadow: 0 -12px 30px rgb(15 23 42 / 8%);
    backdrop-filter: blur(16px);
}

.bottom-nav-inner {
    display: grid;
    width: min(100%, 1200px);
    min-height: var(--nav-height);
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0 auto;
}

.bottom-nav-inner.is-home-page {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.infrastructure-placeholder-card {
    display: grid;
    min-height: 280px;
    place-content: center;
    justify-items: center;
    gap: 8px;
    padding: 34px 20px;
    text-align: center;
}

.infrastructure-placeholder-icon {
    position: relative;
    width: 58px;
    height: 52px;
    margin-bottom: 4px;
    border: 2px solid #2dd4bf;
    border-radius: 15px;
    background: #ecfdfb;
    box-shadow: 0 8px 22px rgb(13 148 136 / 14%);
}

.infrastructure-placeholder-icon::before,
.infrastructure-placeholder-icon::after {
    position: absolute;
    right: 9px;
    left: 9px;
    height: 7px;
    border: 2px solid #0f766e;
    border-radius: 999px;
    content: "";
}

.infrastructure-placeholder-icon::before {
    top: 11px;
}

.infrastructure-placeholder-icon::after {
    bottom: 11px;
}

.infrastructure-placeholder-card h2 {
    margin: 0;
    color: var(--slate-800);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: .02em;
}

.infrastructure-placeholder-card p {
    max-width: 410px;
    margin: 0;
    color: var(--slate-500);
    font-size: 13px;
    font-weight: 650;
}

.infrastructure-placeholder-status {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    margin-top: 5px;
    padding: 0 11px;
    border: 1px solid #99f6e4;
    border-radius: 999px;
    background: #f0fdfa;
    color: #0f766e;
    font-size: 11px;
    font-weight: 850;
}

.warehouse-overview-modal {
    display: grid;
    width: min(100%, 980px);
    max-height: min(92vh, 820px);
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
}

.warehouse-overview-header {
    position: static;
}

.warehouse-overview-header > div {
    min-width: 0;
}

.warehouse-overview-title-row {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
}

.warehouse-overview-header h2 {
    flex: 0 0 auto;
    font-size: 20px;
    font-weight: 950;
    letter-spacing: .01em;
}

.warehouse-overview-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    padding: 12px 16px;
    border-bottom: 1px solid var(--slate-200);
    background: var(--slate-50);
}

.warehouse-toolbar-button {
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid #99f6e4;
    border-radius: 11px;
    background: var(--white);
    color: #0f766e;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
    cursor: pointer;
}

.warehouse-toolbar-primary {
    border-color: #14b8a6;
    background: #0f766e;
    color: #fff;
}

.warehouse-toolbar-button:hover:not(:disabled) {
    border-color: #14b8a6;
    background: #ccfbf1;
}

.warehouse-toolbar-primary:hover:not(:disabled) {
    background: #115e59;
    color: #fff;
}

.warehouse-toolbar-button:focus-visible {
    outline: 3px solid rgb(20 184 166 / 22%);
    outline-offset: 2px;
}

.warehouse-toolbar-button:disabled {
    cursor: not-allowed;
    opacity: .48;
}

.warehouse-overview-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.warehouse-swipe-hint {
    margin: 0 0 9px;
    color: var(--slate-500);
    font-size: 10px;
    font-weight: 750;
}

.module-summary.warehouse-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr)) clamp(72px, 9vw, 88px);
    gap: 8px;
}

body[data-can-write="false"] .module-summary.warehouse-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.warehouse-summary-add {
    width: 100%;
    min-height: 72px;
    padding: 0 5px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.warehouse-summary .summary-card {
    min-height: 72px;
    padding: 10px 12px;
    border-radius: 12px;
}

.warehouse-summary .summary-card span {
    font-size: 9px;
}

.warehouse-summary .summary-card strong {
    right: 12px;
    max-width: calc(100% - 24px);
    font-size: clamp(21px, 2.5vw, 29px);
}

.warehouse-updated-label {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.12;
    text-align: left;
    white-space: pre-line;
}

.warehouse-summary-pcs {
    border-color: #93c5fd;
}

.warehouse-summary-pcs strong {
    color: var(--blue);
}

.warehouse-summary-compartments {
    border-color: #fdba74;
}

.warehouse-summary-compartments strong {
    color: var(--orange);
}

.warehouse-summary-total {
    border-color: #86efac;
}

.warehouse-summary-total strong {
    color: var(--green);
}

.warehouse-pc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 10px;
}

.warehouse-pc-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.warehouse-pc-header-shell {
    min-width: 0;
    overflow: hidden;
}

.warehouse-pc-card-header {
    display: grid;
    min-height: 60px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(135deg, var(--white), var(--blue-soft));
}

.warehouse-pc-header-meta {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
}

.warehouse-pc-header-meta {
    gap: 6px;
}

.warehouse-pc-title-wrap {
    min-width: 0;
}

.warehouse-pc-title-wrap h2 {
    overflow: hidden;
    margin: 0;
    color: var(--slate-900);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.warehouse-pc-title-wrap small {
    display: block;
    margin-top: 2px;
    color: var(--slate-500);
    font-size: 10px;
    font-weight: 750;
}

.warehouse-pc-total {
    display: grid;
    width: 96px;
    min-width: 72px;
    min-height: 38px;
    align-content: center;
    justify-items: end;
    padding: 4px 8px;
    border: 1px solid #86efac;
    border-radius: 11px;
    background: var(--green-soft);
}

.warehouse-pc-total small {
    color: var(--slate-500);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .07em;
    line-height: 1;
    text-transform: uppercase;
}

.warehouse-pc-total strong {
    max-width: 100%;
    overflow: hidden;
    color: var(--green);
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.warehouse-compartment-swipe-grid {
    display: grid;
    grid-template-columns: minmax(0, 58fr) minmax(92px, 42fr);
    align-items: center;
}

.warehouse-compartment-table-head {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    margin: -1px;
    white-space: nowrap;
}

.warehouse-compartment-swipe-grid > * {
    min-width: 0;
    padding: 0 14px;
}

.warehouse-compartment-table-body {
    border-top: 1px solid var(--slate-200);
}

.warehouse-compartment-row + .warehouse-compartment-row {
    border-top: 1px solid var(--slate-200);
}

.warehouse-compartment-swipe-grid {
    min-height: 44px;
}

.warehouse-compartment-row:nth-child(even) .warehouse-compartment-swipe-grid {
    background: var(--slate-50);
}

.warehouse-compartment-name {
    overflow: hidden;
    color: var(--slate-800);
    font-size: 13px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.warehouse-compartment-quantity {
    overflow: hidden;
    border-left: 1px solid var(--slate-200);
    color: var(--slate-900);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    font-weight: 850;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.warehouse-empty-card {
    display: grid;
    min-height: 230px;
    grid-column: 1 / -1;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 24px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--slate-500);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.warehouse-overview-modal .warehouse-empty-card {
    min-height: 190px;
}

.warehouse-empty-card svg {
    width: 38px;
    height: 38px;
    stroke: var(--blue);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.warehouse-empty-card strong {
    color: var(--slate-800);
    font-size: 15px;
}

.warehouse-empty-card small {
    font-size: 10px;
    font-weight: 700;
}

.fab-menu-icon-warehouse-pc,
.fab-menu-icon-warehouse-compartment {
    background: #ecfeff;
    color: #0f766e;
}

.warehouse-entry-modal {
    width: min(100%, 520px);
}

.warehouse-entry-form .modal-body {
    min-width: 0;
}

.warehouse-compartment-builder {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.warehouse-compartment-builder legend {
    margin-bottom: 7px;
    color: var(--slate-700);
    font-size: 11px;
    font-weight: 850;
}

.warehouse-builder-header,
.warehouse-builder-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(112px, .85fr) 34px;
    gap: 8px;
    align-items: center;
}

.warehouse-builder-header {
    margin-bottom: 5px;
    padding: 0 2px;
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.warehouse-builder-row + .warehouse-builder-row {
    margin-top: 8px;
}

.warehouse-builder-row label {
    display: block;
    min-width: 0;
}

.warehouse-builder-row input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
    color: var(--slate-900);
    font-size: 16px;
    outline: none;
}

.warehouse-builder-row input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgb(37 99 235 / 11%);
}

.warehouse-remove-row-button {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 1px solid #fecaca;
    border-radius: 50%;
    background: #fff1f2;
    color: #dc2626;
    font-size: 18px;
    line-height: 1;
}

.warehouse-remove-row-button:disabled {
    border-color: var(--slate-200);
    background: var(--slate-100);
    color: var(--slate-400);
    cursor: not-allowed;
}

.warehouse-add-row-button {
    width: 100%;
    min-height: 42px;
    margin-top: 10px;
}

.warehouse-save-button {
    background: #0f766e;
}

.bottom-nav button {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: var(--nav-height);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-right: 1px solid var(--slate-200);
    background: transparent;
    color: var(--slate-500);
    font-size: 11px;
    font-weight: 800;
    transition: color 160ms ease, background 160ms ease;
}

.bottom-nav button[hidden] {
    display: none;
}

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

.bottom-nav button:first-child {
    border-left: 1px solid var(--slate-200);
}

.bottom-nav button:hover {
    background: var(--slate-50);
    color: var(--slate-800);
}

.bottom-nav button.is-active {
    color: var(--blue);
}

.bottom-nav button.is-active::before {
    position: absolute;
    top: 0;
    width: 34px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: currentColor;
    content: "";
}

.nav-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-infrastructure-icon {
    position: relative;
    border: 1.8px solid currentColor;
    border-radius: 4px;
}

.nav-infrastructure-icon::before,
.nav-infrastructure-icon::after {
    position: absolute;
    right: 3px;
    left: 3px;
    height: 1.8px;
    border-radius: 999px;
    background: currentColor;
    content: "";
}

.nav-infrastructure-icon::before {
    top: 5px;
}

.nav-infrastructure-icon::after {
    bottom: 5px;
}

.modal-layer {
    position: fixed;
    z-index: 170;
    inset: 0;
    display: grid;
    overflow: auto;
    place-items: center;
    padding: 22px;
    background: var(--modal-overlay);
    opacity: 1;
}

.modal-layer.is-open {
    opacity: 1;
}

.modal-panel {
    width: min(100%, 680px);
    max-height: calc(100vh - 44px);
    overflow: auto;
    border: 1px solid var(--modal-border);
    border-radius: 18px;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    opacity: 1;
    transform: none;
}

.modal-panel:focus {
    outline: none;
}

.modal-layer.is-open .modal-panel {
    opacity: 1;
    transform: none;
}

.modal-small {
    width: min(100%, 460px);
}

.modal-medium {
    width: min(100%, 650px);
}

.modal-large {
    width: min(100%, 880px);
}

.modal-form {
    width: min(100%, 560px);
}

.modal-header {
    position: sticky;
    z-index: 3;
    top: 0;
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 16px 13px 19px;
    border-bottom: 1px solid var(--slate-200);
    background: var(--modal-header-glass);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.modal-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.modal-header h2 {
    margin: 0;
    color: var(--slate-800);
    font-size: 18px;
    font-weight: 850;
    letter-spacing: -.02em;
}

#modal-savings .modal-header h2 {
    font-size: 20px;
}

.modal-close {
    display: grid;
    position: relative;
    isolation: isolate;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    flex: 0 0 44px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--modal-close-foreground);
    box-shadow: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0;
    font-weight: 500;
    line-height: 0;
    opacity: 1;
    transform: none;
    transition: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.modal-close::before,
.modal-close::after {
    position: absolute;
    display: block;
    content: "";
    pointer-events: none;
}

.modal-close::before {
    inset: 7px;
    z-index: 0;
    border: 1px solid var(--modal-close-border);
    border-radius: 50%;
    background: linear-gradient(180deg, var(--modal-close-background-start), var(--modal-close-background-end));
    box-shadow: var(--modal-close-shadow);
}

.modal-close::after {
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    content: "×";
    color: var(--modal-close-foreground);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
}

.modal-close:hover,
.modal-close:active {
    border: 0;
    background: transparent;
    color: var(--modal-close-foreground);
    box-shadow: none;
    opacity: 1;
    transform: none;
}

.modal-close:focus-visible {
    outline: 0;
}

.modal-close:focus-visible::before {
    border-color: var(--modal-close-focus);
}

.modal-body {
    padding: 18px;
}

.modal-table-wrap {
    overflow-x: auto;
}

.detail-list {
    display: flex;
    flex-direction: column;
}

.detail-row {
    display: flex;
    min-height: 51px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--slate-100);
}

.detail-row span {
    color: var(--slate-700);
    font-size: 13px;
    font-weight: 650;
}

.detail-row strong,
.detail-total strong {
    color: var(--green);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.detail-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 0 5px;
}

.detail-total span {
    color: var(--slate-800);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.detail-total strong {
    color: var(--slate-950);
    font-size: 19px;
}

.add-outline-button {
    width: 100%;
    min-height: 46px;
    margin-top: 14px;
    border: 1px dashed var(--slate-300);
    border-radius: 10px;
    background: var(--slate-50);
    color: var(--slate-600);
    font-size: 13px;
    font-weight: 800;
}

.add-outline-button:hover {
    border-color: #60a5fa;
    background: #eff6ff;
    color: var(--blue);
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    background: var(--slate-50);
}

.inline-form .form-actions {
    grid-column: 1 / -1;
}

.detail-table {
    min-width: 560px;
    font-size: 12px;
}

.debt-table {
    min-width: 760px;
}

.detail-table td {
    color: var(--slate-700);
    font-variant-numeric: tabular-nums;
}

.detail-table tbody tr:hover {
    background: var(--slate-50);
}

.asset-detail-body {
    padding: 0;
    overflow-x: hidden;
}

.asset-table-hint {
    display: block;
    padding: 9px 14px;
    border-bottom: 1px solid var(--slate-200);
    background: var(--slate-50);
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 750;
    text-align: center;
}

.asset-detail-table-scroll {
    width: 100%;
    overflow: hidden;
}

.cash-detail-modal {
    display: flex;
    max-height: min(90vh, 760px);
    flex-direction: column;
    overflow: hidden;
}

.cash-detail-body {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0;
    overscroll-behavior: contain;
}

.cash-period-section {
    padding: 16px 18px 0;
}

.cash-period-section .detail-row span,
.cash-period-section .detail-row strong {
    color: var(--slate-950);
}

.cash-period-section .detail-row {
    min-height: 43px;
}

.cash-closing-total {
    margin-top: 14px;
    padding: 15px 18px 11px;
}

.cash-closing-total span {
    color: var(--green);
    font-size: 14px;
}

.cash-closing-total strong {
    color: var(--green);
    font-size: 21px;
    white-space: nowrap;
}

.cash-bank-section {
    border-top: 8px solid var(--slate-100);
}

.cash-bank-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px 10px;
}

.cash-bank-header > div {
    min-width: 0;
    flex: 1 1 auto;
}

.cash-bank-header h3 {
    margin: 0;
    color: var(--slate-800);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -.01em;
    text-transform: uppercase;
}

.cash-bank-header small {
    display: block;
    margin-top: 2px;
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 750;
}

.cash-bank-add {
    width: auto;
    min-height: 36px;
    flex: 0 0 auto;
    margin-top: 0;
    padding: 0 12px;
    white-space: nowrap;
}

.cash-bank-hint,
.cash-bank-warning {
    margin: 0;
    padding: 8px 18px;
    border-top: 1px solid var(--slate-100);
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.45;
}

.cash-bank-warning {
    border-top-color: #fed7aa;
    background: #fff7ed;
    color: #c2410c;
}

.cash-bank-table th:nth-child(1) { width: 55%; }
.cash-bank-table th:nth-child(2) { width: 45%; }

.cash-bank-swipe-grid {
    grid-template-columns: 55fr 45fr;
}

.cash-bank-table .swipe-data-cell,
.cash-bank-primary-row td {
    min-height: 48px;
    padding: 9px 12px;
    font-size: 11px;
}

.cash-bank-primary-row td {
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-700);
    font-variant-numeric: tabular-nums;
}

.cash-bank-primary-row td:last-child,
.cash-bank-amount-cell {
    text-align: right;
    white-space: nowrap;
}

.cash-bank-name,
.cash-bank-name-cell {
    overflow: hidden;
    color: var(--slate-800);
    font-weight: 850;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cash-bank-name-cell {
    justify-content: flex-start;
}

.cash-bank-amount-cell {
    justify-content: flex-end;
}

.cash-bank-lock {
    display: block;
    margin-top: 2px;
    color: var(--slate-500);
    font-size: 8px;
    font-weight: 700;
}

.asset-detail-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 11px;
}

.asset-detail-table thead th {
    text-align: center !important;
}

.savings-detail-table th:nth-child(1) { width: 25%; }
.savings-detail-table th:nth-child(2) { width: 18%; }
.savings-detail-table th:nth-child(3) { width: 21%; }
.savings-detail-table th:nth-child(4) { width: 36%; }

.debt-detail-table th:nth-child(1) { width: 17%; }
.debt-detail-table th:nth-child(2) { width: 17%; }
.debt-detail-table th:nth-child(3) { width: 18%; }
.debt-detail-table th:nth-child(4) { width: 20%; }
.debt-detail-table th:nth-child(5) { width: 8%; }
.debt-detail-table th:nth-child(6) { width: 20%; }

.saving-swipe-grid {
    grid-template-columns: 25fr 18fr 21fr 36fr;
}

.debt-swipe-grid {
    grid-template-columns: 17fr 17fr 18fr 20fr 8fr 20fr;
}

.asset-detail-table .swipe-data-cell {
    min-height: 48px;
    padding: 9px 8px;
    font-size: 11px;
}

.asset-detail-table .swipe-date-cell,
.swipe-term-cell,
.swipe-rate-cell {
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.swipe-saving-amount-cell,
.swipe-principal-cell,
.swipe-debt-total-cell {
    justify-content: flex-end;
    text-align: right;
    white-space: nowrap;
}

.swipe-debt-note-cell {
    justify-content: flex-start;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-detail-total {
    min-height: 56px;
    padding: 12px 18px;
    border-top: 1px solid var(--slate-200);
    background: var(--slate-50);
}

.asset-detail-empty td {
    height: 104px;
    padding: 18px !important;
    color: var(--slate-500);
    font-style: italic;
    text-align: center;
    white-space: normal;
}

.asset-entry-form .modal-body {
    min-width: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-grid label,
.form-grid .field-group,
.inline-form label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.form-grid label > span,
.form-grid .field-group > span,
.inline-form label > span,
.type-toggle legend {
    color: var(--slate-700);
    font-size: 11px;
    font-weight: 800;
}

.field-full {
    grid-column: 1 / -1;
}

.form-grid input,
.form-grid select,
.inline-form input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
    outline: none;
}

.date-control-shell {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    overflow: hidden;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
    box-sizing: border-box;
    color: var(--slate-900);
    font-size: 16px;
    font-weight: 400;
    line-height: normal;
}

.form-grid label > .date-control-shell {
    color: var(--slate-900);
    font-size: 16px;
    font-weight: 400;
}

.date-control-shell::after {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 20px;
    height: 20px;
    background: center / 20px 20px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M16 3v4M8 3v4M3 10h18'/%3E%3C/svg%3E");
    content: "";
    pointer-events: none;
    transform: translateY(-50%);
}

.date-control-shell > input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
    color: var(--slate-900);
    font: inherit;
    outline: none;
    text-indent: 6px;
}

.date-control-shell > input[type="date"]::-webkit-date-and-time-value {
    height: 1.5em;
    min-height: 1.5em;
    margin: 0;
    padding: 0;
    align-self: center;
    line-height: 1.5;
    text-align: left;
}

.date-control-shell > input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.form-grid input:focus,
.form-grid select:focus,
.inline-form input:focus,
.date-control-shell:focus-within,
.money-field:focus-within,
.percent-field:focus-within,
.settings-threshold-control:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgb(37 99 235 / 11%);
}

.classification-select-shell {
    position: relative;
    width: 100%;
    min-width: 0;
}

.classification-select-shell > select {
    pointer-events: none;
}

.classification-select-trigger {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

.classification-select-trigger:focus-visible {
    outline: 3px solid rgb(37 99 235 / 36%);
    outline-offset: 2px;
}

.classification-select-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    display: grid;
    width: 100%;
    max-height: var(--classification-menu-max-height, 152px);
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid var(--slate-300);
    border-radius: 12px;
    background: var(--white);
    box-shadow: 0 8px 20px rgb(15 23 42 / 14%);
    overscroll-behavior: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.classification-select-menu::-webkit-scrollbar {
    display: none;
}

.classification-select-menu.opens-upward {
    top: auto;
    bottom: calc(100% + 6px);
}

.classification-select-menu > button {
    position: relative;
    display: grid;
    width: 100%;
    min-height: 44px;
    grid-template-columns: 9px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 8px;
    padding: 0 9px;
    border-radius: 8px;
    background: transparent;
    color: var(--slate-800);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    transition: none;
    -webkit-tap-highlight-color: transparent;
}

.classification-select-menu > button::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--slate-400);
    content: "";
}

.classification-select-menu > button::after {
    color: var(--blue);
    content: "✓";
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    opacity: 0;
    text-align: center;
}

.classification-select-menu > button[data-classification-option="Doanh thu"]::before { background: #16a34a; }
.classification-select-menu > button[data-classification-option="Hạ Tầng"]::before { background: #2563eb; }
.classification-select-menu > button[data-classification-option="Hoạt Động"]::before { background: #ea580c; }
.classification-select-menu > button[data-classification-option="Nhân Sự"]::before { background: #dc2626; }
.classification-select-menu > button[data-classification-option="Gia Đình"]::before { background: #eab308; }
.classification-select-menu > button[data-classification-option="Đầu tư"]::before { background: #7c3aed; }
.classification-select-menu > button[data-classification-option="Vay/góp"]::before { background: #64748b; }
.classification-select-menu > button[data-classification-option="Khác"]::before { background: #0f766e; }

.classification-select-menu > button[aria-selected="true"] {
    background: var(--blue-soft);
    color: var(--blue);
}

.classification-select-menu > button[aria-selected="true"]::after {
    opacity: 1;
}

.classification-select-menu > button:focus-visible {
    outline: 2px solid rgb(37 99 235 / 42%);
    outline-offset: -2px;
}

.money-field {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
}

.money-field input {
    border: 0;
    box-shadow: none !important;
    font-size: 19px;
    font-weight: 800;
}

.money-field b {
    padding-right: 13px;
    color: var(--slate-500);
}

.percent-field {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
}

.percent-field input {
    border: 0;
    box-shadow: none !important;
}

.percent-field b {
    padding-right: 13px;
    color: var(--slate-500);
}

.settings-effective-note {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #ddd6fe;
    border-radius: 11px;
    background: #f5f3ff;
}

.settings-effective-note span {
    color: #7c3aed;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.settings-effective-note strong {
    color: #5b21b6;
    font-size: 12px;
    text-align: right;
}

.settings-effective-note small {
    grid-column: 1 / -1;
    color: var(--slate-500);
    font-size: 10px;
    line-height: 1.45;
}

.settings-form-grid {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 14px;
}

.settings-tiers-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

#modal-sales-settings .modal-header > div {
    min-width: 0;
    flex: 1 1 auto;
}

#modal-sales-settings .modal-header h2 {
    white-space: nowrap;
}

.settings-tier-columns,
.settings-tier-row,
.settings-bottom-row {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
}

.settings-tier-columns {
    margin-bottom: 6px;
    padding: 0 1px;
    color: var(--slate-600);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.settings-tier-columns span:nth-child(-n + 2) {
    text-align: left;
}

.settings-tier-rows {
    display: grid;
    gap: 7px;
}

.settings-tier-row {
    position: relative;
    min-height: 44px;
}

.settings-tier-row label {
    display: block;
    min-width: 0;
}

.settings-threshold-control {
    display: flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
}

.settings-threshold-control > b {
    flex: 0 0 auto;
    margin-right: 6px;
    padding: 0;
    color: var(--slate-500);
    font-size: 10px;
    font-weight: 850;
    white-space: nowrap;
}

.settings-threshold-control input {
    width: auto;
    min-width: 9px;
    max-width: calc(100% - 30px);
    flex: 0 1 auto;
    padding-right: 0;
    padding-left: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none !important;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.settings-rate-field .percent-field {
    display: flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.settings-rate-field .percent-field input {
    width: auto;
    min-width: 9px;
    max-width: 64px;
    flex: 0 0 auto;
    padding-right: 0;
    padding-left: 0;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.settings-rate-field .percent-field b {
    flex: 0 0 auto;
    margin-left: 2px;
    padding-right: 0;
    line-height: 1;
}

#salesSettingsForm .money-field input,
#salesSettingsForm .settings-threshold-control input,
#salesSettingsForm .percent-field input {
    font-size: 16px;
    font-weight: 750;
}

.settings-remove-tier {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: 2px;
    margin-top: -22px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    background: var(--slate-50);
    color: var(--red);
    font-size: 21px;
    font-weight: 600;
    line-height: 1;
}

.settings-tier-row:has(.settings-remove-tier:not(:disabled)) .settings-rate-field .percent-field {
    padding-right: 48px;
}

.settings-remove-tier:hover:not(:disabled),
.settings-remove-tier:focus-visible {
    border-color: var(--red);
    background: var(--red-soft);
}

.settings-remove-tier:disabled {
    cursor: not-allowed;
    visibility: hidden;
}

.settings-final-tier {
    margin-top: 7px;
}

.settings-final-tier-label {
    display: flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    overflow: hidden;
    padding: 0 11px;
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    background: var(--slate-50);
    color: var(--slate-700);
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-bottom-row {
    align-items: end;
    margin-top: 10px;
}

.settings-unit-price-field {
    grid-column: 1;
    min-width: 0;
}

.settings-add-tier-button {
    display: flex;
    width: 100%;
    min-height: 44px;
    grid-column: 2;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 0;
}

.sales-settings-modal {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

#salesSettingsForm {
    display: grid;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
}

#salesSettingsForm .modal-body {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

#salesSettingsForm .modal-footer {
    position: static;
}

.form-error {
    margin: 12px 0 0;
    padding: 9px 11px;
    border-radius: 9px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 11px;
    font-weight: 750;
}

.type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.type-toggle legend {
    margin-bottom: 6px;
}

.type-toggle label {
    position: relative;
}

.type-toggle input {
    position: absolute;
    opacity: 0;
}

.type-toggle label span {
    display: grid;
    min-height: 44px;
    place-items: center;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
    color: var(--slate-600);
    cursor: pointer;
}

.type-toggle input[value="income"]:checked + span {
    border-color: #86d49f;
    background: var(--green-soft);
    color: var(--green);
}

.type-toggle input[value="expense"]:checked + span {
    border-color: #f8a4a4;
    background: var(--red-soft);
    color: var(--red);
}

.type-toggle input:focus-visible + span {
    outline: 3px solid rgb(37 99 235 / 36%);
    outline-offset: 2px;
}

.checkbox-field {
    display: flex !important;
    min-height: 44px;
    flex-direction: row !important;
    align-items: center;
    gap: 9px !important;
    padding: 10px 12px;
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    background: var(--slate-50);
}

.checkbox-field input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--orange);
}

.modal-footer {
    position: sticky;
    z-index: 3;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 13px 18px;
    border-top: 1px solid var(--slate-200);
    background: var(--footer-glass);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.button-primary,
.button-secondary,
.button-danger {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
}

.button-primary {
    background: var(--slate-950);
    color: var(--white);
    box-shadow: 0 8px 18px rgb(15 23 42 / 16%);
}

.button-danger {
    border: 1px solid #ef4444;
    background: #dc2626;
    color: #fff;
    box-shadow: 0 8px 18px rgb(220 38 38 / 16%);
}

.button-danger:hover {
    background: #b91c1c;
}

.delete-confirm-copy {
    display: grid;
    gap: 9px;
}

.delete-confirm-copy p {
    margin: 0;
    color: var(--slate-800);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.55;
}

.delete-confirm-copy small {
    color: var(--red);
    font-size: 10px;
    font-weight: 750;
}

.button-primary:hover {
    background: #263249;
}

.button-secondary {
    border: 1px solid var(--slate-300);
    background: var(--white);
    color: var(--slate-700);
}

.button-secondary:hover {
    background: var(--slate-100);
}

.button-sale {
    background: var(--orange);
}

.button-sale:hover {
    background: #c2410c;
}

.ledger-summary {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--slate-100);
    background: var(--slate-50);
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 700;
}

.ledger-summary strong {
    display: block;
    margin-top: 1px;
    color: var(--slate-900);
    font-size: 14px;
}

.ledger-summary .button-primary {
    margin-left: auto;
}

.transaction-list {
    max-height: 480px;
    overflow: auto;
    padding: 6px 18px 14px;
}

.transaction-row {
    display: grid;
    grid-template-columns: 45px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-height: 64px;
    border-bottom: 1px solid var(--slate-100);
}

.transaction-type-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 11px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 17px;
}

.transaction-type-icon.is-expense {
    background: var(--red-soft);
    color: var(--red);
}

.transaction-copy {
    min-width: 0;
}

.transaction-copy strong,
.transaction-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-copy strong {
    font-size: 12px;
}

.transaction-copy small {
    margin-top: 2px;
    color: var(--slate-500);
    font-size: 10px;
}

.transaction-amount {
    color: var(--green);
    font-size: 13px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.transaction-amount.is-expense {
    color: var(--red);
}

.empty-state {
    display: grid;
    min-height: 150px;
    place-items: center;
    padding: 22px;
    color: var(--slate-500);
    font-size: 12px;
    text-align: center;
}

.sale-history {
    max-height: 135px;
    overflow: auto;
    border-top: 1px solid var(--slate-100);
}

.sale-history-title {
    margin: 3px 0 6px;
    color: var(--slate-600);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.sale-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--slate-100);
    font-size: 11px;
}

.sale-history-row strong {
    color: var(--orange);
    white-space: nowrap;
}

.data-sync-status {
    position: fixed;
    z-index: 155;
    bottom: calc(var(--nav-height) + 17px);
    left: max(18px, calc((100vw - 1200px) / 2 + 24px));
    display: inline-flex;
    max-width: min(260px, calc(100vw - 110px));
    min-height: 34px;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border: 1px solid var(--slate-200);
    border-radius: 999px;
    background: var(--footer-glass);
    color: var(--slate-600);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    transition: opacity 160ms ease, transform 160ms ease;
}

.data-sync-status[hidden] {
    display: none;
}

.data-sync-status.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(5px);
}

.data-sync-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--slate-400);
}

.data-sync-status[data-state="connecting"] .data-sync-dot,
.data-sync-status[data-state="saving"] .data-sync-dot {
    background: var(--blue);
    animation: sync-pulse 900ms ease-in-out infinite alternate;
}

.data-sync-status[data-state="saved"] .data-sync-dot {
    background: var(--green);
}

.data-sync-status[data-state="error"] {
    border-color: color-mix(in srgb, var(--red) 42%, var(--slate-200));
    color: var(--red);
}

.data-sync-status[data-state="error"] .data-sync-dot {
    background: var(--red);
}

@keyframes sync-pulse {
    to { opacity: .35; transform: scale(.72); }
}

.toast-region {
    position: fixed;
    z-index: 160;
    right: 18px;
    bottom: calc(var(--nav-height) + 20px);
    display: flex;
    width: min(340px, calc(100vw - 36px));
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 15px;
    border-radius: 11px;
    background: var(--slate-950);
    color: var(--white);
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    font-weight: 750;
    animation: toast-in 190ms ease both;
}

.toast.is-leaving {
    opacity: 0;
    transform: translateY(7px);
    transition: opacity 180ms ease, transform 180ms ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(7px); }
}

html[data-theme="dark"] {
    color-scheme: dark;
    scrollbar-color: #475569 #111827;
    --slate-950: #f8fafc;
    --slate-900: #edf2f7;
    --slate-800: #e2e8f0;
    --slate-700: #cbd5e1;
    --slate-600: #b6c2d1;
    --slate-500: #94a3b8;
    --slate-400: #7c8ba1;
    --slate-300: #475569;
    --slate-200: #334155;
    --slate-100: #1e293b;
    --slate-50: #172033;
    --white: #111827;
    --green: #4ade80;
    --green-soft: #143322;
    --blue: #60a5fa;
    --blue-soft: #172c4b;
    --red: #fb7185;
    --red-soft: #3b1c22;
    --orange: #fb923c;
    --orange-soft: #422310;
    --cf-purple: #c4b5fd;
    --cf-purple-soft: #2e1b4f;
    --yellow: #fde047;
    --page-background: #0b1220;
    --header-glass: rgb(17 24 39 / 95%);
    --module-header-glass: rgb(17 24 39 / 96%);
    --header-gradient-start: #172033;
    --header-gradient-end: #111827;
    --table-divider: #334155;
    --module-divider: #2a3649;
    --row-hover: #1c2a3e;
    --chart-grid: #334155;
    --chart-zero: #64748b;
    --chart-income-start: #60a5fa;
    --chart-income-end: #2563eb;
    --chart-expense: #fb7185;
    --chart-balance: #4ade80;
    --modal-overlay: rgb(2 6 23 / 78%);
    --modal-border: #334155;
    --modal-header-glass: rgb(23 32 51 / 97%);
    --modal-close-background-start: #3b4657;
    --modal-close-background-end: #2a3444;
    --modal-close-foreground: #e6ebf2;
    --modal-close-border: rgb(255 255 255 / 10%);
    --modal-close-shadow: 0 1px 2px rgb(0 0 0 / 38%), 0 3px 7px rgb(0 0 0 / 24%);
    --modal-close-focus: #60a5fa;
    --footer-glass: rgb(17 24 39 / 97%);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 24%), 0 7px 22px rgb(0 0 0 / 18%);
    --shadow-lg: 0 24px 70px rgb(0 0 0 / 56%);
}

html[data-theme="dark"] body {
    background:
        radial-gradient(circle at 50% -12rem, rgb(59 130 246 / 15%), transparent 34rem),
        var(--page-background);
}

html[data-theme="dark"] ::selection {
    background: rgb(96 165 250 / 35%);
}

html[data-theme="dark"] :focus-visible {
    outline-color: rgb(96 165 250 / 58%);
}

html[data-theme="dark"] .session-menu-trigger[data-role="readonly"] {
    color: #2dd4bf;
}

html[data-theme="dark"] .app-header h1 {
    background-image: linear-gradient(100deg, #f8fafc 0 55%, #60a5fa 100%);
}

html[data-theme="dark"] .asset-card-total {
    border-color: #475569;
    border-top-color: var(--asset-kpi-accent);
    background:
        radial-gradient(circle at 98% 0%, rgb(59 130 246 / 28%), transparent 8rem),
        #020617;
    color: #f8fafc;
}

html[data-theme="dark"] .brand-dot,
html[data-theme="dark"] .fab-button,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .button-primary:not(.button-sale) {
    background: #020617;
    color: #f8fafc;
}

html[data-theme="dark"] .fab-button:hover,
html[data-theme="dark"] .button-primary:not(.button-sale):hover {
    background: #1e293b;
}

html[data-theme="dark"] .fab-button.is-open {
    background: #334155;
}

html[data-theme="dark"] .module-heading .module-accent-title {
    color: #93c5fd;
    text-shadow: 0 2px 2px rgb(2 6 23 / 70%), 0 6px 16px rgb(59 130 246 / 24%);
}

html[data-theme="dark"] .cf-kind-loan,
html[data-theme="dark"] [data-cf-kind="loan"],
html[data-theme="dark"] .cf-type-capital-add,
html[data-theme="dark"] .cf-type-capital_add,
html[data-theme="dark"] [data-cf-type="capital_add"] {
    border-color: #1d4ed8;
}

html[data-theme="dark"] .cf-kind-available {
    border-color: #0e7490;
    background: #083344;
    color: #67e8f9;
}

html[data-theme="dark"] .cf-kind-savings,
html[data-theme="dark"] [data-cf-kind="savings"],
html[data-theme="dark"] .cf-type-profit,
html[data-theme="dark"] [data-cf-type="profit"] {
    border-color: #166534;
}

html[data-theme="dark"] .cf-kind-investment,
html[data-theme="dark"] [data-cf-kind="investment"],
html[data-theme="dark"] .cf-type-fee,
html[data-theme="dark"] [data-cf-type="fee"] {
    border-color: #9a3412;
}

html[data-theme="dark"] .cf-kind-securities,
html[data-theme="dark"] [data-cf-kind="securities"],
html[data-theme="dark"] .cf-type-capital-withdraw,
html[data-theme="dark"] .cf-type-capital_withdraw,
html[data-theme="dark"] [data-cf-type="capital_withdraw"] {
    border-color: #6d28d9;
}

html[data-theme="dark"] .cf-type-loss,
html[data-theme="dark"] [data-cf-type="loss"] {
    border-color: #9f1239;
}

html[data-theme="dark"] .summary-quantity {
    color: #fbbf24;
}

html[data-theme="dark"] .summary-salary,
html[data-theme="dark"] .summary-salary strong {
    color: #c4b5fd;
}

html[data-theme="dark"] .sales-settings-button {
    border-color: #6d4bb5;
    background: #201637;
    color: #c4b5fd;
}

html[data-theme="dark"] .sales-settings-button:hover {
    border-color: #7c3aed;
    background: #24183d;
    color: #c4b5fd;
}

html[data-theme="dark"] .warehouse-overview-button {
    border-color: #0f766e;
    background: #102f30;
    color: #5eead4;
}

html[data-theme="dark"] .warehouse-overview-button:hover {
    border-color: #14b8a6;
    background: #123b38;
    color: #99f6e4;
}

html[data-theme="dark"] .warehouse-toolbar-button {
    border-color: #0f766e;
    background: #172033;
    color: #5eead4;
}

html[data-theme="dark"] .warehouse-toolbar-button:hover:not(:disabled) {
    border-color: #14b8a6;
    background: #123b38;
}

html[data-theme="dark"] .warehouse-toolbar-primary {
    border-color: #14b8a6;
    background: #0f766e;
    color: #f0fdfa;
}

html[data-theme="dark"] .infrastructure-placeholder-icon {
    border-color: #0f766e;
    background: #102f30;
    box-shadow: 0 8px 22px rgb(20 184 166 / 10%);
}

html[data-theme="dark"] .infrastructure-placeholder-icon::before,
html[data-theme="dark"] .infrastructure-placeholder-icon::after {
    border-color: #5eead4;
}

html[data-theme="dark"] .infrastructure-placeholder-status {
    border-color: #0f766e;
    background: #102f30;
    color: #5eead4;
}

html[data-theme="dark"] .transaction-summary-button:hover:not(:disabled) {
    border-color: #3b82f6;
    background: #172c4b;
    color: #93c5fd;
}

html[data-theme="dark"] .transaction-kind.kind-revenue {
    border-color: #166534;
    background: #12351f;
    color: #86efac;
}

html[data-theme="dark"] .transaction-kind.kind-infrastructure {
    border-color: #1d4ed8;
    background: #172554;
    color: #93c5fd;
}

html[data-theme="dark"] .transaction-kind.kind-operations {
    border-color: #9a3412;
    background: #431407;
    color: #fdba74;
}

html[data-theme="dark"] .transaction-kind.kind-people {
    border-color: #991b1b;
    background: #450a0a;
    color: #fca5a5;
}

html[data-theme="dark"] .transaction-kind.kind-family {
    border-color: #a16207;
    background: #422006;
    color: #fde047;
}

html[data-theme="dark"] .transaction-kind.kind-investment {
    border-color: #6b21a8;
    background: #2e1065;
    color: #d8b4fe;
}

html[data-theme="dark"] .transaction-kind.kind-contribution {
    border-color: #475569;
    background: #1e293b;
    color: #cbd5e1;
}

html[data-theme="dark"] .transaction-kind.kind-other {
    border-color: #155e75;
    background: #083344;
    color: #67e8f9;
}

html[data-theme="dark"] .formula-note {
    background: #2b2112;
    color: #fbbf24;
}

html[data-theme="dark"] .settings-effective-note {
    border-color: #5b3f8c;
    background: #24183d;
}

html[data-theme="dark"] .settings-effective-note span {
    color: #c4b5fd;
}

html[data-theme="dark"] .settings-effective-note strong {
    color: #ddd6fe;
}

html[data-theme="dark"] .add-outline-button:hover {
    border-color: #3b82f6;
    background: #172c4b;
    color: #93c5fd;
}

html[data-theme="dark"] .type-toggle input[value="income"]:checked + span {
    border-color: #166534;
}

html[data-theme="dark"] .type-toggle input[value="expense"]:checked + span {
    border-color: #9f1239;
}

html[data-theme="dark"] input::placeholder {
    color: #7c8ba1;
    opacity: 1;
}

html[data-theme="dark"] option {
    background: #111827;
    color: #e2e8f0;
}

html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
    box-shadow: 0 0 0 1000px #111827 inset;
    -webkit-text-fill-color: #edf2f7;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle,
    .theme-toggle span,
    .theme-toggle i,
    .swipe-row-content {
        transition: none;
    }
}

@media (min-width: 1024px) {
    .overview-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .page-shell {
        padding-right: 16px;
        padding-left: 16px;
    }

    .asset-note {
        display: none;
    }
}

@media (max-width: 767px) {
    :root {
        --nav-height: calc(64px + env(safe-area-inset-bottom));
    }

    .page-shell {
        padding: 9px 8px calc(var(--nav-height) + 40px);
    }

    .modal-panel.warehouse-overview-modal {
        display: grid;
        width: 100%;
        max-height: min(94dvh, calc(100dvh - env(safe-area-inset-top)));
        grid-template-rows: auto auto auto minmax(0, 1fr);
        overflow: hidden;
    }

    .warehouse-overview-modal::before {
        grid-row: 1;
    }

    .warehouse-overview-modal .warehouse-overview-header {
        position: static;
        grid-row: 2;
        min-height: 54px;
        gap: 7px;
        padding: 7px 14px;
    }

    .warehouse-overview-title-row {
        gap: 7px;
    }

    .warehouse-overview-header h2 {
        font-size: 18px;
    }

    .warehouse-overview-summary {
        grid-row: 3;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 8px 10px;
    }

    .warehouse-overview-body {
        grid-row: 4;
        padding: 8px 10px max(14px, env(safe-area-inset-bottom));
    }

    .warehouse-swipe-hint {
        margin-bottom: 7px;
        font-size: 9px;
    }

    .warehouse-module-header {
        min-height: 82px;
        align-items: center;
    }

    .warehouse-updated-label {
        font-size: 10px;
    }

    .warehouse-pc-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 6px;
    }

    .module-summary.warehouse-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr)) clamp(64px, 20vw, 84px);
        gap: 6px;
    }

    body[data-can-write="false"] .module-summary.warehouse-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .warehouse-summary .summary-card {
        min-width: 0;
        min-height: 54px;
        padding: 7px 8px;
    }

    .warehouse-summary .summary-card span {
        overflow: hidden;
        font-size: 8px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .warehouse-summary .summary-card strong {
        overflow: hidden;
        font-size: clamp(13px, 3.8vw, 18px);
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .warehouse-summary-add {
        min-height: 54px;
        padding: 0 3px;
        font-size: clamp(9px, 2.6vw, 11px);
        line-height: 1.15;
    }

    .warehouse-pc-card {
        border-radius: 12px;
    }

    .warehouse-pc-card-header {
        min-height: 54px;
        grid-template-columns: minmax(0, 1fr) clamp(64px, 18vw, 76px);
        gap: 4px;
        padding: 6px;
    }

    .warehouse-pc-title-wrap h2 {
        font-size: clamp(14px, 4.2vw, 17px);
    }

    .warehouse-pc-title-wrap small {
        font-size: clamp(8px, 2.2vw, 9px);
    }

    .warehouse-pc-total {
        width: 100%;
        min-width: 0;
        height: 36px;
        min-height: 36px;
        padding: 3px 4px;
    }

    .warehouse-pc-total strong {
        font-size: clamp(11px, 3.2vw, 14px);
    }

    .warehouse-pc-header-meta {
        gap: 0;
    }

    .warehouse-compartment-swipe-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .warehouse-compartment-swipe-grid > * {
        padding-right: 7px;
        padding-left: 7px;
    }

    .warehouse-compartment-swipe-grid {
        min-height: 44px;
    }

    .warehouse-compartment-name {
        font-size: clamp(11px, 3.2vw, 13px);
    }

    .warehouse-compartment-quantity {
        font-size: clamp(11px, 3.1vw, 13px);
    }

    .modal-panel.warehouse-entry-modal {
        display: grid;
        max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top)));
        grid-template-rows: auto auto minmax(0, 1fr);
        overflow: hidden;
    }

    .warehouse-entry-modal::before {
        grid-row: 1;
    }

    .warehouse-entry-modal .modal-header {
        position: static;
        grid-row: 2;
        min-height: 62px;
        padding: 8px 14px;
    }

    .warehouse-entry-form {
        display: grid;
        min-height: 0;
        grid-row: 3;
        grid-template-rows: minmax(0, 1fr) auto;
        overflow: hidden;
    }

    .warehouse-entry-form .modal-body {
        min-height: 0;
        padding: 14px;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .warehouse-entry-form .modal-footer {
        position: static;
    }

    .warehouse-entry-form .form-grid {
        gap: 10px;
    }

    .warehouse-entry-form .form-grid input,
    .warehouse-entry-form .form-grid select,
    .warehouse-builder-row input {
        min-width: 0;
        max-width: 100%;
        min-height: 46px;
        padding-right: 9px;
        padding-left: 9px;
        font-size: 16px;
    }

    .warehouse-builder-header,
    .warehouse-builder-row {
        grid-template-columns: minmax(0, 1fr) minmax(100px, .82fr) 32px;
        gap: 6px;
    }

    .warehouse-empty-card {
        min-height: 190px;
        border-radius: 12px;
    }

    .app-header {
        min-height: 62px;
        gap: 8px;
        padding: 10px;
        border-radius: 12px;
    }

    .brand-block {
        gap: 8px;
    }

    .brand-dot {
        display: grid;
        width: 32px;
        height: 32px;
        border-radius: 9px;
        font-size: 13px;
    }

    .app-header h1 {
        font-size: clamp(22px, 7vw, 29px);
    }

    .home-header-controls {
        gap: 6px;
    }

    .session-menu,
    .session-menu-trigger {
        width: 44px;
        height: 44px;
    }

    .session-menu {
        flex-basis: 44px;
    }

    .session-popover {
        right: -10px;
    }

    .theme-toggle {
        width: 24px;
        height: 42px;
        flex-basis: 24px;
    }

    .theme-toggle-sun {
        top: 5px;
    }

    .theme-toggle-moon {
        bottom: 5px;
    }

    .theme-toggle i {
        left: 3px;
    }

    .theme-toggle[aria-checked="true"] i {
        transform: translateY(18px);
    }

    .year-picker select {
        width: 104px;
        min-width: 104px;
        min-height: 44px;
        padding-right: 23px;
        padding-left: 6px;
        font-size: 12px;
    }

    .year-picker::after {
        right: 9px;
    }

    .dashboard {
        gap: 15px;
        margin-top: 15px;
    }

    .module-page {
        gap: 14px;
    }

    .module-header {
        position: relative;
        min-height: 0;
        align-items: stretch;
        flex-direction: column;
        gap: 13px;
        padding: 13px;
        border-radius: 12px;
    }

    .module-heading {
        gap: 10px;
    }

    .module-heading h1 {
        font-size: 23px;
    }

    .sales-module-header .module-heading {
        min-height: 38px;
        padding-right: 0;
    }

    .module-header .module-accent-title {
        font-size: clamp(15px, 4.2vw, 18px);
        letter-spacing: -.025em;
    }

    .module-header-actions,
    .sales-header-actions {
        width: 100%;
    }

    .module-header-actions .period-picker,
    .sales-header-actions .period-picker {
        flex: 1 1 auto;
    }

    .module-edit-icon-button {
        width: 38px;
        min-width: 38px;
        min-height: 38px;
        padding: 0;
        border-radius: 10px;
    }

    .period-picker {
        width: 100%;
        gap: 8px;
    }

    .period-picker label {
        flex: 1 1 0;
        min-width: 0;
        gap: 5px;
    }

    .period-picker label > span {
        font-size: 10px;
    }

    .period-picker select {
        width: 100%;
        min-width: 0;
        height: 48px;
        min-height: 48px;
        padding: 0 30px;
        border-radius: 11px;
        font-size: 16px;
        font-weight: 800;
        line-height: 1.2;
    }

    .transaction-period-picker {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sales-period-picker {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .72fr) minmax(0, .72fr);
    }

    body[data-can-write="false"] .sales-period-picker {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .72fr);
    }

    .transaction-period-picker label::after,
    .sales-period-picker label::after {
        right: 10px;
    }

    .transaction-period-picker select {
        padding-right: 19px;
        padding-left: 3px;
        font-size: 16px;
        letter-spacing: -.025em;
    }

    .sales-period-picker select {
        padding-right: 18px;
        padding-left: 2px;
        font-size: 14px;
        letter-spacing: -.035em;
    }

    .transaction-summary-button,
    .sales-settings-button,
    .warehouse-overview-button {
        width: 100%;
        min-width: 0;
        height: 48px;
        min-height: 48px;
        padding: 0 4px;
        border-radius: 11px;
        font-size: clamp(10px, 3vw, 13px);
    }

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

    .summary-card {
        min-height: 54px;
        padding: 5px 5px 4px;
        border-radius: 10px;
    }

    .summary-card span {
        display: block;
        min-height: 11px;
        font-size: 6.5px;
        line-height: 1.1;
    }

    .summary-card span small {
        display: block;
        margin-top: 1px;
        font-size: 5.5px;
    }

    .summary-card strong {
        right: 5px;
        max-width: calc(100% - 10px);
        font-size: clamp(11px, 3.5vw, 16px);
        letter-spacing: -.06em;
        line-height: 1;
    }

    .module-table-card {
        border-radius: 12px;
    }

    .module-table-header {
        min-height: 66px;
        padding: 10px 12px;
    }

    .module-table-header h2 {
        font-size: 16px;
    }

    .record-count {
        min-height: 18px;
        margin-bottom: 2px;
        font-size: 9px;
    }

    .swipe-hint {
        margin-top: 3px;
        font-size: 8px;
    }

    .module-table-header .button-primary {
        padding: 0 11px;
        font-size: 10px;
    }

    .transaction-rollup-header,
    .transaction-detail-header {
        min-height: 48px;
        padding: 7px 10px;
    }

    .transaction-rollup-header h2,
    .transaction-detail-header h2 {
        font-size: clamp(13px, 3.75vw, 16px);
        line-height: 1.15;
    }

    .transaction-rollup-modal {
        max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top)));
    }

    .table-edit-controls {
        top: 9px;
        right: 9px;
        gap: 4px;
    }

    .table-edit-button {
        min-width: 44px;
        min-height: 28px;
        padding: 0 7px;
        border-radius: 8px;
        font-size: 9px;
    }

    .inline-edit-row > td {
        padding: 7px !important;
    }

    .record-edit-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
        padding: 7px;
        border-radius: 9px;
    }

    .record-edit-field {
        gap: 4px;
        font-size: 7.5px;
    }

    .record-edit-wide,
    .record-edit-error {
        grid-column: 1 / -1;
    }

    .transaction-edit-grid .record-edit-date,
    .transaction-edit-grid .record-edit-type,
    .transaction-edit-grid .record-edit-classification,
    .transaction-edit-grid .record-edit-amount,
    .sales-edit-grid .record-edit-date,
    .sales-edit-grid .record-edit-id {
        display: grid;
        height: 55px;
        min-width: 0;
        max-width: 100%;
        grid-template-rows: 13px 38px;
        align-content: start;
        gap: 4px;
    }

    .record-edit-input,
    .record-edit-readonly output {
        width: 100%;
        height: 38px;
        min-height: 38px;
        max-height: 38px;
        box-sizing: border-box;
        padding: 6px 7px;
        border-radius: 8px;
    }

    .record-edit-input {
        /* Safari iOS tự phóng trang khi focus control có chữ nhỏ hơn 16 px. */
        font-size: 16px;
    }

    .record-edit-readonly output {
        font-size: 11px;
    }

    .record-edit-error {
        padding: 7px 8px;
        font-size: 9px;
    }

    .module-table th,
    .module-table td {
        padding: 11px 12px;
    }

    .asset-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .asset-card {
        min-height: 70px;
        gap: 7px;
        padding: 8px 9px;
        border-radius: 10px;
    }

    .asset-card::after {
        right: -34px;
        bottom: -48px;
        width: 96px;
        height: 96px;
        border-width: 18px;
    }

    .asset-label {
        font-size: clamp(7px, 2.2vw, 8.5px);
    }

    .asset-label-icon {
        width: 12px;
        height: 12px;
        flex-basis: 12px;
    }

    .asset-value {
        right: 9px;
        width: calc(100% - 18px);
        font-size: clamp(15px, 4.8vw, 20px);
    }

    .overview-grid {
        gap: 15px;
    }

    .dashboard-card {
        border-radius: 12px;
    }

    .card-header {
        min-height: 54px;
        padding: 12px 13px;
    }

    .card-header h2 {
        font-size: 12px;
    }

    .cashflow-table {
        min-width: 0;
        font-size: clamp(8.5px, 2.5vw, 10px);
    }

    .cashflow-table th,
    .cashflow-table td {
        padding: 9px 4px;
    }

    .cashflow-table th:nth-child(1),
    .cashflow-table td:nth-child(1) {
        width: 10%;
    }

    .cashflow-table th:nth-child(n + 2),
    .cashflow-table td:nth-child(n + 2) {
        width: 22.5%;
    }

    .cashflow-table tbody td.number-cell {
        padding-right: 6px;
        padding-left: 4px;
        font-size: clamp(8px, 2.55vw, 10px);
        text-align: right !important;
    }

    .cashflow-table tfoot th,
    .cashflow-table tfoot td {
        padding: 9px 4px;
        font-size: clamp(8px, 2.4vw, 9.5px);
    }

    .cashflow-table tfoot td.number-cell {
        padding-right: 6px;
        padding-left: 4px;
        text-align: right !important;
    }

    .cashflow-table thead th {
        font-size: clamp(9px, 2.6vw, 10px);
    }

    .cashflow-card .table-scroll {
        overflow-x: hidden;
    }

    .expand-table-button {
        min-height: 38px;
        font-size: 9px;
    }

    .overview-chart {
        min-height: 0;
        gap: 9px;
        margin: 11px;
        padding: 10px 6px 6px;
    }

    .chart-legend {
        gap: 7px 12px;
    }

    .chart-legend span {
        font-size: 8px;
    }

    .fab-wrap {
        right: 13px;
        bottom: calc(var(--nav-height) + 11px);
    }

    .fab-button {
        width: 54px;
        height: 54px;
    }

    .bottom-nav {
        min-height: 0;
        padding: 5px 8px max(5px, env(safe-area-inset-bottom));
        border-top: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
    }

    .bottom-nav-inner {
        min-height: 54px;
        gap: 2px;
        padding: 3px;
        border: 1px solid var(--slate-200);
        border-radius: 19px;
        background: var(--footer-glass);
        box-shadow: 0 8px 26px rgb(15 23 42 / 14%), 0 1px 4px rgb(15 23 42 / 8%);
        backdrop-filter: blur(18px) saturate(1.35);
        overflow: hidden;
    }

    .bottom-nav button {
        min-height: 48px;
        gap: 2px;
        padding: 4px 1px 3px;
        border: 0;
        border-radius: 15px;
        font-size: clamp(9px, 2.33vw, 10px);
        line-height: 1.05;
        letter-spacing: -.01em;
        transition: color 160ms ease, background 160ms ease, transform 160ms ease;
    }

    .bottom-nav button:first-child {
        border-left: 0;
    }

    .bottom-nav button:hover {
        background: var(--slate-50);
    }

    .bottom-nav button:active {
        transform: scale(.97);
    }

    .bottom-nav button.is-active {
        background: var(--blue-soft);
    }

    .bottom-nav button.is-active::before {
        top: 3px;
        width: 18px;
        height: 2px;
        border-radius: 999px;
    }

    .nav-icon {
        width: clamp(18px, 4.42vw, 19px);
        height: clamp(18px, 4.42vw, 19px);
        transition: transform 160ms ease;
    }

    .bottom-nav button.is-active .nav-icon {
        transform: translateY(-1px) scale(1.04);
    }

    .modal-layer {
        align-items: end;
        padding: 0;
    }

    .modal-panel,
    .modal-small,
    .modal-medium,
    .modal-large,
    .modal-form {
        width: 100%;
        max-height: 90vh;
        border-radius: 18px 18px 0 0;
        transform: none;
    }

    .modal-layer.is-open .modal-panel {
        animation: none;
    }

    .modal-panel::before {
        display: block;
        width: 36px;
        height: 4px;
        margin: 7px auto 0;
        border-radius: 999px;
        background: var(--slate-200);
        content: "";
    }

    #modal-sales-settings .sales-settings-modal {
        max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top)));
        grid-template-rows: auto auto minmax(0, 1fr);
    }

    #modal-sales-settings .sales-settings-modal::before {
        grid-row: 1;
    }

    #modal-sales-settings .modal-header {
        position: static;
        grid-row: 2;
        min-height: 62px;
        gap: 8px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    #modal-sales-settings .modal-header > div {
        min-width: 0;
        flex: 1 1 auto;
    }

    #modal-sales-settings .modal-header h2 {
        max-width: 100%;
        font-size: clamp(14px, 3.8vw, 17px);
        line-height: 1.15;
        letter-spacing: -.03em;
        white-space: nowrap;
    }

    #modal-sales-settings #salesSettingsForm {
        grid-row: 3;
    }

    #salesSettingsForm .modal-body {
        padding-top: 14px;
        padding-bottom: 14px;
        scroll-padding-block: 12px;
    }

    #salesSettingsForm .settings-effective-note {
        margin-bottom: 12px;
        padding: 10px 11px;
    }

    #salesSettingsForm .settings-form-grid {
        gap: 11px;
    }

    #salesSettingsForm input {
        font-size: 16px;
    }

    .settings-tier-columns,
    .settings-tier-row,
    .settings-bottom-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .settings-tier-columns {
        font-size: 9px;
    }

    .settings-tier-row,
    .settings-threshold-control,
    .settings-rate-field .percent-field,
    .settings-final-tier-label {
        min-height: 48px;
    }

    .settings-threshold-control > b {
        margin-right: 6px;
        padding-right: 0;
        padding-left: 0;
        font-size: 9px;
    }

    .settings-threshold-control input {
        padding-right: 0;
        padding-left: 0;
    }

    .settings-rate-field .percent-field input {
        padding-right: 0;
        padding-left: 0;
    }

    .settings-rate-field .percent-field b {
        padding-right: 0;
    }

    .settings-final-tier-label {
        padding-right: 8px;
        padding-left: 8px;
        font-size: 10px;
    }

    #salesSettingsForm .settings-add-tier-button {
        height: 48px;
        min-height: 48px;
        max-height: 48px;
    }

    #transactionForm .money-field,
    #salesSettingsForm .money-field {
        height: 48px;
        min-height: 48px;
        max-height: 48px;
        box-sizing: border-box;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-right: 14px;
        padding-left: 14px;
    }

    .form-grid,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .field-full,
    .inline-form .form-actions {
        grid-column: auto;
    }

    .type-toggle.field-full {
        grid-column: 1 / -1;
    }

    #modal-transaction-form .modal-form {
        display: grid;
        max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top)));
        grid-template-rows: auto auto minmax(0, 1fr);
        overflow: hidden;
    }

    #modal-transaction-form .modal-header {
        position: static;
        min-height: 62px;
        padding: 8px 14px;
    }

    #transactionForm {
        display: grid;
        min-height: 0;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    #transactionForm .modal-body {
        min-height: 0;
        overflow-y: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 14px;
        overscroll-behavior: contain;
        scroll-padding-block: 12px;
        -webkit-overflow-scrolling: touch;
    }

    #transactionForm .field-full {
        grid-column: 1 / -1;
    }

    #transactionForm .type-toggle {
        gap: 10px;
    }

    #transactionForm .type-toggle,
    #transactionForm .transaction-classification-field,
    #transactionForm .transaction-date-field {
        min-width: 0;
        max-width: 100%;
    }

    #transactionForm .transaction-classification-field,
    #transactionForm .transaction-date-field {
        display: grid;
        height: 71px;
        grid-template-rows: 17px 48px;
        align-content: start;
        gap: 6px;
    }

    #transactionForm .form-grid > label {
        min-width: 0;
    }

    #transactionForm .transaction-classification-field select,
    #transactionForm .transaction-date-field input,
    #transactionForm .field-full > input {
        width: 100%;
        height: 48px;
        min-width: 0;
        max-width: 100%;
        min-height: 48px;
        box-sizing: border-box;
    }

    #transactionForm .transaction-date-field input {
        padding-right: 7px;
        padding-left: 9px;
        letter-spacing: -.02em;
    }

    #transactionForm .modal-footer {
        position: static;
        padding: 9px 14px max(9px, env(safe-area-inset-bottom));
    }

    #transactionForm .modal-footer button {
        min-height: 46px;
        flex: 1 1 0;
        font-size: 14px;
    }

    #transactionForm .type-toggle input {
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
        margin: 0;
        padding: 0;
    }

    #transactionForm .type-toggle label span {
        height: 48px;
        min-height: 48px;
        max-height: 48px;
        box-sizing: border-box;
        font-size: 13px;
    }

    #transactionForm input:not([type="radio"]):not(#transactionAmount),
    #transactionForm select {
        font-size: 16px;
    }

    #modal-sale {
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
    }

    #modal-sale .modal-panel {
        display: grid;
        max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top)));
        grid-template-rows: auto auto minmax(0, 1fr);
        overflow: hidden;
    }

    #modal-sale .modal-header {
        position: static;
        min-height: 62px;
        padding: 8px 14px;
    }

    #saleForm {
        display: grid;
        min-height: 0;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    #saleForm .modal-body {
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 14px;
        overscroll-behavior: contain;
        scroll-padding-block: 12px;
        -webkit-overflow-scrolling: touch;
    }

    #saleForm .sale-date-field,
    #saleForm .sale-id-field {
        display: grid;
        height: 71px;
        min-width: 0;
        max-width: 100%;
        grid-template-rows: 17px 48px;
        align-content: start;
        gap: 6px;
    }

    #saleForm .field-full,
    #saleForm .sale-quantity-field {
        grid-column: 1 / -1;
    }

    #saleForm .modal-body > label {
        min-width: 0;
        max-width: 100%;
    }

    #saleForm .modal-body input {
        width: 100%;
        inline-size: 100%;
        height: 48px;
        block-size: 48px;
        min-width: 0;
        min-inline-size: 0;
        max-width: 100%;
        max-inline-size: 100%;
        min-height: 48px;
        min-block-size: 48px;
        max-height: 48px;
        max-block-size: 48px;
        box-sizing: border-box;
        font-size: 16px;
        scroll-margin-block: 12px;
    }

    #saleForm #saleDate {
        padding: 0;
    }

    #saleDate::-webkit-date-and-time-value {
        min-width: 0;
        padding-right: 4px;
        padding-left: 12px;
        box-sizing: border-box;
        text-align: left;
    }

    #saleForm .modal-footer {
        position: static;
        padding: 9px 14px max(9px, env(safe-area-inset-bottom));
    }

    #saleForm .modal-footer button {
        min-height: 46px;
        min-width: 0;
        flex: 1 1 0;
        font-size: 14px;
    }

    .ledger-summary {
        flex-wrap: wrap;
        gap: 10px 18px;
    }

    .ledger-summary .button-primary {
        width: 100%;
        margin-left: 0;
    }

    .toast-region {
        right: 12px;
        bottom: calc(var(--nav-height) + 76px);
        width: calc(100vw - 24px);
    }

    .data-sync-status {
        bottom: calc(var(--nav-height) + 12px);
        left: 12px;
        max-width: calc(100vw - 86px);
        min-height: 32px;
        padding: 6px 10px;
        font-size: 9px;
    }
}

@media (min-width: 390px) and (max-width: 767px) {
    #transactionForm .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 10px;
    }

    #transactionForm .field-full {
        grid-column: 1 / -1;
    }

    #transactionForm .transaction-classification-field,
    #transactionForm .transaction-date-field {
        min-width: 0;
        max-width: 100%;
    }

    #transactionForm #transactionClassification,
    #transactionForm #transactionDate {
        width: 100%;
        height: 48px;
        min-width: 0;
        max-width: 100%;
        min-height: 48px;
        box-sizing: border-box;
        font-size: 16px;
    }

    #transactionForm #transactionDate {
        padding: 0;
        letter-spacing: -.02em;
    }

    #transactionDate::-webkit-date-and-time-value {
        min-width: 0;
        padding-left: 9px;
        box-sizing: border-box;
        text-align: left;
    }

    .asset-entry-form .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 10px;
    }

    .asset-entry-form .field-full {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    .infrastructure-placeholder-card {
        min-height: 230px;
        padding: 28px 16px;
    }

    .module-table-card .table-scroll {
        overflow: hidden;
    }

    .transaction-page-table,
    .sales-page-table,
    .transaction-rollup-table {
        display: table;
        width: 100%;
        min-width: 0;
        table-layout: fixed;
        font-size: 10px;
    }

    .module-table thead {
        display: table-header-group;
    }

    .module-table tbody {
        display: table-row-group;
    }

    .module-table tbody tr {
        display: table-row;
    }

    .module-table tbody td {
        display: table-cell;
        min-width: 0;
        padding: 8px 5px;
        border-bottom: 1px solid var(--slate-100);
        line-height: 1.35;
        text-align: left;
        vertical-align: top;
    }

    .module-table tbody td::before {
        display: none;
    }

    .module-table th,
    .module-table td {
        padding-right: 5px;
        padding-left: 5px;
    }

    .module-table th:first-child,
    .module-table td:first-child {
        padding-left: 7px;
    }

    .module-table th:last-child,
    .module-table td:last-child {
        padding-right: 7px;
    }

    .module-table thead th {
        padding-top: 8px;
        padding-bottom: 8px;
        border-bottom-color: var(--slate-300);
        font-size: 7.5px;
        letter-spacing: .015em;
        line-height: 1.2;
        vertical-align: middle;
        white-space: normal;
    }

    .transaction-rollup-table tbody td,
    .transaction-rollup-table tfoot th,
    .transaction-rollup-table tfoot td {
        height: 34px;
        padding: 3px 4px;
        font-size: clamp(8px, 2.3vw, 10px);
        line-height: 1;
        vertical-align: middle;
    }

    .transaction-note-summary-table tbody tr:not(.transaction-rollup-empty) td,
    .transaction-note-summary-table tfoot th,
    .transaction-note-summary-table tfoot td {
        height: 38px;
        line-height: 1.3;
    }

    .transaction-rollup-table tbody td.number-cell,
    .transaction-rollup-table tfoot td.number-cell {
        padding-right: 5px;
        padding-left: 3px;
        font-size: clamp(7.5px, 2.15vw, 9.25px);
    }

    .transaction-rollup-table thead th {
        font-size: clamp(7px, 2.05vw, 8.5px);
        text-align: center !important;
    }

    .transaction-rollup-name-cell {
        padding-right: 5px !important;
        padding-left: 5px !important;
    }

    .transaction-rollup-note-cell {
        padding-right: 6px !important;
        padding-left: 7px !important;
        font-size: clamp(8.5px, 2.45vw, 10.5px) !important;
    }

    .transaction-classification-table th:nth-child(1),
    .transaction-classification-table td:nth-child(1),
    .transaction-classification-table th:nth-child(3),
    .transaction-classification-table td:nth-child(3) {
        width: 27%;
    }

    .transaction-classification-table th:nth-child(2),
    .transaction-classification-table td:nth-child(2),
    .transaction-classification-table th:nth-child(4),
    .transaction-classification-table td:nth-child(4) {
        width: 23%;
    }

    .transaction-note-summary-table th:nth-child(1),
    .transaction-note-summary-table td:nth-child(1) {
        width: 54%;
    }

    .transaction-note-summary-table th:nth-child(n + 2),
    .transaction-note-summary-table td:nth-child(n + 2) {
        width: 23%;
    }

    .transaction-classification-table thead th {
        height: 26px;
        padding: 3px 2px;
    }

    .transaction-classification-table tbody td {
        height: 30px;
        padding: 2px 4px;
    }

    .transaction-classification-table .transaction-kind {
        width: min(100%, 112px);
        height: 20px;
        min-height: 20px;
        font-size: clamp(7px, 2vw, 8.5px);
    }

    .transaction-classification-amount-cell {
        padding-right: 4px !important;
        padding-left: 2px !important;
        font-size: clamp(7.5px, 2.15vw, 9.25px) !important;
        font-variant-numeric: tabular-nums;
        letter-spacing: -.03em;
        white-space: nowrap;
    }

    .transaction-rollup-empty td {
        width: auto !important;
        height: 64px;
        padding: 12px !important;
        font-size: 9px !important;
    }

    .desktop-date {
        display: none;
    }

    .mobile-date {
        display: inline;
        white-space: nowrap;
    }

    .transaction-swipe-grid {
        grid-template-columns: 19fr 16fr 23fr 42fr;
    }

    .sales-swipe-grid {
        grid-template-columns: 20fr 28fr 21fr 31fr;
    }

    .swipe-data-cell {
        min-height: 47px;
        padding: 8px 5px;
        font-size: 10px;
        vertical-align: top;
    }

    .swipe-data-cell:first-child {
        padding-left: 7px;
    }

    .swipe-data-cell:last-child {
        padding-right: 7px;
    }

    .swipe-note-cell,
    .swipe-sale-id-cell {
        padding-right: 8px;
        padding-left: 8px;
    }

    .transaction-swipe-grid .swipe-date-cell,
    .transaction-swipe-grid .swipe-classification-cell {
        padding-right: 2px;
        padding-left: 2px;
    }

    .transaction-swipe-grid .swipe-date-cell {
        font-size: clamp(8.5px, 2.35vw, 10px);
        white-space: nowrap;
    }

    .transaction-swipe-grid .swipe-amount-cell {
        padding-right: 3px;
        padding-left: 2px;
        font-size: clamp(7.75px, 2.2vw, 9.5px);
    }

    .transaction-swipe-grid .swipe-note-cell {
        padding-right: 5px;
        padding-left: 5px;
    }

    .swipe-amount-cell,
    .swipe-quantity-cell,
    .swipe-total-cell {
        font-size: clamp(8.25px, 2.35vw, 10px);
        letter-spacing: -.025em;
    }

    .swipe-action {
        min-height: 47px;
    }

    .sales-page-table tbody .swipe-table-cell,
    .sales-page-table .swipe-row-shell,
    .sales-page-table .sales-swipe-grid {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
    }

    .sales-page-table tbody .swipe-table-cell {
        border-bottom: 0;
    }

    .sales-swipe-grid .swipe-data-cell {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
        padding-top: 2px;
        padding-bottom: 2px;
        line-height: 1.15;
        white-space: nowrap;
    }

    .sales-swipe-grid .swipe-sale-id-cell {
        overflow: hidden;
        padding-right: 6px;
        padding-left: 6px;
        font-size: clamp(8.5px, 2.35vw, 10px);
        overflow-wrap: normal;
        text-overflow: ellipsis;
    }

    .sales-swipe-grid .swipe-date-cell {
        font-size: clamp(9px, 2.35vw, 10px);
    }

    .sales-swipe-grid .swipe-quantity-cell {
        padding-right: 5px;
        padding-left: 5px;
    }

    .sales-page-table .swipe-action {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
    }

    .transaction-page-table th:nth-child(1),
    .transaction-page-table td:nth-child(1) {
        width: 19%;
    }

    .transaction-page-table th:nth-child(2),
    .transaction-page-table td:nth-child(2) {
        width: 16%;
    }

    .transaction-page-table th:nth-child(3),
    .transaction-page-table td:nth-child(3) {
        width: 23%;
    }

    .transaction-page-table th:nth-child(4),
    .transaction-page-table td:nth-child(4) {
        width: 42%;
    }

    .transaction-page-table thead th {
        padding-right: 3px;
        padding-left: 3px;
    }

    .transaction-page-table thead th,
    .sales-page-table thead th {
        height: 26px;
        padding-top: 3px;
        padding-bottom: 3px;
        font-size: clamp(7px, 2.05vw, 8.5px);
        line-height: 1.15;
    }

    .transaction-page-table td:nth-child(3) {
        font-size: clamp(8.25px, 2.35vw, 10px);
        letter-spacing: -.025em;
        white-space: nowrap;
    }

    .transaction-page-table .desktop-date {
        display: inline;
        white-space: nowrap;
    }

    .transaction-page-table .mobile-date {
        display: none;
    }

    .transaction-page-table td:nth-child(4),
    .sales-page-table td:nth-child(2) {
        overflow-wrap: anywhere;
    }

    .transaction-page-table tbody td:nth-child(4),
    .sales-page-table tbody td:nth-child(2) {
        padding-left: 8px;
        padding-right: 8px;
    }

    .transaction-kind {
        height: 22px;
        min-height: 22px;
        justify-content: center;
        overflow: hidden;
        padding: 0 3px;
        font-size: clamp(6.75px, 2vw, 7.5px);
        letter-spacing: -.015em;
        line-height: 1;
        text-align: center;
        white-space: nowrap;
    }

    .currency-unit {
        display: none;
    }

    .sales-page-table th:nth-child(1),
    .sales-page-table td:nth-child(1) {
        width: 20%;
    }

    .sales-page-table th:nth-child(2),
    .sales-page-table td:nth-child(2) {
        width: 28%;
    }

    .sales-page-table th:nth-child(3),
    .sales-page-table td:nth-child(3) {
        width: 21%;
    }

    .sales-page-table th:nth-child(4),
    .sales-page-table td:nth-child(4) {
        width: 31%;
    }

    .sales-page-table .desktop-date {
        display: inline;
        white-space: nowrap;
    }

    .sales-page-table .mobile-date {
        display: none;
    }

    .sales-page-table td:nth-child(3) {
        font-size: clamp(8.25px, 2.35vw, 10px);
        letter-spacing: -.02em;
        white-space: nowrap;
    }

    .sales-page-table td:nth-child(4) {
        font-size: clamp(8.25px, 2.35vw, 10px);
        letter-spacing: -.025em;
        white-space: nowrap;
    }

    .module-table tbody .empty-table-row {
        display: table-row;
    }

    .module-table tbody .empty-table-cell {
        display: table-cell;
    }

    .module-table tbody .empty-table-cell::before {
        display: none;
    }

    .empty-table-content {
        position: static;
        width: 100%;
        min-height: 125px;
    }

    .formula-note {
        padding-right: 12px;
        padding-left: 12px;
        font-size: 8px;
        line-height: 1.45;
    }

    .asset-table-hint {
        padding: 7px 10px;
        font-size: 8px;
    }

    .asset-detail-table thead th {
        padding: 7px 4px;
        font-size: clamp(6.25px, 1.9vw, 8px);
        letter-spacing: -.01em;
        line-height: 1.15;
        text-align: center;
        white-space: normal;
    }

    .savings-detail-table thead th {
        padding: 6px 4px;
        font-size: clamp(8.5px, 2.35vw, 10px);
    }

    .debt-detail-table thead th {
        overflow: hidden;
        overflow-wrap: anywhere;
    }

    .asset-detail-table .swipe-data-cell {
        height: 44px;
        min-height: 44px;
        padding: 5px 3px;
        font-size: clamp(7.25px, 2.15vw, 9px);
        letter-spacing: -.02em;
        line-height: 1.1;
        white-space: nowrap;
    }

    .savings-detail-table .swipe-data-cell {
        padding: 5px 4px;
        font-size: clamp(8.5px, 2.5vw, 10.5px);
    }

    .asset-detail-table .swipe-date-cell {
        font-size: clamp(7.25px, 2.1vw, 9px);
    }

    .savings-detail-table .swipe-date-cell {
        font-size: clamp(8.5px, 2.5vw, 10.5px);
    }

    .asset-detail-table .swipe-action {
        min-height: 44px;
    }

    .cash-detail-modal {
        max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top)));
    }

    .cash-period-section {
        padding: 12px 14px 0;
    }

    .cash-period-section .detail-row {
        min-height: 40px;
    }

    .cash-closing-total {
        margin-top: 11px;
        padding: 12px 14px 10px;
    }

    .cash-closing-total span {
        font-size: 14px;
    }

    .cash-closing-total strong {
        font-size: 20px;
    }

    .cash-bank-header {
        gap: 8px;
        padding: 11px 14px 8px;
    }

    .cash-bank-header h3 {
        font-size: 14px;
        white-space: normal;
    }

    .cash-bank-add {
        min-height: 36px;
        padding: 0 9px;
        font-size: 9px;
    }

    .cash-bank-hint,
    .cash-bank-warning {
        padding: 7px 14px;
        font-size: 8px;
    }

    .cash-bank-table .swipe-data-cell,
    .cash-bank-primary-row td {
        height: 44px;
        min-height: 44px;
        padding: 6px 9px;
        font-size: clamp(9px, 2.6vw, 11px);
    }

    .cash-bank-amount-cell,
    .cash-bank-primary-row td:last-child {
        padding-right: 11px !important;
        font-size: clamp(9px, 2.55vw, 10.5px) !important;
    }

    .cash-bank-name-cell,
    .cash-bank-primary-row td:first-child {
        padding-left: 11px !important;
    }

    .cash-bank-lock {
        font-size: 7px;
    }

    .swipe-debt-note-cell {
        padding-right: 5px !important;
        padding-left: 5px !important;
        text-overflow: ellipsis;
    }

    .swipe-saving-amount-cell,
    .swipe-principal-cell,
    .swipe-debt-total-cell {
        padding-right: 5px !important;
        padding-left: 3px !important;
        font-size: clamp(6.75px, 2vw, 8.5px) !important;
    }

    .savings-detail-table .swipe-saving-amount-cell {
        padding-right: 5px !important;
        padding-left: 4px !important;
        font-size: clamp(8.25px, 2.35vw, 10px) !important;
    }

    .swipe-rate-cell {
        padding-right: 2px !important;
        padding-left: 2px !important;
    }

    .asset-detail-total {
        min-height: 50px;
        padding: 9px 12px max(9px, env(safe-area-inset-bottom));
    }

    .asset-detail-total span {
        font-size: 9px;
    }

    .asset-detail-total strong {
        font-size: 16px;
    }

    #modal-savings-form .asset-entry-modal,
    #modal-debt-form .asset-entry-modal,
    #modal-bank-form .asset-entry-modal {
        display: grid;
        max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top)));
        grid-template-rows: auto auto minmax(0, 1fr);
        overflow: hidden;
    }

    #modal-savings-form .asset-entry-modal::before,
    #modal-debt-form .asset-entry-modal::before,
    #modal-bank-form .asset-entry-modal::before {
        grid-row: 1;
    }

    #modal-savings-form .modal-header,
    #modal-debt-form .modal-header,
    #modal-bank-form .modal-header {
        position: static;
        grid-row: 2;
        min-height: 62px;
        padding: 8px 14px;
    }

    .asset-entry-form {
        display: grid;
        min-height: 0;
        grid-row: 3;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .asset-entry-form .modal-body {
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 14px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .asset-entry-form .form-grid {
        gap: 10px;
    }

    #modal-savings-form .form-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        grid-auto-rows: minmax(72px, auto);
        align-content: start;
        align-items: start;
    }

    #modal-debt-form .form-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        grid-auto-rows: minmax(72px, auto);
        align-content: start;
        align-items: start;
    }

    #modal-savings-form .form-grid > label,
    #modal-debt-form .form-grid > label {
        min-width: 0;
    }

    #modal-savings-form .savings-date-field {
        grid-area: 1 / 1 / auto / span 4;
    }

    #modal-savings-form .savings-rate-field {
        grid-area: 1 / 5 / auto / span 4;
    }

    #modal-savings-form .savings-term-field {
        grid-area: 2 / 5 / auto / span 4;
    }

    #modal-savings-form .savings-amount-field {
        grid-area: 2 / 1 / auto / span 4;
    }

    #modal-debt-form .debt-date-field {
        grid-area: 1 / 1 / auto / span 4;
    }

    #modal-debt-form .debt-due-date-field {
        grid-area: 1 / 5 / auto / span 4;
    }

    #modal-debt-form .debt-note-field {
        grid-area: 3 / 1 / auto / span 8;
    }

    #modal-debt-form .debt-principal-field {
        grid-area: 2 / 5 / auto / span 4;
    }

    #modal-debt-form .debt-rate-field {
        grid-area: 2 / 1 / auto / span 4;
    }

    #modal-savings-form .form-grid > label,
    #modal-debt-form .form-grid > label {
        display: grid;
        height: 72px;
        min-height: 72px;
        max-height: 72px;
        grid-template-rows: 18px 48px;
        align-content: start;
        gap: 6px;
    }

    #modal-savings-form .form-grid > label > span,
    #modal-debt-form .form-grid > label > span {
        min-height: 18px;
        overflow: hidden;
        line-height: 18px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .asset-entry-form input {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        min-height: 48px;
        box-sizing: border-box;
        font-size: 16px;
    }

    #modal-savings-form .form-grid > label > input,
    #modal-debt-form .form-grid > label > input {
        height: 48px;
        block-size: 48px;
        min-height: 48px;
        min-block-size: 48px;
        max-height: 48px;
        max-block-size: 48px;
        flex: 0 0 48px;
    }

    .asset-entry-form input[type="date"] {
        width: 100%;
        inline-size: 100%;
        min-inline-size: 0;
        max-inline-size: 100%;
        padding: 0;
        overflow: hidden;
        letter-spacing: -.02em;
        text-indent: 9px;
    }

    .asset-entry-form input[type="date"]::-webkit-date-and-time-value {
        min-width: 0;
        padding-left: 9px;
        box-sizing: border-box;
        text-align: left;
    }

    /* Một box model duy nhất cho toàn bộ control nhìn thấy trên Chrome iOS. */
    #transactionForm .transaction-date-field > input,
    #transactionForm .field-full > input,
    #transactionForm .classification-select-shell > select,
    #saleForm .modal-body > label > input,
    .asset-entry-form .form-grid > label > input {
        height: var(--popup-control-height);
        block-size: var(--popup-control-height);
        min-height: var(--popup-control-height);
        min-block-size: var(--popup-control-height);
        max-height: var(--popup-control-height);
        max-block-size: var(--popup-control-height);
        box-sizing: border-box;
    }

    #transactionForm .money-field,
    #salesSettingsForm .money-field,
    #salesSettingsForm .settings-threshold-control,
    #salesSettingsForm .percent-field {
        height: var(--popup-control-height);
        min-height: var(--popup-control-height);
        max-height: var(--popup-control-height);
        box-sizing: border-box;
    }

    #transactionForm .money-field > input,
    #salesSettingsForm .money-field > input,
    #salesSettingsForm .settings-threshold-control > input,
    #salesSettingsForm .percent-field > input {
        height: var(--popup-control-content-height);
        block-size: var(--popup-control-content-height);
        min-height: var(--popup-control-content-height);
        min-block-size: var(--popup-control-content-height);
        max-height: var(--popup-control-content-height);
        max-block-size: var(--popup-control-content-height);
        box-sizing: border-box;
    }

    .date-control-shell {
        width: 100%;
        height: var(--popup-control-height);
        min-width: 0;
        min-height: var(--popup-control-height);
        max-height: var(--popup-control-height);
        border-radius: 10px;
        color: var(--slate-900);
        font-size: 16px;
        font-weight: 400;
        line-height: var(--popup-control-content-height);
    }

    #transactionForm .date-control-shell > #transactionDate,
    #saleForm .date-control-shell > #saleDate,
    .asset-entry-form .date-control-shell > input[type="date"] {
        width: 100%;
        height: var(--popup-control-content-height);
        min-width: 0;
        min-height: var(--popup-control-content-height);
        max-width: 100%;
        max-height: var(--popup-control-content-height);
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        box-sizing: border-box;
        font-size: 16px;
        font-weight: 400;
        letter-spacing: normal;
        line-height: normal;
        text-indent: 6px;
    }

    #transactionForm .date-control-shell > #transactionDate::-webkit-date-and-time-value,
    #saleForm .date-control-shell > #saleDate::-webkit-date-and-time-value,
    .asset-entry-form .date-control-shell > input[type="date"]::-webkit-date-and-time-value {
        height: 1.5em;
        min-height: 1.5em;
        margin: 0;
        padding: 0;
        align-self: center;
        line-height: 1.5;
        text-align: left;
    }

    .asset-entry-form .modal-footer {
        position: static;
        padding: 9px 14px max(9px, env(safe-area-inset-bottom));
    }

    .asset-entry-form .modal-footer button {
        min-height: 46px;
        flex: 1 1 0;
        font-size: 14px;
    }

    .finance-page {
        gap: 12px;
    }

    .finance-module-header {
        min-height: 66px;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .finance-module-header .module-heading {
        min-width: 0;
        flex: 1 1 auto;
    }

    .finance-module-header .module-accent-title {
        font-size: clamp(17px, 5vw, 20px);
    }

    .finance-header-actions {
        width: 116px;
        min-width: 116px;
        flex: 0 0 116px;
    }

    .finance-header-actions .finance-period-picker {
        width: 100%;
        flex: 0 0 100%;
    }

    .finance-period-picker select {
        height: 48px;
        min-height: 48px;
        padding-right: 22px;
        padding-left: 5px;
        font-size: 15px;
        letter-spacing: -.025em;
    }

    .finance-period-picker label::after {
        right: 10px;
    }

    .cf-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .cf-kpi-card {
        min-height: 70px;
        gap: 7px;
        padding: 8px 9px 8px;
        border-radius: 10px;
    }

    .cf-kpi-card::after {
        right: -34px;
        bottom: -48px;
        width: 96px;
        height: 96px;
        border-width: 18px;
    }

    .cf-kpi-card > span {
        font-size: clamp(7px, 2.2vw, 8.5px);
    }

    .cf-kpi-card > span small {
        font-size: clamp(6.5px, 2vw, 8px);
    }

    .cf-kpi-card > strong {
        right: 9px;
        width: calc(100% - 18px);
        font-size: clamp(15px, 4.8vw, 20px);
    }

    .cf-table-card {
        border-radius: 12px;
    }

    .cf-table-header {
        min-height: 48px;
        padding: 7px 10px;
    }

    .cf-table-header h2 {
        font-size: clamp(12px, 3.65vw, 15px);
        line-height: 1.15;
    }

    .cf-crud-table-header {
        min-height: 62px;
    }

    .cf-table th {
        height: 26px;
        padding: 3px 2px;
        font-size: clamp(6.5px, 1.95vw, 8.25px);
        letter-spacing: .015em;
        line-height: 1.1;
        text-align: center;
        white-space: nowrap;
    }

    .cf-table td {
        height: 42px;
        padding: 7px 3px;
        font-size: clamp(8px, 2.35vw, 10px);
        letter-spacing: -.025em;
        line-height: 1.15;
    }

    .cf-allocation-table td:first-child,
    .cf-position-table td:nth-child(1),
    .cf-position-table td:nth-child(2),
    .cf-transaction-table td:nth-child(3) {
        padding-right: 5px;
        padding-left: 5px;
    }

    .cf-allocation-table thead th,
    .cf-allocation-table thead th.number-cell {
        height: 32px;
        padding: 5px 3px;
        font-size: clamp(9.5px, 2.55vw, 10.5px);
        letter-spacing: .01em;
        text-align: center !important;
    }

    .cf-performance-table thead th,
    .cf-performance-table thead th.number-cell {
        height: 32px;
        padding: 5px 3px;
        font-size: clamp(9.5px, 2.55vw, 10.5px);
        letter-spacing: .01em;
        text-align: center !important;
    }

    .cf-position-table thead th,
    .cf-position-table thead th.number-cell,
    .cf-transaction-table thead th,
    .cf-transaction-table thead th.number-cell {
        height: 32px;
        padding: 5px 3px;
        font-size: clamp(9.5px, 2.55vw, 10.5px);
        letter-spacing: .01em;
        text-align: center !important;
    }

    .cf-position-table .cf-kind-badge {
        width: min(78px, 100%);
        min-height: 24px;
        padding: 3px 4px;
        font-size: clamp(8.5px, 2.35vw, 9.5px);
        white-space: nowrap;
    }

    .cf-transaction-table .cf-transaction-badge {
        width: min(88px, 100%);
        min-height: 24px;
        padding: 3px 4px;
        font-size: clamp(7.5px, 2vw, 8.5px);
        white-space: nowrap;
    }

    .cf-position-swipe-grid .swipe-data-cell.cf-position-kind-cell,
    .cf-transaction-swipe-grid .swipe-data-cell.cf-transaction-type-cell {
        justify-content: center;
        padding-right: 3px;
        padding-left: 3px;
        text-align: center;
    }

    .cf-allocation-table .cf-kind-badge {
        width: min(108px, 100%);
        min-height: 24px;
        padding: 3px 6px;
        font-size: clamp(8.5px, 2.35vw, 9.5px);
        white-space: nowrap;
    }

    .cf-position-table td:nth-child(3),
    .cf-position-table td:nth-child(4),
    .cf-transaction-table td:nth-child(4) {
        padding-right: 3px;
        padding-left: 2px;
        font-size: clamp(7.5px, 2.15vw, 9.25px);
    }

    .cf-performance-table td:nth-child(n + 2),
    .cf-allocation-table td:nth-child(2) {
        font-size: clamp(7.75px, 2.25vw, 9.5px);
    }

    .cf-kind-badge,
    .cf-type-badge,
    .cf-transaction-badge {
        min-height: 19px;
        padding: 2px 3px;
        font-size: clamp(6px, 1.9vw, 7.75px);
        white-space: normal;
    }

    .cf-position-swipe-grid .swipe-data-cell,
    .cf-transaction-swipe-grid .swipe-data-cell {
        min-height: 44px;
        padding: 6px 3px;
        font-size: clamp(8px, 2.35vw, 10px);
        line-height: 1.15;
    }

    .cf-position-swipe-grid .swipe-data-cell:nth-child(1),
    .cf-position-swipe-grid .swipe-data-cell:nth-child(2),
    .cf-transaction-swipe-grid .swipe-data-cell:nth-child(3) {
        padding-right: 5px;
        padding-left: 5px;
    }

    .cf-position-swipe-grid .swipe-data-cell:nth-child(n + 3),
    .cf-transaction-swipe-grid .swipe-data-cell:nth-child(4) {
        padding-right: 3px;
        padding-left: 2px;
        font-size: clamp(7.5px, 2.15vw, 9.25px);
    }

    .cf-position-table .swipe-action,
    .cf-transaction-table .swipe-action {
        min-height: 44px;
    }

    .cf-entry-modal {
        display: grid;
        max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top)));
        grid-template-rows: auto auto minmax(0, 1fr);
        overflow: hidden;
    }

    .cf-entry-modal::before {
        grid-row: 1;
    }

    .cf-entry-modal .modal-header {
        position: static;
        grid-row: 2;
        min-height: 62px;
        padding: 8px 14px;
    }

    .cf-entry-modal .modal-header h2 {
        font-size: 17px;
    }

    .cf-entry-form {
        grid-row: 3;
    }

    .cf-entry-form .modal-body {
        padding: 14px;
        scroll-padding-block: 12px;
    }

    .cf-entry-form .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .cf-entry-form .field-full {
        grid-column: 1 / -1;
    }

    .cf-entry-form .form-grid label,
    .cf-entry-form .form-grid .field-group {
        min-width: 0;
        max-width: 100%;
    }

    .cf-entry-form .form-grid label > span,
    .cf-entry-form .form-grid .field-group > span {
        overflow: hidden;
        font-size: clamp(8px, 2.4vw, 10px);
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .cf-entry-form .form-grid input,
    .cf-entry-form .form-grid select {
        min-width: 0;
        max-width: 100%;
        padding-right: 8px;
        padding-left: 8px;
        font-size: 16px;
    }

    .cf-entry-form .money-field input,
    .cf-entry-form .percent-field input {
        padding-right: 5px;
        padding-left: 8px;
        font-size: 16px;
    }

    .cf-entry-form .money-field b,
    .cf-entry-form .percent-field b {
        padding-right: 9px;
        font-size: 12px;
    }

    .cf-entry-form .date-control-shell > input[type="date"] {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding: 0;
        background: transparent;
        font-size: 16px;
        text-indent: 6px;
    }

    .cf-entry-form .date-control-shell > input[type="date"]::-webkit-date-and-time-value {
        height: 1.5em;
        min-height: 1.5em;
        margin: 0;
        padding: 0;
        align-self: center;
        line-height: 1.5;
        text-align: left;
    }

    .cf-entry-form .form-error {
        margin-top: 10px;
    }

    .cf-entry-form .modal-footer {
        padding: 9px 14px max(9px, env(safe-area-inset-bottom));
    }

    .cf-entry-form .modal-footer button {
        min-height: 48px;
        flex: 1 1 0;
        font-size: 14px;
    }
}

@media (max-width: 389px) {
    .bottom-nav-inner {
        gap: 1px;
    }

    .bottom-nav button {
        padding-right: 0;
        padding-left: 0;
    }

    .warehouse-overview-title-row {
        gap: 5px;
    }

    .warehouse-overview-header h2 {
        font-size: 17px;
    }

    .warehouse-updated-label {
        font-size: 9.5px;
    }

    .transaction-period-picker select {
        padding-right: 17px;
        padding-left: 2px;
        font-size: 14px;
    }

    .sales-period-picker select {
        padding-right: 15px;
        padding-left: 1px;
        font-size: 13px;
    }

    .sales-settings-button,
    .warehouse-overview-button {
        padding-right: 2px;
        padding-left: 2px;
        font-size: 10px;
    }

    .transaction-period-picker label::after,
    .sales-period-picker label::after {
        right: 8px;
    }

    #modal-savings-form .form-grid,
    #modal-debt-form .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    #modal-savings-form .form-grid > label,
    #modal-debt-form .form-grid > label {
        grid-column: 1;
        grid-row: auto;
    }
}

@media (max-width: 380px) {
    .brand-dot {
        display: none;
    }

    .app-header {
        gap: 6px;
        padding: 8px;
    }

    .app-header h1 {
        font-size: 20px;
    }

    .home-header-controls {
        gap: 4px;
    }

    .year-picker select {
        width: 86px;
        min-width: 86px;
        padding-right: 19px;
        padding-left: 3px;
        font-size: 11.5px;
    }

    .year-picker::after {
        right: 7px;
    }

    .session-popover {
        right: -8px;
    }

    .card-caption {
        font-size: 8px;
    }

}

/* Hạ tầng · License và Đường truyền */
.infrastructure-license-header,
.infrastructure-connection-header {
    min-height: 52px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.infrastructure-license-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.infrastructure-connection-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.infrastructure-connection-table th:nth-child(1) { width: 18%; }
.infrastructure-connection-table th:nth-child(2) { width: 30%; }
.infrastructure-connection-table th:nth-child(3) { width: 14%; }
.infrastructure-connection-table th:nth-child(4) { width: 18%; }
.infrastructure-connection-table th:nth-child(5) { width: 20%; }

.infrastructure-license-table th:nth-child(1) { width: 30%; }
.infrastructure-license-table th:nth-child(2) { width: 18%; }
.infrastructure-license-table th:nth-child(3) { width: 17%; }
.infrastructure-license-table th:nth-child(4) { width: 17%; }
.infrastructure-license-table th:nth-child(5) { width: 18%; }

.infrastructure-license-table thead th,
.infrastructure-connection-table thead th {
    text-align: center !important;
    vertical-align: middle;
}

.infrastructure-license-swipe-grid {
    grid-template-columns: 30fr 18fr 17fr 17fr 18fr;
}

.infrastructure-connection-swipe-grid {
    grid-template-columns: 18fr 30fr 14fr 18fr 20fr;
}

.infrastructure-license-table .swipe-data-cell {
    min-height: 48px;
    padding: 8px 7px;
    font-size: 11px;
}

.infrastructure-connection-table .swipe-data-cell {
    min-height: 48px;
    padding: 8px 7px;
    font-size: 11px;
}

.infrastructure-license-name-cell {
    justify-content: flex-start;
    color: var(--slate-800);
    font-weight: 800;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.infrastructure-connection-plan-cell,
.infrastructure-connection-account-cell {
    justify-content: flex-start;
    color: var(--slate-800);
    font-weight: 800;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.infrastructure-license-price-cell {
    justify-content: flex-end;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.infrastructure-license-date-cell,
.infrastructure-license-countdown-cell {
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.infrastructure-connection-term-cell,
.infrastructure-connection-date-cell,
.infrastructure-connection-countdown-cell {
    justify-content: center;
    text-align: center;
}

.infrastructure-connection-term-cell,
.infrastructure-connection-date-cell {
    white-space: nowrap;
}

.infrastructure-license-countdown,
.infrastructure-connection-countdown {
    display: inline-flex;
    min-width: 0;
    min-height: 23px;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
}

.infrastructure-connection-countdown {
    max-width: 100%;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.infrastructure-license-countdown.is-active,
.infrastructure-connection-countdown.is-active {
    background: #dcfce7;
    color: #15803d;
}

.infrastructure-license-countdown.is-warning,
.infrastructure-connection-countdown.is-warning {
    background: #ffedd5;
    color: #c2410c;
}

.infrastructure-license-countdown.is-today,
.infrastructure-license-countdown.is-expired,
.infrastructure-connection-countdown.is-today,
.infrastructure-connection-countdown.is-expired {
    background: #fee2e2;
    color: #b91c1c;
}

.infrastructure-license-actions {
    width: 128px;
    grid-template-columns: 76px 52px;
}

.infrastructure-connection-actions {
    width: 104px;
    grid-template-columns: 52px 52px;
}

.swipe-action-renew {
    background: #2563eb;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: -.01em;
    white-space: nowrap;
}

.infrastructure-license-form .modal-body,
.infrastructure-connection-form .modal-body {
    min-width: 0;
}

.infrastructure-license-form-grid input,
.infrastructure-license-form-grid .money-field,
.infrastructure-license-form-grid .date-control-shell {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    box-sizing: border-box;
}

.infrastructure-connection-form-grid input,
.infrastructure-connection-form-grid .date-control-shell,
.infrastructure-connection-form-grid .infrastructure-connection-term-control {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    box-sizing: border-box;
}

.infrastructure-license-form-grid .money-field input,
.infrastructure-license-form-grid .date-control-shell > input[type="date"] {
    height: 46px;
    min-height: 46px;
    max-height: 46px;
}

.infrastructure-connection-form-grid .date-control-shell > input[type="date"],
.infrastructure-connection-term-control > input {
    height: 46px;
    min-height: 46px;
    max-height: 46px;
}

.infrastructure-connection-term-control {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    background: var(--white);
}

.infrastructure-connection-term-control > input {
    min-width: 0;
    padding-right: 4px;
    border: 0;
    box-shadow: none !important;
}

.infrastructure-connection-term-control > b {
    padding-right: 10px;
    color: var(--slate-500);
    font-size: 11px;
    white-space: nowrap;
}

.infrastructure-connection-term-control:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgb(37 99 235 / 11%);
}

html[data-theme="dark"] .infrastructure-license-countdown.is-active,
html[data-theme="dark"] .infrastructure-connection-countdown.is-active {
    background: rgb(22 101 52 / 30%);
    color: #86efac;
}

html[data-theme="dark"] .infrastructure-license-countdown.is-warning,
html[data-theme="dark"] .infrastructure-connection-countdown.is-warning {
    background: rgb(154 52 18 / 32%);
    color: #fdba74;
}

html[data-theme="dark"] .infrastructure-license-countdown.is-today,
html[data-theme="dark"] .infrastructure-license-countdown.is-expired,
html[data-theme="dark"] .infrastructure-connection-countdown.is-today,
html[data-theme="dark"] .infrastructure-connection-countdown.is-expired {
    background: rgb(153 27 27 / 32%);
    color: #fca5a5;
}

@media (max-width: 767px) {
    .infrastructure-page {
        gap: 10px;
    }

    .infrastructure-license-header,
    .infrastructure-connection-header {
        min-height: 48px;
        padding: 6px 10px;
    }

    .infrastructure-license-header h2,
    .infrastructure-connection-header h2 {
        font-size: 13px;
    }

    .infrastructure-license-table-scroll,
    .infrastructure-connection-table-scroll {
        overflow: hidden;
    }

    .infrastructure-license-table,
    .infrastructure-connection-table {
        display: table;
        font-size: 9px;
    }

    .infrastructure-license-table thead th,
    .infrastructure-connection-table thead th {
        height: 32px;
        padding: 4px 2px;
        font-size: clamp(7px, 1.95vw, 8px);
        line-height: 1.05;
        letter-spacing: 0;
    }

    .infrastructure-license-table .swipe-table-cell,
    .infrastructure-connection-table .swipe-table-cell {
        height: 44px;
        border-bottom: 0;
    }

    .infrastructure-license-table .swipe-row-shell,
    .infrastructure-license-swipe-grid,
    .infrastructure-connection-table .swipe-row-shell,
    .infrastructure-connection-swipe-grid {
        height: 44px;
    }

    .infrastructure-license-table .swipe-data-cell,
    .infrastructure-license-table .swipe-action,
    .infrastructure-connection-table .swipe-data-cell,
    .infrastructure-connection-table .swipe-action {
        height: 44px;
        min-height: 44px;
        max-height: 44px;
    }

    .infrastructure-license-table .swipe-data-cell,
    .infrastructure-connection-table .swipe-data-cell {
        padding: 3px;
        line-height: 1;
    }

    .infrastructure-license-name-cell {
        padding-left: 6px !important;
        font-size: clamp(8.5px, 2.35vw, 10px) !important;
    }

    .infrastructure-license-price-cell {
        padding-right: 4px !important;
        font-size: clamp(7.5px, 2.15vw, 9px) !important;
    }

    .infrastructure-license-date-cell {
        font-size: clamp(7px, 1.95vw, 8.25px) !important;
        letter-spacing: -.025em;
    }

    .infrastructure-license-countdown-cell {
        padding-right: 2px !important;
        padding-left: 2px !important;
    }

    .infrastructure-license-countdown {
        min-height: 20px;
        padding: 0 4px;
        font-size: clamp(6.5px, 1.8vw, 7.5px);
    }

    .infrastructure-connection-plan-cell,
    .infrastructure-connection-account-cell {
        padding-left: 5px !important;
        font-size: clamp(7.75px, 2.15vw, 9.25px) !important;
    }

    .infrastructure-connection-term-cell {
        padding: 2px !important;
        font-size: clamp(7px, 1.95vw, 8.25px) !important;
        line-height: 1.05;
    }

    .infrastructure-connection-date-cell {
        padding: 2px !important;
        font-size: clamp(7px, 1.95vw, 8.25px) !important;
        letter-spacing: -.025em;
    }

    .infrastructure-connection-countdown-cell {
        padding: 2px !important;
    }

    .infrastructure-connection-countdown {
        min-height: 20px;
        padding: 0 4px;
        font-size: clamp(6.5px, 1.8vw, 7.5px);
    }

    .infrastructure-license-modal,
    .infrastructure-connection-modal {
        display: grid;
        max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top)));
        grid-template-rows: auto auto minmax(0, 1fr);
        overflow: hidden;
    }

    .infrastructure-license-modal::before,
    .infrastructure-connection-modal::before {
        grid-row: 1;
    }

    .infrastructure-license-modal .modal-header,
    .infrastructure-connection-modal .modal-header {
        position: static;
        grid-row: 2;
        min-height: 62px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .infrastructure-license-form,
    .infrastructure-connection-form {
        display: grid;
        min-height: 0;
        grid-row: 3;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .infrastructure-license-form .modal-body,
    .infrastructure-connection-form .modal-body {
        min-height: 0;
        overflow-y: auto;
        padding-top: 14px;
        padding-bottom: 14px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .infrastructure-license-form-grid,
    .infrastructure-connection-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .infrastructure-license-form-grid .field-full,
    .infrastructure-connection-form-grid .field-full {
        grid-column: 1 / -1;
    }

    .infrastructure-license-form-grid > label,
    .infrastructure-connection-form-grid > label {
        display: grid;
        height: 71px;
        min-width: 0;
        grid-template-rows: 17px 48px;
        align-content: start;
        gap: 6px;
    }

    .infrastructure-license-form-grid input,
    .infrastructure-license-form-grid .money-field,
    .infrastructure-license-form-grid .date-control-shell,
    .infrastructure-connection-form-grid input,
    .infrastructure-connection-form-grid .date-control-shell,
    .infrastructure-connection-form-grid .infrastructure-connection-term-control {
        width: 100%;
        min-width: 0;
        font-size: 16px;
    }

    .infrastructure-license-form .modal-footer,
    .infrastructure-connection-form .modal-footer {
        position: static;
        padding-top: 9px;
        padding-bottom: max(9px, env(safe-area-inset-bottom));
    }

    .infrastructure-license-form .modal-footer button,
    .infrastructure-connection-form .modal-footer button {
        min-width: 0;
        min-height: 46px;
        flex: 1 1 0;
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
