/* ==========================================================================
   Bit Travel Management System — Shared Styles
   AdminLTE 3.2 + Bootstrap 4.6 base, with custom nav/cards/tables on top.
   ========================================================================== */

:root {
	--bt-navy: #0b2e4f;
	--bt-navy-dark: #081f37;
	--bt-accent: #1e88e5;
	--bt-success: #2e7d32;
	--bt-warning: #b8860b;
	--bt-danger: #c62828;
	--bt-border: #e3e7ec;
	--bt-bg: #f4f6f9;
	--bt-text: #1f2933;
	--bt-text-muted: #64748b;
}

body {
	background: var(--bt-bg);
	color: var(--bt-text);
	font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------------------------------------------------------------------
   App shell — collapsible sidebar + topbar
   ------------------------------------------------------------------- */
.bt-shell {
	display: flex;
	min-height: 100vh;
}

.bt-sidebar {
	width: 240px;
	flex-shrink: 0;
	background: linear-gradient(180deg, var(--bt-navy) 0%, var(--bt-navy-dark) 100%);
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	transition: width 0.18s ease;
	z-index: 1000;
}
.bt-shell.sidebar-collapsed .bt-sidebar { width: 68px; }

.bt-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 56px;
	padding: 0 0.9rem;
	flex-shrink: 0;
	border-bottom: 1px solid rgba(255,255,255,0.08);
}
.bt-brand {
	color: #fff;
	font-weight: 700;
	font-size: 1.05rem;
	text-decoration: none;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	overflow: hidden;
}
.bt-brand i { font-size: 1.3rem; flex-shrink: 0; }
.bt-shell.sidebar-collapsed .bt-brand-text { display: none; }

.bt-sidebar-toggle {
	background: rgba(255,255,255,0.08);
	border: none;
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 6px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 1rem;
}
.bt-sidebar-toggle:hover { background: rgba(255,255,255,0.18); }

