/*
 * IMS Blackbook: "shadcn" theme (issue #4, 2026-10-22; chosen 2026-10-23: desktop only, no dark mode).
 * Hand-written. shadcn/ui's design tokens (zinc palette, radius, borders, focus rings) applied to the
 * classes Yii already outputs: CGridView, CLinkPager, CDetailView, CActiveForm rows, CPortlet, CMenu,
 * jQuery UI autocomplete and date picker. No build step, no fonts or files loaded from anywhere else.
 */

:root {
	--background: #ffffff;
	--foreground: #09090b;
	--card: #ffffff;
	--muted: #f4f4f5;
	--muted-foreground: #71717a;
	--accent: #f4f4f5;
	--border: #e4e4e7;
	--input: #e4e4e7;
	--primary: #18181b;
	--primary-foreground: #fafafa;
	--ring: #a1a1aa;
	--destructive: #dc2626;
	--destructive-muted: #fef2f2;
	--success: #15803d;
	--success-muted: #f0fdf4;
	--warning-muted: #fefce8;
	--radius: 0.5rem;
	--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
	--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
	--font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--muted);
	color: var(--foreground);
	font: 14px/1.5 var(--font-sans);
	-webkit-font-smoothing: antialiased;
}

a { color: var(--foreground); text-underline-offset: 3px; }
a:hover { color: var(--muted-foreground); }

h1, h2, h3, h4 { margin: 0 0 0.75rem; line-height: 1.25; letter-spacing: -0.015em; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
img { border: 0; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.clear { clear: both; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Lucide line icons, inlined by Icon::svg() (#9) */
svg.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- page chrome (theme layouts) ---------- */

#header {
	background: var(--background);
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: 50;
}

/* pages keep a comfortable width; the orders grid pages (body.page-wide, #9) use the whole window */
#header .header-inner,
#page,
#footer {
	max-width: 1320px;
	margin: 0 auto;
	padding-left: 20px;
	padding-right: 20px;
}
body.page-wide #header .header-inner,
body.page-wide #footer { max-width: none; padding-left: 16px; padding-right: 16px; }
body.page-wide #page { max-width: none; width: calc(100% - 32px); margin-top: 16px; padding: 20px 16px; }

#header .header-inner {
	display: flex;
	align-items: center;
	gap: 16px;
	height: 56px;
}

#logo {
	font-weight: 700;
	font-size: 15px;
	letter-spacing: -0.01em;
	text-decoration: none;
	color: var(--foreground);
}

#logo { margin-right: 8px; white-space: nowrap; display: inline-flex; align-items: center; gap: 10px; }
/* C4 2026-10-23: the IMS logo sits in the 56px titlebar, left of the app name */
#logo .logo-mark { height: 40px; width: auto; display: block; }

/* navbar: Home, Orders | quick-find | New order | Logout */
:is(#mainmenu, #usermenu) ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
:is(#mainmenu, #usermenu) ul li a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 32px;
	padding: 0 12px;
	border-radius: calc(var(--radius) - 2px);
	color: var(--muted-foreground);
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
}
:is(#mainmenu, #usermenu) ul li a:hover { color: var(--foreground); background: var(--accent); }
#mainmenu ul li.active a { color: var(--foreground); background: var(--accent); }
#mainmenu { flex: none; }
/* the user menu sits at the right edge; with no search box or button it pushes itself there */
#usermenu { margin-left: auto; }
#header .quickfind ~ #usermenu, #header #nav-new-order ~ #usermenu { margin-left: 0; }
#usermenu ul li a { font-weight: 400; }

/* the #2 quick-find box (themes/shadcn/views/orders/_quickFind.php) */
#header .quickfind { position: relative; display: flex; align-items: center; flex: 0 1 380px; margin: 0 0 0 auto; }
#header .quickfind svg.icon { position: absolute; left: 10px; color: var(--muted-foreground); pointer-events: none; }
#header .quickfind input#quickfind { width: 100%; height: 36px; padding: 4px 12px 4px 34px; background: var(--muted); box-shadow: none; }
#header .quickfind input#quickfind:focus { background: var(--background); }

/* buttons that are links (New order) */
a.btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 36px;
	padding: 0 14px;
	border: 1px solid var(--input);
	border-radius: calc(var(--radius) - 2px);
	background: var(--background);
	color: var(--foreground);
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	box-shadow: var(--shadow-sm);
}
a.btn:hover { background: var(--accent); color: var(--foreground); }
a.btn.btn-primary { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
a.btn.btn-primary:hover { opacity: 0.9; color: var(--primary-foreground); }

#page {
	width: calc(100% - 48px);
	margin-top: 24px;
	margin-bottom: 24px;
	padding-top: 24px;
	padding-bottom: 24px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
}

#content { padding: 0; }
/* the login page is one short form: a narrow card */
#page:has(#login-form) { max-width: 440px; margin-top: 64px; }

#footer {
	padding-bottom: 24px;
	color: var(--muted-foreground);
	font-size: 12px;
	text-align: center;
}

