/* ==========================================================================
   Custody — enterprise accountability ledger
   Design system & application shell
   ========================================================================== */

:root {
	--navy: #172b3a;
	--navy-800: #1b3243;
	--navy-700: #203a4d;
	--navy-600: #284757;
	--primary: #286a8a;
	--primary-600: #22607d;
	--primary-700: #1b526b;
	--primary-soft: #eaf2f6;
	--primary-soft-2: #f3f8fa;
	--bg: #f5f7f8;
	--surface: #ffffff;
	--surface-2: #fafbfc;
	--text: #26333d;
	--text-2: #73808b;
	--text-3: #98a4ae;
	--border: #e1e6ea;
	--border-strong: #d3dae0;
	--success: #27845a;
	--success-soft: #e8f4ee;
	--warning: #b07a22;
	--warning-soft: #fbf3e4;
	--danger: #c44d4d;
	--danger-soft: #fbeded;
	--danger-strong: #a83a3a;
	--neutral: #5f6c76;
	--neutral-soft: #eef1f3;
	--key-tone: #8a6a2f;
	--key-soft: #f7f1e6;
	--vendor-tone: #2f6f66;
	--vendor-soft: #e9f2f1;
	--visitor-tone: #4b5680;
	--visitor-soft: #eef0f7;
	--radius: 12px;
	--radius-md: 10px;
	--radius-sm: 8px;
	--shadow-sm: 0 1px 2px rgba(23, 43, 58, 0.05);
	--shadow-md: 0 8px 24px rgba(23, 43, 58, 0.08);
	--shadow-lg: 0 18px 48px rgba(23, 43, 58, 0.16);
	--font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	--sidebar-w: 246px;
	--sidebar-mini: 76px;
	--topbar-h: 66px;
	--ring: 0 0 0 3px rgba(40, 106, 138, 0.16);
	--transition: 140ms ease;
}

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

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 14px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

::selection {
	background: rgba(40, 106, 138, 0.18);
}

a {
	color: var(--primary);
	text-decoration: none;
}

a:hover {
	color: var(--primary-700);
}

img {
	max-width: 100%;
}

h1, h2, h3, h4, h5, p {
	margin: 0;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
}

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

.icon {
	display: inline-block;
	flex: none;
	vertical-align: -0.15em;
}

.muted {
	color: var(--text-2);
}

.mono {
	font-family: var(--mono);
	font-size: 0.92em;
}

.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }

.sep {
	color: var(--border-strong);
	padding: 0 2px;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.app-shell {
	min-height: 100vh;
}

.app-sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	width: var(--sidebar-w);
	background: var(--navy);
	color: #c3ced6;
	display: flex;
	flex-direction: column;
	z-index: 40;
	transition: width 180ms ease, transform 220ms ease;
}

.sidebar-brand {
	height: var(--topbar-h);
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 18px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	flex: none;
	overflow: hidden;
}

.brand {
	display: flex;
	align-items: center;
	gap: 11px;
	color: #fff;
	min-width: 0;
}

.brand:hover {
	color: #fff;
}

.brand-mark {
	width: 34px;
	height: 34px;
	border-radius: 9px;
	background: var(--primary);
	display: grid;
	place-items: center;
	color: #fff;
	flex: none;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.brand-text {
	display: flex;
	flex-direction: column;
	line-height: 1.1;
	white-space: nowrap;
}

.brand-text strong {
	font-size: 16.5px;
	font-weight: 600;
	letter-spacing: -0.015em;
}

.brand-text small {
	margin-top: 3px;
	font-size: 9.5px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #7e929f;
	font-weight: 600;
}

.sidebar-nav {
	flex: 1;
	overflow-y: auto;
	padding: 14px 12px 20px;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.nav-group + .nav-group {
	margin-top: 22px;
}

.nav-label {
	display: block;
	padding: 0 10px 7px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #6e8494;
	white-space: nowrap;
	overflow: hidden;
}

.nav-item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 11px;
	height: 40px;
	padding: 0 10px;
	margin-bottom: 2px;
	border-radius: 8px;
	color: #bac7d1;
	font-size: 13.5px;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	transition: background var(--transition), color var(--transition);
}

.nav-item .icon {
	color: #8195a3;
	transition: color var(--transition);
}

.nav-item:hover {
	background: rgba(255, 255, 255, 0.055);
	color: #fff;
}

.nav-item:hover .icon {
	color: #b4c7d3;
}

.nav-item.is-active {
	background: #233c4e;
	color: #fff;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.nav-item.is-active .icon {
	color: #8fc1da;
}

.nav-item.is-active::before {
	content: "";
	position: absolute;
	left: -12px;
	top: 10px;
	bottom: 10px;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background: #6aaecb;
}

.nav-item .nav-label-text {
	flex: 1;
}

.nav-count {
	min-width: 20px;
	height: 19px;
	padding: 0 6px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.09);
	color: #a9bcc9;
	font-size: 10.5px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-variant-numeric: tabular-nums;
}

.nav-count.is-alert {
	background: rgba(196, 77, 77, 0.22);
	color: #f0b6b6;
}

.sidebar-foot {
	flex: none;
	padding: 14px 18px 18px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	white-space: nowrap;
	overflow: hidden;
}

.sidebar-note {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 11px;
	color: #7e929f;
}

.sidebar-note .dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #58a984;
	box-shadow: 0 0 0 3px rgba(88, 169, 132, 0.14);
	flex: none;
}

.app-main {
	margin-left: var(--sidebar-w);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	transition: margin 180ms ease;
}

/* Compact sidebar */
.app-shell.is-mini .app-sidebar {
	width: var(--sidebar-mini);
}

.app-shell.is-mini .app-main {
	margin-left: var(--sidebar-mini);
}

.app-shell.is-mini .brand-text,
.app-shell.is-mini .nav-label,
.app-shell.is-mini .nav-item .nav-label-text,
.app-shell.is-mini .nav-count,
.app-shell.is-mini .sidebar-note span:not(.dot) {
	display: none;
}

.app-shell.is-mini .sidebar-brand {
	padding: 0;
	justify-content: center;
}

.app-shell.is-mini .nav-item {
	justify-content: center;
	padding: 0;
}

.app-shell.is-mini .nav-item.is-active::before {
	left: 0;
}

.app-shell.is-mini .sidebar-foot {
	padding: 14px 0;
	display: flex;
	justify-content: center;
}

/* Topbar */
.topbar {
	position: sticky;
	top: 0;
	z-index: 30;
	height: var(--topbar-h);
	background: rgba(255, 255, 255, 0.96);
	backdrop-filter: blur(6px);
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: 18px;
	padding: 0 24px;
	flex: none;
}

.topbar-left {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

.icon-btn {
	width: 38px;
	height: 38px;
	border: 1px solid transparent;
	background: transparent;
	border-radius: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--text-2);
	transition: background var(--transition), color var(--transition), border-color var(--transition);
	flex: none;
}

.icon-btn:hover {
	background: var(--surface-2);
	color: var(--text);
	border-color: var(--border);
}

.facility-btn {
	display: flex;
	align-items: center;
	gap: 9px;
	border: 0;
	background: transparent;
	padding: 4px 6px;
	border-radius: 8px;
	color: var(--text);
	max-width: 340px;
}

.facility-btn:hover {
	background: var(--surface-2);
}

.facility-btn .icon-pin {
	color: var(--text-2);
}

.facility-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	line-height: 1.2;
	min-width: 0;
}

.facility-meta strong {
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 230px;
}

.facility-meta small {
	font-size: 11px;
	color: var(--text-2);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 230px;
	margin-top: 2px;
}

.facility-btn .chev {
	color: var(--text-3);
}

.topbar-center {
	flex: 1;
	display: flex;
	justify-content: center;
	padding: 0 10px;
}

