/* ==========================================================================
   Textile Accounts - modern UI
   Desktop: sidebar with submenus (can collapse to a mini icon bar)
   Mobile:  app bar + bottom tab bar + slide-in drawer (feels like a native app)
   ========================================================================== */
:root {
	--primary: #4f46e5;
	--primary-600: #4338ca;
	--primary-50: #eef2ff;
	--primary-100: #e0e7ff;
	--bg: #f4f5fb;
	--surface: #ffffff;
	--text: #1f2937;
	--muted: #6b7280;
	--border: #e7e9f2;
	--success: #16a34a;
	--success-50: #dcfce7;
	--danger: #dc2626;
	--danger-50: #fee2e2;
	--warning: #d97706;
	--warning-50: #fef3c7;
	--info: #0284c7;
	--info-50: #e0f2fe;
	--radius: 14px;
	--radius-sm: 10px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
	--shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);
	--sidebar-w: 248px;
	--sidebar-mini-w: 72px;
	--topbar-h: 60px;
	--appbar-h: 56px;
	--bottomnav-h: 64px;
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body {
	background: var(--bg); color: var(--text); font-family: var(--font); font-size: 0.925rem;
	-webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); }
a:hover { color: var(--primary-600); text-decoration: none; }
.font-weight-600 { font-weight: 600; }
.text-profit { color: var(--success) !important; }
.text-loss { color: var(--danger) !important; }
.text-muted { color: var(--muted) !important; }
.amount, td.money, th.money, .money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.help-text { font-size: 0.8rem; color: var(--muted); }
.required-mark::after { content: " *"; color: var(--danger); }
::selection { background: var(--primary-100); }

