@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&family=Sora:wght@400;500;600;700;800&display=swap');

:root {
    --font-display: "Sora", ui-sans-serif, system-ui, sans-serif;
    --font-sans: "Manrope", ui-sans-serif, system-ui, sans-serif;
    
    --radius: 0.75rem;
    --radius-sm: calc(var(--radius) - 4px);
    --radius-md: calc(var(--radius) - 2px);
    --radius-lg: var(--radius);
    --radius-xl: calc(var(--radius) + 4px);
    --radius-2xl: calc(var(--radius) + 8px);
    --radius-3xl: calc(var(--radius) + 12px);

    --background: oklch(0.985 0.004 250);
    --foreground: oklch(0.22 0.03 252);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.22 0.03 252);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.22 0.03 252);
    --primary: oklch(0.29 0.055 254);
    --primary-foreground: oklch(0.98 0.006 250);
    --secondary: oklch(0.955 0.008 250);
    --secondary-foreground: oklch(0.3 0.04 252);
    --muted: oklch(0.958 0.007 250);
    --muted-foreground: oklch(0.53 0.024 252);
    --accent: oklch(0.63 0.14 163);
    --accent-foreground: oklch(0.99 0.01 160);
    --destructive: oklch(0.58 0.21 25);
    --destructive-foreground: oklch(0.99 0.005 250);
    --success: oklch(0.63 0.14 163);
    --success-foreground: oklch(0.99 0.01 160);
    --warning: oklch(0.76 0.15 78);
    --warning-foreground: oklch(0.26 0.05 70);
    --info: oklch(0.6 0.13 250);
    --info-foreground: oklch(0.99 0.005 250);
    --border: oklch(0.91 0.008 250);
    --input: oklch(0.91 0.008 250);
    --ring: oklch(0.63 0.14 163);
    --chart-1: oklch(0.63 0.14 163);
    --chart-2: oklch(0.58 0.19 25);
    --chart-3: oklch(0.6 0.13 250);
    --chart-4: oklch(0.76 0.15 78);
    --chart-5: oklch(0.55 0.12 300);
    --sidebar: oklch(0.24 0.04 254);
    --sidebar-foreground: oklch(0.86 0.015 250);
    --sidebar-primary: oklch(0.63 0.14 163);
    --sidebar-primary-foreground: oklch(0.15 0.03 254);
    --sidebar-accent: oklch(0.31 0.045 254);
    --sidebar-accent-foreground: oklch(0.97 0.006 250);
    --sidebar-border: oklch(0.33 0.04 254);
    --sidebar-ring: oklch(0.63 0.14 163);
    --shadow-card: 0 1px 2px oklch(0.2 0.03 250 / 0.06), 0 8px 24px -12px oklch(0.2 0.03 250 / 0.18);
    --shadow-pop: 0 24px 60px -24px oklch(0.2 0.03 250 / 0.35);

    /* Legacy mapping for full compatibility */
    --bg: var(--background);
    --panel: var(--card);
    --panel-soft: var(--muted);
    --text: var(--foreground);
    --line: var(--border);
    --danger: var(--destructive);
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 84px;
    --shadow: var(--shadow-card);
}

.dark {
    --background: oklch(0.19 0.03 254);
    --foreground: oklch(0.96 0.006 250);
    --card: oklch(0.24 0.035 254);
    --card-foreground: oklch(0.96 0.006 250);
    --popover: oklch(0.24 0.035 254);
    --popover-foreground: oklch(0.96 0.006 250);
    --primary: oklch(0.9 0.01 250);
    --primary-foreground: oklch(0.24 0.035 254);
    --secondary: oklch(0.29 0.04 254);
    --secondary-foreground: oklch(0.96 0.006 250);
    --muted: oklch(0.29 0.04 254);
    --muted-foreground: oklch(0.7 0.02 250);
    --accent: oklch(0.66 0.14 163);
    --accent-foreground: oklch(0.18 0.03 254);
    --destructive: oklch(0.65 0.19 25);
    --destructive-foreground: oklch(0.99 0.005 250);
    --border: oklch(1 0 0 / 12%);
    --input: oklch(1 0 0 / 16%);
    --ring: oklch(0.66 0.14 163);
    --sidebar: oklch(0.17 0.03 254);
    --sidebar-foreground: oklch(0.88 0.012 250);
    --sidebar-border: oklch(1 0 0 / 10%);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.page-title,
.section-title,
.brand-title {
    font-family: var(--font-display);
    letter-spacing: -0.025em;
    font-weight: 700;
}

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

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

.num {
    font-variant-numeric: tabular-nums;
}

.surface {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
}

.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: var(--sidebar);
    color: var(--sidebar-foreground);
    border-right: 1px solid var(--sidebar-border);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    z-index: 20;
}

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

