:root {
    --bg: #f8fafc;
    --panel: #ffffff;
    --panel-soft: #f1f5f9;
    --text: #020817;
    --muted: #64748b;
    --line: #dfe5ed;
    --primary: #0572de;
    --primary-dark: #0757b8;
    --success: #05a660;
    --info: #0b6bdc;
    --warning: #b45309;
    --danger: #ef4444;
    --sidebar-width: 256px;
    --sidebar-collapsed-width: 84px;
    --shadow: none;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    transition: grid-template-columns .22s ease;
}

body.sidebar-collapsed .shell {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #fff;
    color: var(--text);
    border-right: 1px solid var(--line);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.sidebar-head {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark,
.avatar {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #0b6bdc;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    overflow: hidden;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand-copy,
.user-copy,
.nav-text {
    min-width: 0;
    transition: opacity .14s ease, transform .18s ease;
}

.brand-title {
    display: block;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}

.brand-subtitle,
.muted {
    color: var(--muted);
}

.sidebar .brand-subtitle {
    color: var(--muted);
    font-size: 12px;
}

.sidebar-toggle {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #4b5563;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.sidebar-toggle:hover {
    background: #f3f6f9;
    color: var(--info);
}

.nav {
    display: grid;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    scrollbar-width: thin;
}

.nav-link {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background .16s ease, color .16s ease, padding .18s ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: #eaf3ff;
    color: #006fe6;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--line);
}

.user-chip {
    min-height: 42px;
    padding: 7px 12px;
    border-radius: 8px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.user-initial {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-radius: 8px;
    background: #eef2f7;
    color: #334155;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 900;
}

.user-copy {
    display: grid;
    gap: 2px;
}

.user-copy strong,
.user-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-copy span {
    color: var(--muted);
    font-size: 12px;
}

.logout-link {
    color: #4b5563;
}

body.sidebar-collapsed .sidebar {
    padding-inline: 0;
}

body.sidebar-collapsed .sidebar-head {
    min-height: 94px;
    display: grid;
    grid-template-columns: 40px 30px;
    justify-items: center;
    align-items: center;
    align-content: start;
    gap: 6px;
    justify-content: center;
    padding: 16px 4px 12px;
}

body.sidebar-collapsed .brand {
    justify-content: center;
}

body.sidebar-collapsed .brand-mark {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .user-copy {
    opacity: 0;
    transform: translateX(-8px);
    width: 0;
    pointer-events: none;
}

body.sidebar-collapsed .sidebar-toggle {
    position: static;
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    z-index: 1;
    border-radius: 8px;
    box-shadow: none;
    background: #f8fafc;
}

body.sidebar-collapsed .sidebar-toggle .nav-icon {
    width: 17px;
    height: 17px;
    transform: rotate(180deg);
}

body.sidebar-collapsed .nav-link,
body.sidebar-collapsed .user-chip {
    justify-content: center;
    padding-inline: 0;
}

body.sidebar-collapsed .nav {
    justify-items: center;
}

body.sidebar-collapsed .nav-link {
    width: 44px;
    min-height: 44px;
    border-radius: 10px;
}

body.sidebar-collapsed .user-chip {
    width: 44px;
    min-height: 44px;
    padding: 8px;
}

body.sidebar-collapsed .logout-link {
    width: 44px;
    margin-inline: auto;
}

body.sidebar-collapsed .sidebar-footer {
    align-items: center;
}

.main {
    min-width: 0;
}

.topbar {
    display: none;
}

.content {
    width: 100%;
    margin: 0;
    padding: 32px;
}

.page-head {
    position: sticky;
    top: 0;
    z-index: 12;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin: -32px -32px 32px;
    padding: 20px 32px;
    border-bottom: 1px solid var(--line);
    background: rgba(248, 250, 252, .95);
    backdrop-filter: blur(14px);
}

.page-title {
    margin: 0 0 6px;
    font-size: clamp(20px, 2vw, 24px);
    line-height: 1.2;
    letter-spacing: 0;
}

.page-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.grid {
    display: grid;
    gap: 24px;
}

.grid.stats {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.grid.two {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, .7fr);
}

.dashboard-grid {
    align-items: stretch;
}

.dashboard-bottom {
    grid-template-columns: minmax(420px, .95fr) minmax(440px, 1fr);
    align-items: start;
}

.dashboard-bottom-custom {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
    margin-top: 16px;
}

.dashboard-bottom-custom > .card {
    height: 100%;
}

.branch-summary-card,
.recent-transactions-card {
    min-height: 360px;
}

.recent-transactions-card {
    display: flex;
    flex-direction: column;
}

.dashboard-card-head {
    min-width: 0;
    padding: 16px 16px 10px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.branch-summary-card .table-wrap {
    overflow-x: auto;
}

.branch-summary-card th,
.branch-summary-card td {
    padding: 10px 12px;
}

.recent-transactions-card .recent-list {
    padding: 0 16px 16px;
    flex: 1;
    align-content: start;
}

.recent-transactions-card .recent-row {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 14px;
}

.recent-transactions-card .recent-row > div:first-child > div:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.recent-transactions-card .recent-row strong:not(.amount) {
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.grid.filter-grid {
    grid-template-columns: repeat(5, minmax(160px, 1fr)) auto;
    align-items: end;
}

.report-filter-grid {
    grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 0;
    overflow: hidden;
}

.content > .grid[style*="margin-top:24px"] {
    margin-top: 16px !important;
}

.content > form[style*="margin-bottom:16px"],
.content > .grid[style*="margin-bottom:24px"],
.content > .grid[style*="margin-bottom:16px"] {
    margin-bottom: 14px !important;
}

.card.pad {
    padding: 24px;
}

.card > .pad:first-child {
    padding: 20px;
}

.stat {
    min-height: 156px;
    padding: 24px;
    position: relative;
    overflow: clip;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 8px;
}

.stat::after {
    content: none;
}

.stat-head {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.stat-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 9px;
    display: grid;
    place-items: center;
}

.stat-icon .nav-icon {
    width: 18px;
    height: 18px;
}

.stat-icon.info {
    background: #eaf3ff;
    color: var(--primary);
}

.stat-icon.success {
    background: #dcfce7;
    color: var(--success);
}

.stat-icon.danger {
    background: #fee2e2;
    color: var(--danger);
}

.stat-label {
    max-width: 170px;
    color: #334155;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 500;
}

.stat-value {
    margin-top: 0;
    align-self: center;
    color: #020817;
    font-size: clamp(24px, 2.2vw, 30px);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: 0;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

.stat-value.income,
.amount.income {
    color: var(--success);
}

.stat-value.expense,
.amount.expense {
    color: var(--danger);
}

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

.section-title {
    margin: 0 0 4px;
    font-size: 18px;
    line-height: 1.25;
    font-weight: 800;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 14px;
    text-transform: none;
    letter-spacing: 0;
    background: transparent;
    font-weight: 500;
}

tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #047857;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
}

.badge.gray {
    background: #eef1f0;
    color: #53605a;
}

.badge.red {
    background: #fee4e2;
    color: var(--danger);
}

.badge.blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.btn {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 14px;
    background: #fff;
    color: var(--text);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.btn.danger {
    border-color: #fda29b;
    background: #fff7f7;
    color: var(--danger);
}

.btn.info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--info);
}

.btn.success {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}

.btn.ghost {
    background: transparent;
}

.inline-form {
    display: inline;
}

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

label {
    font-size: 12px;
    font-weight: 800;
    color: #31443a;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 8px 12px;
}

[data-money-input] {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.branch-access-field {
    grid-column: 1 / -1;
}

.branch-check-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    max-height: 190px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.branch-check {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid #edf1f5;
    border-radius: 8px;
    color: #334155;
    background: #f8fafc;
}

.branch-check input {
    width: 16px;
    min-height: 16px;
    flex: 0 0 16px;
}

.branch-check span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.modal-dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: min(90vh, 760px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: transparent;
    color: var(--text);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}

.modal-dialog.delete-dialog {
    width: min(420px, calc(100vw - 32px));
}

.modal-dialog.receipt-preview-dialog {
    width: min(720px, calc(100vw - 32px));
}

.modal-dialog::backdrop {
    background: rgba(15, 23, 42, .72);
}

.modal-card {
    padding: 24px;
    background: #fff;
    display: grid;
    gap: 16px;
}

.modal-head,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: #f1f5f9;
    color: var(--text);
}

.modal-grid {
    gap: 14px;
}

.modal-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.segment {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
}

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

.payment-summary {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
}

.payment-summary span {
    color: var(--muted);
    font-size: 12px;
}

.branding-form {
    display: grid;
    gap: 24px;
}

.branding-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.branding-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.logo-preview {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    font-size: 16px;
}

.favicon-preview {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    border-radius: 10px;
}

.alert {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #bee3c8;
    background: #effaf2;
    color: var(--primary-dark);
    font-weight: 750;
}

.alert.error {
    border-color: #fecaca;
    background: #fff1f2;
    color: var(--danger);
}

.toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1000;
    width: min(420px, calc(100vw - 32px));
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 28px;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .16);
    transform: translateY(-8px);
    opacity: 0;
    animation: toast-in .22s ease forwards;
}

.toast.is-hiding {
    animation: toast-out .18s ease forwards;
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.toast-success {
    border-color: #bbf7d0;
}

.toast-success .toast-icon {
    background: #dcfce7;
    color: #047857;
}

.toast-error {
    border-color: #fecaca;
}

.toast-error .toast-icon {
    background: #fee2e2;
    color: var(--danger);
}

.toast-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.toast-copy strong {
    font-size: 14px;
    line-height: 1.2;
}

.toast-copy p,
.toast-copy ul {
    margin: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.45;
}

.toast-copy ul {
    padding-left: 18px;
}

.toast-copy small {
    color: var(--muted);
    font-size: 12px;
}

.toast-close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.toast-close:hover {
    background: #f1f5f9;
    color: var(--text);
}

@keyframes toast-in {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toast-out {
    to {
        transform: translateY(-8px);
        opacity: 0;
    }
}

.chart-bars {
    display: grid;
    gap: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 12px;
    align-items: center;
}

.bar-track {
    min-height: 26px;
    background: #eef2f7;
    border-radius: 9px;
    overflow: hidden;
    display: flex;
}

.bar-income {
    background: var(--success);
}

.bar-expense {
    background: #ef4444;
}

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

.chart-card {
    min-height: 368px;
}

.chart-bars.lovable-chart {
    min-height: 230px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: clamp(8px, 1.3vw, 16px);
    overflow-x: auto;
    padding: 8px 4px 0;
    scrollbar-width: thin;
}

.chart-column {
    flex: 1;
    min-width: 50px;
    display: grid;
    align-items: end;
    justify-items: center;
    gap: 9px;
}

.chart-pair {
    height: 178px;
    width: 100%;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    background-image: linear-gradient(to top, transparent 24.5%, rgba(203, 213, 225, .55) 25%, transparent 25.5%, transparent 49.5%, rgba(203, 213, 225, .55) 50%, transparent 50.5%, transparent 74.5%, rgba(203, 213, 225, .55) 75%, transparent 75.5%);
}

.chart-stick {
    width: min(30px, 42%);
    min-height: 4px;
    border-radius: 8px 8px 0 0;
}

.chart-stick.income {
    background: var(--success);
}

.chart-stick.expense {
    background: var(--danger);
}

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

.account-list {
    display: grid;
    gap: 9px;
}

.account-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 12px 16px;
    border: 0;
    border-radius: 10px;
    background: #f3f6fa;
    font-size: 13px;
}

.account-row > * {
    min-width: 0;
}

.account-row strong,
.account-row span {
    overflow-wrap: break-word;
}

.account-row > span,
.account-row > .amount {
    text-align: right;
    font-weight: 800;
    white-space: nowrap;
}

.recent-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
}

.recent-row > div:first-child {
    min-width: 0;
}

.recent-row strong:not(.amount) {
    line-height: 1.35;
    font-weight: 700;
}

.recent-row .muted {
    color: #475569;
    font-size: 13px;
    line-height: 1.4;
}

.recent-row > .amount {
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.recent-row:last-child {
    border-bottom: 0;
}

.detail-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0f172a;
    font-weight: 800;
}

.detail-link span {
    font-size: 20px;
    line-height: 1;
}

.link-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

.link-action span {
    font-size: 18px;
    line-height: 1;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 8px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-single {
    justify-content: flex-start;
}

.pagination-summary {
    color: var(--muted);
    font-size: 13px;
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.page-btn,
.page-ellipsis {
    min-width: 36px;
    min-height: 36px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.page-btn:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--primary);
}

.page-btn.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.page-btn.is-disabled,
.page-ellipsis {
    background: #f8fafc;
    color: #94a3b8;
    cursor: default;
}

.page-btn.is-disabled:hover {
    border-color: var(--line);
    background: #f8fafc;
    color: #94a3b8;
}

.transfer-layout {
    grid-template-columns: minmax(0, 2fr) minmax(260px, .85fr);
}

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

.title-with-icon .nav-icon {
    color: var(--primary);
}

.transfer-flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
    gap: 12px;
    align-items: end;
    margin-top: 16px;
}

.transfer-arrow {
    min-height: 36px;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.transfer-amount-grid {
    grid-template-columns: 180px minmax(0, 1fr);
    margin-top: 12px;
}

.field-hint {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.transfer-warning {
    color: var(--danger);
    font-weight: 700;
}

.info-card {
    align-self: start;
}

.info-list {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.65;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
}

.report-total {
    text-align: right;
}

.account-matrix th:not(:first-child),
.account-matrix td:not(:first-child) {
    text-align: right;
}

.total-row {
    background: #f8fafc;
    font-weight: 800;
}

.branch-filters {
    flex-wrap: nowrap;
}

.branch-filters select,
.branch-filters input {
    width: 170px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

.budget-top {
    grid-template-columns: minmax(280px, .48fr) minmax(0, 1fr);
}

.balance-card {
    min-height: 250px;
}

.balance-bars {
    height: 180px;
    margin-top: 18px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: clamp(34px, 6vw, 68px);
}

.balance-item {
    display: grid;
    justify-items: center;
    gap: 5px;
    color: #0f172a;
    font-weight: 800;
}

.balance-item strong {
    color: #475569;
    font-size: 12px;
}

.balance-item span:last-child {
    color: #0b6bdc;
}

.balance-bar {
    width: 64px;
    border-radius: 8px 8px 0 0;
    display: block;
}

.balance-bar.soft {
    background: #e8eef7;
}

.balance-bar.primary {
    background: #0b6bdc;
}

.budget-hero {
    min-height: 250px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}

.budget-hero strong {
    margin: 6px 0;
    font-size: clamp(36px, 5vw, 52px);
    line-height: 1.05;
    font-weight: 900;
}

.mini-budget-head,
.mini-budget-values,
.budget-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.mini-budget-head span {
    color: #64748b;
    font-size: 13px;
}

.mini-budget .section-title {
    color: #0b6bdc;
}

.mini-budget .section-title.income,
.section-title.income {
    color: #00995f;
}

.expense-title {
    color: #0b6bdc;
}

.mini-budget-values {
    margin-top: 16px;
}

.mini-budget-values span {
    color: #475569;
    display: grid;
    gap: 5px;
}

.mini-budget-values strong {
    color: #0f172a;
}

.progress-track {
    height: 10px;
    margin-top: 14px;
    border-radius: 999px;
    background: #edf2f7;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    display: block;
    border-radius: inherit;
}

.progress-fill.expense {
    background: #0b6bdc;
}

.progress-fill.income {
    background: #0ea563;
}

.danger-state .progress-fill.expense {
    background: #ef4444;
}

.budget-table-card {
    min-height: 360px;
}

.budget-table th,
.budget-table td {
    padding-inline: 8px;
}

.budget-table .totals-row {
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.budget-input {
    width: 130px;
    min-height: 34px;
    padding: 6px 10px;
    text-align: right;
    box-shadow: 0 1px 5px rgba(15, 23, 42, .12);
}

.user-card {
    overflow: hidden;
}

.user-table th {
    height: 52px;
    background: #fff;
    color: #475569;
    font-size: 14px;
    font-weight: 650;
    text-transform: none;
}

.user-table td {
    height: 68px;
    color: #475569;
}

.user-table td:first-child,
.user-table th:first-child {
    padding-left: 16px;
}

.user-name-cell {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #0f172a;
}

.user-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 999px;
    background: #e9f3ff;
    color: #006fe6;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 900;
}

.role-badge {
    min-height: 22px;
    padding: 3px 10px;
}

.role-badge.blue-soft {
    background: #e8f2ff;
    color: #006fe6;
}

.role-badge.plain {
    background: transparent;
    color: #0f172a;
    padding-inline: 0;
}

.user-actions {
    justify-content: flex-end;
    opacity: .22;
    transition: opacity .16s ease;
}

.user-table tr:hover .user-actions {
    opacity: 1;
}

.user-actions .btn {
    min-height: 32px;
    padding: 6px 10px;
}

.bulk-card {
    padding: 18px;
}

.bulk-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.bulk-total {
    min-width: 150px;
    text-align: right;
}

.bulk-total .stat-value {
    align-self: auto;
    margin-top: 6px;
}

.bulk-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    scrollbar-width: thin;
}

.bulk-row {
    margin: 0;
    padding: 7px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.icon-btn {
    min-width: 62px;
    min-height: 38px;
    padding: 0 9px;
}

.bulk-grid {
    display: grid;
    min-width: max-content;
}

.bulk-grid-head,
.bulk-row {
    display: grid;
    align-items: start;
    gap: 10px;
}

.bulk-grid-income .bulk-grid-head,
.bulk-row-income {
    grid-template-columns: 140px 140px 160px 110px 180px 150px 200px 120px 88px;
}

.bulk-grid-expense .bulk-grid-head,
.bulk-row-expense {
    grid-template-columns: 140px 150px 140px 160px 110px 180px 150px 120px 88px;
}

.bulk-grid-head {
    padding: 8px 7px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.bulk-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.bulk-row input,
.bulk-row select {
    min-height: 34px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

.tax-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
}

.tax-input-group > input {
    width: auto;
    min-width: 0;
    flex: 1 1 0;
}

.tax-input-group > select {
    width: 64px;
    min-width: 64px;
    flex: 0 0 64px;
    padding-inline: 8px;
}

.bulk-tax-total,
.tax-hint {
    margin-top: 4px;
    color: var(--danger);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}

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

.upload-control {
    min-height: 34px;
    padding: 0 12px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    min-width: 116px;
    max-width: 160px;
}

.upload-control input {
    display: none;
}

.upload-control span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-control.has-file {
    border-style: solid;
    background: #eef6ff;
    color: var(--info);
}

.receipt-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.receipt-actions[hidden] {
    display: none;
}

.proof-chip {
    min-height: 28px;
    max-width: 132px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f8fafc;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    padding: 4px 8px;
}

.proof-remove {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--danger);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.proof-chip:hover,
.proof-remove:hover {
    background: #eef2f7;
}

.receipt-preview-image {
    display: block;
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #f8fafc;
}

.row-icon-btn {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #0f172a;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.row-icon-btn:hover {
    background: #eef2f7;
}

.row-icon-btn.danger {
    color: var(--danger);
}

.bulk-desc {
    min-width: 180px;
}

.bulk-proof {
    min-width: 140px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.tab {
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    padding: 7px 10px;
    font-weight: 800;
}

.tab.is-active {
    background: var(--primary);
    color: #fff;
}

.tab-panel[hidden] {
    display: none;
}

.report-category-row {
    cursor: pointer;
}

.report-category-row:hover {
    background: #f8fafc;
}

.report-toggle {
    display: inline-block;
    width: 16px;
    color: var(--muted);
    font-weight: 900;
}

.nested-report-table {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.permission-matrix table {
    min-width: 720px;
}

.permission-matrix th,
.permission-matrix td {
    text-align: center;
}

.permission-matrix th:first-child,
.permission-matrix td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
}

.permission-check {
    justify-content: center;
    gap: 6px;
}

.permission-check span {
    font-size: 12px;
    color: var(--muted);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
    background: var(--bg);
}

.login-panel {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
}

.login-card {
    width: min(448px, 100%);
    display: grid;
    gap: 28px;
}

.login-brand {
    gap: 10px;
}

.login-title {
    margin: 0 0 8px;
    color: var(--text);
    font-size: clamp(30px, 5vw, 38px);
    line-height: 1.08;
}

.login-submit {
    min-height: 48px;
    font-size: 16px;
}

.login-hint {
    margin: 0;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.login-hero {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--primary);
    color: #fff;
}

.login-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0b6bdc, #2f7ef0 55%, #60a5fa);
}

.login-hero-content {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-hero h2 {
    max-width: 560px;
    margin: 0;
    font-size: clamp(36px, 5vw, 54px);
    line-height: 1.05;
}

.login-hero p {
    max-width: 520px;
    color: rgba(255, 255, 255, .82);
    font-size: 17px;
}

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

.login-metrics div {
    display: grid;
    gap: 4px;
}

.login-metrics strong {
    font-size: 28px;
}

.login-metrics span {
    color: rgba(255, 255, 255, .78);
}

.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;
}

.transactions-head {
    margin-bottom: 32px;
}

.transactions-head .actions {
    gap: 10px;
}

.transactions-head .actions .btn {
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
    font-size: 14px;
    font-weight: 700;
}

.transactions-head .actions .btn:not(.primary) {
    background: #fff;
}

.transactions-filter-card {
    padding: 20px;
    margin-bottom: 24px !important;
    border-radius: 18px;
    box-shadow: none;
}

.transactions-filter-card .filter-grid {
    grid-template-columns: minmax(190px, 1.2fr) repeat(4, minmax(145px, 1fr)) max-content;
    gap: 12px;
    align-items: center;
}

.transactions-filter-card .field {
    position: relative;
    gap: 0;
}

.transactions-filter-card input,
.transactions-filter-card select {
    width: 100%;
    min-height: 38px;
    border-radius: 9px;
    border: 1px solid #d9e2ec;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
    color: #020817;
    font-size: 14px;
}

.transactions-filter-card .search-field input {
    padding-left: 38px;
}

.transactions-filter-card .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    z-index: 1;
    width: 16px;
    height: 16px;
    color: #64748b;
    transform: translateY(-50%);
    pointer-events: none;
}

.transactions-filter-card .search-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.transactions-filter-card .filter-submit {
    display: none;
}

.transactions-filter-card .filter-reset .btn {
    min-height: 38px;
    padding-inline: 14px;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
    font-size: 14px;
    font-weight: 700;
}

.transactions-table-card {
    border-radius: 18px;
    box-shadow: none;
}

.transactions-table th {
    padding: 17px 16px;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
}

.transactions-table td {
    padding: 18px 16px;
    vertical-align: middle;
}

.transactions-table td[data-label="Tanggal"],
.transactions-table td[data-label="Kategori"],
.transactions-table td[data-label="Rekening"],
.transactions-table td[data-label="Dibuat Oleh"] {
    color: #475569;
}

.transactions-table td[data-label="Cabang"] strong {
    color: #020817;
    font-weight: 800;
}

.transactions-table .badge {
    min-height: 20px;
    padding: 3px 10px;
    background: #dff7eb;
    color: #00995d;
    font-weight: 600;
}

.transactions-table .badge.red {
    background: #fee4e2;
    color: #ef4444;
}

.transactions-table .amount {
    font-weight: 800;
}

.transaction-row-actions {
    justify-content: flex-end;
}

.transaction-row-actions > .btn.danger {
    width: 32px;
    min-height: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #64748b;
    box-shadow: none;
    font-size: 0;
}

.transaction-row-actions > .btn.danger::before {
    content: "";
    display: block;
    width: 16px;
    height: 16px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M9%203h6l1%202h4v2H4V5h4l1-2Zm1%207h2v8h-2v-8Zm4%200h2v8h-2v-8ZM6%208h12l-1%2013H7L6%208Z%27/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M9%203h6l1%202h4v2H4V5h4l1-2Zm1%207h2v8h-2v-8Zm4%200h2v8h-2v-8ZM6%208h12l-1%2013H7L6%208Z%27/%3E%3C/svg%3E") center / contain no-repeat;
}

.transaction-row-actions > .btn.danger:hover {
    color: #ef4444;
    background: #fee2e2;
}

.mobile-only {
    display: none;
}

@media (max-width: 1240px) and (min-width: 1061px) {
    .content {
        padding-inline: 24px;
    }

    .page-head {
        margin-inline: -24px;
        padding-inline: 24px;
    }

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

    .dashboard-bottom-custom {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1060px) {
    .shell {
        grid-template-columns: 1fr;
    }

    body.sidebar-collapsed .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        z-index: 30;
        inset: 0 auto 0 0;
        width: min(320px, 86vw);
        transform: translateX(-105%);
        transition: transform .2s ease;
        padding: 20px 12px;
    }

    body.sidebar-collapsed .sidebar-head {
        min-height: auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 0 8px 16px;
    }

    body.sidebar-collapsed .brand-mark {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    body.sidebar-collapsed .brand-copy,
    body.sidebar-collapsed .nav-text,
    body.sidebar-collapsed .user-copy {
        opacity: 1;
        transform: none;
        width: auto;
        pointer-events: auto;
    }

    body.sidebar-collapsed .sidebar-toggle {
        position: static;
        box-shadow: none;
    }

    body.sidebar-collapsed .sidebar-toggle .nav-icon {
        transform: none;
    }

    body.sidebar-collapsed .nav-link,
    body.sidebar-collapsed .user-chip {
        justify-content: flex-start;
        padding-inline: 12px;
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .topbar {
        position: fixed;
        inset: 0 auto auto 0;
        z-index: 20;
        width: 56px;
        height: 56px;
        min-height: 0;
        padding: 0;
        background: transparent;
        border: 0;
        display: flex;
        pointer-events: none;
    }

    .topbar strong,
    .topbar > .btn.primary {
        display: none;
    }

    .mobile-menu-btn {
        position: absolute;
        top: 12px;
        left: 14px;
        z-index: 24;
        width: 36px;
        min-height: 36px;
        padding: 0;
        border: 0;
        background: transparent;
        color: #111827;
        pointer-events: auto;
    }

    .mobile-menu-btn span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .content {
        padding: 24px 16px 36px;
    }

    .page-head {
        position: sticky;
        top: 0;
        margin: -24px -16px 24px;
        padding: 16px 16px 16px 58px;
    }

    .grid.two,
    .transfer-layout,
    .grid.filter-grid,
    .report-filter-grid,
    .grid.form-grid,
    .budget-top {
        grid-template-columns: 1fr;
    }

    .dashboard-bottom-custom {
        grid-template-columns: 1fr;
    }

    .branch-summary-card,
    .recent-transactions-card {
        min-height: 0;
    }

    .transfer-flow,
    .transfer-amount-grid {
        grid-template-columns: 1fr;
    }

    .transfer-arrow {
        min-height: 18px;
        transform: rotate(90deg);
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        display: none;
    }

    .branch-filters {
        flex-wrap: wrap;
    }

    .branch-filters select,
    .branch-filters input {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .toast-stack {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .toast {
        grid-template-columns: 30px minmax(0, 1fr) 28px;
        padding: 12px;
    }

    .content {
        padding-inline: 12px;
    }

    .page-head {
        margin-inline: -12px;
        padding-inline: 12px;
        padding-left: 58px;
    }

    .page-head {
        display: grid;
    }

    .grid {
        gap: 16px;
    }

    .grid.stats {
        grid-template-columns: 1fr;
    }

    .card.pad {
        padding: 14px;
    }

    .branding-preview-grid {
        grid-template-columns: 1fr;
    }

    .modal-card {
        padding: 20px;
    }

    .modal-grid.two-col {
        grid-template-columns: 1fr;
    }

    .stat {
        min-height: 132px;
        padding: 20px;
    }

    .stat-value {
        font-size: clamp(21px, 7vw, 25px);
    }

    .chart-card {
        min-height: 292px;
    }

    .chart-bars.lovable-chart {
        min-height: 200px;
    }

    .chart-pair {
        height: 148px;
    }

    .actions,
    .form-actions {
        width: 100%;
        justify-content: stretch;
    }

    .actions .btn,
    .form-actions .btn {
        flex: 1;
    }

    table.responsive thead {
        display: none;
    }

    table.responsive,
    table.responsive tbody,
    table.responsive tr,
    table.responsive td {
        display: block;
        width: 100%;
    }

    table.responsive tr {
        padding: 8px 0;
        border-bottom: 1px solid var(--line);
    }

    table.responsive td {
        border: 0;
        padding: 6px 10px;
        display: flex;
        justify-content: space-between;
        gap: 18px;
        text-align: right;
    }

    table.responsive td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 800;
        text-align: left;
    }

    .account-row {
        display: grid;
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .account-row > span,
    .account-row > .amount {
        text-align: left;
        white-space: normal;
    }

    .recent-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .recent-row > .amount {
        text-align: left;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .pagination,
    .pagination-links {
        width: 100%;
    }

    .pagination-links {
        justify-content: flex-start;
    }

    .mobile-only {
        display: block;
    }

    .bulk-grid-head {
        display: none;
    }

    .bulk-table-scroll {
        overflow: visible;
        border: 0;
        border-radius: 0;
    }

    .bulk-card-head {
        display: grid;
    }

    .bulk-total {
        text-align: left;
    }

    .bulk-grid {
        min-width: 0;
    }

    .bulk-row,
    .bulk-row-income,
    .bulk-row-expense {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 14px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: 14px;
    }

    .bulk-row:last-child {
        border-radius: var(--radius);
    }

    .bulk-row-number {
        color: var(--muted);
        font-size: 12px;
        font-weight: 900;
        text-transform: uppercase;
    }

    .bulk-actions {
        justify-content: stretch;
    }

    .bulk-actions .btn {
        width: 100%;
    }
}