.global-search {
	position: relative;
	width: 100%;
	max-width: 430px;
}

.global-search .icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-3);
	pointer-events: none;
}

.global-search input {
	width: 100%;
	height: 38px;
	border: 1px solid var(--border);
	background: var(--surface-2);
	border-radius: 8px;
	padding: 0 44px 0 36px;
	font-size: 13px;
	color: var(--text);
	transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.global-search input::placeholder {
	color: var(--text-3);
}

.global-search input:focus {
	outline: none;
	background: #fff;
	border-color: var(--primary);
	box-shadow: var(--ring);
}

.global-search kbd {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	font-family: var(--font);
	font-size: 10px;
	font-weight: 600;
	color: var(--text-3);
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 1px 5px;
	line-height: 1.4;
}

.topbar-right {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}

.topbar-clock {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	line-height: 1.2;
	padding-right: 12px;
	margin-right: 2px;
	border-right: 1px solid var(--border);
}

.topbar-clock strong {
	font-size: 13px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.topbar-clock small {
	font-size: 10.5px;
	color: var(--text-2);
	letter-spacing: 0.02em;
}

.bell-btn {
	position: relative;
}

.bell-dot {
	position: absolute;
	top: 5px;
	right: 5px;
	min-width: 15px;
	height: 15px;
	padding: 0 3px;
	border-radius: 999px;
	background: var(--danger);
	color: #fff;
	font-size: 9.5px;
	font-weight: 700;
	line-height: 15px;
	text-align: center;
	box-shadow: 0 0 0 2px #fff;
	font-variant-numeric: tabular-nums;
}

.user-btn {
	display: flex;
	align-items: center;
	gap: 9px;
	border: 1px solid transparent;
	background: transparent;
	padding: 4px 7px 4px 5px;
	border-radius: 9px;
}

.user-btn:hover {
	background: var(--surface-2);
	border-color: var(--border);
}

.user-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	line-height: 1.2;
}

.user-meta strong {
	font-size: 12.5px;
	font-weight: 600;
}

.user-meta small {
	font-size: 10.5px;
	color: var(--text-2);
	margin-top: 1px;
}

.avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: #fff;
	flex: none;
	background: #4b6577;
}

.avatar.lg {
	width: 44px;
	height: 44px;
	font-size: 14.5px;
}