.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: var(--radius-md);
    background: var(--sidebar-primary);
    color: var(--sidebar-primary-foreground);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 800;
    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: 800;
    font-size: 16px;
    line-height: 1.2;
    color: var(--sidebar-accent-foreground);
}

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

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

.sidebar-toggle {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    background: var(--sidebar-accent);
    color: var(--sidebar-foreground);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.sidebar-toggle:hover {
    background: var(--sidebar-border);
    color: var(--sidebar-accent-foreground);
}

.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 14px;
    border-radius: var(--radius-md);
    border: 0;
    background: transparent;
    color: var(--sidebar-foreground);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all .16s ease;
}

.nav-link:hover {
    background: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
}

.nav-link.is-active {
    background: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
    position: relative;
    box-shadow: inset 3px 0 0 0 var(--sidebar-primary);
}

.nav-link.is-active .nav-icon {
    color: var(--sidebar-primary);
}

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

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

.user-chip {
    min-height: 42px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    color: var(--sidebar-foreground);
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.user-initial {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-radius: var(--radius-sm);
    background: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    font-family: var(--font-display);
}

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

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

.user-copy strong {
    color: var(--sidebar-accent-foreground);
    font-size: 13px;
}

.user-copy span {
    color: var(--sidebar-foreground);
    font-size: 11px;
    opacity: 0.75;
}

.logout-link {
    color: var(--sidebar-foreground);
    border-radius: var(--radius-md);
}

.logout-link:hover {
    background: rgba(225, 29, 72, 0.16);
    color: #fecdd3;
}

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: var(--radius-sm);
    box-shadow: none;
    background: var(--sidebar-accent);
    color: var(--sidebar-foreground);
    border: 1px solid var(--sidebar-border);
}

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: 24px 32px 40px;
}

/* Canvas Sticky Topbar (Matching React app-shell) */
.canvas-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    border-bottom: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 32px;
    width: 100%;
}

.topbar-search {
    position: relative;
    flex: 1;
    max-width: 384px;
}

.topbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    display: grid;
    place-items: center;
    pointer-events: none;
}

.topbar-search-icon .nav-icon {
    width: 16px;
    height: 16px;
}

.topbar-search-input {
    width: 100%;
    height: 38px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 0 14px 0 38px;
    font-size: 13.5px;
    font-family: var(--font-sans);
    color: var(--foreground);
    outline: none;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.topbar-search-input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px oklch(0.63 0.14 163 / 0.18);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-pill-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 13px;
    border-radius: 9999px;
    background: oklch(0.63 0.14 163 / 0.1);
    color: oklch(0.52 0.15 163);
    border: 1px solid oklch(0.63 0.14 163 / 0.2);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 9999px;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--foreground);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.topbar-icon-btn:hover {
    background: var(--secondary);
    border-color: var(--border);
}

.topbar-icon-btn .nav-icon {
    width: 16px;
    height: 16px;
}

.topbar-icon-btn.mobile-menu-btn {
    display: none;
    border-radius: var(--radius-md);
}

/* Sidebar Section Headers */
.nav-section {
    display: grid;
    gap: 2px;
    margin-bottom: 8px;
}

.nav-section-title {
    padding: 10px 14px 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: oklch(0.6 0.02 250);
}

body.sidebar-collapsed .nav-section-title {
    display: none;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
    padding: 0;
    background: transparent;
}

.page-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(22px, 2.2vw, 28px);
    font-weight: 800;
    color: var(--foreground);
    line-height: 1.2;
    letter-spacing: -0.025em;
}

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

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

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

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

/* Dashboard V2 Styles */
.stat-card-v2 {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-card-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

.stat-card-val {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    color: var(--foreground);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.stat-card-sub {
    font-size: 12px;
    color: var(--muted-foreground);
}

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

.dashboard-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
}

.dashboard-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.dashboard-section-tag {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--foreground);
}