/* secondary menu ($this->menu), from the app's column2 layout */
#submainmenu { margin: 0 0 20px; }
#submainmenu:not(:has(li)) { display: none; }
#page .span-100 { width: auto; margin: 0; }
#submainmenu ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
/* the li is the button: some items put an icon <img> before the link (CMenu 'template') */
#submainmenu ul li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 32px;
	padding: 0 12px;
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) - 2px);
	background: var(--background);
	box-shadow: var(--shadow-sm);
}
#submainmenu ul li:hover { background: var(--accent); }
#submainmenu ul li a { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; text-decoration: none; }
#submainmenu svg.icon { color: var(--muted-foreground); }

/* breadcrumbs (CBreadcrumbs, if a view turns them on) */
div.breadcrumbs { margin: 0 0 12px; color: var(--muted-foreground); font-size: 13px; }
div.breadcrumbs a { color: var(--muted-foreground); text-decoration: none; }
div.breadcrumbs a:hover { color: var(--foreground); }
div.breadcrumbs span { color: var(--foreground); font-weight: 500; }

/* ---------- buttons and inputs ---------- */

input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="search"], input[type="date"], input[type="url"], input[type="tel"], input:not([type]),
select, textarea {
	height: 36px;
	padding: 4px 12px;
	border: 1px solid var(--input);
	border-radius: calc(var(--radius) - 2px);
	background: var(--background);
	color: var(--foreground);
	font: inherit;
	box-shadow: var(--shadow-sm);
	transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; min-height: 72px; }
select { padding-right: 8px; }
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--ring);
	box-shadow: 0 0 0 3px rgb(161 161 170 / 0.35);
}
/* the order form's date pickers carry an inline style="height:20px" */
input.hasDatepicker { height: 36px !important; width: 140px; }
input[readonly] { background: var(--muted) !important; color: var(--muted-foreground) !important; border-color: var(--input) !important; }
input::placeholder { color: var(--muted-foreground); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); vertical-align: middle; }