.avatar.a1 { background: #4b6d82; }
.avatar.a2 { background: #506f63; }
.avatar.a3 { background: #6b627a; }
.avatar.a4 { background: #7a6656; }
.avatar.a5 { background: #4f6685; }
.avatar.a6 { background: #736355; }

/* Page content */
.page-content {
	width: 100%;
	max-width: 1560px;
	margin: 0 auto;
	padding: 26px 28px 56px;
	flex: 1;
}

.page-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 22px;
	flex-wrap: wrap;
}

.page-head-main {
	min-width: 0;
}

.eyebrow {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--text-2);
	margin-bottom: 8px;
}

.eyebrow a {
	color: var(--text-2);
}

.eyebrow a:hover {
	color: var(--primary);
}

.page-title {
	font-size: 25px;
	font-weight: 600;
	letter-spacing: -0.022em;
	line-height: 1.2;
}

.page-subtitle {
	margin-top: 6px;
	font-size: 13.5px;
	color: var(--text-2);
	max-width: 720px;
}

.page-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 38px;
	padding: 0 14px;
	border-radius: 8px;
	border: 1px solid transparent;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: -0.005em;
	white-space: nowrap;
	transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
	text-decoration: none;
}

.btn:disabled,
.btn.is-disabled {
	opacity: 0.5;
	pointer-events: none;
}

.btn-primary {
	background: var(--primary);
	color: #fff;
	box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
	background: var(--primary-600);
	color: #fff;
}

.btn-primary:active {
	background: var(--primary-700);
}

.btn-secondary {
	background: var(--surface);
	border-color: var(--border-strong);
	color: var(--text);
	box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
	background: var(--surface-2);
	border-color: #c5ced5;
	color: var(--text);
}

.btn-ghost {
	background: transparent;
	color: var(--text-2);
}

.btn-ghost:hover {
	background: var(--surface-2);
	color: var(--text);
}

.btn-danger {
	background: var(--danger);
	color: #fff;
}

.btn-danger:hover {
	background: var(--danger-strong);
	color: #fff;
}

.btn-danger-ghost {
	background: transparent;
	color: var(--danger);
	border-color: transparent;
}

.btn-danger-ghost:hover {
	background: var(--danger-soft);
	color: var(--danger-strong);
}

.btn-success {
	background: var(--success);
	color: #fff;
}

.btn-success:hover {
	background: #1f704b;
	color: #fff;
}

.btn-lg {
	height: 46px;
	padding: 0 20px;
	font-size: 13.5px;
	border-radius: 9px;
}

.btn-sm {
	height: 30px;
	padding: 0 10px;
	font-size: 12px;
	gap: 6px;
	border-radius: 7px;
}

.btn-block {
	width: 100%;
}

.btn.is-loading {
	position: relative;
	color: transparent !important;
	pointer-events: none;
}

.btn.is-loading::after {
	content: "";
	position: absolute;
	width: 15px;
	height: 15px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-top-color: #fff;
	animation: spin 0.7s linear infinite;
}

.btn-secondary.is-loading::after {
	border-color: rgba(40, 106, 138, 0.25);
	border-top-color: var(--primary);
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

.link {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--primary);
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.link:hover {
	color: var(--primary-700);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Chips, pills, refs
   -------------------------------------------------------------------------- */

.pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 23px;
	padding: 0 9px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.005em;
	white-space: nowrap;
	background: var(--neutral-soft);
	color: var(--neutral);
}

.pill::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
	flex: none;
}

.pill.no-dot::before {
	display: none;
}

.pill-success { background: var(--success-soft); color: var(--success); }
.pill-info { background: var(--primary-soft); color: var(--primary); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-neutral { background: var(--neutral-soft); color: var(--neutral); }

.pill-lg {
	height: 27px;
	padding: 0 11px;
	font-size: 12px;
}

.profile-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 24px;
	padding: 0 8px 0 7px;
	border-radius: 6px;
	font-size: 11.5px;
	font-weight: 600;
	white-space: nowrap;
}

.profile-chip .icon {
	width: 13px;
	height: 13px;
}

.profile-chip.tone-key { background: var(--key-soft); color: var(--key-tone); }
.profile-chip.tone-vendor { background: var(--vendor-soft); color: var(--vendor-tone); }
.profile-chip.tone-visitor { background: var(--visitor-soft); color: var(--visitor-tone); }

.ref {
	display: inline-block;
	font-family: var(--mono);
	font-size: 11.5px;
	font-weight: 500;
	color: #4b5a66;
	background: #f2f5f7;
	border: 1px solid #e7ecef;
	padding: 1px 6px;
	border-radius: 5px;
	white-space: nowrap;
	letter-spacing: -0.01em;
}

.meta-line {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11.5px;
	color: var(--text-2);
}

.person {
	display: flex;
	align-items: center;
	gap: 9px;
	min-width: 0;
}

.person .avatar {
	width: 28px;
	height: 28px;
	font-size: 10.5px;
}

.person-text {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
	min-width: 0;
}

.person-text strong {
	font-size: 12.5px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.person-text small {
	font-size: 11px;
	color: var(--text-2);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sig-state {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 11.5px;
	font-weight: 500;
	white-space: nowrap;
}

.sig-state.is-signed { color: var(--success); }
.sig-state.is-pending { color: var(--text-3); }

/* --------------------------------------------------------------------------
   Panels
   -------------------------------------------------------------------------- */

.panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	min-width: 0;
}

.panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 15px 18px;
	border-bottom: 1px solid var(--border);
	flex-wrap: wrap;
}

.panel-head h2 {
	font-size: 14.5px;
	font-weight: 600;
	letter-spacing: -0.01em;
	display: flex;
	align-items: center;
	gap: 9px;
}

.panel-head h2 .icon {
	color: var(--text-2);
}

.panel-head .panel-meta {
	font-size: 12px;
	color: var(--text-2);
}

.panel-body {
	padding: 18px;
}

.panel-body.is-flush {
	padding: 0;
}

.panel-foot {
	padding: 13px 18px;
	border-top: 1px solid var(--border);
	background: var(--surface-2);
	border-radius: 0 0 var(--radius) var(--radius);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.panel + .panel {
	margin-top: 18px;
}

/* --------------------------------------------------------------------------
   Metric tiles
   -------------------------------------------------------------------------- */

.stat-grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 14px;
	margin-bottom: 20px;
}

.stat-tile {
	position: relative;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 15px 16px 14px;
	box-shadow: var(--shadow-sm);
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 9px;
}

.stat-top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
}

.stat-label {
	font-size: 11.5px;
	font-weight: 600;
	color: var(--text-2);
	letter-spacing: 0.01em;
	line-height: 1.3;
}

.stat-icon {
	width: 26px;
	height: 26px;
	border-radius: 7px;
	display: grid;
	place-items: center;
	background: var(--surface-2);
	color: var(--text-2);
	border: 1px solid var(--border);
	flex: none;
}

.stat-value {
	font-size: 27px;
	font-weight: 600;
	letter-spacing: -0.03em;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.stat-meta {
	font-size: 11.5px;
	color: var(--text-2);
	display: flex;
	align-items: center;
	gap: 5px;
}

.stat-tile.tone-warning .stat-icon { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.stat-tile.tone-danger .stat-icon { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.stat-tile.tone-success .stat-icon { background: var(--success-soft); color: var(--success); border-color: transparent; }
.stat-tile.tone-info .stat-icon { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.stat-tile.tone-danger .stat-value { color: var(--danger); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

table.table {
	width: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.table thead th {
	text-align: left;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--text-2);
	padding: 10px 16px;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

.table thead th a {
	color: inherit;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.table thead th a:hover {
	color: var(--text);
}

.table tbody td {
	padding: 11px 16px;
	border-bottom: 1px solid var(--border);
	font-size: 12.8px;
	vertical-align: middle;
	color: var(--text);
}

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

.table tbody tr {
	transition: background 100ms ease;
}

.table tbody tr:hover {
	background: #fbfcfd;
}

.table .cell-strong {
	font-weight: 600;
}

.table .cell-stack {
	display: flex;
	flex-direction: column;
	gap: 2px;
	line-height: 1.3;
}

.table .cell-stack small {
	color: var(--text-2);
	font-size: 11.5px;
}

.table .cell-actions {
	text-align: right;
	white-space: nowrap;
}

.table th.cell-actions {
	position: relative;
}

.table .cell-actions .btn + .btn {
	margin-left: 6px;
}

.table .cell-time {
	white-space: nowrap;
	color: var(--text-2);
	font-size: 12px;
}

.table .cell-time strong {
	color: var(--text);
	font-weight: 500;
}

.table-sm tbody td {
	padding: 9px 14px;
}

.table-sm thead th {
	padding: 8px 14px;
}

.table-compact tbody td {
	padding: 8px 12px;
}

.sort-caret {
	display: inline-flex;
	color: var(--text-3);
}

.sort-caret.is-asc,
.sort-caret.is-desc {
	color: var(--primary);
}

.table thead th .th-sort:hover {
	color: var(--primary);
}

.row-overdue td {
	background: rgba(196, 77, 77, 0.018);
}

/* --------------------------------------------------------------------------
   Toolbars / filters
   -------------------------------------------------------------------------- */

.toolbar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--border);
	flex-wrap: wrap;
}

.toolbar .toolbar-search {
	position: relative;
	min-width: 220px;
	flex: 1;
	max-width: 330px;
}

.toolbar-search .icon {
	position: absolute;
	left: 11px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-3);
	pointer-events: none;
}

.toolbar-search input {
	height: 36px;
	width: 100%;
	padding: 0 12px 0 34px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
	font-size: 12.5px;
}

.toolbar-search input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: var(--ring);
}

.toolbar .spacer {
	flex: 1;
}

.seg {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 3px;
	background: #eef1f3;
	border-radius: 8px;
}

.seg a,
.seg button {
	height: 29px;
	padding: 0 11px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-2);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

.seg a:hover,
.seg button:hover {
	color: var(--text);
}

.seg .is-active {
	background: var(--surface);
	color: var(--text);
	font-weight: 600;
	box-shadow: 0 1px 2px rgba(23, 43, 58, 0.08);
}

.seg .seg-count {
	font-size: 10.5px;
	color: var(--text-3);
	font-weight: 600;
}

.seg .is-active .seg-count {
	color: var(--primary);
}

.filter-select {
	height: 36px;
	padding: 0 30px 0 10px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2373808b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
	font-size: 12.5px;
	color: var(--text);
	appearance: none;
	cursor: pointer;
}

.filter-select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: var(--ring);
}

.filter-input {
	height: 36px;
	padding: 0 10px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
	font-size: 12.5px;
	color: var(--text);
}

.filter-input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: var(--ring);
}

.filter-group {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--text-2);
}

.filter-group label {
	font-weight: 500;
}

.filter-bar {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 13px 16px;
	margin-bottom: 16px;
	display: flex;
	align-items: flex-end;
	gap: 12px;
	flex-wrap: wrap;
	box-shadow: var(--shadow-sm);
}

.filter-bar .field-inline {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.filter-bar .field-inline > label {
	font-size: 10.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--text-2);
}

.filter-bar .spacer {
	flex: 1;
}

.chip-filter {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 28px;
	padding: 0 10px;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--surface);
	font-size: 11.5px;
	font-weight: 500;
	color: var(--text-2);
}

.chip-filter:hover {
	border-color: var(--border-strong);
	color: var(--text);
}

.chip-filter.is-active {
	background: var(--primary-soft);
	border-color: transparent;
	color: var(--primary);
	font-weight: 600;
}

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

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 16px;
	min-width: 0;
}

.field > label,
.field-label {
	font-size: 12px;
	font-weight: 600;
	color: #4b5a66;
	display: flex;
	align-items: center;
	gap: 6px;
}

.field > label .req {
	color: var(--danger);
	font-weight: 600;
}

.optional {
	margin-left: 4px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--text-3);
}

.field .hint {
	font-size: 11.5px;
	color: var(--text-2);
	line-height: 1.45;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="date"],
.field input[type="datetime-local"],
.field input[type="number"],
.field input[type="search"],
.field select,
.field textarea {
	width: 100%;
	height: 42px;
	border: 1px solid var(--border-strong);
	border-radius: 8px;
	background: var(--surface);
	padding: 0 12px;
	font-size: 13.5px;
	color: var(--text);
	transition: border-color var(--transition), box-shadow var(--transition);
}

.field select {
	padding-right: 32px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2373808b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	appearance: none;
}

.field textarea {
	height: auto;
	min-height: 86px;
	padding: 10px 12px;
	resize: vertical;
	line-height: 1.5;
}

.field input::placeholder,
.field textarea::placeholder {
	color: var(--text-3);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: var(--ring);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
	background: #f6f8f9;
	color: var(--text-2);
	cursor: not-allowed;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
	border-color: var(--danger);
}

.field.has-error input:focus,
.field.has-error select:focus,
.field.has-error textarea:focus {
	box-shadow: 0 0 0 3px rgba(196, 77, 77, 0.12);
}

.field-error {
	font-size: 11.5px;
	color: var(--danger);
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 4px;
}

.form-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 0 16px;
}

