/* =====================================================================
   Timber ERP - Tally style desktop theme
   Desktop (>= 992px): menu bar + screen title bar on top, F-key button bar on the right,
   compact panels, yellow highlight on the current field / row / menu item.
   Phone: app bar, bottom tabs and sheets (installable PWA).
   Built on Bootstrap 4 / SB Admin 2 utilities, which the pages use.
   ===================================================================== */
:root {
	--navy: #12324d; --navy-2: #1b4466; --navy-3: #0c2438;
	--brand: #1d5b84; --brand-600: #174b6d; --brand-700: #103a55; --brand-50: #e7f0f7; --brand-100: #cfe0ec;
	--hl: #ffe08a; --hl-2: #fff3c4; --hl-border: #d9a72b; --hk: #c0392b;
	--accent: #e39b16; --accent-600: #c98510; --accent-50: #fdf3e0;
	--bg: #e9f0f5; --surface: #fff; --surface-2: #f4f8fb; --panel-head: #d7e6f1; --text: #13202b; --muted: #5f6f7e; --border: #b9cddb; --border-soft: #d9e4ec;
	--danger: #c0392b; --success: #1d7a4f; --warning: #a86f00; --info: #1d5b84;
	--radius: 4px; --radius-sm: 3px;
	--shadow-sm: 0 1px 2px rgba(16, 36, 56, .08);
	--shadow-lg: 0 10px 28px rgba(16, 36, 56, .22);
	--menubar-h: 34px; --titlebar-h: 30px; --fbar-w: 158px; --bottomnav-h: 62px; --appbar-h: 54px;
	--font: "Segoe UI", "Inter", "Noto Sans Devanagari", Tahoma, Arial, sans-serif;
	--focus: 0 0 0 2px var(--hl-border);
}