.link-emerald {
    font-size: 13px;
    font-weight: 700;
    color: var(--success);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.15s ease;
}

.link-emerald:hover {
    opacity: 0.8;
}

/* Dual Bar Chart with Y-axis */
.chart-v2-container {
    position: relative;
    display: flex;
    gap: 12px;
    height: 230px;
    padding-top: 8px;
}

.chart-v2-yaxis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 24px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted-foreground);
    text-align: right;
    width: 48px;
    user-select: none;
}

.chart-v2-plot {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chart-v2-gridlines {
    position: absolute;
    inset: 0 0 24px 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.chart-v2-gridline {
    border-bottom: 1px dashed var(--border);
    width: 100%;
}

.chart-v2-bars {
    position: relative;
    z-index: 1;
    height: calc(100% - 24px);
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 6px;
}

.chart-v2-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
}

.chart-v2-bar-pair {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 100%;
    width: 100%;
    justify-content: center;
}

.chart-v2-bar {
    width: min(28px, 42%);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
}

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

.chart-v2-bar.expense {
    background: oklch(0.58 0.21 25);
}

.chart-v2-labels {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-around;
    height: 24px;
    align-items: center;
}

.chart-v2-day-label {
    flex: 1;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted-foreground);
}

/* Account List V2 */
.account-list-v2 {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-item-v2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.account-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.account-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--foreground);
}

.account-branch {
    font-size: 12px;
    color: var(--muted-foreground);
}

.account-balance {
    font-family: var(--font-display);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--foreground);
    white-space: nowrap;
}

/* Branch Table V2 */
.table-v2 {
    width: 100%;
    border-collapse: collapse;
}

.table-v2 th {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted-foreground);
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.table-v2 td {
    padding: 11px 12px;
    font-size: 13px;
    color: var(--foreground);
    border-bottom: 1px solid oklch(0.96 0.005 250);
}

.branch-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.branch-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--foreground);
}

.branch-code {
    font-size: 11.5px;
    color: var(--muted-foreground);
    font-family: var(--font-sans);
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-pill.badge-success {
    background: oklch(0.63 0.14 163 / 0.12);
    color: oklch(0.52 0.15 163);
}

.badge-pill.badge-warning {
    background: oklch(0.76 0.15 78 / 0.16);
    color: oklch(0.55 0.14 70);
}

.badge-pill.badge-danger {
    background: oklch(0.58 0.21 25 / 0.12);
    color: oklch(0.58 0.21 25);
}

.badge-pill.badge-muted {
    background: oklch(0.93 0.008 250);
    color: oklch(0.5 0.02 250);
}

.card-footer-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
    padding-top: 4px;
}

/* Recent Transactions V2 */
.recent-tx-list {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.recent-tx-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.recent-tx-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-tx-desc {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--foreground);
}

.recent-tx-sub {
    font-size: 12px;
    color: var(--muted-foreground);
}

.recent-tx-amount {
    font-family: var(--font-display);
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--destructive) !important;
}

.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(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    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;
    container-type: inline-size;
}

.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: var(--radius-md);
    display: grid;
    place-items: center;
}

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

.stat-icon.info {
    background: oklch(0.95 0.03 250);
    color: var(--info);
}

.stat-icon.success {
    background: oklch(0.96 0.03 163);
    color: var(--success);
}

.stat-icon.danger {
    background: oklch(0.96 0.03 25);
    color: var(--destructive);
}

.stat-label {
    max-width: 170px;
    color: var(--muted-foreground);
    font-size: 14px;
    line-height: 1.45;
    font-weight: 600;
}

.stat-value {
    min-width: 0;
    max-width: 100%;
    margin-top: 0;
    align-self: center;
    color: var(--foreground);
    font-family: var(--font-display);
    font-size: clamp(21px, 1.65vw, 29px);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -0.03em;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    font-variant-numeric: tabular-nums;
}

@container (max-width: 250px) {
    .stat-value {
        font-size: clamp(20px, 8cqi, 24px);
    }
}

@container (max-width: 220px) {
    .stat-value {
        font-size: 20px;
    }
}

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

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

.mutation-period {
    color: var(--text);
    font-size: 18px;
    line-height: 1.25;
}