.form-grid .span-2 {
	grid-column: 1 / -1;
}

.form-grid-3 {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0 16px;
}

.form-section {
	padding: 22px 24px;
	border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
	border-bottom: 0;
}

.form-section-head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 18px;
}

.form-step-no {
	width: 27px;
	height: 27px;
	border-radius: 50%;
	background: var(--primary-soft);
	color: var(--primary);
	font-size: 12px;
	font-weight: 700;
	display: grid;
	place-items: center;
	flex: none;
	margin-top: 1px;
}

.form-section-head h3 {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.form-section-head p {
	margin-top: 3px;
	font-size: 12px;
	color: var(--text-2);
}

.form-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	padding: 16px 24px;
	background: var(--surface-2);
	border-top: 1px solid var(--border);
	border-radius: 0 0 var(--radius) var(--radius);
}

.form-actions .spacer {
	flex: 1;
}

.checkbox {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 12.8px;
	color: var(--text);
	cursor: pointer;
	line-height: 1.45;
}

.checkbox input {
	width: 17px;
	height: 17px;
	margin: 1px 0 0;
	accent-color: var(--primary);
	flex: none;
}

.checkbox small {
	display: block;
	color: var(--text-2);
	margin-top: 2px;
}

.radio-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 10px;
}

.radio-card {
	position: relative;
	border: 1px solid var(--border-strong);
	border-radius: 9px;
	padding: 12px 13px;
	cursor: pointer;
	transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.radio-card input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.radio-card strong {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 12.8px;
	font-weight: 600;
}

.radio-card small {
	display: block;
	margin-top: 4px;
	font-size: 11.5px;
	color: var(--text-2);
	line-height: 1.4;
}

.radio-card:has(input:checked) {
	border-color: var(--primary);
	background: var(--primary-soft-2);
	box-shadow: 0 0 0 1px var(--primary);
}

.radio-card input:focus-visible + * {
	outline: 2px solid var(--primary);
}

.search-results {
	max-height: 210px;
	overflow-y: auto;
	border: 1px solid var(--border);
	border-radius: 8px;
	margin-top: 6px;
}

.search-result {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-bottom: 1px solid var(--border);
	background: var(--surface);
	text-align: left;
	font-size: 12.5px;
}

.search-result:last-child {
	border-bottom: 0;
}

.search-result:hover {
	background: var(--primary-soft-2);
}

.search-result .person-text {
	flex: 1;
}

/* --------------------------------------------------------------------------
   Workflow layout
   -------------------------------------------------------------------------- */

.flow-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 18px;
	align-items: start;
}

.flow-main {
	min-width: 0;
}

.flow-aside {
	position: sticky;
	top: calc(var(--topbar-h) + 20px);
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.side-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	overflow: hidden;
}

.side-card-head {
	padding: 14px 16px;
	border-bottom: 1px solid var(--border);
	background: var(--surface-2);
}

.side-card-head h3 {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--text-2);
}

.side-card-body {
	padding: 16px;
}

.summary-list {
	display: flex;
	flex-direction: column;
	gap: 11px;
	margin: 0;
}

.summary-list > div {
	display: flex;
	justify-content: space-between;
	gap: 14px;
	font-size: 12.3px;
}

.summary-list > div dt {
	color: var(--text-2);
	flex: none;
}

.summary-list > div dd {
	margin: 0;
	text-align: right;
	font-weight: 500;
	color: var(--text);
	min-width: 0;
	overflow-wrap: anywhere;
}

.summary-divider {
	height: 1px;
	background: var(--border);
	margin: 3px 0;
}

.side-cta {
	padding: 14px 16px;
	border-top: 1px solid var(--border);
	background: var(--surface-2);
}

.side-cta .btn {
	width: 100%;
}

.side-note {
	font-size: 11.5px;
	color: var(--text-2);
	line-height: 1.5;
	padding: 12px 16px;
	display: flex;
	gap: 8px;
}

.side-note .icon {
	margin-top: 1px;
	flex: none;
	color: var(--text-2);
}

.stepper {
	display: flex;
	align-items: flex-start;
	gap: 0;
	padding: 16px 18px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	margin-bottom: 16px;
	box-shadow: var(--shadow-sm);
	overflow-x: auto;
}

.step {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 120px;
	position: relative;
	padding-right: 14px;
}

.step:last-child {
	flex: none;
	padding-right: 0;
}

.step-dot {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 1px solid var(--border-strong);
	background: var(--surface);
	color: var(--text-3);
	font-size: 11px;
	font-weight: 700;
	display: grid;
	place-items: center;
	flex: none;
}

.step-label {
	font-size: 11.5px;
	font-weight: 600;
	color: var(--text-2);
	line-height: 1.25;
	white-space: nowrap;
}

.step-label small {
	display: block;
	font-size: 10.5px;
	font-weight: 400;
	color: var(--text-3);
	margin-top: 1px;
}

.step::after {
	content: "";
	height: 1px;
	background: var(--border);
	flex: 1;
	margin-left: 4px;
	min-width: 14px;
}

.step:last-child::after {
	display: none;
}

.step.is-current .step-dot {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
}

.step.is-current .step-label {
	color: var(--text);
}

.step.is-done .step-dot {
	background: var(--success-soft);
	border-color: transparent;
	color: var(--success);
}

/* --------------------------------------------------------------------------
   Signature capture
   -------------------------------------------------------------------------- */

.signature-field {
	margin-top: 4px;
}

.signature-pad {
	border: 1px solid var(--border-strong);
	border-radius: 9px;
	background: #fcfdfd url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M0 23.5h24' stroke='%23e8edf0' stroke-width='1'/%3E%3C/svg%3E");
	overflow: hidden;
	position: relative;
}

.signature-pad canvas {
	display: block;
	width: 100%;
	height: 170px;
	touch-action: none;
	cursor: crosshair;
	position: relative;
	z-index: 1;
}

.signature-hint {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	pointer-events: none;
	color: var(--text-3);
	font-size: 12px;
	z-index: 0;
	transition: opacity 150ms ease;
}

.signature-hint .icon {
	color: #c3cdd4;
}

.signature-pad.has-ink .signature-hint {
	opacity: 0;
}

.signature-pad.is-signed {
	border-color: rgba(39, 132, 90, 0.5);
	background: #fbfdfc;
}

.signature-pad.is-signed canvas {
	cursor: default;
}

.signature-tools {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 9px;
	flex-wrap: wrap;
}

.signature-tools .spacer {
	flex: 1;
}

.signature-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11.5px;
	color: var(--success);
	font-weight: 500;
}

.signature-status .icon {
	color: var(--success);
}

.signature-meta {
	font-size: 11px;
	color: var(--text-2);
}

.sig-preview {
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fcfdfd;
	padding: 6px 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 78px;
}

.sig-preview img {
	max-height: 64px;
	width: auto;
}

.sig-thumb {
	height: 30px;
	width: auto;
	display: inline-block;
	vertical-align: middle;
}

.sig-block {
	display: flex;
	align-items: center;
	gap: 12px;
}

.sig-block .sig-preview {
	min-width: 150px;
	min-height: 62px;
	flex: none;
}

.sig-block-meta {
	display: flex;
	flex-direction: column;
	gap: 3px;
	font-size: 12px;
}

.sig-block-meta strong {
	font-size: 12.5px;
	font-weight: 600;
}

.sig-block-meta small {
	color: var(--text-2);
	font-size: 11.5px;
}

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */

.timeline {
	position: relative;
	padding: 4px 0 4px 3px;
}

.timeline-item {
	position: relative;
	padding: 0 0 20px 34px;
}

.timeline-item:last-child {
	padding-bottom: 0;
}

.timeline-item::before {
	content: "";
	position: absolute;
	left: 11px;
	top: 24px;
	bottom: 0;
	width: 1px;
	background: var(--border);
}