/* ----------------------------------------------------------------- buttons */
.btn { border-radius: var(--radius-sm); font-weight: 500; transition: all .15s ease; }
.btn-sm { border-radius: 8px; }
.btn-primary, .btn-primary:focus { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:not(:disabled):not(.disabled):active { background: var(--primary-600); border-color: var(--primary-600); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary-100); background: var(--primary-50); }
.btn-outline-primary:hover, .btn-outline-primary.active, .btn-outline-primary:not(:disabled):not(.disabled):active { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-light { background: #f3f4f8; border-color: #f3f4f8; color: #374151; }
.btn-light:hover { background: #e7e9f2; border-color: #e7e9f2; }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-soft-danger { background: var(--danger-50); color: var(--danger); border: 0; }
.btn-soft-danger:hover { background: var(--danger); color: #fff; }
.btn:focus, .form-control:focus, .custom-select:focus { box-shadow: 0 0 0 3px rgba(79, 70, 229, .18); }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.btn .bi { vertical-align: -1px; }

/* ----------------------------------------------------------------- badges */
.badge { font-weight: 600; padding: .35em .6em; border-radius: 6px; font-size: 72%; letter-spacing: .01em; }
.badge-success { background: var(--success-50); color: #15803d; }
.badge-warning { background: var(--warning-50); color: #b45309; }
.badge-danger { background: var(--danger-50); color: #b91c1c; }
.badge-info { background: var(--info-50); color: #0369a1; }
.badge-secondary { background: #eceef4; color: #4b5563; }
.badge-dark { background: #1f2937; color: #fff; }
.badge-light, .badge-soft { background: var(--primary-50); color: var(--primary-600); }
.type-chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: .2rem .5rem; border-radius: 6px; white-space: nowrap; background: #eef0f6; color: #374151; }
.type-income, .type-customer_payment, .type-other_receipt { background: var(--success-50); color: #15803d; }
.type-expense, .type-supplier_payment, .type-other_payment { background: var(--danger-50); color: #b91c1c; }
.type-customer_invoice { background: var(--info-50); color: #0369a1; }
.type-supplier_bill { background: var(--warning-50); color: #b45309; }

/* ----------------------------------------------------------------- cards */
.card { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: .9rem 1.1rem; font-weight: 600; }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-body { padding: 1.1rem; }
.list-group-item { border-color: var(--border); }
.form-section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 0 0 .75rem; }

/* stat cards */
.stat-card { position: relative; overflow: hidden; }
.stat-card .card-body { display: flex; align-items: flex-start; gap: .85rem; }
.stat-icon { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; background: var(--primary-50); color: var(--primary); }
.stat-icon.green { background: var(--success-50); color: var(--success); }
.stat-icon.red { background: var(--danger-50); color: var(--danger); }
.stat-icon.amber { background: var(--warning-50); color: var(--warning); }
.stat-icon.blue { background: var(--info-50); color: var(--info); }
.stat-card .stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.stat-card .stat-value { font-size: 1.32rem; font-weight: 700; white-space: nowrap; letter-spacing: -.01em; line-height: 1.3; }
.stat-card .stat-sub { font-size: .76rem; color: var(--muted); line-height: 1.35; }
.stat-card.hero { background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%); color: #fff; }
.stat-card.hero .stat-label, .stat-card.hero .stat-sub, .stat-card.hero a { color: rgba(255,255,255,.85); }
.stat-card.hero .stat-icon { background: rgba(255,255,255,.18); color: #fff; }
.stat-card.hero.loss { background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%); }
a.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }

/* ----------------------------------------------------------------- forms */
.form-control, .custom-select { border-radius: var(--radius-sm); border-color: #dfe2ec; min-height: 42px; }
.form-control-sm { min-height: 34px; border-radius: 8px; }
.form-control:focus { border-color: var(--primary); }
label { font-weight: 600; font-size: .82rem; color: #374151; margin-bottom: .3rem; }
.form-control.is-invalid, .was-validated .form-control:invalid { background-image: none; }
.invalid-feedback { font-size: .78rem; font-weight: 500; }
.custom-control-label { font-weight: 500; }
.custom-control-input:checked ~ .custom-control-label::before { background-color: var(--primary); border-color: var(--primary); }
.input-group > .input-group-append > .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* type picker (transaction form) */
.type-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.type-picker .type-option { margin: 0; cursor: pointer; border: 1.5px solid var(--border); border-radius: 12px; padding: .65rem .7rem; background: #fff;
	display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: .82rem; transition: all .15s; }
.type-picker .type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-picker .type-option .bi { font-size: 1.15rem; color: var(--muted); }
.type-picker .type-option:hover { border-color: var(--primary-100); background: var(--primary-50); }
.type-picker .type-option.active { border-color: var(--primary); background: var(--primary-50); color: var(--primary-600); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.type-picker .type-option.active .bi { color: var(--primary); }
@media (max-width: 767.98px) { .type-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ----------------------------------------------------------------- select2 */
.select2-container--bootstrap4 .select2-selection { border-radius: var(--radius-sm); border-color: #dfe2ec; min-height: 42px; }
.select2-container--bootstrap4 .select2-selection--single { height: 42px !important; }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered { line-height: 40px; padding-left: .75rem; color: var(--text); }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow { height: 40px; }
.select2-container--bootstrap4.select2-container--focus .select2-selection { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.18); }
.select2-container--bootstrap4 .select2-dropdown { border-color: #dfe2ec; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); overflow: hidden; }
.select2-container--bootstrap4 .select2-results__option--highlighted, .select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option[aria-selected=true] { background: var(--primary); }
.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field { border-radius: 8px; min-height: 38px; }
.select2-results__option .s2-sub { display: block; font-size: .75rem; opacity: .7; }
.select2-sm + .select2-container--bootstrap4 .select2-selection--single { height: 34px !important; min-height: 34px; border-radius: 8px; }
.select2-sm + .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered { line-height: 32px; font-size: .875rem; }
.select2-sm + .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow { height: 32px; }
.is-invalid + .select2-container--bootstrap4 .select2-selection { border-color: var(--danger) !important; }
.input-group > .select2-container--bootstrap4 { flex: 1 1 auto; width: 1% !important; }
.input-group > .select2-container--bootstrap4 .select2-selection { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* ----------------------------------------------------------------- tables & DataTables */
.table { color: var(--text); margin-bottom: 0; }
.table thead th { background: #f8f9fc; border-top: 0; border-bottom: 1px solid var(--border); color: #4b5563; font-size: .74rem;
	text-transform: uppercase; letter-spacing: .04em; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.table td { border-top: 1px solid var(--border); vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8f9ff; }
tr.row-muted td { color: #9ca3af; }
tr.row-muted td.money { text-decoration: line-through; }
tr.row-bold td { font-weight: 700; background: #fafbff; }
tr.row-total td, tfoot tr td { font-weight: 700; border-top: 2px solid #c7cbe0; background: #f8f9fc; }
tr[data-href] { cursor: pointer; }
.table-card { border-radius: var(--radius); overflow: hidden; }
.dataTables_wrapper { padding: 0; }
.dataTables_wrapper .dt-top { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; padding: .85rem 1rem; }
.dataTables_wrapper .dt-bottom { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-top: 1px solid var(--border); }
.dataTables_wrapper .dataTables_filter { text-align: left; }
.dataTables_wrapper .dataTables_filter label, .dataTables_wrapper .dataTables_length label { margin: 0; font-weight: 500; color: var(--muted); }
.dataTables_wrapper .dataTables_filter input { margin-left: 0 !important; width: 260px !important; max-width: 100%; padding-left: 2.1rem;
	background: #f6f7fb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat .7rem center; border-color: transparent; }
.dataTables_wrapper .dataTables_filter input:focus { background-color: #fff; border-color: var(--primary); }
.dataTables_wrapper .dataTables_length select { width: auto; display: inline-block; min-height: 34px; }
.dataTables_wrapper .dataTables_info { padding-top: 0 !important; color: var(--muted); font-size: .82rem; }
.dataTables_wrapper .dataTables_paginate { margin: 0; }
.dataTables_wrapper .dataTables_processing { background: rgba(255,255,255,.92); border: 0; box-shadow: var(--shadow-lg); border-radius: 12px; padding: .8rem 1rem !important;
	width: auto !important; margin-left: 0 !important; transform: translateX(-50%); color: var(--primary); font-weight: 600; z-index: 5; }
.dataTables_wrapper .dataTables_processing > div:last-child { display: none; }
table.dataTable { margin-top: 0 !important; margin-bottom: 0 !important; border-collapse: collapse !important; }
table.dataTable thead .sorting::before, table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::before, table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::before, table.dataTable thead .sorting_desc::after { bottom: .7em; }
table.dataTable td.dataTables_empty { color: var(--muted); padding: 2.5rem 1rem; text-align: center; }
.pagination .page-link { border: 0; color: #374151; border-radius: 8px !important; margin: 0 2px; min-width: 34px; text-align: center; }
.pagination .page-item.active .page-link { background: var(--primary); color: #fff; }
.pagination .page-item.disabled .page-link { color: #c0c4d0; background: transparent; }
.dt-summary { padding: 0 1rem .75rem; font-size: .82rem; color: var(--muted); }
.table-skeleton td { color: transparent !important; }

/* ----------------------------------------------------------------- filters */
.filter-bar { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem .35rem; margin-bottom: 1rem; }
.filter-bar .form-group { margin-bottom: .55rem; margin-right: .6rem; }
.filter-bar label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .2rem; display: block; }
.filter-bar .select2-container { min-width: 180px; }
.filter-toggle { display: none; }
.period-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--primary-50); color: var(--primary-600); font-weight: 600; font-size: .8rem; padding: .4rem .7rem; border-radius: 999px; }

/* ----------------------------------------------------------------- page header */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
h1.page-title { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-sub { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.export-bar { display: flex; flex-wrap: wrap; gap: .35rem; }

/* ----------------------------------------------------------------- alerts / toasts */
.alert { border: 0; border-radius: 12px; box-shadow: var(--shadow); }
.alert-success { background: var(--success-50); color: #14532d; }
.alert-danger { background: var(--danger-50); color: #7f1d1d; }
.alert-warning { background: var(--warning-50); color: #78350f; }
.alert-info { background: var(--info-50); color: #0c4a6e; }
.toast-stack { position: fixed; right: 1rem; top: calc(var(--topbar-h) + .75rem); z-index: 1090; width: 360px; max-width: calc(100vw - 2rem); }
.app-toast { display: flex; gap: .65rem; align-items: flex-start; background: #111827; color: #fff; border-radius: 12px; padding: .8rem 1rem; box-shadow: var(--shadow-lg);
	margin-bottom: .5rem; animation: toastIn .25s ease; font-size: .875rem; }
.app-toast .bi { font-size: 1.1rem; margin-top: 1px; }
.app-toast.success .bi { color: #4ade80; } .app-toast.error .bi { color: #f87171; } .app-toast.warning .bi { color: #fbbf24; } .app-toast.info .bi { color: #60a5fa; }
.app-toast .close-toast { margin-left: auto; background: none; border: 0; color: #9ca3af; font-size: 1.1rem; line-height: 1; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ----------------------------------------------------------------- modal (confirm) */
.modal-content { border: 0; border-radius: 20px; box-shadow: var(--shadow-lg); }
.modal-backdrop.show { opacity: .45; }
.modal-header, .modal-footer { border-color: var(--border); }
.confirm-modal .modal-body { padding: 1.75rem 1.5rem 1rem; text-align: center; }
.confirm-modal .confirm-icon { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.8rem; margin-bottom: .9rem; }
.confirm-modal .confirm-icon.danger { background: var(--danger-50); color: var(--danger); box-shadow: 0 0 0 8px #fff1f1; }
.confirm-modal .confirm-icon.primary { background: var(--primary-50); color: var(--primary); box-shadow: 0 0 0 8px #f5f6ff; }
.confirm-modal h5 { font-weight: 700; }
.confirm-modal p { color: var(--muted); margin-bottom: 1rem; }
.confirm-modal .text-left label { font-size: .8rem; }
.confirm-modal .modal-footer { border: 0; padding: 0 1.5rem 1.5rem; display: flex; gap: .5rem; }
.confirm-modal .modal-footer .btn { flex: 1 1 0; min-height: 44px; margin: 0; }

/* ==========================================================================
   Desktop shell: sidebar + topbar
   ========================================================================== */
.topbar {
	position: fixed; top: 0; right: 0; left: var(--sidebar-w); height: var(--topbar-h); z-index: 1030;
	display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
	background: rgba(244, 245, 251, .85); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
	border-bottom: 1px solid transparent; transition: left .2s ease;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar .search-box { position: relative; flex: 0 1 420px; }
.topbar .search-box .bi { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.topbar .search-box input { padding-left: 2.25rem; background: #fff; border-color: transparent; box-shadow: var(--shadow); border-radius: 12px; }
.topbar .user-btn { display: flex; align-items: center; gap: .5rem; background: #fff; border: 0; box-shadow: var(--shadow); border-radius: 12px; padding: .3rem .7rem .3rem .3rem; color: var(--text); font-weight: 600; font-size: .85rem; }
.avatar { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #818cf8, #4f46e5); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.dropdown-menu { border: 0; border-radius: 12px; box-shadow: var(--shadow-lg); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; font-size: .875rem; }
.dropdown-item .bi { margin-right: .5rem; color: var(--muted); }

.sidebar {
	position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); z-index: 1040;
	background: #111827; color: #cbd5e1; display: flex; flex-direction: column; transition: width .2s ease, transform .25s ease;
}
.sidebar .brand { height: var(--topbar-h); display: flex; align-items: center; gap: .7rem; padding: 0 1rem; color: #fff; font-weight: 700; flex: 0 0 auto; text-decoration: none; overflow: hidden; }
.sidebar .brand img { width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px; }
.sidebar .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.sidebar .menu { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: .5rem .65rem 1rem; scrollbar-width: thin; }
.sidebar .menu-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; padding: .9rem .75rem .35rem; white-space: nowrap; }
.sidebar .nav-item { position: relative; }
.sidebar .nav-link { display: flex; align-items: center; gap: .75rem; color: #cbd5e1; padding: .55rem .75rem; border-radius: 10px; font-size: .875rem; font-weight: 500; white-space: nowrap; margin-bottom: 2px; }
.sidebar .nav-link .bi { font-size: 1.1rem; flex: 0 0 22px; text-align: center; color: #94a3b8; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link:hover .bi { color: #fff; }
.sidebar .nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.35); }
.sidebar .nav-link.active .bi { color: #fff; }
.sidebar .nav-link .caret { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.sidebar .has-sub.open > .nav-link .caret { transform: rotate(90deg); }
.sidebar .has-sub.child-active > .nav-link { color: #fff; background: rgba(255,255,255,.06); }
.sidebar .has-sub.child-active > .nav-link .bi { color: #a5b4fc; }
.sidebar .submenu { list-style: none; padding: .15rem 0 .35rem 2.35rem; margin: 0; display: none; }
.sidebar .has-sub.open > .submenu { display: block; }
.sidebar .submenu .nav-link { padding: .42rem .65rem; font-size: .84rem; color: #9ca3af; position: relative; }
.sidebar .submenu .nav-link::before { content: ""; position: absolute; left: -.95rem; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: #4b5563; transform: translateY(-50%); }
.sidebar .submenu .nav-link.active { background: transparent; color: #fff; box-shadow: none; font-weight: 600; }
.sidebar .submenu .nav-link.active::before { background: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,.25); }
.sidebar .submenu .flyout-title { display: none; }
.sidebar .sidebar-foot { padding: .75rem; border-top: 1px solid rgba(255,255,255,.06); }

.content { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 1rem) 1.5rem 2rem; min-height: 100vh; transition: margin-left .2s ease; }
.app-footer { color: var(--muted); font-size: .78rem; margin-top: 2rem; }

/* ---- mini sidebar (desktop) */
@media (min-width: 992px) {
	body.sidebar-mini .sidebar { width: var(--sidebar-mini-w); }
	body.sidebar-mini .topbar { left: var(--sidebar-mini-w); }
	body.sidebar-mini .content { margin-left: var(--sidebar-mini-w); }
	body.sidebar-mini .sidebar .brand span,
	body.sidebar-mini .sidebar .menu-label,
	body.sidebar-mini .sidebar .menu > .nav > .nav-item > .nav-link > .label,
	body.sidebar-mini .sidebar .menu > .nav > .nav-item > .nav-link > .caret,
	body.sidebar-mini .sidebar .sidebar-foot { display: none; }
	body.sidebar-mini .sidebar .brand { justify-content: center; padding: 0; }
	body.sidebar-mini .sidebar .menu { overflow: visible; padding: .5rem .6rem; }
	body.sidebar-mini .sidebar .menu > .nav > .nav-item > .nav-link { justify-content: center; padding: .65rem 0; }
	body.sidebar-mini .sidebar .menu > .nav > .nav-item > .nav-link .bi { flex-basis: auto; font-size: 1.2rem; }
	/* flyout submenu / tooltip on hover */
	body.sidebar-mini .sidebar .has-sub > .submenu,
	body.sidebar-mini .sidebar .has-sub.open > .submenu { display: none; }
	body.sidebar-mini .sidebar .nav-item:hover > .submenu {
		display: block; position: absolute; left: calc(100% + 8px); top: 0; min-width: 210px; background: #1f2937; border-radius: 12px;
		padding: .4rem; box-shadow: var(--shadow-lg); z-index: 1050;
	}
	body.sidebar-mini .sidebar .nav-item:hover > .submenu::before { content: ""; position: absolute; left: -10px; top: 0; bottom: 0; width: 10px; }
	body.sidebar-mini .sidebar .submenu .flyout-title { display: block; color: #fff; font-weight: 700; font-size: .8rem; padding: .45rem .65rem .35rem; }
	body.sidebar-mini .sidebar .submenu .nav-link::before { display: none; }
	body.sidebar-mini .sidebar .submenu .nav-link.active { background: rgba(255,255,255,.08); }
	body.sidebar-mini .sidebar .single > .nav-link .label {
		display: none; position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: #1f2937; color: #fff;
		padding: .4rem .65rem; border-radius: 8px; font-size: .8rem; box-shadow: var(--shadow-lg); z-index: 1050;
	}
	body.sidebar-mini .sidebar .single:hover > .nav-link .label { display: block; }
}

/* ==========================================================================
   Mobile / tablet shell: app bar, bottom navigation, drawer, cards
   ========================================================================== */
.appbar, .appbar-search, .bottom-nav, .drawer-backdrop { display: none; }

@media (max-width: 991.98px) {
	body { padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom)); background: var(--bg); }
	.topbar { display: none; }
	.appbar {
		display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 1030; height: calc(var(--appbar-h) + var(--safe-top)); padding: var(--safe-top) .35rem 0;
		align-items: center; gap: .15rem; background: var(--primary); color: #fff; box-shadow: 0 2px 10px rgba(67,56,202,.25);
	}
	.appbar .appbar-btn { width: 44px; height: 44px; border: 0; background: transparent; color: #fff; border-radius: 50%; font-size: 1.3rem; display: inline-flex; align-items: center; justify-content: center; }
	.appbar .appbar-btn:active { background: rgba(255,255,255,.15); }
	.appbar .appbar-title { flex: 1 1 auto; font-size: 1.08rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 .25rem; }
	.appbar-search { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 1035; height: calc(var(--appbar-h) + var(--safe-top)); padding: var(--safe-top) .5rem 0; background: #fff; align-items: center; gap: .25rem; box-shadow: var(--shadow); }
	.appbar-search.show { display: flex; }
	.appbar-search input { border: 0; box-shadow: none !important; font-size: 1rem; }
	.appbar-search .appbar-btn { color: var(--text); width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.3rem; }

	.sidebar { transform: translateX(-105%); width: min(86vw, 320px); box-shadow: none; padding-top: var(--safe-top); }
	.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
	.drawer-backdrop { display: block; position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 1035; opacity: 0; pointer-events: none; transition: opacity .2s; }
	.drawer-backdrop.show { opacity: 1; pointer-events: auto; }
	.sidebar .nav-link { padding: .75rem .85rem; font-size: .95rem; }
	.sidebar .submenu .nav-link { padding: .6rem .7rem; font-size: .9rem; }

	.content { margin-left: 0; padding: calc(var(--appbar-h) + var(--safe-top) + .85rem) .85rem 1.25rem; min-height: auto; }
	h1.page-title { display: none; }
	.page-head { margin-bottom: .75rem; }
	.page-head:empty { display: none; }

	.bottom-nav {
		display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; height: calc(var(--bottomnav-h) + var(--safe-bottom));
		padding-bottom: var(--safe-bottom); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
		border-top: 1px solid var(--border); box-shadow: 0 -4px 20px rgba(16,24,40,.06);
	}
	.bottom-nav a, .bottom-nav button { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
		color: #6b7280; font-size: .68rem; font-weight: 600; border: 0; background: none; text-decoration: none; position: relative; }
	.bottom-nav .bi { font-size: 1.3rem; }
	.bottom-nav .active { color: var(--primary); }
	.bottom-nav .active::before { content: ""; position: absolute; top: 6px; width: 48px; height: 30px; border-radius: 15px; background: var(--primary-50); z-index: -1; }
	.bottom-nav .fab { flex: 0 0 64px; }
	.bottom-nav .fab span.fab-btn { width: 54px; height: 54px; border-radius: 18px; background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff; display: flex;
		align-items: center; justify-content: center; font-size: 1.6rem; box-shadow: 0 8px 20px rgba(79,70,229,.45); transform: translateY(-14px); }

	.toast-stack { top: auto; bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + .75rem); left: .75rem; right: .75rem; width: auto; }

	/* filters collapse behind a button */
	.filter-toggle { display: inline-flex; }
	.filter-bar.collapsible { display: none; }
	.filter-bar.collapsible.show { display: block; }
	.filter-bar .form-group { margin-right: 0; width: 100%; }
	.filter-bar .select2-container { width: 100% !important; }
	.filter-bar.form-inline .form-control:not(.select2-hidden-accessible) { width: 100%; }
	.export-bar .btn { flex: 1 1 auto; }
	.form-actions .btn { flex: 1 1 auto; min-height: 46px; }
	.form-control, .select2-container--bootstrap4 .select2-selection--single { min-height: 46px; font-size: 16px; } /* 16px stops iOS zoom */
	.select2-container--bootstrap4 .select2-selection--single { height: 46px !important; }
	.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered { line-height: 44px; }
	.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow { height: 44px; }
	.select2-search__field { font-size: 16px !important; }
	.modal-dialog { margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: none; }
	.modal.fade .modal-dialog { transform: translateY(100%); transition: transform .25s ease-out; }
	.modal.show .modal-dialog { transform: none; }
	.modal-content { border-radius: 22px 22px 0 0; padding-bottom: var(--safe-bottom); }
	.modal-content::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: #d1d5db; margin: 8px auto 0; }
}

/* tables become card lists on phones */
@media (max-width: 767.98px) {
	.dataTables_wrapper .dt-top { padding: .75rem; }
	.dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_filter label, .dataTables_wrapper .dataTables_filter input { width: 100% !important; }
	.dataTables_wrapper .dataTables_length { display: none; }
	.dataTables_wrapper .dt-bottom { justify-content: center; }
	.dataTables_wrapper .dataTables_info { width: 100%; text-align: center; }
	table.dt-cards thead { display: none; }
	table.dt-cards, table.dt-cards tbody, table.dt-cards tfoot { display: block; width: 100% !important; }
	table.dt-cards tbody tr, table.dt-cards tfoot tr { display: block; margin: 0 .75rem .65rem; border: 1px solid var(--border); border-radius: 14px; background: #fff; padding: .55rem .8rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
	table.dt-cards tbody tr:active { background: #f8f9ff; }
	table.dt-cards td { display: flex; justify-content: space-between; align-items: center; gap: .75rem; border: 0 !important; padding: .28rem 0 !important; text-align: right !important; font-size: .88rem; }
	table.dt-cards td::before { content: attr(data-label); flex: 0 0 auto; text-align: left; color: var(--muted); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
	table.dt-cards td:empty, table.dt-cards td.empty-cell { display: none; }
	table.dt-cards td:first-child { font-weight: 600; font-size: .95rem; }
	table.dt-cards td.dataTables_empty { display: block; text-align: center !important; }
	table.dt-cards td.dataTables_empty::before { content: none; }
	table.dt-cards tfoot tr { background: #f8f9fc; }
	.table-card { box-shadow: none; background: transparent; }
	.table-card .dataTables_wrapper { background: transparent; }
	.stat-card .stat-value { font-size: 1.12rem; }
	.stat-card .card-body { padding: .9rem; }
	.stat-icon { flex-basis: 38px; width: 38px; height: 38px; font-size: 1.05rem; }
}

/* installed app (standalone) tweaks */
@media (display-mode: standalone) {
	body { overscroll-behavior-y: none; }
	.install-only-browser { display: none !important; }
}

/* ----------------------------------------------------------------- misc */
.summary-table td, .summary-table th { padding: .5rem .75rem; border-color: var(--border); }
.report-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.report-summary-grid .card-body { padding: .85rem 1rem; }
.report-summary-grid .s-label { font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.report-summary-grid .s-value { font-size: 1.1rem; font-weight: 700; }
.report-summary-grid .s-note { font-size: .75rem; color: var(--muted); }
.section-heading { font-size: .95rem; font-weight: 700; margin: 0; }
.chart-box { position: relative; height: 300px; }
.detail-list { margin: 0; }
.detail-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--border); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { font-weight: 500; color: var(--muted); font-size: .85rem; }
.detail-list dd { margin: 0; text-align: right; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.5rem; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: -6px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty-state .bi { font-size: 2.2rem; color: #c7cbe0; display: block; margin-bottom: .5rem; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background:
	radial-gradient(1200px 600px at 10% -10%, #c7d2fe 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #ddd6fe 0%, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-body { padding: 2rem; }
.auth-logo { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 24px rgba(79,70,229,.35); }

@media print {
	.topbar, .sidebar, .appbar, .bottom-nav, .no-print, .filter-bar, .export-bar, .app-footer, .dt-top, .dt-bottom { display: none !important; }
	.content { margin: 0; padding: 0; }
	body { background: #fff; padding: 0; }
	.card { box-shadow: none; }
}

/* ----------------------------------------------------------------- themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c3c7da transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c9cde0; border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #a5abc6; }
::-webkit-scrollbar-corner { background: transparent; }
.card ::-webkit-scrollbar-thumb, .modal ::-webkit-scrollbar-thumb, .select2-results ::-webkit-scrollbar-thumb { border-color: #fff; }
/* dark sidebar: slim indigo-tinted thumb that only stands out on hover */
.sidebar, .sidebar .menu { scrollbar-width: thin; scrollbar-color: rgba(129,140,248,.35) transparent; }
.sidebar .menu::-webkit-scrollbar { width: 6px; }
.sidebar .menu::-webkit-scrollbar-thumb { background: rgba(129,140,248,.28); border: 0; border-radius: 6px; }
.sidebar .menu:hover::-webkit-scrollbar-thumb { background: rgba(129,140,248,.55); }
.sidebar .menu::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
.sidebar .menu { scrollbar-gutter: stable; }

/* GST / Non-GST toggle */
.d-none-gst { display: none !important; }
.gst-toggle .btn { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 42px; }
.gst-toggle .btn input { position: absolute; clip: rect(0,0,0,0); pointer-events: none; }

/* ----------------------------------------------------------------- alignment fixes
   Every filter bar: same-size fields on a grid, label always above the field. */
.filter-bar.form-inline {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .65rem .85rem;
	align-items: end; padding: .9rem 1rem;
}
.filter-bar.form-inline .form-group { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; margin: 0 !important; width: auto; min-width: 0; }
.filter-bar.form-inline .form-group.d-none { display: none !important; }
.filter-bar.form-inline label { display: block; justify-content: flex-start; text-align: left; margin: 0 0 .3rem; }
.filter-bar.form-inline label.d-none { display: none !important; }
.filter-bar.form-inline .form-control:not(.select2-hidden-accessible), .filter-bar .select2-container { width: 100% !important; min-width: 0 !important; }
.filter-bar.form-inline .custom-control { min-height: 34px; display: flex; align-items: center; }
.filter-bar.form-inline .form-group > .btn, .filter-bar.form-inline .form-group > .period-chip { align-self: flex-start; }
.filter-bar .btn-sm, .filter-bar .form-control-sm { min-height: 34px; }
.filter-bar .form-row > [class*="col"] { display: flex; flex-direction: column; justify-content: flex-end; }
@media (min-width: 992px) {
	.filter-bar.form-inline .form-group.ml-auto { grid-column: -2 / -1; align-items: flex-end; }
}
@media (max-width: 991.98px) {
	.filter-bar.collapsible:not(.show) { display: none !important; }
	.filter-bar.form-inline { grid-template-columns: 1fr 1fr; }
	.filter-bar.form-inline .form-group > .btn { align-self: stretch; }
}
@media (max-width: 575.98px) {
	.filter-bar.form-inline { grid-template-columns: 1fr; }
}

/* Select2: arrow and clear button centred in the box at every size */
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
	top: 0 !important; bottom: 0 !important; height: auto !important; right: 6px !important; width: 20px !important;
	display: flex; align-items: center; justify-content: center; position: absolute;
}
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b {
	position: static !important; margin: 0 !important; border-color: #6b7280 transparent transparent transparent !important; border-width: 5px 4px 0 4px !important;
}
.select2-container--bootstrap4.select2-container--open .select2-selection--single .select2-selection__arrow b { border-color: transparent transparent #6b7280 transparent !important; border-width: 0 4px 5px 4px !important; }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered { padding-right: 2.6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select2-container--bootstrap4 .select2-selection__clear { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); margin: 0 !important; line-height: 1; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.select2-container--bootstrap4 .select2-selection__placeholder { color: #9ca3af; }
/* Same height for inputs, selects and buttons in a row */
.form-group > .form-control:not(textarea), .form-group .select2-selection--single { box-sizing: border-box; }
.input-group > .input-group-append > .btn { min-height: 42px; }
@media (max-width: 991.98px) { .input-group > .input-group-append > .btn { min-height: 46px; } }
/* Wide tables scroll inside their card, never the whole page */
.dt-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.content { overflow-x: hidden; }
@media (max-width: 767.98px) { .dt-scroll { overflow-x: visible; } }
/* Select2 keeps the original <select> as a 1px hidden element - never stretch it */
select.select2-hidden-accessible { width: 1px !important; min-width: 0 !important; }
/* Phones: two stat cards per row - stack icon over value so large amounts fit */
@media (max-width: 575.98px) {
	.stat-card .card-body { flex-direction: column; gap: .45rem; padding: .8rem; }
	.stat-card.hero .card-body { flex-direction: row; }
	.stat-card .stat-value { font-size: 1.02rem; white-space: normal; overflow-wrap: anywhere; }
	.stat-card.hero .stat-value { font-size: 1.3rem; }
	.stat-card .stat-icon { flex-basis: 34px; width: 34px; height: 34px; font-size: .95rem; border-radius: 10px; }
	.stat-card .stat-label { font-size: .68rem; }
}
.btn-outline-primary:not(:disabled):not(.disabled).active, .btn-outline-primary:not(:disabled):not(.disabled):active,
.show > .btn-outline-primary.dropdown-toggle { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: none; }
.btn-outline-primary:not(:disabled):not(.disabled).active:focus { box-shadow: 0 0 0 3px rgba(79,70,229,.18); }
/* Filter button group (Apply + Reset) stays on one line, aligned with the fields */
.filter-bar .form-row > .filter-actions { flex-direction: row; align-items: flex-end; justify-content: flex-start; gap: .4rem; }
.filter-bar .filter-actions .btn { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: .3rem; white-space: nowrap; }
.filter-bar .filter-actions .btn-primary { flex: 1 1 auto; }
.filter-bar .filter-actions .btn-light { flex: 0 0 34px; width: 34px; padding: 0; }
/* Column-based filter bars use the same grid as the inline ones: fields never wrap early */
.filter-bar .form-row {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .65rem .85rem; margin: 0; align-items: end;
}
.filter-bar .form-row > [class*="col"] { max-width: none; width: auto; padding: 0; margin: 0; flex: none; }
.filter-bar .form-row > [class*="col"].d-none { display: none !important; }
@media (max-width: 991.98px) { .filter-bar .form-row { grid-template-columns: 1fr 1fr; } .filter-bar .form-row > .filter-actions { grid-column: 1 / -1; } }
@media (max-width: 575.98px) { .filter-bar .form-row { grid-template-columns: 1fr; } }

/* ==========================================================================
   Simple Add entry form
   ========================================================================== */
.tx-form.choosing .tx-main { display: none; }
.tx-form:not(.choosing) .tx-chooser { display: none; }
.tx-chooser { max-width: 760px; }
.tx-seg { display: flex; background: #e9eaf5; border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 1rem; }
.tx-seg-btn { flex: 1 1 0; border: 0; background: transparent; border-radius: 11px; padding: .65rem .5rem; font-weight: 700; color: #4b5563; font-size: .95rem; transition: all .15s; }
.tx-seg-btn.on { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(16,24,40,.08); }
.tx-seg-btn.tx-income.on { color: var(--success); }
.tx-seg-btn.tx-expense.on { color: var(--danger); }
.tx-seg-sm .tx-seg-btn { padding: .5rem .4rem; font-size: .88rem; }
.tx-seg-sm { margin-bottom: 0; max-width: 420px; }
.tx-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; }
.tx-tile { text-align: left; background: #fff; border: 1.5px solid transparent; border-radius: 16px; padding: 1rem .9rem; box-shadow: var(--shadow); transition: all .15s; }
.tx-tile:hover { border-color: var(--primary-100); transform: translateY(-1px); }
.tx-tile.sel { border-color: var(--primary); background: var(--primary-50); }
.tx-tile i { display: block; font-size: 1.45rem; color: var(--primary); margin-bottom: .4rem; }
.tx-tile b { display: block; font-size: .95rem; color: var(--text); }
.tx-tile span { display: block; font-size: .76rem; color: var(--muted); line-height: 1.35; margin-top: .15rem; }
.tx-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 0 0 .4rem; }
.tx-chooser .tx-label { margin-top: 1.1rem; }
.tx-recent { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.tx-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; background: #fff; border-radius: 12px; padding: .7rem .9rem; box-shadow: var(--shadow); color: var(--text); }
.tx-row:hover { color: var(--text); background: #fafbff; }
.tx-row .k { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .45rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-row .v { font-weight: 700; white-space: nowrap; }

.tx-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
.tx-col-form { min-width: 0; display: flex; flex-direction: column; gap: .9rem; }
.tx-col-side { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.tx-typebar { display: flex; align-items: center; gap: .75rem; background: #fff; border-radius: 14px; padding: .7rem .9rem; box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.tx-typebar.income { border-left-color: var(--success); }
.tx-typebar.expense { border-left-color: var(--danger); }
.tx-typeicon { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-50); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex: 0 0 40px; }
.tx-typebar.income .tx-typeicon { background: var(--success-50); color: var(--success); }
.tx-typebar.expense .tx-typeicon { background: var(--danger-50); color: var(--danger); }
.tx-typename { font-weight: 700; }
.tx-typehint { font-size: .78rem; color: var(--muted); }
.tx-block { background: #fff; border-radius: 14px; padding: .85rem .95rem; box-shadow: var(--shadow); }
.tx-hint { font-size: .8rem; color: var(--muted); margin-top: .35rem; }
.tx-amount { background: #fff; border-radius: 16px; padding: .9rem 1rem; box-shadow: var(--shadow); text-align: center; }
.tx-amount-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 0; }
.tx-amount-input { display: flex; align-items: center; justify-content: center; gap: .25rem; }
.tx-amount-input span { font-size: 1.9rem; font-weight: 800; color: #9ca3af; }
.tx-amount-input input.form-control { border: 0; box-shadow: none !important; font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; text-align: center; min-height: 58px; max-width: 320px; padding: 0; background: transparent; color: var(--text); }
.tx-amount-input input.form-control::placeholder { color: #d1d5db; }
.tx-amount.is-invalid { box-shadow: 0 0 0 2px var(--danger); }
.tx-amount .js-fb, .tx-amount .server-fb { text-align: center; }
.tx-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.tx-chip { background: #fff; border: 1.5px solid #e5e7eb; border-radius: 999px; padding: .42rem .85rem; font-size: .84rem; font-weight: 600; color: #374151; display: inline-flex; align-items: center; gap: .35rem; transition: all .12s; }
.tx-chip:hover { border-color: var(--primary-100); background: var(--primary-50); }
.tx-chip.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.tx-chip.small-chip { padding: .2rem .6rem; font-size: .78rem; margin: 0 .2rem .25rem 0; cursor: default; }
.tx-alloc-summary { line-height: 2; }
.tx-allocbox { background: #fafbff; border-radius: 12px; padding: .4rem; }
.tx-more { font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .1rem; }
.tx-details { background: #fff; border-radius: 14px; padding: .95rem; box-shadow: var(--shadow); }
.tx-summary { background: #fff; border-radius: 16px; padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.tx-summary-title { font-weight: 700; margin-bottom: .35rem; }
.tx-sum-lines > div { display: flex; justify-content: space-between; padding: .2rem 0; font-variant-numeric: tabular-nums; }
.tx-sum-lines > div.t { border-top: 1px dashed #d1d5db; margin-top: .3rem; padding-top: .5rem; font-weight: 800; font-size: 1.1rem; }
.tx-effect { margin-top: .85rem; }
.tx-effect:empty { display: none; }
.tx-effect-title { font-weight: 700; color: #065f46; margin-bottom: .25rem; font-size: .85rem; }
.tx-effect ul { margin: 0; padding: .7rem .9rem .7rem 1.6rem; background: #ecfdf5; border-radius: 12px; color: #065f46; font-size: .83rem; }
.tx-effect li { margin: .1rem 0; }
.tx-savebar { grid-column: 1 / 2; position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; gap: .5rem; background: rgba(244,245,251,.95); padding: .75rem 0; }
.tx-savebar .btn { min-height: 46px; border-radius: 12px; font-weight: 700; }
.tx-savebar .btn-primary { max-width: 360px; }
.tx-another { margin-left: .5rem; white-space: nowrap; }

@media (max-width: 991.98px) {
	.tx-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tx-recent { grid-template-columns: 1fr; }
	.tx-main { display: block; }
	.tx-col-form { gap: .75rem; }
	.tx-col-side { position: static; margin-top: .75rem; }
	body.has-savebar { padding-bottom: calc(76px + var(--safe-bottom)); }
	body.has-savebar .bottom-nav { display: none; }
	.tx-savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: #fff; border-top: 1px solid var(--border);
		padding: .65rem .85rem calc(.65rem + var(--safe-bottom)); box-shadow: 0 -4px 20px rgba(16,24,40,.06); }
	.tx-savebar .btn-primary { max-width: none; }
	.tx-another { font-size: .8rem; }
	.tx-amount-input input.form-control { font-size: 2rem; }
	body.has-savebar .toast-stack { bottom: calc(80px + var(--safe-bottom)); }
}

/* Recent entries never overflow on phones: text wraps, amount stays visible */
.tx-recent { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tx-row { min-width: 0; }
.tx-row .k { flex: 1 1 auto; min-width: 0; }
@media (max-width: 991.98px) {
	.tx-recent { grid-template-columns: minmax(0, 1fr); }
	.tx-row { align-items: flex-start; }
	.tx-row .k { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; align-items: flex-start; }
	.tx-row .k i { margin-top: 2px; }
	.tx-row .v { flex: 0 0 auto; }
	.tx-chooser, .tx-main, .tx-col-form { max-width: 100%; min-width: 0; }
}
/* Space between the category shortcut chips and the search dropdown */
#category_id + .select2-container { margin-top: .7rem; }
.tx-chips:empty { display: none; }
.tx-chips:empty + select + .select2-container { margin-top: 0; }