input[type="submit"], input[type="button"], input[type="reset"], button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 36px;
	padding: 0 16px;
	border: 1px solid var(--primary);
	border-radius: calc(var(--radius) - 2px);
	background: var(--primary);
	color: var(--primary-foreground);
	font: 500 14px/1 var(--font-sans);
	box-shadow: var(--shadow-sm);
	cursor: pointer;
}
input[type="submit"]:hover, button:hover { opacity: 0.9; }
/* secondary buttons: ajax "Refresh"/"Search" and the date picker trigger */
input[type="button"], button.ui-datepicker-trigger {
	background: var(--background);
	color: var(--foreground);
	border-color: var(--input);
}
input[type="button"]:hover, button.ui-datepicker-trigger:hover { background: var(--accent); opacity: 1; }
button.ui-datepicker-trigger { height: 36px; width: 36px; padding: 0; margin-left: 6px; font-size: 0; }
button.ui-datepicker-trigger::before {
	content: "";
	width: 16px;
	height: 16px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- CActiveForm ---------- */

div.form { max-width: 900px; }
div.form .row { margin: 0 0 16px; }
div.form label { display: block; margin: 0 0 6px; font-weight: 500; font-size: 14px; }
div.form .rememberMe label, div.form label[for$="tax_exempt"] { display: inline; margin-left: 6px; }
div.form .rememberMe { display: flex; align-items: center; }
div.form .rememberMe label { margin: 0 0 0 8px; }
div.form .note { color: var(--muted-foreground); font-size: 13px; }
div.form span.required { color: var(--destructive); }
div.form .hint { margin: 4px 0 0; color: var(--muted-foreground); font-size: 13px; }
div.form .row.buttons { margin-top: 24px; }
div.form input[size] { max-width: 100%; }
/* the order form's "/" between the vendor boxes */
div.form .row > b { margin: 0 4px; color: var(--muted-foreground); font-weight: 400; }

div.form .errorSummary, div.errorSummary {
	margin: 0 0 16px;
	padding: 12px 16px;
	border: 1px solid rgb(220 38 38 / 0.3);
	border-radius: var(--radius);
	background: var(--destructive-muted);
	color: var(--destructive);
}
div.errorSummary p { margin: 0 0 4px; font-weight: 500; }
div.errorSummary ul { margin: 0; padding-left: 20px; }
div.form .errorMessage { margin-top: 6px; color: var(--destructive); font-size: 13px; }
div.form label.error, div.form span.error { color: var(--destructive); }
div.form input.error, div.form select.error, div.form textarea.error { border-color: var(--destructive); }
div.form input.error:focus { box-shadow: 0 0 0 3px rgb(220 38 38 / 0.2); }
div.form .success input { border-color: var(--success); }

/* "wide" forms (search forms) */
div.wide.form label { float: left; width: 160px; margin: 8px 12px 0 0; text-align: right; }
div.wide.form .row { clear: left; }
div.wide.form .buttons, div.wide.form .hint, div.wide.form .errorMessage { clear: left; padding-left: 172px; }

/* flash messages */
div.flash-error, div.flash-notice, div.flash-success {
	margin: 0 0 16px;
	padding: 12px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
div.flash-error { background: var(--destructive-muted); color: var(--destructive); }
div.flash-notice { background: var(--warning-muted); }
div.flash-success { background: var(--success-muted); color: var(--success); }

/* ---------- CGridView ---------- */

.grid-view { padding: 0; overflow-x: auto; }
.grid-view .summary { margin: 0 0 8px; color: var(--muted-foreground); font-size: 13px; text-align: right; }
.grid-view .empty { color: var(--muted-foreground); font-style: normal; }

.grid-view table.items {
	width: 100%;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	border-collapse: separate;
	border-spacing: 0;
	background: var(--background);
	font-variant-numeric: tabular-nums;
}
.grid-view table.items th, .grid-view table.items td {
	padding: 8px 6px;
	border: 0;
	border-bottom: 1px solid var(--border);
	font-size: 13px;
	line-height: 1.4;
}
.grid-view table.items :is(th, td):first-child { padding-left: 12px; }
.grid-view table.items th {
	background: var(--muted);
	color: var(--muted-foreground);
	font-weight: 500;
	text-align: left;
	vertical-align: bottom;
}
.grid-view table.items thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.grid-view table.items thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
.grid-view table.items th a { color: var(--muted-foreground); font-weight: 500; text-decoration: none; }
.grid-view table.items th a:hover { color: var(--foreground); }
.grid-view table.items th a.asc, .grid-view table.items th a.desc { background: none; padding-right: 0; color: var(--foreground); }
.grid-view table.items th a.asc::after { content: " \2191"; }
.grid-view table.items th a.desc::after { content: " \2193"; }

.grid-view table.items tr.odd, .grid-view table.items tr.even { background: transparent; }
.grid-view table.items tbody tr:hover { background: var(--muted); }
.grid-view table.items tr.selected, .grid-view table.items tr:hover.selected { background: var(--accent); }
.grid-view table.items tbody tr:last-child td { border-bottom: 0; }
.grid-view table.items td a { font-weight: 500; }
/* C4 2026-10-23 (#25): the PO number opens the order (no row view button): always underlined, stronger on hover */
.grid-view table.items td.col-po a { text-decoration: underline; text-decoration-color: var(--muted-foreground); text-underline-offset: 3px; border-radius: 4px; padding: 1px 3px; margin: -1px -3px; }
.grid-view table.items td.col-po a:is(:hover, :focus-visible) { color: var(--foreground); text-decoration-color: var(--foreground); text-decoration-thickness: 2px; background: var(--accent); }
/* money and date columns (the views right/centre-align them inline): keep each value on one line */
.grid-view table.items tbody td:is([style*="text-align:right"], [style*="text-align:center"]) { white-space: nowrap; }

/* the orders grid's columns (themes/shadcn/views/orders/index.php, #9). PO numbers, dates and money never wrap or
   truncate; customer, vendors and description are one line with an ellipsis (full text in the span's title).
   max-width:0 lets those three shrink below their content and share whatever the other columns leave, in
   proportion to their text, so the grid always fits the window. Salesperson names keep their width up to 160px. */
.grid-view table.items td:is(.col-po, .col-date, .col-money, .col-person) { width: 1%; white-space: nowrap; }
/* headers may wrap at a space ("Shipping / Amount"); the values under them never do */
.grid-view table.items th:is(.col-text, .col-person) { white-space: nowrap; }
.grid-view table.items .col-money { text-align: right; font-variant-numeric: tabular-nums; }
.grid-view table.items td.col-money { font-family: var(--font-sans); }
.grid-view table.items td.col-text { max-width: 0; }
/* C4 2026-10-23 (#25): how the three share the width left over (measured: each one gains at 1280 and at 1600 once
   the view button is gone; without weights, customer and vendor stayed at their header's width) */
.grid-view table.items th.col-customer { width: 18%; }
.grid-view table.items th.col-vendor { width: 14%; }
.grid-view table.items th.col-description { width: 68%; }
.grid-view table.items :is(td.col-text, td.col-person) > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-view table.items td.col-person > span { max-width: 160px; }
.grid-view table.items tfoot td.col-totals-label { text-align: right; }
/* the totals cover every matching order, so they are the widest figures: one size down */
.grid-view table.items tfoot td { font-size: 12px; }

.grid-view table.items tr.filters td { background: var(--background); padding: 6px 6px; }
/* width:0 + min-width:100%: fill the cell without the input's size=20 width forcing the column wider */
.grid-view .filters input, .grid-view .filters select { width: 0; min-width: 100%; height: 30px; padding: 2px 8px; font-size: 13px; border: 1px solid var(--input); }

.grid-view table.items tfoot td {
	background: var(--muted);
	border-top: 1px solid var(--border);
	border-bottom: 0;
	font-weight: 500;
}

.grid-view .button-column { width: 1%; white-space: nowrap; text-align: center; }
.grid-view .button-column a { display: inline-flex; padding: 3px; border-radius: 4px; color: var(--muted-foreground); }
.grid-view .button-column a:hover { color: var(--foreground); background: var(--accent); }
.grid-view .button-column a.delete:hover { color: var(--destructive); background: var(--destructive-muted); }
.grid-view-loading { opacity: 0.6; }

/* ---------- CLinkPager ---------- */

.grid-view .pager, .list-view .pager, div.pager {
	margin: 12px 0 0;
	color: var(--muted-foreground);
	font-size: 13px;
	text-align: right;
}
ul.yiiPager { display: inline-flex; gap: 4px; margin: 0 0 0 8px; padding: 0; font-size: 13px; line-height: 1; vertical-align: middle; }
ul.yiiPager li { display: block; }
ul.yiiPager a:link, ul.yiiPager a:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 10px;
	border: 1px solid transparent;
	border-radius: calc(var(--radius) - 2px);
	color: var(--foreground);
	font-weight: 500;
	text-decoration: none;
}
ul.yiiPager .page a { font-weight: 500; }
ul.yiiPager a:hover { border-color: transparent; background: var(--accent); }
ul.yiiPager .selected a { border-color: var(--border); background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
ul.yiiPager .hidden a { border-color: transparent; color: var(--muted-foreground); opacity: 0.5; pointer-events: none; }
ul.yiiPager .first, ul.yiiPager .last { display: none; }

/* ---------- CListView / CDetailView ---------- */

div.view {
	margin: 0 0 12px;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

table.detail-view {
	width: 100%;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	border-collapse: separate;
	border-spacing: 0;
}
table.detail-view th, table.detail-view td { padding: 8px 12px; border: 0; border-bottom: 1px solid var(--border); font-size: 14px; }
table.detail-view tr:last-child th, table.detail-view tr:last-child td { border-bottom: 0; }
table.detail-view th { width: 200px; color: var(--muted-foreground); font-weight: 500; text-align: left; }
table.detail-view tr.odd, table.detail-view tr.even { background: transparent; }
table.detail-view .null { color: var(--muted-foreground); }

/* ---------- CPortlet (dashboard panels) and plain .table ---------- */

/* CPortlet only adds .portlet when the view sets no class of its own (the dashboard's don't have it) */
.portlet, div:has(> .portlet-decoration) {
	margin-bottom: 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--card);
	box-shadow: var(--shadow-sm);
	overflow: hidden;
}
.portlet-decoration { height: auto; padding: 14px 16px 0; background: none; border: 0; border-radius: 0; filter: none; }
.portlet-title, .portlet-title h3 { margin: 0; color: var(--foreground); font-size: 15px; font-weight: 600; }
.portlet-content, .portlet-table .portlet-content { margin: 0; padding: 8px 16px 16px; border: 0; border-radius: 0; background: none; font-size: 14px; }

table.table { width: 100%; margin: 0; border-collapse: collapse; }
table.table th, table.table td { padding: 8px 0 8px 12px; border: 0; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
table.table tr:last-child th, table.table tr:last-child td { border-bottom: 0; }
table.table th { color: var(--muted-foreground); font-weight: 500; }
table.table select { height: 32px; margin-right: 4px; }

/* the dashboard's 1140px grid (registered by views/site/index.php): fill the card instead (#9) */
#page .row { max-width: none; min-width: 0; }
.row .sixcol { margin-right: 4%; }
.row .last { margin-right: 0; }

/* the /orders toolbar; body prefix beats the view's own inline <style> */
body #orders-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
	margin: 0 0 12px;
	padding: 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--muted);
}
body #orders-toolbar label { margin: 0; color: var(--muted-foreground); font-weight: 500; font-size: 13px; }
body #orders-toolbar input, body #orders-toolbar select { height: 32px; margin-left: 6px; font-size: 13px; }

/* ---------- home dashboard panels (views/site/_dashboard.php) ---------- */
/* the view's own <style> comes after this file, so every rule here starts with #dashboard */

#dashboard .dash { gap: 20px; margin: 0 0 20px; }
#dashboard .dash-panel {
	padding: 16px 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--card);
	box-shadow: var(--shadow-sm);
}
#dashboard .dash-panel h3 { margin: 0 0 12px; color: var(--foreground); font-size: 15px; font-weight: 600; }
#dashboard .dash-panel h3 small { display: block; margin-top: 2px; color: var(--muted-foreground); font-size: 13px; font-weight: 400; letter-spacing: 0; }
#dashboard .dash-panel p.note { margin: 10px 0 0; color: var(--muted-foreground); font-size: 12px; }
#dashboard .dash-panel h3 small a { color: var(--muted-foreground); }