.timeline-item:last-child::before {
	display: none;
}

.timeline-dot {
	position: absolute;
	left: 0;
	top: 1px;
	width: 23px;
	height: 23px;
	border-radius: 50%;
	background: var(--surface);
	border: 1px solid var(--border);
	color: var(--text-2);
	display: grid;
	place-items: center;
}

.timeline-dot .icon {
	width: 12px;
	height: 12px;
}

.timeline-dot.tone-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.timeline-dot.tone-info { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.timeline-dot.tone-warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.timeline-dot.tone-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.timeline-content {
	font-size: 12.8px;
	line-height: 1.45;
}

.timeline-content strong {
	font-weight: 600;
}

.timeline-meta {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 11px;
	color: var(--text-2);
	margin-top: 3px;
	flex-wrap: wrap;
}

.timeline-sig {
	margin-top: 6px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 3px 8px;
	background: #fcfdfd;
}

.timeline-sig img {
	height: 24px;
}

.timeline-sig span {
	font-size: 10.5px;
	color: var(--text-2);
}

/* --------------------------------------------------------------------------
   Attention / notices
   -------------------------------------------------------------------------- */

.attention-list {
	display: flex;
	flex-direction: column;
}

.attention-item {
	display: flex;
	gap: 12px;
	padding: 13px 18px;
	border-bottom: 1px solid var(--border);
	transition: background 100ms ease;
}

.attention-item:last-child {
	border-bottom: 0;
}

.attention-item:hover {
	background: #fbfcfd;
}

.attention-icon {
	width: 30px;
	height: 30px;
	border-radius: 8px;
	display: grid;
	place-items: center;
	flex: none;
	background: var(--neutral-soft);
	color: var(--neutral);
}

.attention-icon.tone-danger { background: var(--danger-soft); color: var(--danger); }
.attention-icon.tone-warning { background: var(--warning-soft); color: var(--warning); }
.attention-icon.tone-info { background: var(--primary-soft); color: var(--primary); }
.attention-icon.tone-neutral { background: var(--neutral-soft); color: var(--neutral); }

.attention-body {
	flex: 1;
	min-width: 0;
}

.attention-title {
	font-size: 12.8px;
	font-weight: 600;
	line-height: 1.35;
}

.attention-meta {
	margin-top: 2px;
	font-size: 11.5px;
	color: var(--text-2);
	line-height: 1.4;
}

.attention-group {
	font-size: 9.5px;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--text-3);
	margin-bottom: 3px;
}

.notice {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 11px 14px;
	border-radius: 9px;
	font-size: 12.3px;
	line-height: 1.45;
	background: var(--primary-soft-2);
	border: 1px solid #e3edf1;
	color: #4b6473;
}

.notice .icon {
	flex: none;
	margin-top: 1px;
	color: var(--primary);
}

.notice strong {
	color: var(--text);
}

.notice-warning {
	background: #fdf9f1;
	border-color: #f0e3c8;
	color: #7d6435;
}

.notice-warning .icon {
	color: var(--warning);
}

.notice-danger {
	background: #fdf4f4;
	border-color: #f2d9d9;
	color: #8a4a4a;
}

.notice-danger .icon {
	color: var(--danger);
}

.notice-success {
	background: #f3faf6;
	border-color: #d7ecdf;
	color: #3b6b52;
}

.notice-success .icon {
	color: var(--success);
}

/* --------------------------------------------------------------------------
   Dropdowns
   -------------------------------------------------------------------------- */

.dropdown {
	position: relative;
}

.dropdown-panel {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 240px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 11px;
	box-shadow: var(--shadow-lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity 120ms ease, transform 120ms ease, visibility 120ms;
	z-index: 60;
	overflow: hidden;
}

.dropdown.is-open .dropdown-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.dropdown-header {
	padding: 12px 15px;
	border-bottom: 1px solid var(--border);
	background: var(--surface-2);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.dropdown-header strong {
	font-size: 12.5px;
	font-weight: 600;
}

.dropdown-footer {
	padding: 9px 15px;
	border-top: 1px solid var(--border);
	background: var(--surface-2);
	display: flex;
	justify-content: center;
}

.dropdown-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 15px;
	font-size: 12.5px;
	color: var(--text);
	width: 100%;
	border: 0;
	background: transparent;
	text-align: left;
}

.dropdown-item:hover {
	background: var(--surface-2);
	color: var(--text);
}

.dropdown-item .icon {
	color: var(--text-2);
}

.dropdown-item.is-danger {
	color: var(--danger);
}

.dropdown-item.is-danger .icon {
	color: var(--danger);
}

.dropdown-sep {
	height: 1px;
	background: var(--border);
	margin: 5px 0;
}

.dropdown-meta {
	padding: 12px 15px;
	font-size: 12px;
	color: var(--text-2);
	line-height: 1.5;
}

.dropdown-meta strong {
	display: block;
	color: var(--text);
	font-size: 12.5px;
	margin-bottom: 2px;
}

.facility-panel {
	width: 310px;
}

.facility-panel .dropdown-meta {
	display: flex;
	gap: 10px;
}

.facility-panel .dropdown-meta .icon {
	color: var(--primary);
	margin-top: 2px;
}

.notifications-panel {
	width: 380px;
	max-width: calc(100vw - 24px);
}

.notifications-panel .attention-item {
	padding: 11px 15px;
}

.notifications-panel .attention-title {
	font-size: 12.3px;
}

.notifications-panel .attention-icon {
	width: 27px;
	height: 27px;
}

.notifications-panel .attention-item:hover {
	background: var(--surface-2);
}

.user-panel {
	width: 262px;
}

.user-panel-head {
	padding: 15px;
	display: flex;
	align-items: center;
	gap: 11px;
	border-bottom: 1px solid var(--border);
}

.user-panel-head .avatar {
	width: 38px;
	height: 38px;
	font-size: 12.5px;
}

.user-panel-head strong {
	display: block;
	font-size: 13px;
	font-weight: 600;
}

.user-panel-head small {
	display: block;
	font-size: 11.5px;
	color: var(--text-2);
	margin-top: 2px;
}

.user-panel .role-badge {
	margin: 12px 15px 6px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 24px;
	padding: 0 9px;
	border-radius: 999px;
	background: var(--primary-soft);
	color: var(--primary);
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toast-stack {
	position: fixed;
	right: 20px;
	bottom: 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	z-index: 100;
	max-width: 380px;
	width: calc(100% - 40px);
}

.toast {
	display: flex;
	align-items: flex-start;
	gap: 11px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 3px solid var(--success);
	border-radius: 10px;
	box-shadow: var(--shadow-md);
	padding: 12px 14px;
	animation: toast-in 200ms ease;
}

.toast.is-leaving {
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 160ms ease, transform 160ms ease;
}

.toast-icon {
	width: 26px;
	height: 26px;
	border-radius: 7px;
	background: var(--success-soft);
	color: var(--success);
	display: grid;
	place-items: center;
	flex: none;
}

.toast-body {
	flex: 1;
	min-width: 0;
	font-size: 12.5px;
	line-height: 1.4;
}

.toast-body strong {
	display: block;
	font-size: 12.8px;
	font-weight: 600;
	margin-bottom: 1px;
}

.toast-body span {
	color: var(--text-2);
}

.toast-close {
	border: 0;
	background: transparent;
	color: var(--text-3);
	padding: 2px;
	border-radius: 4px;
}

.toast-close:hover {
	color: var(--text);
	background: var(--surface-2);
}

.toast.tone-error {
	border-left-color: var(--danger);
}

.toast.tone-error .toast-icon {
	background: var(--danger-soft);
	color: var(--danger);
}

.toast.tone-warning {
	border-left-color: var(--warning);
}

.toast.tone-warning .toast-icon {
	background: var(--warning-soft);
	color: var(--warning);
}

.toast.tone-info {
	border-left-color: var(--primary);
}

.toast.tone-info .toast-icon {
	background: var(--primary-soft);
	color: var(--primary);
}

@keyframes toast-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Confirmation
   -------------------------------------------------------------------------- */

.confirm-wrap {
	max-width: 760px;
	margin: 8px auto 0;
}

.confirm-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: var(--shadow-sm);
	overflow: hidden;
}

.confirm-top {
	padding: 30px 32px 24px;
	display: flex;
	gap: 16px;
	align-items: flex-start;
	border-bottom: 1px solid var(--border);
}

.confirm-mark {
	width: 50px;
	height: 50px;
	border-radius: 50%;
	background: var(--success-soft);
	color: var(--success);
	display: grid;
	place-items: center;
	flex: none;
}

.confirm-top h1 {
	font-size: 21px;
	font-weight: 600;
	letter-spacing: -0.02em;
}

.confirm-top p {
	margin-top: 5px;
	font-size: 13px;
	color: var(--text-2);
	max-width: 480px;
}

.confirm-ref {
	margin-top: 12px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--mono);
	font-size: 14px;
	font-weight: 600;
	color: var(--text);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 7px;
	padding: 5px 10px;
}

