/* ------------------------------------------------------------------ *
 * Business Management -- application chrome.
 *
 * Deliberately small: Bootstrap 5 does the work, this only adds the
 * sidebar layout and a few restrained adjustments for dense data tables.
 * ------------------------------------------------------------------ */

:root {
	--bms-sidebar-width: 220px;
	--bms-topbar-bg: #1f2d3d;
	--bms-border: #dee2e6;
	--bms-muted: #6c757d;
}

body {
	background-color: #f5f6f8;
	font-size: 0.9375rem;
}

/* ---------- Top bar ---------- */

.topbar {
	background-color: var(--bms-topbar-bg);
	padding-top: 0.5rem;
	padding-bottom: 0.5rem;
}

.topbar .navbar-brand {
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.topbar .navbar-brand:hover {
	color: #fff;
}

/* ---------- Layout ---------- */

.layout {
	display: flex;
	align-items: flex-start;
}

.sidebar {
	width: var(--bms-sidebar-width);
	flex: 0 0 var(--bms-sidebar-width);
	padding: 1rem 0.75rem;
	background-color: #fff;
	border-right: 1px solid var(--bms-border);
	min-height: calc(100vh - 56px);
	position: sticky;
	top: 56px;
}

.sidebar .nav-link {
	color: #33404d;
	padding: 0.4rem 0.75rem;
	border-radius: 0.25rem;
	font-size: 0.9rem;
}

.sidebar .nav-link:hover {
	background-color: #eef1f4;
}

.sidebar .nav-link.active {
	background-color: #1f2d3d;
	color: #fff;
}

.sidebar .nav-section {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--bms-muted);
	padding: 0.9rem 0.75rem 0.3rem;
	font-weight: 600;
}

.content {
	flex: 1 1 auto;
	min-width: 0;
	padding: 1.25rem;
}

@media (max-width: 991.98px) {
	.content {
		padding: 1rem;
	}

	.offcanvas-body.sidebar {
		width: auto;
		flex: none;
		border-right: 0;
		min-height: 0;
		position: static;
	}
}

/* ---------- Page headings ---------- */

.page-header {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1rem;
}

.page-header h1 {
	font-size: 1.35rem;
	font-weight: 600;
	margin: 0;
}

.page-header .subtitle {
	color: var(--bms-muted);
	font-size: 0.85rem;
	margin: 0.15rem 0 0;
}

/* ---------- Cards and tables ---------- */

.card {
	border-color: var(--bms-border);
}

.card-header {
	background-color: #fff;
	border-bottom: 1px solid var(--bms-border);
	font-weight: 600;
	font-size: 0.9rem;
	padding: 0.7rem 1rem;
}

.table {
	font-size: 0.875rem;
	margin-bottom: 0;
}

.table > thead th {
	background-color: #f8f9fa;
	border-bottom-width: 1px;
	font-weight: 600;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #4a5562;
	white-space: nowrap;
}

.table td,
.table th {
	vertical-align: middle;
}

.table .num {
	text-align: right;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.table .actions {
	white-space: nowrap;
	text-align: right;
	width: 1%;
}

/* ---------- Dashboard tiles ---------- */

.stat-card .stat-label {
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--bms-muted);
	font-weight: 600;
}

.stat-card .stat-value {
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.2;
	margin-top: 0.2rem;
	font-variant-numeric: tabular-nums;
}

.stat-card .stat-note {
	font-size: 0.78rem;
	color: var(--bms-muted);
}

/* Renewal buckets keep a colour-coded left edge. */
.bucket-overdue  { border-left: 3px solid var(--bs-danger); }
.bucket-today    { border-left: 3px solid var(--bs-warning); }
.bucket-week     { border-left: 3px solid var(--bs-info); }
.bucket-month    { border-left: 3px solid var(--bs-secondary); }

/* ---------- Forms ---------- */

.form-label {
	font-weight: 500;
	font-size: 0.85rem;
	margin-bottom: 0.25rem;
}

.required-mark {
	color: var(--bs-danger);
}

fieldset legend {
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
	color: var(--bms-muted);
	border-bottom: 1px solid var(--bms-border);
	padding-bottom: 0.4rem;
	margin-bottom: 0.9rem;
}

/* Line-item editor */

.items-table input,
.items-table select {
	font-size: 0.85rem;
}

.items-table td {
	padding: 0.35rem;
}

.items-table .drag-handle {
	cursor: grab;
	color: var(--bms-muted);
	user-select: none;
}

.items-table tr.dragging {
	opacity: 0.4;
}

/* Definition lists on view pages */

.detail-list {
	margin: 0;
}

.detail-list dt {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--bms-muted);
	font-weight: 600;
}

.detail-list dd {
	margin-bottom: 0.75rem;
}

/* Rendered quotation content */

.rich-content {
	font-size: 0.9rem;
}

.rich-content table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1rem;
}

.rich-content table td,
.rich-content table th {
	border: 1px solid var(--bms-border);
	padding: 0.4rem 0.5rem;
}

.rich-content img {
	max-width: 100%;
}

/* ---------- Login ---------- */

.login-page {
	background-color: #1f2d3d;
	min-height: 100vh;
	display: flex;
	align-items: center;
}

.login-card {
	max-width: 400px;
	width: 100%;
	margin: 0 auto;
}

/* CKEditor 5 content area */
.ck-editor__editable_inline {
	min-height: 260px;
}

/* Line-item inputs: wide enough that values are never clipped. The table
   scrolls sideways inside its card on narrow screens. */
.items-table {
	min-width: 860px;
}
.items-table .item-quantity,
.items-table input[name="items[unit][]"] {
	min-width: 4.5rem;
}
.items-table .item-unit-price,
.items-table .item-discount {
	min-width: 6.5rem;
}
.items-table .item-service {
	min-width: 8.5rem;
}