#dashboard .kpis { gap: 12px; }
#dashboard .kpi { padding: 12px 16px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: var(--background); }
#dashboard .kpi .label { color: var(--muted-foreground); font-size: 13px; font-weight: 500; }
#dashboard .kpi .value { margin: 2px 0; color: var(--foreground); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
#dashboard .kpi .value a { text-decoration: underline; text-decoration-color: var(--border); }
#dashboard .kpi .delta { color: var(--muted-foreground); font-size: 12px; }
#dashboard .up { color: var(--success); }
#dashboard .down { color: var(--destructive); }
#dashboard .flat { color: var(--muted-foreground); }

#dashboard table.dash-table { font-size: 13px; font-variant-numeric: tabular-nums; }
#dashboard table.dash-table th { padding: 8px; border-bottom: 1px solid var(--border); color: var(--muted-foreground); font-weight: 500; }
#dashboard table.dash-table td { padding: 8px; border-bottom: 1px solid var(--border); }
#dashboard table.dash-table tr:last-child :is(td, th) { border-bottom: 0; }
#dashboard table.dash-table :is(th, td):first-child { padding-left: 0; }
#dashboard table.dash-table :is(th, td):last-child { padding-right: 0; }
#dashboard table.dash-table td a { font-weight: 500; }
#dashboard table.dash-table img { width: 16px; height: 16px; opacity: 0.6; }
#dashboard table.dash-table a:hover img { opacity: 1; }
/* money owed: the total row, and the greyed "over a year" row */
#dashboard #age-total th { border-top: 1px solid var(--border); color: var(--foreground); font-weight: 600; }
#dashboard table.dash-table tr.muted td, #dashboard table.dash-table tr.muted a { color: var(--muted-foreground); opacity: 0.7; font-weight: 400; }
#dashboard #dash-recent tbody tr:hover td { background: var(--muted); }