.confirm-body {
	padding: 24px 32px;
}

.confirm-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px 28px;
	margin: 0;
}

.confirm-grid .span-2 {
	grid-column: 1 / -1;
}

.confirm-grid dt {
	font-size: 10.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--text-2);
	margin-bottom: 4px;
}

.confirm-grid dd {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.45;
}

.confirm-actions {
	padding: 16px 32px;
	background: var(--surface-2);
	border-top: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.confirm-actions .spacer {
	flex: 1;
}

/* --------------------------------------------------------------------------
   Empty states & pagination
   -------------------------------------------------------------------------- */

.empty-state {
	padding: 46px 24px;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.empty-icon {
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text-3);
	display: grid;
	place-items: center;
	margin-bottom: 4px;
}

.empty-state h3 {
	font-size: 14px;
	font-weight: 600;
}

.empty-state p {
	font-size: 12.5px;
	color: var(--text-2);
	max-width: 360px;
	line-height: 1.5;
}

.empty-state .btn {
	margin-top: 6px;
}

.pager {
	padding: 12px 16px;
	border-top: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.pager-links {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-left: auto;
	flex-wrap: wrap;
}

.pager-num,
.pager-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	height: 30px;
	padding: 0 9px;
	border-radius: 7px;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-2);
	border: 1px solid transparent;
}

.pager-num:hover,
.pager-btn a:hover {
	background: var(--surface-2);
	color: var(--text);
}

.pager-num.is-current {
	background: var(--primary-soft);
	color: var(--primary);
	border-color: transparent;
	font-weight: 600;
}

.pager-btn a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	height: 30px;
	padding: 0 9px;
	color: var(--text-2);
	border-radius: 7px;
}

.pager-info {
	font-size: 12px;
	color: var(--text-2);
}

/* --------------------------------------------------------------------------
   Settings
   -------------------------------------------------------------------------- */

.tabs {
	display: flex;
	align-items: center;
	gap: 4px;
	border-bottom: 1px solid var(--border);
	margin-bottom: 20px;
	overflow-x: auto;
	scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
	display: none;
}

.tab {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	height: 40px;
	padding: 0 13px;
	border: 0;
	border-bottom: 2px solid transparent;
	background: transparent;
	font-size: 13px;
	font-weight: 500;
	color: var(--text-2);
	white-space: nowrap;
	margin-bottom: -1px;
}

.tab:hover {
	color: var(--text);
}

.tab.is-active {
	color: var(--primary);
	border-bottom-color: var(--primary);
	font-weight: 600;
}

.tab .icon {
	width: 15px;
	height: 15px;
}

.settings-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 18px;
	align-items: start;
}

.settings-aside {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.permission-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 12.5px;
}

.permission-table th,
.permission-table td {
	padding: 10px 14px;
	border-bottom: 1px solid var(--border);
	text-align: center;
}

.permission-table th:first-child,
.permission-table td:first-child {
	text-align: left;
}

.permission-table thead th {
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--text-2);
	background: var(--surface-2);
	font-weight: 600;
}

.permission-table tbody tr:last-child td {
	border-bottom: 0;
}

.permission-yes {
	color: var(--success);
}

.permission-no {
	color: var(--text-3);
}

.role-card {
	border: 1px solid var(--border);
	border-radius: 9px;
	padding: 13px 14px;
	margin-bottom: 10px;
}

.role-card:last-child {
	margin-bottom: 0;
}

.role-card strong {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: 12.8px;
	font-weight: 600;
}

.role-card p {
	margin-top: 4px;
	font-size: 11.5px;
	color: var(--text-2);
	line-height: 1.45;
}

.role-card .role-count {
	font-size: 11px;
	font-weight: 500;
	color: var(--text-2);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 999px;
	padding: 1px 8px;
}

.key-availability {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-radius: 8px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	font-size: 12px;
	color: var(--text-2);
	margin-top: 4px;
}

.key-availability strong {
	color: var(--text);
	font-weight: 600;
}

.key-availability .icon {
	color: var(--primary);
}

/* --------------------------------------------------------------------------
   Reports
   -------------------------------------------------------------------------- */

.report-layout {
	display: grid;
	grid-template-columns: 280px minmax(0, 1fr);
	gap: 18px;
	align-items: start;
}

.report-nav {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 10px;
	box-shadow: var(--shadow-sm);
	position: sticky;
	top: calc(var(--topbar-h) + 20px);
}

.report-nav-group {
	margin-bottom: 10px;
}

.report-nav-group:last-child {
	margin-bottom: 0;
}

.report-nav-label {
	padding: 7px 9px 5px;
	font-size: 9.5px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-3);
}

.report-nav-item {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	padding: 9px 9px;
	border-radius: 8px;
	font-size: 12.3px;
	font-weight: 500;
	color: var(--text-2);
	line-height: 1.35;
}

.report-nav-item .icon {
	margin-top: 1px;
	color: var(--text-3);
	flex: none;
}

.report-nav-item:hover {
	background: var(--surface-2);
	color: var(--text);
}

.report-nav-item.is-active {
	background: var(--primary-soft);
	color: var(--primary);
	font-weight: 600;
}

.report-nav-item.is-active .icon {
	color: var(--primary);
}

.report-main {
	min-width: 0;
}

.report-summary {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin-bottom: 16px;
}

.summary-tile {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 13px 15px;
	box-shadow: var(--shadow-sm);
}

.summary-tile span {
	display: block;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-2);
	margin-bottom: 5px;
}

.summary-tile strong {
	font-size: 21px;
	font-weight: 600;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.report-title-block {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}

.report-title-block h1 {
	font-size: 18px;
	font-weight: 600;
	letter-spacing: -0.015em;
}

.report-title-block p {
	margin-top: 3px;
	font-size: 12.5px;
	color: var(--text-2);
	max-width: 560px;
}

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

.auth {
	min-height: 100vh;
	display: grid;
	grid-template-columns: minmax(380px, 44%) 1fr;
}

.auth-brand {
	background: var(--navy);
	color: #fff;
	padding: 44px 52px;
	display: flex;
	flex-direction: column;
	position: relative;
	overflow: hidden;
}

.auth-brand::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
	background-size: 44px 44px;
	pointer-events: none;
}

.auth-brand > * {
	position: relative;
	z-index: 1;
}

.auth-info {
	position: relative;
	z-index: 1;
}