.amount {
    font-weight: 800;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.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(--border);
    vertical-align: middle;
}

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

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 10px;
    border-radius: 999px;
    background: oklch(0.96 0.03 163);
    color: oklch(0.42 0.14 163);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
}

.badge.gray {
    background: var(--muted);
    color: var(--muted-foreground);
}

.badge.red {
    background: oklch(0.96 0.03 25);
    color: oklch(0.5 0.2 25);
}

.badge.blue,
.badge.blue-soft {
    background: oklch(0.95 0.03 250);
    color: oklch(0.42 0.14 250);
}

.btn {
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    background: #fff;
    color: var(--foreground);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .16s ease;
}

.btn:hover {
    background: var(--secondary);
    border-color: var(--border);
}

.btn.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 1px 2px rgba(18, 24, 46, 0.12);
}

.btn.primary:hover {
    filter: brightness(1.15);
    background: var(--primary);
}

.btn.danger {
    border-color: rgba(225, 29, 72, 0.25);
    background: #fff1f2;
    color: var(--destructive);
}

.btn.danger:hover {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.btn.info {
    border-color: rgba(37, 99, 235, 0.2);
    background: #eff6ff;
    color: var(--info);
}

.btn.info:hover {
    background: var(--info);
    color: #fff;
}

.btn.success {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-foreground);
}

.btn.success:hover {
    filter: brightness(1.1);
}

.btn.ghost {
    background: transparent;
    border-color: transparent;
}

.btn.ghost:hover {
    background: var(--secondary);
}

.inline-form {
    display: inline;
}

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

.search-card {
    overflow: visible;
}

.search-bar-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) max-content;
    gap: 12px;
    align-items: end;
}

.search-field {
    position: relative;
}

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

.search-field .search-icon {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 1;
    width: 16px;
    height: 16px;
    color: #64748b;
    pointer-events: none;
}

.search-field .search-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.inner-search-card {
    padding-top: 0;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--foreground);
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--foreground);
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 13.5px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px oklch(0.63 0.14 163 / 0.18);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    display: grid;
    width: 30px;
    height: 30px;
    padding: 6px;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--text);
}

.password-toggle svg {
    width: 100%;
    height: 100%;
}

.password-toggle-slash {
    opacity: 0;
}

.password-toggle[aria-pressed="true"] .password-toggle-slash {
    opacity: 1;
}

.temporal-input-fallback {
    padding-right: 38px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http://www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27none%27%20stroke%3D%27%2364748b%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%272%27%20d%3D%27M8%202v4m8-4v4M3%2010h18M5%204h14a2%202%200%200%201%202%202v14a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2V6a2%202%200%200%201%202-2Z%27/%3E%3C/svg%3E");
    background-position: right 11px center;
    background-repeat: no-repeat;
    background-size: 17px 17px;
}

.temporal-picker {
    position: fixed;
    z-index: 1200;
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: #fff;
    color: var(--foreground);
    box-shadow: var(--shadow-pop);
}

.temporal-picker[hidden] {
    display: none;
}

.temporal-picker-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 8px;
}

.temporal-picker-head strong {
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    font-family: var(--font-display);
}

.temporal-picker-head button,
.temporal-picker-cell {
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--foreground);
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
}

.temporal-picker-head button {
    padding: 0;
    font-size: 20px;
    line-height: 1;
}

.temporal-picker-grid {
    display: grid;
    gap: 6px;
}

.temporal-picker-grid.month-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.temporal-picker-grid.date-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.temporal-picker-day {
    color: var(--muted-foreground);
    text-align: center;
    font-size: 11px;
    font-weight: 800;
}

.temporal-picker-cell:hover,
.temporal-picker-head button:hover {
    border-color: var(--ring);
    background: oklch(0.96 0.03 163);
    color: var(--accent);
}

.temporal-picker-cell.is-today {
    border-color: var(--accent);
}

.temporal-picker-cell.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--primary-foreground);
}

[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;
    accent-color: var(--accent);
}

.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(--border);
    border-radius: var(--radius-md);
    background: #fff;
}

.branch-check {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--foreground);
    background: var(--secondary);
}

.branch-check input {
    width: 16px;
    min-height: 16px;
    flex: 0 0 16px;
    accent-color: var(--accent);
}

.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(--border);
    border-radius: var(--radius-2xl);
    background: transparent;
    color: var(--foreground);
    box-shadow: var(--shadow-pop);
}