/* billing status: shadcn badge (rounded-md, text-xs, medium), one tint per status */
#dashboard .badge { padding: 2px 8px; border: 1px solid transparent; border-radius: calc(var(--radius) - 2px); font-size: 12px; font-weight: 500; line-height: 16px; }
#dashboard .badge.unbilled { border-color: #fde68a; background: #fffbeb; color: #92400e; }
#dashboard .badge.billed { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
#dashboard .badge.paid { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }

/* TTM chart: shadcn's blue chart palette, theme gridlines and type */
#dashboard .chart .bar-billed { fill: #2563eb; }
#dashboard .chart .bar-profit { fill: #93c5fd; }
#dashboard .chart rect:is(.bar-billed, .bar-profit) { rx: 2px; }
#dashboard .chart svg line { stroke: var(--border); }
#dashboard .chart svg > line:last-of-type { stroke: var(--ring); }
#dashboard .chart text { fill: var(--muted-foreground); font-family: var(--font-sans); font-size: 11px; }
#dashboard .chart a:hover .hit { fill: var(--muted); }

/* the navbar's quick-find suggestions, above the sticky header. jQuery UI 1.9 writes an inline z-index from the
   input's positioned ancestors and ignores position:sticky, so it would put the menu under the header. */
.ui-autocomplete { z-index: 1000 !important; max-width: 560px; }