.auth-brand .brand-mark {
	background: rgba(255, 255, 255, 0.1);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.auth-brand .brand-text small {
	color: #8da3b0;
}

.auth-hero {
	margin: auto 0;
	padding: 60px 0;
	max-width: 460px;
}

.auth-hero h1 {
	font-size: 34px;
	font-weight: 600;
	letter-spacing: -0.03em;
	line-height: 1.18;
}

.auth-hero h1 span {
	color: #8fc1da;
}

.auth-hero p {
	margin-top: 14px;
	font-size: 13.5px;
	line-height: 1.6;
	color: #a8bac6;
	max-width: 400px;
}

.auth-features {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: 34px;
	padding-top: 26px;
	border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.auth-feature {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 12.5px;
	color: #c3d1da;
}

.auth-feature .feature-icon {
	width: 32px;
	height: 32px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.08);
	display: grid;
	place-items: center;
	color: #8fc1da;
	flex: none;
}

.auth-feature strong {
	color: #fff;
	font-weight: 600;
	display: block;
	font-size: 12.8px;
}

.auth-feature small {
	display: block;
	color: #8da3b0;
	font-size: 11.5px;
	margin-top: 1px;
}

.auth-foot {
	font-size: 11px;
	color: #718695;
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.auth-panel {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48px 32px;
	background: var(--bg);
}

.auth-card {
	width: 100%;
	max-width: 388px;
}

.auth-card h2 {
	font-size: 21px;
	font-weight: 600;
	letter-spacing: -0.02em;
}

.auth-card .auth-sub {
	margin-top: 5px;
	font-size: 13px;
	color: var(--text-2);
}

.auth-form {
	margin-top: 26px;
}

.auth-form .field {
	margin-bottom: 15px;
}

.auth-form .field input {
	height: 44px;
}

.auth-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: 2px 0 18px;
	font-size: 12px;
	color: var(--text-2);
}

.auth-error {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 10px 12px;
	border-radius: 8px;
	background: var(--danger-soft);
	color: var(--danger-strong);
	font-size: 12px;
	line-height: 1.45;
	margin-bottom: 16px;
}

.auth-error .icon {
	flex: none;
	margin-top: 1px;
}

.demo-accounts {
	margin-top: 26px;
	padding-top: 20px;
	border-top: 1px solid var(--border);
}

.demo-accounts .demo-title {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 10.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-2);
	margin-bottom: 10px;
}

.demo-btn {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 11px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
	margin-bottom: 7px;
	text-align: left;
	transition: border-color var(--transition), background var(--transition);
}

.demo-btn:hover {
	border-color: var(--primary);
	background: var(--primary-soft-2);
}

.demo-btn .demo-role {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-2);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 1px 5px;
	margin-left: auto;
	flex: none;
}

.demo-btn .person-text strong {
	font-size: 12px;
}

.demo-btn .person-text small {
	font-size: 10.5px;
}

.auth-note {
	margin-top: 18px;
	font-size: 11px;
	line-height: 1.5;
	color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */

.stack-sm > * + * { margin-top: 10px; }
.stack-md > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 20px; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; }
.gap-10 { gap: 10px; }
.gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }

.inline-form {
	display: inline;
}

.input-suffix {
	position: relative;
}

.input-suffix input {
	padding-right: 64px;
}

.input-suffix > span {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 11.5px;
	color: var(--text-3);
	pointer-events: none;
}

.plain-list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 7px;
	font-size: 12.3px;
	line-height: 1.45;
	color: var(--text-2);
}

.plain-list li {
	position: relative;
	padding-left: 14px;
}

.plain-list li::before {
	content: "";
	position: absolute;
	left: 2px;
	top: 7px;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var(--border-strong);
}
.w-full { width: 100%; }

.two-col {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 16px;
}

.three-col {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

.detail-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 360px;
	gap: 18px;
	align-items: start;
}

.detail-aside {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.info-list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px 22px;
	margin: 0;
}

.info-list dt {
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-2);
	margin-bottom: 4px;
}

.info-list dd {
	margin: 0;
	font-size: 13px;
	line-height: 1.45;
}

.info-list .span-2 {
	grid-column: 1 / -1;
}

.integration-fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 13px 22px;
	font-size: 12px;
}

.integration-fields dt {
	color: var(--text-2);
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
	margin-bottom: 2px;
}

.integration-fields dd {
	margin: 0;
	font-family: var(--mono);
	font-size: 11.5px;
	color: var(--text);
	word-break: break-all;
}

.ph1-tag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--text-2);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 5px;
	padding: 2px 6px;
}

.event-identity {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 18px;
	flex-wrap: wrap;
}

.event-ref-large {
	font-family: var(--mono);
	font-size: 12.5px;
	font-weight: 500;
	color: var(--text-2);
	letter-spacing: 0.01em;
	display: flex;
	align-items: center;
	gap: 9px;
}

.event-ref-large .ref {
	font-size: 12.5px;
}