html { -webkit-text-size-adjust: 100%; }
body, .app-body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13px; min-height: 100vh; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: var(--font); color: var(--text); }
a { color: var(--brand); }
a:hover { color: var(--brand-700); text-decoration: none; }
.text-muted, .text-gray-500, .text-gray-600 { color: var(--muted) !important; }
.text-gray-700, .text-gray-800, .text-gray-900 { color: var(--text) !important; }
.lh-sm { line-height: 1.2; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
u.hk { text-decoration: none; color: var(--hk); font-weight: 700; }
.skip-link { position: absolute; left: -999px; top: 6px; z-index: 2000; background: var(--hl); color: var(--text); padding: .3rem .7rem; }
.skip-link:focus { left: 6px; }

/* ---------- colours in place of SB Admin blue ---------- */
.text-primary { color: var(--brand) !important; }
.bg-primary, .badge-primary { background-color: var(--brand) !important; }
.border-primary { border-color: var(--brand) !important; }
.border-left-primary { border-left: 3px solid var(--brand) !important; }
.border-left-success { border-left: 3px solid var(--success) !important; }
.border-left-warning { border-left: 3px solid var(--accent) !important; }
.border-left-info { border-left: 3px solid var(--info) !important; }
.border-left-danger { border-left: 3px solid var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

/* ---------- buttons (flat, compact) ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; font-family: var(--font); font-size: 13px; padding: .3rem .8rem; }
.btn-sm, .btn-group-sm > .btn { padding: .2rem .55rem; font-size: 12px; border-radius: var(--radius-sm); }
.btn-primary { background: var(--brand); border-color: var(--brand-600); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:not(:disabled):not(.disabled):active, .btn-primary:not(:disabled):not(.disabled).active { background: var(--brand-600); border-color: var(--brand-700); color: #fff; }
.btn-primary:disabled, .btn-primary.disabled { background: var(--brand); border-color: var(--brand); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); background: #fff; }
.btn-outline-primary:hover, .btn-outline-primary:not(:disabled):not(.disabled):active, .btn-outline-primary:not(:disabled):not(.disabled).active { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-success { background: var(--success); border-color: #17643f; }
.btn-success:hover { background: #17643f; }
.btn-warning { background: var(--accent); border-color: var(--accent-600); color: #fff; }
.btn-warning:hover, .btn-warning:focus { background: var(--accent-600); color: #fff; }
.btn-info { background: #2779bd; border-color: #1f669f; }
.btn-danger { background: var(--danger); border-color: #a5301f; }
.btn-secondary, .btn-light { background: #f4f7fa; border-color: var(--border); color: var(--text); }
.btn-secondary:hover, .btn-secondary:focus, .btn-light:hover { background: #e6edf3; border-color: var(--border); color: var(--text); }
.btn-act { padding: .15rem .45rem; margin: 1px; font-size: 12px; }
.btn:focus, .btn.focus { box-shadow: var(--focus); }

/* ---------- forms: current field gets the Tally yellow bar ---------- */
label, .col-form-label { font-weight: 600; font-size: 12.5px; color: #2c3e50; margin-bottom: .2rem; }
.form-check-label, .custom-control-label { font-weight: 500; }
.form-control { border-radius: var(--radius-sm); border-color: var(--border); color: var(--text); font-size: 13px; height: calc(1.5em + .6rem + 2px); padding: .3rem .55rem; background: #fff; }
textarea.form-control { height: auto; }
.form-control-sm { height: calc(1.5em + .4rem + 2px); padding: .2rem .45rem; font-size: 12.5px; }
.form-control:focus { border-color: var(--hl-border); background: var(--hl-2); box-shadow: var(--focus); color: var(--text); }
.form-control[readonly], .readonly-grey { background: #eef2f5 !important; }
.form-group { margin-bottom: .6rem; }
.custom-control-input:checked ~ .custom-control-label::before { background: var(--brand); border-color: var(--brand); }
.input-group-text { background: var(--surface-2); border-color: var(--border); border-radius: var(--radius-sm); font-size: 13px; }
.select2-container--focus .select2-selection, .select2-container--open .select2-selection { border-color: var(--hl-border) !important; background: var(--hl-2) !important; box-shadow: var(--focus) !important; }

/* Tally voucher look: label on the left, value on the right (wide screens only) */
@media (min-width: 992px) {
	.main-form .card-body, .main-form [class*="col-"], .modal-body { container-type: inline-size; }
	@container (min-width: 560px) {
		.form-group:not([class*="col-"]):has(> label) { display: grid; grid-template-columns: 170px minmax(0, 1fr); column-gap: .9rem; align-items: center; }
		.form-group:not([class*="col-"]):has(> label) > label { margin: 0; text-align: right; color: #33475b; }
		.form-group:not([class*="col-"]):has(> label) > :not(label) { grid-column: 2; }
		.form-group:not([class*="col-"]):has(> label) > .form-control:not(textarea), .form-group:not([class*="col-"]):has(> label) > select + .select2-container { max-width: 520px; }
	}
}

/* ---------- panels (cards) ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm) !important; background: var(--surface); }
.card.shadow, .card.shadow-lg, .card.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card-header { background: var(--panel-head); border-bottom: 1px solid var(--border); padding: .45rem .8rem; }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-header.py-3 { padding-top: .45rem !important; padding-bottom: .45rem !important; }
.card-header.bg-light { background: var(--panel-head) !important; }
.card-header h6, .card-header .h6 { font-weight: 700 !important; font-size: 13.5px; color: var(--navy) !important; }
.card-body { padding: .8rem; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius) !important; padding: .5rem .8rem; }
.card-footer .btn { min-width: 90px; }
.card-header-tabs { margin-bottom: -.45rem; }
.nav-tabs .nav-link { border-radius: 3px 3px 0 0; color: var(--muted); font-weight: 600; padding: .35rem .8rem; }
.nav-tabs .nav-link.active { color: var(--navy); background: #fff; border-color: var(--border) var(--border) #fff; }
.page-title { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: .5rem; }
.card-title-lg { font-size: 14.5px; font-weight: 700; color: var(--navy); margin: 0; }
.section-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .5rem; }
.text-xs { font-size: 11px; letter-spacing: .03em; }
.mb-4 { margin-bottom: .9rem !important; }
.h5 { font-size: 1.05rem; }
.h4 { font-size: 1.2rem; }

/* ---------- tables (dense, Tally list) ---------- */
.table { color: var(--text); margin-bottom: 0; font-size: 13px; }
.table td, .table th { color: var(--text); vertical-align: middle; border-color: var(--border-soft); padding: .32rem .55rem; }
.table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--navy); font-weight: 700; background: var(--panel-head); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table-bordered, .table-bordered td, .table-bordered th { border-color: var(--border-soft); }
.table-striped tbody tr:nth-of-type(odd) { background: #f7fafc; }
.table-hover tbody tr:hover { background: var(--brand-50) !important; }
.table tbody tr.kb-row, .table tbody tr.kb-row > * { background: var(--hl) !important; }
.table tfoot th, .table tfoot td { font-weight: 700; background: var(--panel-head); border-top: 1px solid var(--border); }
.thead-dark-grey th { background: var(--navy) !important; color: #fff !important; }
.table-sm td, .table-sm th, .table-sm-pad td { padding: .25rem .5rem; }
.items-table input { min-width: 70px; }
.items-table td { padding: .25rem .35rem; }
table.dataTable.table-striped > tbody > tr.odd > * { box-shadow: none; }

/* DataTables */
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_info { font-size: 12.5px; color: var(--muted); }
.dataTables_wrapper .dataTables_filter input { border-radius: var(--radius-sm); border: 1px solid var(--border); height: 30px; padding: .2rem .55rem; margin-left: .4rem; min-width: 220px; }
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--hl-border); background: var(--hl-2); outline: 0; box-shadow: var(--focus); }
.dataTables_wrapper .dataTables_length select { border-radius: var(--radius-sm); border-color: var(--border); height: 30px; }
.dataTables_wrapper .row:first-child { margin-bottom: .4rem; }
.dataTables_wrapper .row:last-child { margin-top: .4rem; }
.page-link { color: var(--brand); border-color: var(--border); padding: .25rem .6rem; font-size: 12.5px; }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.page-item:first-child .page-link, .page-item:last-child .page-link { border-radius: var(--radius-sm); }
table.dataTable thead .sorting:before, table.dataTable thead .sorting:after { opacity: .2; }

/* ---------- badges, alerts, dropdowns, modals ---------- */
.badge { font-weight: 700; border-radius: 3px; padding: .25em .5em; font-size: 11px; }
.badge-success { background: #dcf1e5; color: #155d3a; }
.badge-danger { background: #f9e0dd; color: #962a1d; }
.badge-warning { background: #fdefc8; color: #7c5300; }
.badge-info { background: #dde9f4; color: #174b6d; }
.badge-secondary { background: #e8edf1; color: #44525f; }
.badge-primary { color: #fff; }
a.badge-info:hover { background: #c9dcee; color: #103a55; }
.badge-light { background: var(--surface-2); color: var(--text); }
.summary-badges .badge { font-size: 12px; padding: .35rem .55rem; margin-right: .35rem; }
.alert { border-radius: var(--radius-sm); border: 1px solid transparent; padding: .55rem .8rem; }
.alert-danger { background: #fbe7e4; color: #7e2116; border-color: #efc2bb; }
.alert-success { background: #e2f3e9; color: #135033; border-color: #b9dfc9; }
.alert-warning { background: #fff4d6; color: #6b4900; border-color: #f0d68c; }
.alert-info { background: #e3eef7; color: #163f5e; border-color: #bcd3e6; }
.dropdown-menu { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .25rem; font-size: 13px; min-width: 230px; }
.dropdown-item { border-radius: 2px; padding: .32rem .6rem; display: flex; align-items: center; gap: .55rem; color: var(--text); }
.dropdown-item i { color: var(--muted); width: 1rem; text-align: center; }
.dropdown-item:hover, .dropdown-item:focus, .dropdown-item.active, .dropdown-item:active { background: var(--hl); color: var(--text); }
.dropdown-item:hover i, .dropdown-item:focus i, .dropdown-item.active i { color: var(--text); }
.dropdown-item kbd { margin-left: auto; }
.dropdown-header { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--muted); padding: .35rem .6rem; }
.modal-content { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header { background: var(--navy); color: #fff; border-bottom: 0; padding: .5rem .9rem; border-radius: var(--radius) var(--radius) 0 0; }
.modal-header .modal-title { font-weight: 700; font-size: 14px; color: #fff; }
.modal-header .close { color: #fff; opacity: .8; text-shadow: none; padding: .5rem .9rem; margin: -.5rem -.9rem -.5rem auto; }
.modal-body { padding: .9rem; }
.modal-footer { border-top-color: var(--border-soft); padding: .5rem .9rem; background: var(--surface-2); }
.modal-backdrop.show { opacity: .4; }
kbd { display: inline-block; min-width: 1.5em; padding: 0 .3rem; font: 600 11px/1.6 Consolas, ui-monospace, monospace; color: var(--text); background: #fff; border: 1px solid var(--border);
	border-bottom-width: 2px; border-radius: 3px; text-align: center; box-shadow: none; }

/* Select2 */
.select2-container--default .select2-selection--single { height: calc(1.5em + .6rem + 2px); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: calc(1.5em + .6rem); padding-left: .55rem; color: var(--text); font-size: 13px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: calc(1.5em + .6rem); }
.select2-dropdown { border-color: var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13px; }
.select2-search--dropdown .select2-search__field { border-radius: var(--radius-sm); border-color: var(--border) !important; padding: .3rem .5rem; }
.select2-container--default .select2-results__option--highlighted[aria-selected], .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--hl); color: var(--text); }
.select2-results__option { padding: .3rem .6rem; }
select + .select2-container { width: 100% !important; }

/* Toastr */
#toast-container > div { border-radius: var(--radius); box-shadow: var(--shadow-lg); opacity: 1; font-family: var(--font); font-size: 13px; }
#toast-container > .toast-success { background-color: var(--success); }
#toast-container > .toast-error { background-color: var(--danger); }
#toast-container > .toast-warning { background-color: var(--accent); }
#toast-container.toast-top-right { top: calc(var(--menubar-h) + var(--titlebar-h) + 8px); right: calc(var(--fbar-w) + 12px); }

/* ---------- helpers used by the screens ---------- */
.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 10.5px; flex-shrink: 0; }
.brand-mark { width: 24px; height: 24px; border-radius: 4px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; flex-shrink: 0; }
.order-card { color: #fff; border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow-sm); }
.order-card h4 { font-size: 13px; font-weight: 700; color: #fff; text-transform: uppercase; }
.order-card .amt { color: #fff; font-weight: 800; }
.order-card.c-today { background: var(--brand); }
.order-card.c-month { background: #2779bd; }
.order-card.c-year { background: var(--accent-600); }
.challan-card { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .8rem; background: var(--surface); overflow: hidden; }
.challan-card .head { background: var(--panel-head); padding: .45rem .8rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.totbox { border: 1px dashed var(--border); background: var(--surface-2); padding: .3rem .6rem; border-radius: var(--radius-sm); }
.ic-green { background: #dcf1e5; color: #155d3a; }
.ic-amber { background: var(--accent-50); color: #8a5a00; }
.ic-blue { background: #dde9f4; color: #174b6d; }
.ic-red { background: #f9e0dd; color: #962a1d; }
.ic-purple { background: #ebe5f8; color: #5a37a8; }
.ic-teal { background: var(--brand-50); color: var(--brand); }
.keys-table td { padding: .3rem .45rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; font-size: 12.5px; }
.keys-table td:first-child { white-space: nowrap; width: 1%; }

/* ---------- focus ---------- */
:focus { outline: 0; }
:focus-visible { outline: 2px solid var(--hl-border); outline-offset: 1px; }
a:focus-visible, .btn:focus-visible, .page-link:focus-visible { outline: 2px solid var(--hl-border); outline-offset: 1px; box-shadow: none; }
.table tbody tr.kb-row a:focus, .table tbody tr.kb-row button:focus { box-shadow: 0 0 0 2px var(--navy); }
.form-control:focus-visible { outline: 0; }

/* =====================================================================
   Desktop shell
   ===================================================================== */
.tbar { position: sticky; top: 0; z-index: 1030; }
.menubar { height: var(--menubar-h); background: var(--navy); color: #dbe7f1; display: flex; align-items: stretch; padding: 0 .4rem; gap: 1px; font-size: 12.5px; }
.mb-brand { display: flex; align-items: center; gap: .45rem; color: #fff; font-weight: 700; padding: 0 .8rem 0 .3rem; margin-right: .3rem; border-right: 1px solid rgba(255, 255, 255, .12); white-space: nowrap; }
.mb-brand:hover, .mb-brand:focus { color: #fff; }
.mb-menu { display: flex; }
.mb-item { background: transparent; border: 0; color: #dbe7f1; padding: 0 .75rem; height: var(--menubar-h); display: inline-flex; align-items: center; gap: .3rem; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.mb-item b { color: #ffd76a; font-weight: 700; }
.mb-item:hover, .mb-item:focus, .show > .mb-item { background: var(--navy-2); color: #fff; }
.mb-item:focus-visible { outline: 2px solid var(--hl); outline-offset: -2px; }
.mb-menu .dropdown-menu { margin-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.mb-right { margin-left: auto; display: flex; align-items: center; gap: .3rem; }
.mb-date { color: #b7cadb; padding: 0 .6rem; white-space: nowrap; }
.mb-user .avatar { background: rgba(255, 255, 255, .18); }
.titlebar { height: var(--titlebar-h); background: linear-gradient(#2a6f9c, var(--brand)); color: #fff; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 .4rem 0 .9rem;
	border-bottom: 2px solid var(--navy-3); font-size: 13px; }
.tb-left { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.tb-center { font-weight: 700; text-align: center; letter-spacing: .04em; white-space: nowrap; color: #ffe9a8; }
.tb-right { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; }
.tb-close { background: rgba(0, 0, 0, .18); border: 1px solid rgba(255, 255, 255, .25); color: #fff; font-size: 11.5px; font-weight: 700; padding: .05rem .5rem; border-radius: 3px; }
.tb-close:hover { background: var(--danger); }
.net-dot { width: 9px; height: 9px; border-radius: 50%; background: #43c27a; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.is-offline .net-dot { background: #e74c3c; }
.net-banner { position: sticky; top: 0; z-index: 1031; background: #8a1c14; color: #fff; text-align: center; font-size: 12.5px; font-weight: 600; padding: .35rem 1rem; }
.is-offline form[method=post] button[type=submit] { opacity: .55; }

.desk { display: flex; align-items: flex-start; min-height: calc(100vh - var(--menubar-h) - var(--titlebar-h)); }
.app-main { flex: 1; min-width: 0; padding: .75rem .9rem 1.5rem; outline: 0; }
.fbar { position: sticky; top: calc(var(--menubar-h) + var(--titlebar-h)); width: var(--fbar-w); flex: 0 0 var(--fbar-w); height: calc(100vh - var(--menubar-h) - var(--titlebar-h));
	flex-direction: column; background: #dfe9f1; border-left: 1px solid var(--border); padding: .35rem; gap: 3px; overflow-y: auto; }
.fb-btn { display: block; width: 100%; text-align: left; background: #f6f9fb; border: 1px solid var(--border); border-radius: 3px; color: var(--text); font-size: 12px; padding: .32rem .5rem;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; cursor: pointer; }
.fb-btn b { color: var(--navy); }
.fb-btn:hover, .fb-btn:focus { background: var(--hl); border-color: var(--hl-border); color: var(--text); }
.fb-btn.active { background: var(--brand-50); border-color: var(--brand); }
.fb-accept { background: #e2f3e9; border-color: #8fcaa7; }
.fb-gap { flex: 1; min-height: .5rem; }

/* ---------- Gateway (home) ---------- */
.gateway { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: .9rem; align-items: start; margin-bottom: .9rem; }
.tpanel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.tpanel-head { background: var(--panel-head); color: var(--navy); font-weight: 700; padding: .4rem .8rem; border-bottom: 1px solid var(--border); font-size: 13px; }
.gw-period + .tpanel-head { border-top: 1px solid var(--border); }
.gw-period { padding: .45rem .8rem; font-weight: 600; }
.gw-figs { width: 100%; border-collapse: collapse; font-size: 13px; }
.gw-figs th { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: .35rem .8rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border-soft); background: var(--surface-2); }
.gw-figs td { padding: .4rem .8rem; border-bottom: 1px solid var(--border-soft); }
.gw-figs td:first-child { font-weight: 600; }
.gw-due { display: flex; justify-content: space-between; padding: .55rem .8rem; color: var(--danger); font-weight: 600; background: #fff7f5; }
.gw-due:hover { background: var(--hl); color: var(--danger); }
.gw-menu .tpanel-head { background: var(--navy); color: #fff; font-size: 13.5px; letter-spacing: .03em; }
.gw-menu { padding-bottom: .4rem; }
.gw-group { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; padding: .55rem 1.2rem .15rem; }
.gw-item { display: flex; align-items: center; justify-content: space-between; padding: .2rem 1.2rem .2rem 2rem; color: var(--text); font-size: 13.5px; line-height: 1.5; }
.gw-item small { color: var(--muted); font-size: 11px; }
.gw-item:hover { background: var(--hl-2); color: var(--text); }
.gw-item:focus, .gw-item.active { background: var(--hl); color: var(--text); outline: 0; font-weight: 600; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.kpi { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-top: 3px solid var(--brand); border-radius: var(--radius); padding: .55rem .7rem; color: var(--text); box-shadow: var(--shadow-sm); min-width: 0; }
.kpi:hover, .kpi:focus { background: var(--hl-2); color: var(--text); border-color: var(--hl-border); }
.k-lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-val { font-size: 19px; font-weight: 800; line-height: 1.3; white-space: nowrap; font-variant-numeric: tabular-nums; }
.k-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-red { border-top-color: var(--danger); } .k-red .k-val { color: var(--danger); }
.k-amber { border-top-color: var(--accent); } .k-amber .k-val { color: #9a6200; }
.k-blue { border-top-color: #2779bd; } .k-blue .k-val { color: #1f5f96; }
.k-green { border-top-color: var(--success); } .k-green .k-val { color: var(--success); }
.k-navy { border-top-color: var(--navy); } .k-navy .k-val { color: var(--navy); }
.k-teal { border-top-color: var(--brand); } .k-teal .k-val { color: var(--brand); }
.k-grey { border-top-color: #8a99a6; }
.dash { display: grid; gap: .8rem; margin-bottom: .9rem; align-items: start;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 320px;
	grid-template-areas: "today trend gw" "pend site gw" "stock recent alert"; }
.d-today { grid-area: today; } .d-trend { grid-area: trend; } .d-gw { grid-area: gw; } .d-pend { grid-area: pend; } .d-site { grid-area: site; }
.d-stock { grid-area: stock; } .d-recent { grid-area: recent; } .d-alert { grid-area: alert; }
.dash .tpanel { height: 100%; }
.dash .tpanel-head a { font-weight: 600; font-size: 12px; }
.dash .table td, .dash .table th { padding: .28rem .6rem; }
.today-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border); }
.today-grid a { display: flex; flex-direction: column; align-items: center; padding: .55rem .3rem; color: var(--text); border-right: 1px solid var(--border-soft); }
.today-grid a:last-child { border-right: 0; }
.today-grid a:hover { background: var(--hl-2); }
.today-grid b { font-size: 20px; line-height: 1.1; color: var(--navy); }
.today-grid span { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.today-grid small { font-size: 11.5px; }
.d-today { display: flex; flex-direction: column; }
.quick { margin-top: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; padding: .6rem; border-top: 1px solid var(--border-soft); background: var(--surface-2); }
.quick .btn { white-space: nowrap; padding: .35rem .3rem; }
.quick kbd { background: rgba(255, 255, 255, .25); border-color: rgba(255, 255, 255, .35); color: inherit; font-size: 10px; margin-left: 2px; }
@media (max-width: 767.98px) { .quick { grid-template-columns: repeat(2, 1fr); } }
.bar { height: 4px; background: #edf2f6; border-radius: 2px; margin-top: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--danger); opacity: .75; }
.bar-stock i { background: var(--brand); }
.stock-sum { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .3rem; padding: .45rem .7rem; background: var(--surface-2); border-bottom: 1px solid var(--border-soft); font-size: 12px; color: var(--muted); }
.stock-sum b { color: var(--text); }
.recent a, .alerts a { display: flex; align-items: center; gap: .55rem; padding: .38rem .7rem; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.recent a:hover, .alerts a:hover, .recent a:focus, .alerts a:focus { background: var(--hl-2); color: var(--text); }
.recent i { width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.r-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.r-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.recent a.cancelled { opacity: .55; text-decoration: line-through; }
.alerts a > span { flex: 1; min-width: 0; font-size: 12.5px; }
.alerts a > b { white-space: nowrap; }
.alerts i { width: 16px; text-align: center; }
@media (max-width: 1499.98px) {
	.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 300px; grid-template-areas: "today trend gw" "pend site gw" "stock recent gw" "alert alert gw"; }
}
@media (max-width: 1199.98px) {
	.dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "gw today" "gw trend" "pend site" "stock recent" "alert alert"; }
}
@media (max-width: 767.98px) {
	.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
	.k-val { font-size: 17px; }
	.dash { grid-template-columns: minmax(0, 1fr); grid-template-areas: "today" "pend" "site" "alert" "recent" "stock" "trend" "gw"; }
}

/* ---------- Go To (palette) ---------- */
.palette .modal-dialog { max-width: 560px; margin-top: 9vh; }
.palette .modal-content { overflow: hidden; }
.palette-head { background: var(--navy); color: #fff; font-weight: 700; padding: .45rem .9rem; font-size: 13px; }
.palette-input { border: 0 !important; box-shadow: none !important; font-size: 15px; height: auto; padding: .7rem .9rem .7rem 2.4rem; border-bottom: 1px solid var(--border) !important; border-radius: 0 !important; background: var(--hl-2) !important; }
.palette-ic { position: absolute; left: .95rem; top: .95rem; color: var(--muted); }
.palette-list { max-height: 55vh; overflow-y: auto; padding: .25rem; }
.palette-group { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .45rem .6rem .15rem; }
.palette-item { display: flex; align-items: center; gap: .6rem; padding: .32rem .6rem; border-radius: 2px; color: var(--text); cursor: pointer; }
.palette-item i { color: var(--muted); width: 16px; text-align: center; }
.palette-item .sub { font-size: 11.5px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.palette-item.active, .palette-item:hover { background: var(--hl); color: var(--text); }
.palette-foot { border-top: 1px solid var(--border); padding: .35rem .8rem; font-size: 11.5px; color: var(--muted); display: flex; gap: 1rem; flex-wrap: wrap; background: var(--surface-2); }
.palette-empty { padding: 1rem; text-align: center; color: var(--muted); }

/* ---------- phone / tablet ---------- */
.appbar, .bottomnav, .sheet, .sheet-backdrop { display: none; }
@media (max-width: 991.98px) {
	body { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); font-size: 14px; }
	.appbar { display: flex; position: sticky; top: 0; z-index: 1030; align-items: center; gap: .25rem; height: calc(var(--appbar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) .4rem 0;
		background: var(--navy); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
	.ab-btn { background: transparent; border: 0; color: #fff; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }
	.ab-btn:hover, .ab-btn:focus { background: rgba(255, 255, 255, .12); color: #fff; }
	.ab-btn .avatar { width: 30px; height: 30px; background: rgba(255, 255, 255, .18); font-size: 12px; }
	.ab-title { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: .3rem; }
	.desk { display: block; min-height: 0; }
	.app-main { padding: .6rem .6rem 1.2rem; }
	.app-main .row { margin-left: -.35rem; margin-right: -.35rem; }
	.app-main .row > [class*=col] { padding-left: .35rem; padding-right: .35rem; }
	.app-main .form-inline { gap: .4rem; }
	.app-main .form-inline .form-control { flex: 1 1 140px; min-width: 0; margin-right: 0 !important; }
	.card { border-radius: 10px; }
	.card-header:first-child { border-radius: 10px 10px 0 0; }
	.form-control, .select2-container--default .select2-selection--single .select2-selection__rendered, .dataTables_wrapper .dataTables_filter input { font-size: 16px !important; } /* no iOS zoom */
	.form-control, .select2-container--default .select2-selection--single, .select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px; }
	.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 38px; }
	.btn { padding: .4rem .85rem; }
	.dataTables_wrapper .dataTables_filter { text-align: left !important; }
	.dataTables_wrapper .dataTables_filter label { width: 100%; }
	.dataTables_wrapper .dataTables_filter input { min-width: 0; width: 100%; margin: .25rem 0 0; height: 38px; }
	.dataTables_wrapper .dataTables_paginate { text-align: center !important; }
	#toast-container.toast-top-right { left: 10px; right: 10px; top: calc(var(--appbar-h) + env(safe-area-inset-top) + 8px); }
	#toast-container > div { width: auto; }
	.main-form > .card-footer, form.main-form .card-footer { position: sticky; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); z-index: 5; box-shadow: 0 -4px 12px rgba(16, 36, 56, .08); }
	.main-form > .card-footer .btn, form.main-form .card-footer .btn { flex: 1; }

	.gateway { grid-template-columns: 1fr; }
	.gw-menu { order: -1; }
	.gw-item { padding: .45rem 1rem .45rem 1.4rem; font-size: 15px; }

	.bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
		background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(16, 36, 56, .08); }
	.bottomnav a, .bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; border: 0; background: transparent; }
	.bottomnav a i, .bottomnav button i { font-size: 18px; }
	.bottomnav a.active { color: var(--brand); }
	.bottomnav .fab-wrap { flex: 1; display: flex; justify-content: center; }
	.bottomnav .fab { flex: 0 0 54px; width: 54px; height: 54px; border-radius: 16px; background: var(--accent); color: #fff; margin-top: -22px; font-size: 22px; box-shadow: 0 6px 16px rgba(227, 155, 22, .45); }

	.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1045; }
	.sheet-backdrop.show { display: block; }
	.sheet { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1046; background: #fff; border-radius: 18px 18px 0 0; max-height: 86vh; overflow-y: auto;
		padding: .5rem 1rem calc(1rem + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .25s cubic-bezier(.4, 0, .2, 1); visibility: hidden; }
	.sheet.show { transform: none; visibility: visible; }
	.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: #ccd6de; margin: .25rem auto .75rem; }
	.sheet .avatar { width: 34px; height: 34px; font-size: 13px; }
	.sheet-title { font-weight: 700; margin-bottom: .75rem; }
	.sheet-section { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 1rem 0 .6rem; }
	.more-sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem .25rem; }
	.more-sheet-grid a { display: flex; flex-direction: column; align-items: center; gap: .35rem; font-size: 11.5px; color: var(--text); text-align: center; font-weight: 500; line-height: 1.2; }
	.more-sheet-grid a i { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 18px; }

	/* lists as cards */
	table.table-cards thead { display: none; }
	table.table-cards, table.table-cards tbody, table.table-cards tr, table.table-cards td { display: block; width: 100% !important; }
	table.table-cards { border: 0 !important; background: transparent; }
	table.table-cards tbody tr { background: #fff !important; border: 1px solid var(--border); border-radius: 10px; margin-bottom: .55rem; padding: .5rem .75rem; box-shadow: var(--shadow-sm); }
	table.table-cards tbody tr.kb-row { background: var(--hl-2) !important; border-color: var(--hl-border); }
	table.table-cards td, table.table-cards tbody tr > * { box-shadow: none !important; background: transparent !important; }
	table.table-cards td { border: 0 !important; padding: .18rem 0 !important; display: flex; justify-content: space-between; gap: 1rem; text-align: right; white-space: normal; font-size: 14px; }
	table.table-cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: 12px; text-align: left; flex-shrink: 0; }
	table.table-cards td.dataTables_empty { display: block; text-align: center; }
	table.table-cards td.dataTables_empty::before { display: none; }
	table.table-cards td.td-actions { justify-content: flex-end; border-top: 1px dashed var(--border) !important; margin-top: .3rem; padding-top: .45rem !important; }
	table.table-cards td.td-actions::before { display: none; }
	table.table-cards td.td-actions .btn-act { padding: .35rem .7rem; font-size: 14px; }
	table.table-cards tfoot { display: block; }
	table.table-cards tfoot tr { display: flex; flex-wrap: wrap; gap: .5rem; background: var(--panel-head); border-radius: 10px; padding: .5rem .75rem; }
	table.table-cards tfoot th, table.table-cards tfoot td { display: inline; width: auto !important; border: 0 !important; background: transparent; padding: 0 !important; }
	.table-responsive:has(> table.table-cards) { overflow: visible; }
}

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.auth-hero { background: linear-gradient(140deg, #0c2438 0%, #12324d 50%, #1d5b84 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: repeating-radial-gradient(circle, rgba(255, 255, 255, .06) 0 2px, transparent 2px 22px); }
.auth-hero .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 15px; }
.auth-hero .brand-mark { width: 34px; height: 34px; font-size: 16px; }
.auth-hero .brand-text small { display: block; font-weight: 500; font-size: 11px; opacity: .7; }
.auth-hero h2 { font-weight: 800; font-size: 30px; letter-spacing: -.01em; max-width: 460px; color: #fff; }
.auth-hero .feat { display: flex; gap: .75rem; align-items: center; margin-bottom: .9rem; opacity: .92; font-size: 14px; }
.auth-hero .feat i { width: 34px; height: 34px; border-radius: 6px; background: rgba(255, 255, 255, .12); display: flex; align-items: center; justify-content: center; color: #ffd76a; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 360px; }
.auth-card .form-control { height: calc(1.5em + 1.1rem + 2px); padding: .55rem .8rem; font-size: 14px; }
.auth-card .btn-primary { padding: .55rem 1rem; font-size: 14px; }
@media (max-width: 991.98px) {
	.auth-wrap { grid-template-columns: 1fr; background: var(--navy); }
	.auth-hero { padding: 2.5rem 1.5rem 4rem; }
	.auth-hero .feats, .auth-hero .foot { display: none; }
	.auth-hero h2 { font-size: 22px; }
	.auth-form { background: #fff; border-radius: 22px 22px 0 0; margin-top: -2rem; position: relative; z-index: 2; align-items: flex-start; padding: 2rem 1.5rem; }
	body.auth-body { padding-bottom: 0; }
}

/* ---------- printed documents: preview frame and letterhead for list pages ---------- */
.print-preview { background: #f2f2f2; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 0; overflow-x: auto; }
.print-preview iframe { display: block; width: 100%; min-width: 820px; height: 1180px; border: 0; background: #fff; }
.print-head { display: none; }

/* ---------- print ---------- */
@media print {
	.tbar, .appbar, .fbar, .bottomnav, .sheet, .net-banner, .no-print, .dataTables_length, .dataTables_filter, .dataTables_paginate, .dataTables_info { display: none !important; }
	body { background: #fff !important; padding: 0 !important; }
	.desk { display: block; }
	.app-main { padding: 0; }
	.card { border: 0 !important; box-shadow: none !important; }
	/* list pages print on the firm letterhead, like the bills */
	.print-head { display: block; text-align: center; font-family: Arial, Helvetica, sans-serif; color: #000; margin-bottom: 8pt; border-bottom: 0.9pt solid #000; padding-bottom: 5pt; }
	.ph-top { display: flex; justify-content: space-between; font-size: 9pt; }
	.ph-mob { color: #2244aa; }
	.ph-firm { color: #e00000; font-size: 22pt; line-height: 1.2; }
	.ph-line { font-size: 8pt; }
	.card-header { background: #d9d6cf !important; border: 0.9pt solid #000 !important; }
	.table thead th { background: #d9d6cf !important; color: #000 !important; border: 0.9pt solid #000 !important; font-family: "Times New Roman", serif; text-transform: none; font-size: 9pt; }
	.table td, .table th { border-color: #000 !important; color: #000 !important; font-size: 9pt; }
	.table tbody tr.kb-row, .table tbody tr.kb-row > * { background: transparent !important; }
	.btn, .no-print, .print-preview { display: none !important; }
	a { color: #000 !important; text-decoration: none !important; }
	.badge { border: 0; background: transparent !important; color: #000 !important; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