/* ---------- order form (themes/shadcn/views/orders/_form.php, #11) ---------- */
/* sections as cards in two columns; each field is label | control, errors under the control */

/* the whole page width (1320px at most), so the sticky bar spans the page card */
div.form.order-form { max-width: none; }
.order-form .note { margin: 0 0 12px; }
.order-form .of-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.order-form .of-column { display: grid; gap: 20px; }
.order-form .of-card {
	padding: 16px 20px 6px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--card);
	box-shadow: var(--shadow-sm);
}
.order-form .of-card h2 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }

.order-form .of-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); column-gap: 16px; align-items: start; margin: 0 0 12px; }
.order-form .of-row > label { margin: 0; padding-top: 8px; font-weight: 500; line-height: 1.4; }
.order-form .of-control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.order-form .of-control .errorMessage { flex-basis: 100%; margin: 0; }
.order-form .of-row.of-error > label { color: var(--destructive); }

/* widths fit the content: short PO, dates and money; wide text */
.order-form input.of-po { width: 120px; }
.order-form .of-wide input[type="text"], .order-form .of-wide input:not([type]) { width: 100%; }
.order-form select { min-width: 200px; }
.order-form input.of-money { width: 140px; text-align: right; font-variant-numeric: tabular-nums; }
/* the date and its picker button read as one control */
.order-form .of-date input.hasDatepicker { width: 130px; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.order-form .of-date button.ui-datepicker-trigger { margin-left: -9px; border-top-left-radius: 0; border-bottom-left-radius: 0; box-shadow: none; }

/* tax, invoice total and profit are worked out by the form: a quiet, read-only panel */
.order-form .of-computed { margin: 4px -8px 10px; padding: 10px 8px 0; border-top: 1px dashed var(--border); }
.order-form .of-computed-note { margin: 0 0 10px; color: var(--muted-foreground); font-size: 12px; }
.order-form .of-computed input[readonly] { border-style: dashed; box-shadow: none; }
.order-form label.of-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }

/* Save / Cancel stay in view at the bottom of the window */
.order-form .of-actions {
	position: sticky;
	bottom: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 20px -20px -24px;   /* #page's padding: 20px at the sides, 24px at the bottom */
	padding: 12px 20px;
	border-top: 1px solid var(--border);
	border-radius: 0 0 var(--radius) var(--radius);
	background: rgb(255 255 255 / 0.92);
	backdrop-filter: blur(6px);
}
.order-form .of-actions input[type="submit"] { min-width: 96px; }
.order-form .of-actions .of-actions-po { margin-left: auto; color: var(--muted-foreground); font-size: 13px; }

/* ---------- jQuery UI: autocomplete and date picker ---------- */

.ui-widget { font-family: var(--font-sans); font-size: 14px; }
.ui-widget-content { border: 1px solid var(--border); background: var(--background); color: var(--foreground); }
.ui-widget-header { border: 0; background: none; color: var(--foreground); font-weight: 600; }
.ui-corner-all { border-radius: calc(var(--radius) - 2px); }

.ui-autocomplete.ui-menu {
	padding: 4px;
	border-radius: calc(var(--radius) - 2px);
	box-shadow: var(--shadow-md);
	max-height: 320px;
	overflow-y: auto;
	font-size: 14px;
}
.ui-menu .ui-menu-item a { display: block; padding: 6px 8px; border: 0; border-radius: 4px; line-height: 1.4; }
.ui-menu .ui-menu-item a.ui-state-focus,
.ui-menu .ui-menu-item a.ui-state-hover,
.ui-menu .ui-menu-item a.ui-state-active { margin: 0; border: 0; background: var(--accent); color: var(--foreground); font-weight: 400; }

/* above the order form's sticky action bar (#11): like the autocomplete menu, jQuery UI gives it a z-index from
   the input's positioned ancestors, ignoring sticky ones, which leaves it at 1 */
.ui-datepicker { z-index: 1000 !important; }
.ui-datepicker { width: 17rem; padding: 12px; border-radius: var(--radius); box-shadow: var(--shadow-md); }
.ui-datepicker .ui-datepicker-header { padding: 0 0 8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 40px; line-height: 28px; font-size: 14px; }
.ui-datepicker .ui-datepicker-title select { height: 28px; padding: 0 4px; font-size: 13px; box-shadow: none; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next {
	top: 0; width: 28px; height: 28px;
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) - 2px);
	cursor: pointer;
}
.ui-datepicker .ui-datepicker-prev { left: 0; }
.ui-datepicker .ui-datepicker-next { right: 0; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 0; border: 1px solid var(--border); background: var(--accent); }
.ui-datepicker .ui-datepicker-prev-hover { left: 0; }
.ui-datepicker .ui-datepicker-next-hover { right: 0; }
/* lucide chevrons instead of jQuery UI's icon sprite */
.ui-datepicker :is(.ui-datepicker-prev, .ui-datepicker-next) .ui-icon { background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
.ui-datepicker .ui-datepicker-next .ui-icon { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E"); }
.ui-datepicker .ui-datepicker-title select { font-weight: 400; }
.ui-datepicker th { padding: 4px 0; color: var(--muted-foreground); font-weight: 400; font-size: 12px; }
.ui-datepicker td { padding: 1px; }
.ui-datepicker td a.ui-state-default, .ui-datepicker td span.ui-state-default {
	padding: 6px 0;
	border: 0;
	border-radius: calc(var(--radius) - 2px);
	background: none;
	color: var(--foreground);
	font-weight: 400;
	text-align: center;
}
.ui-datepicker td a.ui-state-hover { background: var(--accent); }
.ui-datepicker td a.ui-state-highlight { background: var(--accent); font-weight: 600; }
.ui-datepicker td a.ui-state-active { background: var(--primary); color: var(--primary-foreground); }

/* ---------- print ---------- */

@media print {
	body { background: #fff; }
	#header, #submainmenu, #footer, .pager, .button-column, tr.filters, #orders-toolbar { display: none !important; }
	#page { margin: 0; padding: 0; border: 0; box-shadow: none; max-width: none; }
	/* paper has no tooltips: print the full text of the ellipsis columns (#9) */
	.grid-view table.items :is(td.col-text, td.col-person) { max-width: none; }
	.grid-view table.items :is(td.col-text, td.col-person) > span { max-width: none; overflow: visible; white-space: normal; }
}