.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: oklch(0.15 0.03 254 / 0.65);
    backdrop-filter: blur(4px);
}

.modal-card {
    padding: 24px;
    background: var(--card);
    border-radius: var(--radius-2xl);
    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: var(--radius-sm);
    background: transparent;
    color: var(--muted-foreground);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all .15s ease;
}

.modal-close:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.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(--border);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--foreground);
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
}

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

.payment-summary {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--secondary);
}

.payment-summary span {
    color: var(--muted-foreground);
    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: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    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 {
    max-width: 100%;
    text-align: right;
    font-weight: 800;
    white-space: normal;
    overflow-wrap: anywhere;
}

.card .amount,
.card .stat-value {
    max-width: 100%;
}

.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: normal;
    overflow-wrap: anywhere;
}

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

.proof-preview-button {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.proof-preview-button:hover {
    color: var(--primary-dark);
}

.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 150px 140px 160px 110px 180px 150px 150px 200px 120px 88px;
}

.bulk-grid-expense .bulk-grid-head,
.bulk-row-expense {
    grid-template-columns: 140px 150px 140px 160px 110px 180px 150px 150px 130px 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(--border);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--foreground);
    padding: 7px 14px;
    font-weight: 700;
    font-size: 13px;
    transition: all .15s ease;
}

.tab:hover {
    background: var(--secondary);
}

.tab.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}

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

.category-access-list {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    max-height: 220px;
    overflow: auto;
    padding-right: 4px;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background-color: #fafbfc;
    background-image:
        radial-gradient(at 12% 15%, rgba(16, 185, 129, 0.14) 0px, transparent 48%),
        radial-gradient(at 88% 12%, rgba(59, 130, 246, 0.14) 0px, transparent 48%),
        radial-gradient(at 50% 50%, rgba(236, 253, 245, 0.6) 0px, transparent 65%),
        radial-gradient(at 82% 88%, rgba(168, 85, 247, 0.09) 0px, transparent 50%),
        radial-gradient(at 18% 85%, rgba(14, 165, 233, 0.11) 0px, transparent 50%);
    position: relative;
    overflow-x: hidden;
}

.login-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.login-panel {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: var(--radius-2xl);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02),
                0 8px 24px -6px rgba(15, 23, 42, 0.05),
                0 24px 48px -12px rgba(15, 23, 42, 0.08);
    padding: 38px 34px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2px;
}

.login-brand .brand-title {
    color: var(--foreground, #0f172a);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.login-header-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.login-title {
    margin: 0;
    color: var(--foreground);
    font-family: var(--font-display);
    font-size: clamp(20px, 5vw, 24px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.login-submit {
    min-height: 44px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-md);
    transition: transform 160ms ease-out, background 160ms ease-out, filter 160ms ease-out;
}

.login-submit:active:not(:disabled) {
    transform: scale(0.98);
}

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

.register-panel {
    max-width: 600px;
}

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

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

.login-footer-copy {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--muted-foreground);
    position: relative;
    z-index: 1;
}

@media (max-width: 600px) {
    .register-panel {
        max-width: 100%;
    }

    .register-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 540px) {
    .login-shell {
        padding: 24px 14px;
    }

    .login-card {
        padding: 26px 18px;
        gap: 16px;
        border-radius: var(--radius-xl);
    }

    .login-title {
        font-size: 20px;
    }

    .selected-plan-card {
        padding: 10px 12px;
        gap: 8px;
    }

    .selected-plan-price {
        font-size: 15px;
    }
}

.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(5, minmax(130px, 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%;
    bottom: auto;
    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"],
.transactions-table td[data-label="Bukti"] {
    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-inner {
        padding: 12px 16px;
        gap: 8px;
    }

    .topbar-icon-btn.mobile-menu-btn {
        display: grid;
    }

    .content {
        padding: 16px;
    }

    .page-head {
        margin-bottom: 16px;
        padding: 0;
    }

    .dashboard-v2-grid-2 {
        grid-template-columns: 1fr;
    }

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

    .grid.two,
    .transfer-layout,
    .grid.filter-grid,
    .report-filter-grid,
    .search-bar-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-card {
        padding: 28px 20px;
    }

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

    .topbar-pill-badge {
        display: none;
    }

    .page-head {
        margin: 0 0 16px 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

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