.bt-navlinks {
	list-style: none;
	margin: 0.5rem 0;
	padding: 0 0.6rem;
	flex: 1;
	overflow-y: auto;
}
.bt-navlinks li { margin-bottom: 0.15rem; }
.bt-navlinks li a {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	color: rgba(255,255,255,0.75);
	text-decoration: none;
	padding: 0.55rem 0.65rem;
	border-radius: 7px;
	font-size: 0.875rem;
	white-space: nowrap;
	overflow: hidden;
	transition: background 0.15s, color 0.15s;
}
.bt-navlinks li a i { font-size: 1.05rem; flex-shrink: 0; width: 20px; text-align: center; }
.bt-navlinks li a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.bt-navlinks li.active a { background: rgba(255,255,255,0.16); color: #fff; font-weight: 600; border-left: 3px solid var(--bt-accent); padding-left: calc(0.65rem - 3px); }
.bt-shell.sidebar-collapsed .bt-navlink-text { display: none; }
.bt-shell.sidebar-collapsed .bt-navlinks li a { justify-content: center; }

.bt-nav-section-label {
	color: rgba(255,255,255,0.4);
	font-size: 0.68rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding: 0.9rem 0.65rem 0.3rem;
	font-weight: 600;
}
.bt-shell.sidebar-collapsed .bt-nav-section-label { display: none; }

.bt-sidebar-footer {
	padding: 0.75rem 0.6rem;
	border-top: 1px solid rgba(255,255,255,0.08);
	flex-shrink: 0;
}
.bt-sidebar-footer a {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	color: rgba(255,255,255,0.65);
	text-decoration: none;
	padding: 0.5rem 0.65rem;
	border-radius: 7px;
	font-size: 0.85rem;
}
.bt-sidebar-footer a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.bt-sidebar-footer a i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.bt-shell.sidebar-collapsed .bt-sidebar-footer-text { display: none; }

.bt-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.bt-topbar {
	height: 56px;
	background: #fff;
	border-bottom: 1px solid var(--bt-border);
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.75rem;
	padding: 0 1.25rem;
	flex-shrink: 0;
	position: sticky;
	top: 0;
	z-index: 900;
}
.bt-topbar-mobile-toggle {
	display: none;
	background: none;
	border: none;
	font-size: 1.3rem;
	color: var(--bt-navy);
	cursor: pointer;
	margin-right: auto;
}

.bt-impersonate-badge {
	background: #fdf3da;
	color: #8a6500;
	border: 1px solid #f0dba3;
	padding: 0.3rem 0.75rem;
	border-radius: 6px;
	font-size: 0.8rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	white-space: nowrap;
	margin-right: auto;
}
.bt-impersonate-exit { color: #8a6500; font-weight: 600; text-decoration: underline; }

.bt-navuser {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	white-space: nowrap;
}
.bt-avatar {
	width: 32px; height: 32px;
	border-radius: 50%;
	background: var(--bt-accent);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 0.85rem;
	flex-shrink: 0;
}
.bt-navuser-name { color: var(--bt-text); font-size: 0.875rem; font-weight: 600; }
.bt-role-badge {
	font-size: 0.68rem;
	padding: 0.15rem 0.5rem;
	border-radius: 10px;
	background: #eef2f7;
	color: var(--bt-navy);
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-weight: 700;
}
.bt-logout { color: var(--bt-text-muted); font-size: 1.2rem; text-decoration: none; }
.bt-logout:hover { color: var(--bt-danger); }

@media (max-width: 900px) {
	.bt-sidebar {
		position: fixed;
		left: 0;
		transform: translateX(-100%);
		transition: transform 0.18s ease;
	}
	.bt-shell.sidebar-mobile-open .bt-sidebar { transform: translateX(0); width: 240px; }
	.bt-topbar-mobile-toggle { display: block; }
	.bt-main { width: 100%; }
}

/* ---------------------------------------------------------------------
   Page wrappers
   ------------------------------------------------------------------- */
.page-wrap {
	max-width: 1300px;
	margin: 1.5rem auto;
	padding: 0 1.5rem;
	width: 100%;
}
.invoice-page {
	/*max-width: 1100px;*/
	margin: 1.5rem auto;
	padding: 0 1.5rem;
	width: 100%;
}

.page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.25rem;
	flex-wrap: wrap;
	gap: 0.75rem;
}
.page-header h1 {
	font-size: 1.4rem;
	font-weight: 700;
	margin: 0;
	color: var(--bt-navy);
}

/* ---------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------- */
.bt-card {
	background: #fff;
	border: 1px solid var(--bt-border);
	border-radius: 10px;
	padding: 1.25rem;
	margin-bottom: 1.25rem;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.bt-card-title {
	font-size: 1rem;
	font-weight: 700;
	color: var(--bt-navy);
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.bt-stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 1rem;
}
.bt-stat-card {
	background: #fff;
	border: 1px solid var(--bt-border);
	border-radius: 10px;
	padding: 1.1rem;
}
.bt-stat-label { font-size: 0.8rem; color: var(--bt-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.bt-stat-value { font-size: 1.6rem; font-weight: 700; color: var(--bt-navy); margin-top: 0.25rem; }
.bt-stat-value.positive { color: var(--bt-success); }
.bt-stat-value.negative { color: var(--bt-danger); }

/* ---------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------- */
.btn-bt-primary {
	background: var(--bt-accent);
	border: none;
	color: #fff;
	padding: 0.5rem 1rem;
	border-radius: 6px;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
}
.btn-bt-primary:hover { background: #1565c0; color: #fff; }
.btn-bt-secondary {
	background: #fff;
	border: 1px solid var(--bt-border);
	color: var(--bt-text);
	padding: 0.5rem 1rem;
	border-radius: 6px;
	font-size: 0.875rem;
	cursor: pointer;
}
.btn-bt-secondary:hover { background: #f0f2f5; }
.btn-bt-danger {
	background: #fff;
	border: 1px solid var(--bt-danger);
	color: var(--bt-danger);
	padding: 0.4rem 0.85rem;
	border-radius: 6px;
	font-size: 0.8rem;
	cursor: pointer;
}
.btn-bt-danger:hover { background: var(--bt-danger); color: #fff; }
.btn-bt-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }

/* ---------------------------------------------------------------------
   Tables
   ------------------------------------------------------------------- */
.bt-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.bt-table th {
	text-align: left;
	background: #f0f3f7;
	color: var(--bt-text-muted);
	font-weight: 600;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	padding: 0.6rem 0.75rem;
	border-bottom: 2px solid var(--bt-border);
}
.bt-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--bt-border); vertical-align: middle; }
.bt-table tr:hover td { background: #fafbfc; }
.bt-table .text-right { text-align: right; }
.bt-table .text-center { text-align: center; }

/* Invoice line-item rows */
#invoice-body td.desc textarea {
	width: 100%;
	min-height: 38px;
	resize: vertical;
	border: 1px solid var(--bt-border);
	border-radius: 4px;
	padding: 0.35rem;
	font-size: 0.85rem;
	font-family: inherit;
}
#invoice-body input, #invoice-body select {
	width: 100%;
	border: 1px solid var(--bt-border);
	border-radius: 4px;
	padding: 0.35rem;
	font-size: 0.85rem;
}

/* ---------------------------------------------------------------------
   Badges
   ------------------------------------------------------------------- */
.badge-status {
	padding: 0.25rem 0.6rem;
	border-radius: 10px;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}
.badge-paid { background: #e3f3e5; color: var(--bt-success); }
.badge-partial { background: #fdf3da; color: var(--bt-warning); }
.badge-pending { background: #fde6e6; color: var(--bt-danger); }

/* ---------------------------------------------------------------------
   Modals
   ------------------------------------------------------------------- */
.bt-modal-overlay {
	display: none;
	position: fixed; inset: 0;
	background: rgba(15,23,33,0.45);
	z-index: 2000;
	align-items: center;
	justify-content: center;
}
.bt-modal-overlay.open { display: flex; }
.bt-modal {
	background: #fff;
	border-radius: 10px;
	width: 100%;
	max-width: 480px;
	max-height: 90vh;
	overflow-y: auto;
	padding: 1.5rem;
	box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.bt-modal h3 { margin-top: 0; color: var(--bt-navy); }
.bt-modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }

/* ---------------------------------------------------------------------
   Toasts
   ------------------------------------------------------------------- */
.bt-toast-container {
	position: fixed; top: 70px; right: 20px;
	z-index: 3000;
	display: flex; flex-direction: column; gap: 0.5rem;
}
.bt-toast {
	background: #fff;
	border-left: 4px solid var(--bt-accent);
	border-radius: 6px;
	padding: 0.75rem 1rem;
	min-width: 260px;
	box-shadow: 0 4px 14px rgba(0,0,0,0.15);
	font-size: 0.875rem;
	animation: bt-toast-in 0.2s ease-out;
}
.bt-toast.success { border-left-color: var(--bt-success); }
.bt-toast.error { border-left-color: var(--bt-danger); }
@keyframes bt-toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ---------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------- */
.bt-form-group { margin-bottom: 1rem; }
.bt-form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--bt-text); margin-bottom: 0.3rem; }
.bt-form-group input, .bt-form-group select, .bt-form-group textarea {
	width: 100%;
	border: 1px solid var(--bt-border);
	border-radius: 6px;
	padding: 0.5rem 0.65rem;
	font-size: 0.875rem;
}
.bt-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.bt-error-banner { background: #fde6e6; color: var(--bt-danger); padding: 0.65rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.875rem; }
.bt-success-banner { background: #e3f3e5; color: var(--bt-success); padding: 0.65rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.875rem; }

/* ---------------------------------------------------------------------
   DataTables — restyled to match app theme instead of default look
   ------------------------------------------------------------------- */
.dataTables_wrapper { font-size: 0.875rem; }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
	border: 1px solid var(--bt-border);
	border-radius: 6px;
	padding: 0.35rem 0.6rem;
	font-size: 0.85rem;
	margin-left: 0.4rem;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
	outline: none;
	border-color: var(--bt-accent);
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
	color: var(--bt-text-muted);
	font-size: 0.82rem;
	padding-top: 0.75rem;
}
.dataTables_wrapper .dataTables_filter { float: right; }
table.dataTable thead th {
	background: #f0f3f7;
	color: var(--bt-text-muted);
	font-weight: 600;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	border-bottom: 2px solid var(--bt-border) !important;
	padding: 0.6rem 0.75rem !important;
}
table.dataTable thead th.sorting:before,
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:before,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:before,
table.dataTable thead th.sorting_desc:after {
	opacity: 0.4;
}
table.dataTable tbody td {
	padding: 0.6rem 0.75rem !important;
	border-bottom: 1px solid var(--bt-border) !important;
	vertical-align: middle;
}
table.dataTable tbody tr:hover td { background: #fafbfc; }
table.dataTable.no-footer { border-bottom: none !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
	border-radius: 6px !important;
	border: 1px solid transparent !important;
	padding: 0.3rem 0.65rem !important;
	margin-left: 0.15rem !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
	background: var(--bt-accent) !important;
	border-color: var(--bt-accent) !important;
	color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
	background: #eef2f7 !important;
	border-color: var(--bt-border) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
	opacity: 0.4;
}

/* Search box with leading icon, used alongside DataTables' built-in filter */
.bt-search-box {
	position: relative;
	max-width: 320px;
}
.bt-search-box i {
	position: absolute;
	left: 0.7rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--bt-text-muted);
	font-size: 0.95rem;
}
.bt-search-box input {
	width: 100%;
	border: 1px solid var(--bt-border);
	border-radius: 7px;
	padding: 0.5rem 0.75rem 0.5rem 2.1rem;
	font-size: 0.85rem;
}
.bt-search-box input:focus { outline: none; border-color: var(--bt-accent); }

/* ---------------------------------------------------------------------
   Invoice redesign — sale/cost summary cards, refined line-item table
   ------------------------------------------------------------------- */
.bt-invoice-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1.5rem;
	flex-wrap: wrap;
	padding-bottom: 1.25rem;
	margin-bottom: 1.25rem;
	border-bottom: 1px solid var(--bt-border);
}
.bt-invoice-brand { display: flex; gap: 0.9rem; align-items: flex-start; }
.bt-invoice-logo { max-height: 56px; max-width: 140px; object-fit: contain; }
.bt-invoice-company-name { font-size: 1.25rem; font-weight: 800; color: var(--bt-navy); margin: 0; }
.bt-invoice-meta { font-size: 0.8rem; color: var(--bt-text-muted); line-height: 1.5; }
.bt-invoice-doc-title {
	text-align: right;
}
.bt-invoice-doc-title h2 {
	margin: 0;
	font-size: 1.6rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	color: var(--bt-accent);
}
.bt-invoice-doc-meta { font-size: 0.85rem; margin-top: 0.35rem; }
.bt-invoice-doc-meta .invoice-no { font-weight: 700; font-size: 1rem; color: var(--bt-text); }

.bt-bill-to {
	background: #f7f9fb;
	border-radius: 8px;
	padding: 0.9rem 1.1rem;
	margin-bottom: 1.25rem;
	display: inline-block;
	min-width: 240px;
}
.bt-bill-to-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--bt-text-muted); font-weight: 700; margin-bottom: 0.25rem; }
.bt-bill-to-name { font-weight: 700; font-size: 1rem; color: var(--bt-text); }

.bt-summary-panel {
	display: flex;
	justify-content: flex-end;
	margin-top: 1.5rem;
}
.bt-summary-box {
	width: 320px;
	background: #f7f9fb;
	border-radius: 10px;
	padding: 1.1rem 1.25rem;
}
.bt-summary-row { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 0.9rem; }
.bt-summary-row.divider { border-top: 1px solid var(--bt-border); margin-top: 0.4rem; padding-top: 0.6rem; }
.bt-summary-row.total { font-weight: 800; font-size: 1.05rem; color: var(--bt-navy); }
.bt-summary-row .label { color: var(--bt-text-muted); }

.bt-invoice-footer-note {
	margin-top: 1.75rem;
	padding-top: 1.1rem;
	border-top: 1px solid var(--bt-border);
	font-size: 0.78rem;
	color: var(--bt-text-muted);
}

/* Sticky summary bar on create/edit screens */
.bt-sticky-summary {
	position: sticky;
	bottom: 0;
	background: #fff;
	border-top: 1px solid var(--bt-border);
	box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
	padding: 1rem 1.25rem;
	margin: 1.25rem -1.25rem -1.25rem;
	border-radius: 0 0 10px 10px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
}
.bt-sticky-summary-totals { display: flex; gap: 1.75rem; flex-wrap: wrap; }
.bt-sticky-summary-item { text-align: right; }
.bt-sticky-summary-item .label { font-size: 0.7rem; text-transform: uppercase; color: var(--bt-text-muted); letter-spacing: 0.04em; }
.bt-sticky-summary-item .value { font-size: 1.1rem; font-weight: 800; color: var(--bt-navy); }
.bt-sticky-summary-item .value.positive { color: var(--bt-success); }
.bt-sticky-summary-item .value.negative { color: var(--bt-danger); }

@media print {
	.bt-sidebar, .bt-topbar, .no-print, .bt-modal-overlay, .bt-toast-container { display: none !important; }
	.bt-shell { display: block; }
	.bt-main { width: 100%; }
	.invoice-page { max-width: 100%; margin: 0; padding: 0; }
	body { background: #fff; }
	#invoice-body td.desc textarea {
		border: none;
		resize: none;
		background: transparent;
	}
	.bt-card { box-shadow: none; border: none; }
	.bt-sticky-summary { position: static; box-shadow: none; margin: 1.25rem 0 0; }
}