.signature-pair {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.record-card {
	border: 1px solid var(--border);
	border-radius: 10px;
	overflow: hidden;
}

.record-card-head {
	padding: 11px 14px;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
	font-size: 11.5px;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.record-card-head .meta-line {
	font-weight: 400;
}

.record-card-body {
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.record-card.is-empty {
	border-style: dashed;
	color: var(--text-2);
}

.record-card.is-empty .record-card-body {
	align-items: center;
	text-align: center;
	justify-content: center;
	min-height: 130px;
	font-size: 12px;
}

.record-signer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-size: 12px;
}

.record-signer strong {
	font-weight: 600;
}

.record-signer small {
	display: block;
	color: var(--text-2);
	font-size: 11px;
	margin-top: 1px;
}

.record-notes {
	font-size: 12px;
	color: var(--text-2);
	border-top: 1px solid var(--border);
	padding-top: 9px;
	line-height: 1.5;
}

.overdue-banner {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-radius: 9px;
	background: var(--danger-soft);
	border: 1px solid #f2d9d9;
	color: #8a4444;
	font-size: 12.5px;
	margin-bottom: 16px;
}

.overdue-banner .icon {
	color: var(--danger);
	flex: none;
}

.overdue-banner strong {
	color: var(--danger-strong);
}

.demo-banner {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 11.5px;
	color: var(--text-2);
	padding: 7px 11px;
	border: 1px dashed var(--border-strong);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.6);
	width: fit-content;
}

.demo-banner .icon {
	color: var(--text-3);
}

.section-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.section-title h2 {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.kpi-inline {
	display: flex;
	align-items: center;
	gap: 18px;
	flex-wrap: wrap;
}

.kpi-inline .kpi {
	display: flex;
	align-items: baseline;
	gap: 7px;
	font-size: 12px;
	color: var(--text-2);
}

.kpi-inline .kpi strong {
	font-size: 18px;
	font-weight: 600;
	color: var(--text);
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

dialog.app-dialog {
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 0;
	width: min(440px, calc(100vw - 32px));
	box-shadow: var(--shadow-lg);
	color: var(--text);
}

dialog.app-dialog::backdrop {
	background: rgba(23, 43, 58, 0.42);
	backdrop-filter: blur(2px);
}

.dialog-head {
	padding: 18px 20px 6px;
	font-size: 15px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 10px;
}

.dialog-head .icon {
	color: var(--danger);
}

.dialog-body {
	padding: 4px 20px 18px;
	font-size: 12.8px;
	color: var(--text-2);
	line-height: 1.5;
}

.dialog-actions {
	padding: 13px 20px;
	background: var(--surface-2);
	border-top: 1px solid var(--border);
	display: flex;
	justify-content: flex-end;
	gap: 9px;
}

.truncate {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hide-desktop { display: none; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1399px) {
	.stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1279px) {
	.page-content { padding: 22px 22px 48px; }
	.flow-grid { grid-template-columns: minmax(0, 1fr) 310px; }
	.detail-grid { grid-template-columns: minmax(0, 1fr) 330px; }
	.settings-grid { grid-template-columns: minmax(0, 1fr) 290px; }
	.report-layout { grid-template-columns: 250px minmax(0, 1fr); }
	.topbar { padding: 0 18px; gap: 12px; }
	.topbar-clock { display: none; }
}

@media (max-width: 1023px) {
	.app-sidebar {
		transform: translateX(-100%);
		width: var(--sidebar-w);
		box-shadow: var(--shadow-lg);
	}
	.app-main { margin-left: 0; }
	.app-shell.is-mini .app-sidebar { width: var(--sidebar-w); }
	.app-shell.is-mini .app-main { margin-left: 0; }
	.app-shell.is-mini .brand-text,
	.app-shell.is-mini .nav-label,
	.app-shell.is-mini .nav-item .nav-label-text,
	.app-shell.is-mini .nav-count,
	.app-shell.is-mini .sidebar-note span:not(.dot) {
		display: initial;
	}
	.app-shell.is-mini .brand-text { display: flex; }
	.app-shell.is-mini .nav-item { justify-content: flex-start; padding: 0 10px; }
	.app-shell.is-mini .sidebar-brand { padding: 0 18px; justify-content: flex-start; }
	.sidebar-open .app-sidebar { transform: translateX(0); }
	.sidebar-scrim {
		position: fixed;
		inset: 0;
		background: rgba(23, 43, 58, 0.4);
		z-index: 35;
		opacity: 0;
		visibility: hidden;
		transition: opacity 200ms ease, visibility 200ms;
	}
	.sidebar-open .sidebar-scrim { opacity: 1; visibility: visible; }
	.flow-grid { grid-template-columns: minmax(0, 1fr); }
	.flow-aside { position: static; }
	.detail-grid { grid-template-columns: minmax(0, 1fr); }
	.detail-aside { position: static; }
	.settings-grid { grid-template-columns: minmax(0, 1fr); }
	.report-layout { grid-template-columns: minmax(0, 1fr); }
	.report-nav { position: static; display: flex; gap: 4px; overflow-x: auto; }
	.report-nav-group { display: contents; }
	.report-nav-label { display: none; }
	.report-nav-item { white-space: nowrap; align-items: center; }
	.report-nav-item .icon { margin-top: 0; }
	.topbar-center { max-width: 320px; }
	.global-search { max-width: 320px; }
	.auth { grid-template-columns: 1fr; }
	.auth-brand { display: none; }
	.auth-panel { min-height: 100vh; }
	.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 30px 26px; box-shadow: var(--shadow-sm); }
}

@media (max-width: 767px) {
	.hide-mobile { display: none !important; }
	.hide-desktop { display: block; }
	.page-content { padding: 18px 14px 44px; }
	.topbar { padding: 0 12px; gap: 8px; }
	.topbar-center { display: none; }
	.facility-meta small { display: none; }
	.facility-meta strong { max-width: 150px; }
	.facility-btn { padding-left: 2px; }
	.user-meta { display: none; }
	.user-btn { padding: 3px; }
	.page-title { font-size: 22px; }
	.page-head { margin-bottom: 16px; }
	.stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.stat-tile { padding: 13px 14px; gap: 7px; }
	.stat-value { font-size: 24px; }
	.panel-head { padding: 13px 14px; }
	.panel-body { padding: 14px; }
	.form-section { padding: 18px 16px; }
	.form-actions { padding: 14px 16px; }
	.toolbar { padding: 10px 12px; }
	.toolbar .toolbar-search { max-width: none; min-width: 100%; }
	.form-grid, .form-grid-3, .two-col, .three-col, .info-list, .confirm-grid, .integration-fields {
		grid-template-columns: 1fr;
	}
	.signature-pair { grid-template-columns: 1fr; }
	.report-summary { grid-template-columns: repeat(2, 1fr); }
	.stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.filter-bar { padding: 12px; }
	.filter-bar .field-inline { flex: 1; min-width: 130px; }
	.filter-bar .spacer { display: none; }
	.filter-bar .btn { flex: 1; }
	.confirm-top, .confirm-body, .confirm-actions { padding-left: 18px; padding-right: 18px; }
	.stepper { padding: 12px; }
	.step { min-width: 96px; }
	.step-label small { display: none; }
	.notifications-panel { position: fixed; top: calc(var(--topbar-h) + 6px); left: 12px; right: 12px; width: auto; }
	.facility-panel { position: fixed; top: calc(var(--topbar-h) + 6px); left: 12px; right: 12px; width: auto; }
	.toast-stack { right: 12px; bottom: 12px; width: calc(100% - 24px); }
	.auth-panel { padding: 24px 16px; }
	.auth-card { padding: 24px 18px; border-radius: 12px; }
	.pager { padding: 10px 12px; }
	.pager-info { display: none; }
	.pager-links { margin: 0 auto; }
	.report-nav { padding: 8px; }
	.panel + .panel { margin-top: 14px; }
	.demo-banner { width: 100%; }
	.event-identity { gap: 10px; }
}

@media (max-width: 1023px) {
	.table-stacked thead { display: none; }
	.table-stacked tbody tr {
		display: block;
		padding: 10px 14px;
		border-bottom: 1px solid var(--border);
	}
	.table-stacked tbody tr:last-child { border-bottom: 0; }
	.table-stacked tbody td {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 14px;
		padding: 6px 0;
		border: 0;
		font-size: 12.5px;
	}
	.table-stacked tbody td::before {
		content: attr(data-label);
		font-size: 10px;
		font-weight: 600;
		letter-spacing: 0.06em;
		text-transform: uppercase;
		color: var(--text-2);
		flex: none;
		padding-top: 2px;
	}
	.table-stacked tbody td[data-label=""]::before { display: none; }
	.table-stacked tbody td .cell-stack { align-items: flex-end; text-align: right; }
	.table-stacked tbody td.cell-actions { justify-content: flex-end; padding-top: 9px; }
	.table-stacked tbody td.cell-actions .btn { flex: 1; }
	.table-stacked tbody td.cell-actions .btn + .btn { margin-left: 5px; }
	.table-stacked tbody td .person { justify-content: flex-end; }
	.table-stacked tbody td .person-text { align-items: flex-end; }
}

@media (max-width: 420px) {
	.stat-grid { grid-template-columns: 1fr; }
	.page-actions { width: 100%; }
	.page-actions .btn { flex: 1; }
	.report-summary { grid-template-columns: 1fr 1fr; }
}

/* --------------------------------------------------------------------------
   Overview layout & interactive tiles
   -------------------------------------------------------------------------- */

.overview-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 380px;
	gap: 18px;
	align-items: start;
}

.overview-grid > * {
	min-width: 0;
}

.activity-profile {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	font-weight: 600;
	white-space: nowrap;
}

.activity-profile .icon { width: 11px; height: 11px; }
.activity-profile.tone-key { color: var(--key-tone); }
.activity-profile.tone-vendor { color: var(--vendor-tone); }
.activity-profile.tone-visitor { color: var(--visitor-tone); }

a.stat-tile {
	color: inherit;
	transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

a.stat-tile:hover {
	color: inherit;
	border-color: #c9d6dd;
	box-shadow: var(--shadow-md);
}

.table tbody tr[data-href] {
	cursor: pointer;
}

.signature-pad.is-invalid {
	border-color: var(--danger);
	box-shadow: 0 0 0 3px rgba(196, 77, 77, 0.12);
}

.signature-pad.is-invalid .signature-hint {
	color: var(--danger);
}

.stat-tile .stat-meta .icon {
	color: var(--text-3);
}

@media (max-width: 1200px) {
	.overview-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Four-up metric grids (module registers) */
.stat-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1023px) {
	.stat-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
	.stat-grid.cols-4 { grid-template-columns: 1fr; }
}
