/*
 * SSAP Factory Inventory – visual system.
 *
 * Style:    Minimalism / Swiss – flat surfaces, 1px rules, type hierarchy instead of
 *           decoration. No gradients, wedges, 3D or layered shadows in the Desk.
 * Density:  dense (4–32px scale) – this is an operations tool, not a marketing page.
 * Motion:   subtle only (150–220ms), and nothing that moves layout.
 * Contrast: every text/surface pair declared here is >= 4.5:1 in both light and dark.
 *           Brand orange is 2.3:1 on white, so it is only ever a fill, bar or rule –
 *           use --fi-warn-ink when the same meaning has to be carried by text.
 */

:root {
	/* Brand */
	--ssap-orange: #f7941d;
	--ssap-orange-dark: #b35f00;
	--ssap-navy: #13213a;
	--ssap-charcoal: #1e2730;

	/* Ink for text sitting directly on the navy - the login page, and nothing
	   else. The --fi-ink-* scale is for light surfaces and goes dark-on-dark
	   here; these two are the other way round. On #13213a: 16.1:1 and 10.4:1,
	   against the 1.1:1 and 2.3:1 they replace. */
	--ssap-login-ink-strong: #ffffff;
	--ssap-login-ink: #c7d1de;
	/* And the ink for the sign-in card, which is pinned to white whatever the
	   theme, so it must not follow --fi-ink-2 into dark mode. 7.0:1 on white. */
	--ssap-login-card-ink: #4f5a68;

	/* Surfaces */
	--fi-bg: #f4f6f8;
	--fi-surface: #ffffff;
	--fi-surface-2: #f4f6f8;
	--fi-surface-3: #e9edf2;

	/* Ink */
	--fi-ink: #13213a;
	--fi-ink-2: #4f5a68;
	--fi-ink-3: #55606e;
	--fi-ink-invert: #ffffff;

	/* Lines */
	--fi-line: #dde1e6;
	--fi-line-strong: #c4ccd6;

	/* Status – "ink" variants are safe as text, "fill" variants as blocks of colour */
	--fi-ok-ink: #036d4f;
	--fi-ok-fill: #047857;
	--fi-warn-ink: #9a5200;
	--fi-warn-fill: #f7941d;
	--fi-danger-ink: #b42318;
	--fi-danger-fill: #b42318;
	--fi-tint-warn: #fff4e2;
	--fi-tint-ok: #eaf6f1;

	/* Data marks – bars must clear 3:1 against the surface behind them */
	--fi-bar: #13213a;
	--fi-bar-track: #e9edf2;

	/* Spacing (dense) */
	--fi-1: 4px;
	--fi-2: 8px;
	--fi-3: 12px;
	--fi-4: 16px;
	--fi-5: 24px;
	--fi-6: 32px;

	/* Shape, motion, targets */
	--fi-radius: 6px;
	--fi-radius-lg: 10px;
	--fi-shadow: 0 1px 2px rgba(19, 33, 58, 0.08);
	--fi-touch: 44px;
	--fi-dur: 180ms;
	--fi-ease: cubic-bezier(0.2, 0.6, 0.2, 1);
	--fi-focus: var(--ssap-navy);

	/* Type scale: 12 / 13 / 14 / 16 / 20 / 28 */
	--fi-text-xs: 0.75rem;
	--fi-text-sm: 0.8125rem;
	--fi-text-md: 0.875rem;
	--fi-text-base: 1rem;
	--fi-text-lg: 1.25rem;
	--fi-text-xl: 1.75rem;

	/* Legacy aliases kept so existing Frappe overrides keep working */
	--ssap-text: var(--fi-ink-2);
	--ssap-grey: var(--fi-surface-2);
	--ssap-border: var(--fi-line);
	--ssap-shadow: var(--fi-shadow);
	--primary: var(--ssap-navy);
	--primary-color: var(--ssap-navy);
	--text-color: var(--fi-ink-2);
	--heading-color: var(--fi-ink);
	--border-color: var(--fi-line);
	--desk-sidebar-bg: var(--ssap-navy);
	--font-stack: "InterVariable", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"],
[data-theme-mode="dark"] {
	--fi-bg: #0f1622;
	--fi-surface: #16202f;
	--fi-surface-2: #1d2838;
	--fi-surface-3: #27344a;

	--fi-ink: #e6ecf4;
	--fi-ink-2: #c6d0dd;
	--fi-ink-3: #aab6c6;
	--fi-ink-invert: #0f1622;

	--fi-line: #2c3a4f;
	--fi-line-strong: #3b4c66;

	--fi-ok-ink: #34d399;
	--fi-ok-fill: #047857;
	--fi-warn-ink: #ffb959;
	--fi-warn-fill: #f7941d;
	--fi-danger-ink: #fca5a5;
	--fi-danger-fill: #b42318;
	--fi-tint-warn: #2a2113;
	--fi-tint-ok: #112a22;

	--fi-bar: #ffb959;
	--fi-bar-track: #27344a;

	--fi-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
	--fi-focus: #ffb959;

	--heading-color: var(--fi-ink);
	--text-color: var(--fi-ink-2);
	--border-color: var(--fi-line);
}

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

body,
button,
input,
select,
textarea {
	font-family: var(--font-stack);
	font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

body {
	line-height: 1.5;
}

/* Numbers in an inventory system are compared column-to-column constantly. */
.fi-dash .val,
.fi-dash .num,
.fi-dash td.n,
.fi-dash .fi-headline-val {
	font-variant-numeric: tabular-nums;
}

/* Priority 1: a visible focus indicator on every interactive element. Brand orange
   alone is 2.3:1 on white, so the ring is navy (or amber on dark) with an orange halo. */
:where(a, button, [role="button"], input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--fi-focus);
	outline-offset: 2px;
	box-shadow: 0 0 0 4px rgba(247, 148, 29, 0.35);
	border-radius: var(--fi-radius);
}

/* ------------------------------------------------------------------ desk chrome */

body[data-route^="app"] .navbar,
body[data-route^="app"] header.navbar {
	border-bottom: 1px solid var(--fi-line);
	box-shadow: none;
}

/* .main-section is the Desk's scroll container (height:100dvh, overflow:auto), but the
   page chain inside it is sized to content, so the document ends up scrollable too.
   On a page taller than the viewport — the dashboard is the only one here — scrolling
   to the bottom then chains out to the document, which slides the whole app up:
   .body-sidebar is position:relative, so it rides up with the content and leaves a
   band of empty page below everything. Containing the chain pins the scroll where it
   belongs. Verified in WebKit and Chromium; harmless on pages that never overflow. */
.main-section {
	overscroll-behavior-y: contain;
}

.layout-side-section,
.desk-sidebar {
	background: var(--ssap-navy) !important;
	color: #fff;
	border-right-color: rgba(255, 255, 255, 0.12) !important;
}

/* Frappe v16 persistent app sidebar. */
:root,
[data-theme="light"],
[data-theme="dark"] {
	--desk-sidebar-bg: var(--ssap-navy);
}

.body-sidebar {
	background: var(--ssap-navy) !important;
	border-right-color: rgba(255, 255, 255, 0.14) !important;
}

.body-sidebar .standard-sidebar-item .item-anchor,
.body-sidebar .standard-sidebar-item .sidebar-item-label,
.body-sidebar .standard-sidebar-item .sidebar-item-suffix,
.body-sidebar .standard-sidebar-item .keyboard-shortcut,
.body-sidebar .sidebar-header,
.body-sidebar .sidebar-header .header-title,
.body-sidebar .sidebar-header .header-subtitle,
.body-sidebar .sidebar-user-button,
.body-sidebar .sidebar-user-button .avatar-name-email span,
.body-sidebar .sidebar-user-button .avatar-name-email span + span,
.body-sidebar svg {
	color: #eef2f7 !important;
	stroke: currentColor;
}

.body-sidebar .section-break,
.body-sidebar .section-break .sidebar-item-label {
	color: #aeb9c8 !important;
}

.body-sidebar .divider,
.body-sidebar .indent + .nested-container {
	border-color: rgba(255, 255, 255, 0.16) !important;
}

.body-sidebar .standard-sidebar-item:not(.active-sidebar):has(a:not(.section-break)):hover,
.body-sidebar .sidebar-user-button:hover,
.body-sidebar .sidebar-user-button.user-menu-active {
	background: rgba(255, 255, 255, 0.12) !important;
}

.body-sidebar .active-sidebar,
.body-sidebar .standard-sidebar-item.active-sidebar {
	background: var(--ssap-orange) !important;
	box-shadow: none !important;
}

.body-sidebar .active-sidebar .item-anchor,
.body-sidebar .active-sidebar .sidebar-item-label,
.body-sidebar .active-sidebar .sidebar-item-suffix,
.body-sidebar .active-sidebar svg {
	color: var(--ssap-navy) !important;
}

/* Sidebar rows are tapped on shop-floor tablets – keep them thumb-sized THERE only.
   Applying this on the desktop Desk inflated the module sidebar by ~12px per row;
   with 25+ rows that made the sidebar, not the page, the tallest thing in the
   document, so scrolling ran on past the end of the content into dead space. */
@media (hover: none) and (pointer: coarse) {
	.body-sidebar .standard-sidebar-item .item-anchor,
	.desk-sidebar .standard-sidebar-item a {
		min-height: 40px;
		display: flex;
		align-items: center;
	}
}

.layout-side-section .sidebar-section,
.layout-side-section .standard-sidebar,
.desk-sidebar .sidebar-section,
.desk-sidebar .standard-sidebar {
	background: transparent !important;
}

.layout-side-section .standard-sidebar-label,
.layout-side-section .sidebar-label,
.layout-side-section .sidebar-item-label,
.layout-side-section .standard-sidebar-item,
.layout-side-section .standard-sidebar-item a,
.layout-side-section .sidebar-item,
.layout-side-section .sidebar-item a,
.layout-side-section svg,
.desk-sidebar .standard-sidebar-label,
.desk-sidebar .sidebar-label,
.desk-sidebar .sidebar-item-label,
.desk-sidebar .standard-sidebar-item,
.desk-sidebar .standard-sidebar-item a,
.desk-sidebar .sidebar-item,
.desk-sidebar .sidebar-item a,
.desk-sidebar svg {
	color: #fff !important;
	stroke: currentColor;
}

.standard-sidebar-item.selected,
.desk-sidebar-item.selected,
.standard-sidebar-item:hover,
.desk-sidebar-item:hover {
	background: var(--ssap-orange) !important;
	color: var(--ssap-navy) !important;
}

.layout-side-section .standard-sidebar-item.selected *,
.layout-side-section .standard-sidebar-item:hover *,
.desk-sidebar .standard-sidebar-item.selected *,
.desk-sidebar .standard-sidebar-item:hover *,
.desk-sidebar .desk-sidebar-item.selected *,
.desk-sidebar .desk-sidebar-item:hover * {
	color: var(--ssap-navy) !important;
}

/* Appearance control, injected into the sidebar by factory_inventory.js.
   It sits on the navy sidebar in both themes, so its colours are fixed. */
.body-sidebar .fi-theme {
	display: flex;
	gap: 2px;
	margin: var(--fi-2) var(--fi-3);
	padding: 3px;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 999px;
}

.body-sidebar .fi-theme button {
	flex: 1 1 0;
	min-width: 0;
	min-height: 30px;
	padding: 0 var(--fi-2);
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #c7d1de;
	font: inherit;
	font-size: var(--fi-text-xs);
	font-weight: 600;
	cursor: pointer;
	transition: background-color var(--fi-dur) var(--fi-ease), color var(--fi-dur) var(--fi-ease);
}

.body-sidebar .fi-theme button:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

.body-sidebar .fi-theme button[aria-pressed="true"] {
	background: var(--ssap-orange);
	color: var(--ssap-navy);
}

/* Previous / Next paging, injected into the list paging area by
   factory_inventory.js. */
.list-paging-area .fi-pager {
	display: inline-flex;
	align-items: center;
	gap: var(--fi-2);
	margin-right: var(--fi-3);
}

.list-paging-area .fi-pager button {
	min-height: 32px;
	padding: 0 var(--fi-3);
	background: var(--fi-surface);
	border: 1px solid var(--fi-line-strong);
	border-radius: var(--fi-radius);
	color: var(--fi-ink);
	font: inherit;
	font-size: var(--fi-text-sm);
	font-weight: 600;
	cursor: pointer;
	transition: background-color var(--fi-dur) var(--fi-ease);
}

.list-paging-area .fi-pager button:hover:not(:disabled) {
	background: var(--fi-surface-2);
}

.list-paging-area .fi-pager button:disabled {
	opacity: 0.45;
	cursor: default;
}

.list-paging-area .fi-pager .fi-page-label {
	min-width: 68px;
	color: var(--fi-ink-3);
	font-size: var(--fi-text-sm);
	font-variant-numeric: tabular-nums;
	text-align: center;
}

/* ------------------------------------------------------------------ actions */

/* Navy is the primary action: 16:1 on white, and it keeps orange meaning
   "look here" rather than "press here" everywhere in the product. */
.btn-primary,
.primary-action,
.btn.btn-primary {
	background-color: var(--ssap-navy) !important;
	border-color: var(--ssap-navy) !important;
	color: #fff !important;
	font-weight: 600;
	transition: background-color var(--fi-dur) var(--fi-ease);
}

.btn-primary:hover,
.primary-action:hover,
.btn.btn-primary:hover {
	background-color: #24374f !important;
	border-color: #24374f !important;
	color: #fff !important;
}

.btn,
.btn-default,
.btn-secondary {
	transition: background-color var(--fi-dur) var(--fi-ease), border-color var(--fi-dur) var(--fi-ease);
}

/* Toolbar and form buttons: comfortable to hit with a glove on. */
.page-actions .btn,
.page-head .btn,
.form-footer .btn,
.modal-footer .btn {
	min-height: 36px;
}

@media (hover: none) and (pointer: coarse) {
	.page-actions .btn,
	.page-head .btn,
	.form-footer .btn,
	.modal-footer .btn,
	.btn-primary,
	.primary-action {
		min-height: var(--fi-touch);
		padding-inline: var(--fi-3);
	}
}

.page-head .title-text,
.page-title .title-text,
.widget-title,
.form-section .section-head {
	color: var(--fi-ink);
}

.frappe-card,
.widget,
.form-dashboard-section,
.form-layout,
.list-row-container {
	border-color: var(--fi-line);
}

/* ------------------------------------------------------------------ login */

body[frappe-session-status="logged-out"] {
	min-height: 100vh;
	background: var(--ssap-navy);
	/* Bright, because this is the one page whose background is dark. --fi-ink-2
	   is the ink for a light surface (#4f5a68); inherited onto the navy it comes
	   out at about 1.8:1, so anything that picked it up here was unreadable. */
	color: var(--ssap-login-ink);
}

body[frappe-session-status="logged-out"] .page-content-wrapper {
	min-height: 100vh;
	display: grid;
	align-items: center;
	position: relative;
}

body[frappe-session-status="logged-out"] main.container {
	width: 100%;
	max-width: 1120px;
	display: flex;
	justify-content: flex-end;
	padding: var(--fi-6) var(--fi-5);
}

/* The strapline is real text in the DOM (see ssap_web.js) so it can be
   translated and read aloud; it used to be a CSS content string. */
.ssap-login-aside {
	position: fixed;
	left: clamp(24px, 6vw, 96px);
	top: 50%;
	width: min(38vw, 420px);
	transform: translateY(-50%);
	color: var(--ssap-login-ink-strong);
}

.ssap-login-aside h1 {
	margin: 0;
	/* Stated outright rather than inherited from the aside above. Frappe's
	   website bundle gives every h1-h6 an explicit near-black:

	       h1,h2,h3,h4,h5,h6,.h1,... { ...; color: #171717 }

	   and a colour set on the element itself always beats an inherited one, no
	   matter how specific the ancestor's rule is. So `color: #fff` on the aside
	   never reached this heading, and it sat on the navy at roughly 1.1:1 -
	   present in the page, and invisible. The paragraph below only escaped
	   because its colour happens to be declared directly too. */
	color: var(--ssap-login-ink-strong);
	font-size: clamp(28px, 3.2vw, 44px);
	line-height: 1.1;
	font-weight: 800;
	letter-spacing: 0.01em;
}

.ssap-login-aside p {
	margin: var(--fi-3) 0 0;
	color: var(--ssap-login-ink);
	font-size: var(--fi-text-base);
}

.ssap-login-aside hr {
	width: 56px;
	margin: var(--fi-4) 0 0;
	border: 0;
	border-top: 3px solid var(--ssap-orange);
}

body[frappe-session-status="logged-out"] .page_content {
	width: min(100%, 420px);
}

body[frappe-session-status="logged-out"] .login-content.page-card {
	width: 100%;
	max-width: none;
	padding: var(--fi-6) var(--fi-5);
	background: #fff;
	border: 1px solid var(--fi-line);
	border-radius: var(--fi-radius-lg);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

body[frappe-session-status="logged-out"] .page-card-head .app-logo {
	width: 149px;
	height: 60px;
	object-fit: contain;
	object-position: left center;
}

body[frappe-session-status="logged-out"] .page-card-head h4 {
	color: var(--ssap-navy) !important;
	font-size: 26px;
	font-weight: 700;
}

body[frappe-session-status="logged-out"] .page-card-subtitle {
	color: var(--ssap-login-card-ink) !important;
}

/* The field labels and the password-reset link come from Frappe's --ink-gray-5,
   which is #7c7c7c: 4.17:1 on the card's white, just under the 4.5:1 this file
   holds itself to in the note at the top. They are the text a person has to
   read in order to sign in, so they get this theme's body ink (7.0:1) instead.
   Specificity carries it - no !important needed - even though Frappe's login
   bundle is served after this file. */
body[frappe-session-status="logged-out"] label,
body[frappe-session-status="logged-out"] .text-ink-gray-5 {
	color: var(--ssap-login-card-ink);
}

body[frappe-session-status="logged-out"] .form-control {
	min-height: var(--fi-touch);
	border-color: #8a94a3;
	border-radius: var(--fi-radius);
}

body[frappe-session-status="logged-out"] .form-control:focus {
	border-color: var(--ssap-navy);
	box-shadow: 0 0 0 3px rgba(247, 148, 29, 0.34);
}

body[frappe-session-status="logged-out"] .es-button[data-variant="solid"] {
	min-height: var(--fi-touch);
	background: var(--ssap-navy) !important;
	border-color: var(--ssap-navy) !important;
	color: #fff !important;
	font-weight: 600;
}

body[frappe-session-status="logged-out"] .es-button[data-variant="solid"]:hover {
	background: #24374f !important;
	border-color: #24374f !important;
}

body[frappe-session-status="logged-out"] .web-footer {
	display: none;
}

@media (max-width: 1080px) {
	.ssap-login-aside {
		display: none;
	}

	body[frappe-session-status="logged-out"] main.container {
		justify-content: center;
	}
}

/* ------------------------------------------------------------------ dashboard */

/* Announcements for screen readers only (Frappe's own .sr-only is not guaranteed). */
.fi-dash-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* The Desk gives a custom page no horizontal padding, so content butts straight up
   against the sidebar. Gutter the page head and the body together so the title, the
   date filters and the cards all share one left edge, clear of the sidebar. */
.fi-dash-page .page-head .container,
.fi-dash-page .page-head > .row,
.fi-dash-page .layout-main-section {
	padding-left: var(--fi-5);
	padding-right: var(--fi-5);
}

.fi-dash {
	/* The right gutter also keeps the last column clear of the Desk's scrollbar,
	   which was clipping the period and "stock UOM" labels at the window edge. */
	padding: 0 0 var(--fi-6);
	min-width: 0;
	max-width: 100%;
	color: var(--fi-ink-2);
}

/* Grid and flex children default to min-width:auto, which lets a long unbroken
   value push the whole page wider instead of wrapping inside its own cell. */
.fi-dash section,
.fi-dash .fi-grid > *,
.fi-dash .fi-flow > *,
.fi-dash .fi-panels > *,
.fi-dash .fi-split > * {
	min-width: 0;
}

/* Sections are separated by air, not by boxes. */
.fi-dash section {
	margin-top: var(--fi-6);
}

.fi-dash section:first-child {
	margin-top: var(--fi-2);
}

.fi-dash .fi-h {
	margin: 0 0 var(--fi-4);
	color: var(--fi-ink-3);
	font-size: var(--fi-text-xs);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.fi-dash .fi-h-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--fi-2);
	margin-bottom: var(--fi-3);
}

.fi-dash .fi-h-row .fi-h {
	margin: 0;
}

.fi-dash .fi-period {
	color: var(--fi-ink-3);
	font-size: var(--fi-text-sm);
}

.fi-dash .fi-note {
	color: var(--fi-ink-3);
	font-size: var(--fi-text-sm);
}

/* Buttons do not inherit type by default, and most of the dashboard's clickable
   surfaces are buttons. Reset here so the classes below can set their own sizes. */
.fi-dash button {
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
}

/* --- brand banner --------------------------------------------------- */

/* A slim band, not a poster. The corner wedge was pure decoration and the
   style this follows calls for none; one hairline rule carries the brand. */
.fi-dash .fi-hero {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: var(--fi-5);
	align-items: center;
	padding: var(--fi-4) var(--fi-5);
	background: var(--ssap-navy);
	border-radius: var(--fi-radius);
	border-left: 3px solid var(--ssap-orange);
	color: #fff;
}

.fi-dash .fi-eyebrow {
	margin-bottom: 2px;
	color: #9fb0c6;
	font-size: var(--fi-text-xs);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.fi-dash .fi-hero h2 {
	margin: 0;
	color: #fff;
	font-size: var(--fi-text-lg);
	font-weight: 650;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.fi-dash .fi-hero p {
	margin: var(--fi-1) 0 0;
	max-width: 68ch;
	color: #a9b6c7;
	font-size: var(--fi-text-sm);
}

.fi-dash .fi-hero-logo {
	width: 92px;
	padding: 6px 8px;
	background: #fff;
	border-radius: 4px;
}

/* --- cards and tiles ------------------------------------------------ */

.fi-dash .fi-card {
	padding: var(--fi-4) var(--fi-5);
	background: var(--fi-surface);
	border: 1px solid var(--fi-line);
	border-radius: var(--fi-radius);
}

/* auto-fit, not auto-fill: empty tracks would otherwise show the hairline
   background as a grey slab when a row holds fewer tiles than it could. */
.fi-dash .fi-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 1px;
	background: var(--fi-line);
	border: 1px solid var(--fi-line);
	border-radius: var(--fi-radius);
	overflow: hidden;
}

/* Tiles share hairlines instead of each carrying its own box - one rule
   between neighbours rather than two borders and a gap. */
.fi-dash .fi-tile {
	display: flex;
	flex-direction: column;
	justify-content: center;
	width: 100%;
	min-height: 78px;
	padding: var(--fi-3) var(--fi-4);
	background: var(--fi-surface);
	border: 0;
	border-radius: 0;
	text-align: left;
	color: inherit;
	transition: background-color var(--fi-dur) var(--fi-ease);
}

/* Only tiles that are buttons are clickable, so only they get the affordance. */
.fi-dash button.fi-tile {
	cursor: pointer;
}

.fi-dash button.fi-tile:hover {
	background: var(--fi-surface-2);
}

.fi-dash .fi-tile .lbl {
	color: var(--fi-ink-3);
	font-size: var(--fi-text-sm);
}

.fi-dash .fi-tile .val {
	margin-top: var(--fi-1);
	color: var(--fi-ink);
	font-size: 1.375rem;
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.2;
}

.fi-dash .fi-tile .sub {
	margin-top: var(--fi-1);
	color: var(--fi-ink-3);
	font-size: var(--fi-text-xs);
}

/* --- needs attention ------------------------------------------------ */

.fi-dash .fi-attn {
	display: grid;
	gap: var(--fi-2);
}

.fi-dash .fi-attn-item {
	display: grid;
	grid-template-columns: 20px minmax(0, 1fr) auto;
	align-items: center;
	gap: var(--fi-3);
	width: 100%;
	min-height: var(--fi-touch);
	padding: var(--fi-3) var(--fi-4);
	background: var(--fi-surface);
	border: 1px solid var(--fi-line);
	border-left: 2px solid var(--fi-warn-fill);
	border-radius: var(--fi-radius);
	text-align: left;
	color: var(--fi-ink);
	cursor: pointer;
	transition: background-color var(--fi-dur) var(--fi-ease);
}

.fi-dash .fi-attn-item:hover {
	background: var(--fi-tint-warn);
}

.fi-dash .fi-attn-item.info {
	border-left-color: var(--fi-line-strong);
}

/* Meaning is carried by the icon and the wording as well as the colour. */
.fi-dash .fi-attn-item svg {
	width: 20px;
	height: 20px;
	color: var(--fi-warn-ink);
	flex: none;
}

.fi-dash .fi-attn-item.info svg {
	color: var(--fi-ink-3);
}

.fi-dash .fi-attn-item .what {
	font-size: var(--fi-text-md);
	font-weight: 600;
}

.fi-dash .fi-attn-item .detail {
	display: block;
	margin-top: 2px;
	color: var(--fi-ink-3);
	font-size: var(--fi-text-xs);
	font-weight: 400;
}

.fi-dash .fi-attn-item .go {
	color: var(--fi-ink-3);
	font-size: var(--fi-text-xs);
	white-space: nowrap;
}

.fi-dash .fi-clear {
	display: flex;
	align-items: center;
	gap: var(--fi-3);
	padding: var(--fi-3) var(--fi-4);
	background: var(--fi-tint-ok);
	border: 1px solid var(--fi-line);
	border-radius: var(--fi-radius);
	color: var(--fi-ink);
	font-size: var(--fi-text-md);
}

.fi-dash .fi-clear svg {
	width: 20px;
	height: 20px;
	color: var(--fi-ok-ink);
	flex: none;
}

/* --- common tasks --------------------------------------------------- */

/* Tasks are grouped by where the material is in its life, so each group gets a
   quiet heading and its own row of buttons rather than one long slab. */
.fi-dash .fi-taskgroup + .fi-taskgroup {
	margin-top: var(--fi-4);
}

.fi-dash .fi-taskgroup h3 {
	margin: 0 0 var(--fi-2);
	color: var(--fi-ink-3);
	font-size: var(--fi-text-xs);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.fi-dash .fi-tasks {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
	gap: var(--fi-2);
}

.fi-dash .fi-task {
	display: flex;
	align-items: center;
	gap: var(--fi-3);
	min-height: var(--fi-touch);
	padding: var(--fi-3);
	background: var(--fi-surface);
	border: 1px solid var(--fi-line-strong);
	border-radius: var(--fi-radius);
	color: var(--fi-ink);
	font-size: var(--fi-text-md);
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition: background-color var(--fi-dur) var(--fi-ease), border-color var(--fi-dur) var(--fi-ease);
}

.fi-dash .fi-task:hover {
	background: var(--fi-surface-2);
	border-color: var(--ssap-navy);
}

.fi-dash .fi-task svg {
	width: 20px;
	height: 20px;
	color: var(--fi-ink-3);
	flex: none;
}

.fi-dash .fi-task:hover svg {
	color: var(--fi-ink);
}

/* --- stock on hand -------------------------------------------------- */

.fi-dash .fi-split {
	display: grid;
	grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
	gap: var(--fi-3);
}

.fi-dash .fi-headline {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--fi-1);
	text-align: left;
	cursor: pointer;
}

/* The currency symbol and the figure must stay on one line - format_currency
   puts a space between them, which was breaking the number onto its own row. */
.fi-dash .fi-headline-val {
	color: var(--fi-ink);
	font-size: clamp(1.5rem, 2.1vw, 1.875rem);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* --- bar rows ------------------------------------------------------- */

.fi-dash .fi-bar {
	display: grid;
	grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) minmax(88px, auto);
	align-items: center;
	gap: var(--fi-2);
	margin: var(--fi-2) 0;
	font-size: var(--fi-text-sm);
}

.fi-dash .fi-bar .track {
	height: 6px;
	background: var(--fi-bar-track);
	border-radius: 999px;
	overflow: hidden;
}

.fi-dash .fi-bar .fill {
	height: 6px;
	min-width: 2px;
	background: var(--fi-bar);
	border-radius: 999px;
}

.fi-dash .fi-bar .num {
	text-align: right;
	color: var(--fi-ink);
}

/* --- factory flow --------------------------------------------------- */

.fi-dash .fi-flow {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: var(--fi-3);
}

.fi-dash .fi-stage {
	display: flex;
	flex-direction: column;
	gap: var(--fi-1);
	padding: var(--fi-3) var(--fi-4);
	background: var(--fi-surface);
	border: 1px solid var(--fi-line);
	border-radius: var(--fi-radius);
	text-align: left;
	color: inherit;
	cursor: pointer;
	transition: border-color var(--fi-dur) var(--fi-ease), background-color var(--fi-dur) var(--fi-ease);
}

.fi-dash .fi-stage:hover {
	background: var(--fi-surface-2);
}

.fi-dash .fi-stage .step {
	color: var(--fi-ink-3);
	font-size: var(--fi-text-xs);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.fi-dash .fi-stage .name {
	color: var(--fi-ink);
	font-size: var(--fi-text-md);
	font-weight: 600;
}

.fi-dash .fi-stage dl {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 2px var(--fi-2);
	margin: var(--fi-1) 0 0;
	font-size: var(--fi-text-sm);
}

.fi-dash .fi-stage dt {
	color: var(--fi-ink-3);
	font-weight: 400;
	min-width: 0;
	overflow-wrap: break-word;
}

.fi-dash .fi-stage dd {
	margin: 0;
	color: var(--fi-ink);
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* --- panels and tables ---------------------------------------------- */

.fi-dash .fi-panels {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: var(--fi-3);
}

.fi-dash .fi-panel {
	padding: var(--fi-4) var(--fi-5);
	background: var(--fi-surface);
	border: 1px solid var(--fi-line);
	border-radius: var(--fi-radius);
}

.fi-dash .ttl {
	margin-bottom: var(--fi-3);
	color: var(--fi-ink);
	font-size: var(--fi-text-md);
	font-weight: 600;
}

/* Wide tables scroll inside their panel instead of stretching the page. */
.fi-dash .fi-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.fi-dash table {
	width: 100%;
	min-width: 320px;
	border-collapse: collapse;
	font-size: var(--fi-text-sm);
}

.fi-dash th,
.fi-dash td {
	padding: var(--fi-2) var(--fi-2);
	border-bottom: 1px solid var(--fi-line);
	text-align: left;
}

.fi-dash th {
	color: var(--fi-ink-3);
	font-weight: 500;
	white-space: nowrap;
}

.fi-dash td {
	color: var(--fi-ink-2);
}

.fi-dash tbody tr:last-child td {
	border-bottom: 0;
}

.fi-dash td.n,
.fi-dash th.n {
	text-align: right;
}

.fi-dash a {
	color: var(--fi-ink);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* --- the sign-in list of pending tasks ------------------------------- */

.fi-pending {
	margin: 0 0 var(--fi-3);
	padding-left: var(--fi-5);
}

.fi-pending li {
	margin-bottom: var(--fi-1);
	line-height: 1.6;
}

/* --- the movement record -------------------------------------------- */

.fi-dash .fi-record {
	margin-top: var(--fi-4);
	padding: var(--fi-4) var(--fi-5);
	background: var(--fi-surface);
	border: 1px solid var(--fi-line);
	border-radius: var(--fi-radius);
}

/* Filter chips, full touch height: the shop floor reads this on a tablet. */
.fi-dash .fi-chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fi-2);
	margin-bottom: var(--fi-3);
}

.fi-dash .fi-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--fi-1);
	min-height: var(--fi-touch);
	padding: var(--fi-2) var(--fi-3);
	background: var(--fi-surface);
	color: var(--fi-ink-2);
	border: 1px solid var(--fi-line-strong);
	border-radius: var(--fi-radius);
	font-size: var(--fi-text-sm);
	font-weight: 500;
	cursor: pointer;
	transition: background var(--fi-dur) var(--fi-ease), color var(--fi-dur) var(--fi-ease);
}

.fi-dash .fi-chip svg {
	width: 15px;
	height: 15px;
	flex: 0 0 auto;
}

.fi-dash .fi-chip:hover {
	background: var(--fi-surface-2);
}

/* The chosen filter is carried by fill, by weight and by aria-pressed – never
   by fill on its own. */
.fi-dash .fi-chip.on {
	background: var(--fi-ink);
	color: var(--fi-ink-invert);
	border-color: var(--fi-ink);
	font-weight: 600;
}

.fi-dash .fi-today,
.fi-dash .fi-record-foot {
	margin-top: var(--fi-3);
}

.fi-dash .fi-showmore {
	min-height: var(--fi-touch);
	margin-bottom: var(--fi-2);
	padding: var(--fi-2) var(--fi-4);
	background: var(--fi-surface-2);
	color: var(--fi-ink);
	border: 1px solid var(--fi-line-strong);
	border-radius: var(--fi-radius);
	font-size: var(--fi-text-sm);
	font-weight: 600;
	cursor: pointer;
	transition: background var(--fi-dur) var(--fi-ease);
}

.fi-dash .fi-showmore:hover {
	background: var(--fi-surface-3);
}

/* A second line inside a cell – the item name under its code, the clock time
   under the date. Dimmer and smaller, never the only copy of a fact. */
.fi-dash .sub2 {
	display: block;
	color: var(--fi-ink-3);
	font-size: var(--fi-text-xs);
}

.fi-dash td.when {
	white-space: nowrap;
}

/* What happened: the arrow, the sentence, and the direction spelled out. */
.fi-dash .fi-move {
	display: grid;
	grid-template-columns: 16px minmax(0, 1fr);
	gap: var(--fi-2);
	align-items: start;
}

.fi-dash .fi-move svg {
	width: 16px;
	height: 16px;
	margin-top: 2px;
}

.fi-dash .fi-move .w {
	display: block;
	color: var(--fi-ink);
	font-weight: 500;
}

.fi-dash .fi-move.in svg {
	color: var(--fi-ok-ink);
}

.fi-dash .fi-move.out svg {
	color: var(--fi-warn-ink);
}

.fi-dash .fi-move.inside svg {
	color: var(--fi-ink-2);
}

.fi-dash .fi-move.count svg {
	color: var(--fi-danger-ink);
}

/* --- movements per day ---------------------------------------------- */

.fi-dash .fi-days {
	display: grid;
	gap: var(--fi-2);
}

.fi-dash .fi-day {
	display: grid;
	grid-template-columns: 92px minmax(0, 1fr) 2.5rem;
	gap: var(--fi-2);
	align-items: center;
	font-size: var(--fi-text-sm);
}

.fi-dash .fi-day .d {
	color: var(--fi-ink-2);
	white-space: nowrap;
}

.fi-dash .fi-day .track {
	display: flex;
	height: 10px;
	background: var(--fi-bar-track);
	border-radius: 999px;
	overflow: hidden;
}

.fi-dash .fi-day .seg {
	height: 100%;
}

/* Four fills that also differ in lightness, so the split still reads in
   greyscale; the counts printed underneath carry it either way. */
.fi-dash .fi-day .seg.in {
	background: var(--fi-ok-fill);
}

.fi-dash .fi-day .seg.out {
	background: var(--fi-warn-fill);
}

.fi-dash .fi-day .seg.inside {
	background: var(--fi-bar);
}

.fi-dash .fi-day .seg.count {
	background: var(--fi-line-strong);
}

.fi-dash .fi-day .num {
	color: var(--fi-ink);
	font-weight: 600;
	text-align: right;
}

.fi-dash .fi-day .parts {
	grid-column: 2 / -1;
	color: var(--fi-ink-3);
	font-size: var(--fi-text-xs);
}

/* --- progressive disclosure ----------------------------------------- */

.fi-dash .fi-more {
	margin-top: var(--fi-5);
	border-top: 1px solid var(--fi-line);
}

.fi-dash .fi-more > summary {
	display: flex;
	align-items: center;
	gap: var(--fi-2);
	min-height: var(--fi-touch);
	padding: var(--fi-3) 0;
	color: var(--fi-ink);
	font-size: var(--fi-text-md);
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}

.fi-dash .fi-more > summary::-webkit-details-marker {
	display: none;
}

.fi-dash .fi-more > summary::before {
	content: "";
	width: 7px;
	height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform var(--fi-dur) var(--fi-ease);
}

.fi-dash .fi-more[open] > summary::before {
	transform: rotate(45deg);
}

/* --- loading skeleton (reserves height so the page does not jump) --- */

.fi-dash .fi-skeleton {
	display: grid;
	gap: var(--fi-3);
}

.fi-dash .fi-skeleton span {
	display: block;
	height: 76px;
	background: var(--fi-surface-3);
	border-radius: var(--fi-radius-lg);
}

.fi-dash .fi-skeleton span:first-child {
	height: 44px;
}

@media (max-width: 760px) {
	.fi-dash .fi-hero {
		grid-template-columns: minmax(0, 1fr);
		padding: var(--fi-4);
	}

	.fi-dash .fi-hero-logo {
		display: none;
	}

	.fi-dash .fi-hero::after {
		border-top-width: 64px;
		border-left-width: 64px;
	}

	.fi-dash .fi-split {
		grid-template-columns: minmax(0, 1fr);
	}

	.fi-dash .fi-bar {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.fi-dash .fi-bar .track {
		grid-column: 1 / -1;
		order: 2;
	}

	.fi-dash .fi-attn-item {
		grid-template-columns: 20px minmax(0, 1fr);
	}

	.fi-dash .fi-attn-item .go {
		display: none;
	}

	.fi-dash .fi-record {
		padding: var(--fi-4) var(--fi-3);
	}

	/* The date moves onto its own line so the bar keeps a usable width. */
	.fi-dash .fi-day {
		grid-template-columns: minmax(0, 1fr) 2.5rem;
	}

	.fi-dash .fi-day .d,
	.fi-dash .fi-day .parts {
		grid-column: 1 / -1;
	}

	.fi-dash .fi-day .track {
		grid-column: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fi-dash *,
	.btn,
	.btn-primary {
		transition-duration: 1ms !important;
		animation-duration: 1ms !important;
	}
}
