/*
 * Be AI Control Centre
 * Design system: warm bone canvas with an ink sidebar (the control plane),
 * orange from the Be AI wordmark for action and AI, ink for human decisions.
 * No blue anywhere. The six 6D stages carry the site's warm progression.
 */

:root {
	--f-display: "Fraunces", Georgia, "Times New Roman", serif;
	--f-ui: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
	--f-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
	--f-mono: "DM Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

	--lime: #D84626;
	--lime-2: #E35A3A;
	--lime-ink: #FFFFFF;
	--forest: #27742E;
	--navy: #191512;
	--navy-2: #3C3630;
	--sky: #D84626;
	--amber: #F0B430;
	--orange: #E06A2C;
	--red: #B3261E;

	--ai: #D84626;
	--ai-deep: #C63C1E;
	--ai-ink: #B03418;
	--good: #27742E;
	--night: #17120F;
	--night-2: #221A15;
	--night-3: #2D241E;

	/* the six 6D stages, warm and blue-free (same as beai.nz) */
	--s1: #96BE1A; --s2: #27742E; --s3: #F0B430; --s4: #D84626; --s5: #B03418; --s6: #191512;

	/* Severity: fill colours */
	--sev-crit: #B3261E;
	--sev-high: #E06A2C;
	--sev-med: #F0B430;
	--sev-low: #4F8A3C;
	--sev-info: #7C8A93;

	--r-xl: 18px;
	--r-lg: 16px;
	--r-md: 12px;
	--r-sm: 8px;
	--r-pill: 999px;

	--side-w: 256px;
	--side-w-min: 76px;
	--top-h: 64px;
	--tab-h: 66px;
	--gut: clamp(14px, 1.8vw, 26px);
	--gap: clamp(12px, 1.1vw, 16px);

	--ease: cubic-bezier(.22, .61, .36, 1);
	color-scheme: light;
}

/* ---------- Night (warm dark) ---------- */
[data-theme="dark"] {
	--bg: #14100D;
	--bg-2: #1B1511;
	--glass: rgba(255, 244, 232, .045);
	--glass-2: rgba(255, 244, 232, .075);
	--glass-3: rgba(255, 244, 232, .11);
	--solid: #1E1814;
	--solid-2: #261F1A;
	--stroke: rgba(255, 236, 220, .10);
	--stroke-2: rgba(255, 236, 220, .18);
	--edge: rgba(255, 236, 220, .30);
	--text: #F7F3EC;
	--text-2: #E2D9CD;
	--muted: #B3A89B;
	--faint: #A2968A;
	--accent: #E0512F;
	--accent-t: #F0805F;
	--accent-ink: #FFFFFF;
	--focus: #FFD9C9;
	--shadow: 0 18px 50px -22px rgba(0, 0, 0, .7), 0 2px 8px -2px rgba(0, 0, 0, .35);
	--shadow-lg: 0 40px 90px -30px rgba(0, 0, 0, .8);
	--hl: inset 0 1px 0 rgba(255, 255, 255, .05);

	--t-crit: #F28B82;
	--t-high: #F5A06B;
	--t-med: #F3C866;
	--t-low: #9FCB7E;
	--t-info: #B7C2C9;

	--grid-line: rgba(255, 236, 220, .06);
	--scrim: rgba(10, 7, 5, .62);
	--guard-bg: #3A302A;
	color-scheme: dark;
}

/* ---------- Bone (light, default) ---------- */
[data-theme="light"] {
	--bg: #F4F0E9;
	--bg-2: #FBF9F5;
	--glass: rgba(255, 255, 255, .72);
	--glass-2: #FFFFFF;
	--glass-3: #FFFFFF;
	--solid: #FFFFFF;
	--solid-2: #F7F3EC;
	--stroke: rgba(64, 48, 32, .10);
	--stroke-2: rgba(64, 48, 32, .17);
	--edge: #8C8377;
	--text: #191512;
	--text-2: #3C3630;
	--muted: #6B625A;
	--faint: #6E655C;
	--accent: #C63C1E;
	--accent-t: #B03418;
	--accent-ink: #FFFFFF;
	--focus: #191512;
	--shadow: 0 1px 2px rgba(64, 48, 32, .06), 0 10px 28px -12px rgba(64, 48, 32, .16);
	--shadow-lg: 0 4px 10px rgba(64, 48, 32, .07), 0 30px 60px -20px rgba(64, 48, 32, .22);
	--hl: inset 0 1px 0 rgba(255, 255, 255, .9);

	--t-crit: #A32019;
	--t-high: #A8461A;
	--t-med: #7A5806;
	--t-low: #2F6B2A;
	--t-info: #4F5D66;

	--grid-line: rgba(64, 48, 32, .07);
	--scrim: rgba(25, 21, 18, .38);
	--guard-bg: #F4F0E9;
	color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
	margin: 0;
	font: 400 14.5px/1.5 var(--f-body);
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; letter-spacing: -.01em; line-height: 1.15; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(216, 70, 38, .35); }
.mono { font-family: var(--f-mono); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.skip { position: fixed; left: 12px; top: -64px; z-index: 300; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; transition: top .15s; }
.skip:focus { top: 12px; }
.view:focus { outline: none; }
.req { color: var(--t-high); }
[role="button"]:focus-visible, tr.click:focus-visible, th.sortable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.input[aria-invalid="true"] { border-color: var(--t-crit); }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 6px; }
.between { justify-content: space-between; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }

/* ---------- Atmosphere ---------- */
.aurora {
	position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
	background:
		radial-gradient(1200px 700px at 12% -10%, rgba(216, 70, 38, .5), transparent 60%),
		radial-gradient(900px 600px at 105% 10%, rgba(150, 190, 26, .26), transparent 60%),
		radial-gradient(900px 700px at 70% 115%, rgba(216, 70, 38, .22), transparent 60%),
		linear-gradient(180deg, var(--bg-2), var(--bg) 55%);
}
[data-theme="light"] .aurora {
	background:
		radial-gradient(1100px 600px at 10% -10%, rgba(216, 70, 38, .22), transparent 60%),
		radial-gradient(900px 600px at 105% 0%, rgba(216, 70, 38, .16), transparent 60%),
		radial-gradient(900px 700px at 60% 120%, rgba(120, 70, 40, .08), transparent 60%),
		var(--bg);
}
.aurora::before, .aurora::after {
	content: ""; position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
	filter: blur(80px); opacity: .32; mix-blend-mode: screen;
	animation: drift 38s var(--ease) infinite alternate;
}
.aurora::before { background: radial-gradient(circle, rgba(216, 70, 38, .35), transparent 65%); top: -20vmax; right: -10vmax; }
.aurora::after { background: radial-gradient(circle, rgba(120, 70, 40, .7), transparent 65%); bottom: -25vmax; left: -15vmax; animation-duration: 46s; }
[data-theme="light"] .aurora::before, [data-theme="light"] .aurora::after { mix-blend-mode: multiply; opacity: .16; }
.aurora .grid {
	position: absolute; inset: 0;
	background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
	background-size: 46px 46px;
	mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
	-webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}
@keyframes drift { to { transform: translate3d(-8vmax, 6vmax, 0) scale(1.15); } }

/* ---------- App frame ---------- */
.app {
	position: relative; z-index: 1;
	display: grid;
	grid-template-columns: var(--side-w) minmax(0, 1fr);
	min-height: 100vh; min-height: 100dvh;
	transition: grid-template-columns .35s var(--ease);
}
.app.side-min { grid-template-columns: var(--side-w-min) minmax(0, 1fr); }
.app.copilot-open .main-wrap { padding-right: min(400px, 34vw); }

/* Sidebar */
.side {
	position: sticky; top: 0; height: 100vh; height: 100dvh;
	display: flex; flex-direction: column;
	padding: 16px 12px 14px;
	border-right: 1px solid var(--stroke);
	background: linear-gradient(180deg, rgba(23, 18, 15, .5), rgba(23, 18, 15, .22));
	backdrop-filter: blur(22px) saturate(140%);
	-webkit-backdrop-filter: blur(22px) saturate(140%);
	z-index: 30;
}
[data-theme="light"] .side { background: rgba(255, 255, 255, .62); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; min-height: 52px; color: inherit; text-decoration: none; border-radius: 10px; }
.brand img, .top .m-brand img { transition: opacity .15s; }
.brand:hover img, .top .m-brand:hover img { opacity: .82; }
.brand:focus-visible, .top .m-brand:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.brand img.logo-full { height: 34px; width: auto; }
.brand img.logo-mark { height: 36px; width: auto; display: none; }
.app.side-min .brand img.logo-full { display: none; }
.app.side-min .brand img.logo-mark { display: block; margin: 0 auto; }
.brand .portal-tag {
	font: 600 10.5px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase;
	color: var(--accent-t); padding: 4px 7px; border: 1px solid var(--stroke-2); border-radius: 6px; margin-left: auto;
}
.app.side-min .brand .portal-tag { display: none; }
.logo-light { display: none !important; }
[data-theme="light"] .logo-dark { display: none !important; }
[data-theme="light"] .logo-light { display: block !important; }
[data-theme="light"] .app.side-min .brand img.logo-full.logo-light { display: none !important; }

.tenant-pill {
	display: flex; align-items: center; gap: 10px; width: 100%;
	padding: 9px 10px; margin: 0 0 12px; border-radius: var(--r-md);
	background: var(--glass); border: 1px solid var(--stroke);
	text-align: left; transition: border-color .2s, background .2s;
}
.tenant-pill:hover { border-color: var(--stroke-2); background: var(--glass-2); }
.tenant-pill .t-name { font: 600 13.5px/1.2 var(--f-display); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-pill .t-sub { font-size: 11.5px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app.side-min .tenant-pill { justify-content: center; padding: 8px; }
.app.side-min .tenant-pill .t-meta, .app.side-min .tenant-pill .ic-chev { display: none; }
.avatar {
	width: 32px; height: 32px; border-radius: 10px; flex: none;
	display: grid; place-items: center;
	font: 700 12.5px/1 var(--f-display); color: #fff;
	background: linear-gradient(135deg, var(--a1, #3C3630), var(--a2, #27742E));
	box-shadow: var(--hl);
}
.avatar.round { border-radius: 50%; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; border-radius: 8px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; border-radius: 13px; }

.nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.nav-cap {
	font: 600 10.5px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase;
	color: var(--faint); padding: 14px 10px 8px; white-space: nowrap;
}
.app.side-min .nav-cap { text-align: center; padding: 12px 0 6px; font-size: 0; }
.app.side-min .nav-cap::after { content: ""; display: block; width: 18px; height: 1px; background: var(--stroke-2); margin: 0 auto; }
.nav a {
	position: relative; display: flex; align-items: center; gap: 11px;
	padding: 9px 10px; margin: 1px 0; border-radius: 11px;
	color: var(--text-2); font-weight: 500; font-size: 13.8px; white-space: nowrap;
	transition: background .18s, color .18s;
}
.nav a:hover { background: var(--glass); color: var(--text); }
.nav a .n-ic {
	width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
	background: var(--glass); border: 1px solid var(--stroke); color: var(--mc, var(--muted));
	transition: background .2s, color .2s, border-color .2s;
}
.nav a.on { color: var(--text); background: linear-gradient(90deg, rgba(216, 70, 38, .14), rgba(216, 70, 38, 0) 85%); }
[data-theme="light"] .nav a.on { background: linear-gradient(90deg, rgba(216, 70, 38, .2), rgba(216, 70, 38, 0) 85%); }
.nav a.on .n-ic { background: var(--mc, var(--accent)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px -6px var(--mc, var(--accent)); }
.nav a.on::before {
	content: ""; position: absolute; left: -6px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px;
	background: var(--mc, var(--accent));
}
.nav a .lock { margin-left: auto; color: var(--faint); }
.nav a .n-badge {
	margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
	font: 600 11px/20px var(--f-mono); text-align: center; color: #fff; background: var(--sev-crit);
}
.nav a .n-badge.soft { background: var(--glass-3); color: var(--text-2); }
.nav a.locked { color: var(--faint); }
.nav a.locked .n-ic { color: var(--faint); }
.app.side-min .nav a { justify-content: center; padding: 8px 0; }
.app.side-min .nav a .n-label, .app.side-min .nav a .lock, .app.side-min .nav a .n-badge { display: none; }
.app.side-min .nav a.on::before { left: -6px; }

.side-foot { border-top: 1px solid var(--stroke); padding-top: 10px; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.plan-card {
	border-radius: var(--r-md); padding: 12px; position: relative; overflow: hidden;
	background: linear-gradient(140deg, rgba(216, 70, 38, .16), rgba(120, 70, 40, .22));
	border: 1px solid var(--stroke-2);
}
.plan-card b { font-family: var(--f-display); font-size: 13.5px; }
.plan-card .meter { margin-top: 8px; }
.app.side-min .plan-card { display: none; }
.collapse-btn { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 8px 10px; border-radius: 10px; font-size: 13px; }
.collapse-btn:hover { background: var(--glass); color: var(--text); }
.app.side-min .collapse-btn { justify-content: center; }
.app.side-min .collapse-btn span { display: none; }
.app.side-min .collapse-btn .ic { transform: rotate(180deg); }

/* Top bar */
.main-wrap { min-width: 0; display: flex; flex-direction: column; transition: padding-right .35s var(--ease); }
.top {
	position: sticky; top: 0; z-index: 25;
	height: var(--top-h);
	display: flex; align-items: center; gap: 10px;
	padding: 0 var(--gut);
	border-bottom: 1px solid var(--stroke);
	background: rgba(23, 18, 15, .55);
	backdrop-filter: blur(22px) saturate(150%);
	-webkit-backdrop-filter: blur(22px) saturate(150%);
}
[data-theme="light"] .top { background: rgba(251, 249, 245, .72); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { opacity: .5; }
.top .m-brand { display: none; }
.search-btn {
	margin-left: auto; display: flex; align-items: center; gap: 10px;
	height: 40px; min-width: 260px; padding: 0 12px; border-radius: 12px;
	background: var(--glass); border: 1px solid var(--stroke); color: var(--muted); font-size: 13.5px;
	transition: border-color .2s, background .2s;
}
.search-btn:hover { border-color: var(--stroke-2); background: var(--glass-2); }
.kbd { font: 500 11px/1 var(--f-mono); padding: 4px 6px; border-radius: 6px; border: 1px solid var(--stroke-2); color: var(--muted); margin-left: auto; }
.icon-btn {
	position: relative; width: 40px; height: 40px; flex: none; border-radius: 12px;
	display: grid; place-items: center; color: var(--text-2);
	background: var(--glass); border: 1px solid var(--stroke);
	transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.icon-btn:hover { background: var(--glass-2); color: var(--text); border-color: var(--stroke-2); }
.icon-btn:active { transform: scale(.96); }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--sev-crit); box-shadow: 0 0 0 2px var(--bg); }
.icon-btn.ai { color: var(--sky); }
.icon-btn.ai.on { background: rgba(216, 70, 38, .18); border-color: rgba(216, 70, 38, .45); }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 14px; border: 1px solid transparent; }
.user-btn:hover { background: var(--glass); border-color: var(--stroke); }
.user-btn .u-meta { text-align: left; line-height: 1.2; }
.user-btn .u-meta b { font-size: 13px; display: block; }
.user-btn .u-meta span { font-size: 11.5px; color: var(--muted); }

.demo-strip {
	display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
	padding: 7px var(--gut); font-size: 12.5px; color: var(--text-2);
	background: linear-gradient(90deg, rgba(216, 70, 38, .12), rgba(216, 70, 38, .12));
	border-bottom: 1px solid var(--stroke);
}
.demo-strip b { color: var(--text); }
.demo-strip button { color: var(--accent-t); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 26px; }
.demo-strip .ds-cta { background: var(--accent); color: var(--accent-ink); text-decoration: none; padding: 3px 12px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.demo-strip .ds-cta:hover { filter: brightness(1.08); }

.view { padding: var(--gut); padding-bottom: calc(var(--gut) + 20px); min-width: 0; flex: 1 1 auto; }

/* ---------- Page header ---------- */
.ph { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: var(--gap); }
.ph .ph-main { min-width: 0; flex: 1 1 420px; }
.ph .eyebrow {
	display: inline-flex; align-items: center; gap: 8px;
	font: 600 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mc, var(--accent-t));
	margin-bottom: 9px;
}
[data-theme="dark"] .ph .eyebrow { color: color-mix(in srgb, var(--mc, var(--accent-t)) 58%, #fff); }
[data-theme="light"] .ph .eyebrow { color: color-mix(in srgb, var(--mc, var(--accent-t)) 68%, #191512); }
button[data-act="fx:event"]::before { content: ""; position: absolute; inset: -7px; }
.ph .eyebrow .pip { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(216, 70, 38, .15); }
.ph h1, .ph h2.as-h1 { font-size: clamp(24px, 2.2vw, 32px); font-weight: 800; }
.ph .ph-sub { color: var(--muted); margin-top: 6px; font-size: 14.5px; max-width: 980px; }
.ph .ph-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.live {
	display: inline-flex; align-items: center; gap: 7px; font: 600 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
	color: var(--t-low); padding: 6px 9px; border-radius: var(--r-pill); border: 1px solid rgba(216, 70, 38, .35); background: rgba(216, 70, 38, .08);
}
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(216, 70, 38, .6); } 70% { box-shadow: 0 0 0 8px rgba(216, 70, 38, 0); } 100% { box-shadow: 0 0 0 0 rgba(216, 70, 38, 0); } }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	height: 40px; padding: 0 15px; border-radius: 12px; white-space: nowrap;
	font: 600 13.5px/1 var(--f-body);
	border: 1px solid var(--edge); color: var(--text); background: var(--glass);
	transition: background .2s, border-color .2s, transform .15s, box-shadow .2s, color .2s;
}
.btn:hover { background: var(--glass-2); border-color: var(--text-2); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: #C63C1E; box-shadow: 0 10px 26px -12px rgba(216, 70, 38, .8); }
[data-theme="light"] .btn.primary { border-color: #A8361A; }
.btn.primary:hover { background: var(--lime-2); }
.btn.ai { border-color: rgba(216, 70, 38, .55); color: var(--t-info); background: rgba(216, 70, 38, .1); }
.btn.ai:hover { background: rgba(216, 70, 38, .18); }
.btn.danger { border-color: rgba(242, 139, 130, .55); color: var(--t-crit); background: rgba(179, 38, 30, .08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--glass); border-color: var(--stroke); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 10px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 8px; gap: 6px; }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .ic { width: 16px; height: 16px; }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--glass); border: 1px solid var(--stroke); gap: 2px; }
.seg button { height: 32px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--glass-3); color: var(--text); box-shadow: var(--hl), 0 2px 8px -3px rgba(0, 0, 0, .4); }
[data-theme="light"] .seg button.on { background: #fff; box-shadow: 0 1px 4px rgba(64, 48, 32, .12); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--stroke); margin: 0 0 var(--gap); overflow-x: auto; scrollbar-width: none; position: relative; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
	position: relative; padding: 11px 14px 12px; font-weight: 600; font-size: 13.8px; color: var(--muted); white-space: nowrap;
	border-radius: 10px 10px 0 0;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); }
.tabs button .cnt { margin-left: 7px; font: 600 11px/1 var(--f-mono); padding: 3px 6px; border-radius: 8px; background: var(--glass-2); color: var(--muted); }
.tabs .ink { position: absolute; bottom: -1px; height: 2px; background: var(--mc, var(--accent)); border-radius: 2px; transition: left .35s var(--ease), width .35s var(--ease); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.g-main-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.mt { margin-top: var(--gap); }

.card {
	position: relative; min-width: 0;
	border-radius: var(--r-lg);
	background: var(--glass);
	border: 1px solid var(--stroke);
	box-shadow: var(--hl), var(--shadow);
	backdrop-filter: blur(18px) saturate(140%);
	-webkit-backdrop-filter: blur(18px) saturate(140%);
	padding: 16px 18px;
	transition: border-color .25s, transform .25s var(--ease), background .25s;
	isolation: isolate;
}
.card.glow::before {
	content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
	background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(216, 70, 38, .10), transparent 45%);
	opacity: 0; transition: opacity .3s;
}
.card.glow:hover::before { opacity: 1; }
.card.hover:hover { border-color: var(--stroke-2); transform: translateY(-2px); }
.card.flush { padding: 0; }
.card.tint { background: linear-gradient(150deg, rgba(216, 70, 38, .12), rgba(120, 70, 40, .16)); border-color: var(--stroke-2); }
.card.tint-ai { background: linear-gradient(150deg, rgba(216, 70, 38, .14), rgba(120, 70, 40, .14)); border-color: rgba(216, 70, 38, .3); }
.card.solid { background: var(--solid); }
.ch { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
.ch h3 { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; min-width: 0; }
.ch h3 .ch-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--glass-2); color: var(--mc, var(--accent-t)); border: 1px solid var(--stroke); }
.ch .ch-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 400; font-family: var(--f-body); }
.ch .ch-act { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.link { color: var(--accent-t); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link.ai { color: var(--t-info); }

/* KPI */
.kpis { display: grid; gap: var(--gap); grid-template-columns: repeat(var(--kn, 4), minmax(0, 1fr)); margin-bottom: var(--gap); }
.kpi { padding: 15px 16px 14px; overflow: hidden; display: flex; flex-direction: column; gap: 4px; min-height: 128px; }
.kpi .k-top { display: flex; align-items: center; gap: 8px; }
.kpi .k-label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.kpi .k-ic { margin-left: auto; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--glass-2); color: var(--kc, var(--accent-t)); border: 1px solid var(--stroke); }
.kpi .k-val { font: 800 clamp(26px, 2.2vw, 34px)/1.05 var(--f-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--kv, var(--text)); margin-top: 4px; }
.kpi .k-val small { font-size: .5em; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi .k-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: auto; min-height: 18px; }
.kpi .spark { position: absolute; right: 0; bottom: 0; width: 46%; height: 52px; opacity: .9; pointer-events: none; }
.delta { font: 600 11.5px/1 var(--f-mono); padding: 4px 6px; border-radius: 7px; display: inline-flex; align-items: center; gap: 3px; }
.delta.up-bad, .delta.down-bad { color: var(--t-crit); background: rgba(179, 38, 30, .12); }
.delta.up-good, .delta.down-good { color: var(--t-low); background: rgba(216, 70, 38, .12); }
.delta.flat { color: var(--muted); background: var(--glass-2); }

/* Severity + status pills */
.sev {
	display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px; border-radius: 8px;
	font: 600 11.5px/1 var(--f-body); white-space: nowrap; border: 1px solid transparent;
}
.sev::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.sev.critical { color: var(--t-crit); background: rgba(179, 38, 30, .13); border-color: rgba(179, 38, 30, .28); }
.sev.high { color: var(--t-high); background: rgba(224, 106, 44, .12); border-color: rgba(224, 106, 44, .26); }
.sev.medium { color: var(--t-med); background: rgba(240, 180, 48, .12); border-color: rgba(240, 180, 48, .26); }
.sev.low { color: var(--t-low); background: rgba(216, 70, 38, .12); border-color: rgba(216, 70, 38, .26); }
.sev.info { color: var(--t-info); background: rgba(216, 70, 38, .12); border-color: rgba(216, 70, 38, .26); }
.sev.none { color: var(--muted); background: var(--glass-2); }
.pill {
	display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-pill);
	font: 600 11.5px/1 var(--f-body); white-space: nowrap; color: var(--text-2); background: var(--glass-2); border: 1px solid var(--stroke);
}
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--t-low); border-color: rgba(216, 70, 38, .3); background: rgba(216, 70, 38, .1); }
.pill.warn { color: var(--t-med); border-color: rgba(240, 180, 48, .3); background: rgba(240, 180, 48, .1); }
.pill.bad { color: var(--t-crit); border-color: rgba(179, 38, 30, .3); background: rgba(179, 38, 30, .1); }
.pill.ai { color: var(--t-info); border-color: rgba(216, 70, 38, .35); background: rgba(216, 70, 38, .1); }
.pill.mono { font-family: var(--f-mono); font-weight: 500; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; font: 500 11.5px/1 var(--f-mono); color: var(--text-2); background: var(--glass-2); border: 1px solid var(--stroke); white-space: nowrap; }
.grade {
	width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
	font: 800 15px/1 var(--f-display); color: #fff; background: var(--gc, var(--sev-low));
	box-shadow: 0 8px 18px -8px var(--gc, var(--sev-low));
}
.grade.sm { width: 26px; height: 26px; font-size: 12.5px; border-radius: 8px; }
.grade.A { --gc: #27742E; color: var(--lime-ink); } .grade.B { --gc: #D84626; color: var(--lime-ink); } .grade.C { --gc: #F0B430; color: var(--lime-ink); } .grade.D { --gc: #C63C1E; } .grade.F { --gc: #A32019; }

/* Ribbon: the brand severity scale */
.ribbon { display: flex; height: 6px; border-radius: 6px; overflow: hidden; gap: 2px; }
.ribbon i { flex: 1; }
.ribbon i:nth-child(1) { background: #27742E; } .ribbon i:nth-child(2) { background: var(--lime); } .ribbon i:nth-child(3) { background: var(--amber); } .ribbon i:nth-child(4) { background: var(--orange); } .ribbon i:nth-child(5) { background: var(--red); }

/* Meter */
.meter { height: 8px; border-radius: 8px; background: var(--glass-3); overflow: hidden; position: relative; }
.meter > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--mcol, var(--accent)); width: var(--w, 0%); transition: width .9s var(--ease); }
.meter.thin { height: 5px; }
.meter-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 44px; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.meter-row .mr-v { text-align: right; font: 600 12.5px/1 var(--f-mono); color: var(--text-2); }

/* ---------- Tables ---------- */
.tbl-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.input {
	height: 40px; border-radius: 11px; padding: 0 12px; border: 1px solid var(--edge); background: var(--glass);
	font-size: 14px; outline: none; min-width: 0; transition: border-color .2s, background .2s;
}
.input:focus { border-color: var(--focus); background: var(--glass-2); }
.input.search { padding-left: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C8377' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 16px; background-position: 12px center; }
select.input { padding-right: 30px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C8377' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 15px; background-position: right 10px center; }
select.input option { background: var(--solid); color: var(--text); }
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; scrollbar-width: thin; }
.card.flush .tbl-wrap { margin: 0; padding: 0; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
	text-align: left; font: 600 11px/1.2 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
	padding: 10px 12px; border-bottom: 1px solid var(--stroke); white-space: nowrap; user-select: none;
	position: sticky; top: 0; background: transparent;
}
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text-2); }
.tbl th .sort-ic { display: inline-block; margin-left: 5px; opacity: .6; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--glass); }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.c, .tbl th.c { text-align: center; }
.tbl .t-main { font-weight: 600; color: var(--text); display: block; }
.tbl .t-sub { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }
.tbl .t-mono { font-family: var(--f-mono); font-size: 12.5px; }
.cell-ent { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-ent > div { min-width: 0; }
.tbl-foot { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 0 0; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; gap: 4px; }
.pager button { min-width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--stroke); background: var(--glass); font: 600 12.5px/1 var(--f-mono); color: var(--text-2); }
.pager button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pager button[disabled] { opacity: .4; cursor: default; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .ic { width: 34px; height: 34px; margin: 0 auto 10px; opacity: .6; }
.masked { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .02em; color: var(--text-2); }
.check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--edge); display: inline-grid; place-items: center; vertical-align: middle; }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Stack lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--stroke); min-width: 0; }
.rep-row .li-t { white-space: normal; }
.k-val.long { font-size: 21px; line-height: 1.15; letter-spacing: -.01em; }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; border-radius: 10px; margin: 0 -8px; padding: 11px 8px; }
.li.click:hover { background: var(--glass); }
.li .li-ic { width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--stroke); color: var(--lc, var(--text-2)); }
/* Tool colours used as text are eased toward the theme's text colour so they stay readable. */
[data-theme="dark"] .li .li-ic { color: color-mix(in srgb, var(--lc, var(--text-2)) 55%, #fff); }
[data-theme="light"] .li .li-ic { color: color-mix(in srgb, var(--lc, var(--text-2)) 70%, #191512); }
.li .li-main { flex: 1 1 auto; min-width: 0; }
.li .li-t { font-weight: 600; font-size: 13.8px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .li-s { font-size: 12.3px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .li-r { flex: none; display: flex; align-items: center; gap: 8px; }

/* Feed (threat stream) */
.feed-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--stroke); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .fi-meta { font: 500 11.5px/1.3 var(--f-mono); color: var(--faint); display: flex; gap: 8px; flex-wrap: wrap; }
.feed-item .fi-t { font-weight: 600; margin: 3px 0 6px; }
.feed-item .fi-q { font: 400 12.5px/1.55 var(--f-mono); color: var(--text-2); padding: 9px 11px; border-radius: 10px; background: rgba(0, 0, 0, .18); border: 1px solid var(--stroke); }
[data-theme="light"] .feed-item .fi-q { background: rgba(64, 48, 32, .04); }
.feed-item .fi-q mark { background: none; color: var(--t-crit); }
.feed-item .fi-time { font: 500 11.5px/1.3 var(--f-mono); color: var(--faint); text-align: right; white-space: nowrap; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .axis text, .chart text.ax { font: 500 10.5px/1 var(--f-mono); fill: var(--faint); }
.chart .gl { stroke: var(--grid-line); stroke-width: 1; }
.chart .gl-0 { stroke: var(--stroke-2); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--lc); }
.chart-legend b { color: var(--text); font-family: var(--f-mono); font-weight: 600; margin-left: 2px; }
.ctip {
	position: fixed; z-index: 120; pointer-events: none; min-width: 150px;
	padding: 10px 12px; border-radius: 12px; font-size: 12.5px;
	background: rgba(20, 16, 13, .94); color: #F7F3EC; border: 1px solid rgba(255, 236, 220, .22);
	box-shadow: var(--shadow-lg); backdrop-filter: blur(10px);
	opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
}
.ctip.on { opacity: 1; transform: none; }
.ctip .tt-h { font: 600 11px/1 var(--f-mono); color: #B3A89B; margin-bottom: 7px; letter-spacing: .04em; }
.ctip .tt-r { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.ctip .tt-r i { width: 8px; height: 8px; border-radius: 2px; }
.ctip .tt-r b { margin-left: auto; font-family: var(--f-mono); padding-left: 14px; }
.donut-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; }
.donut-center { font: 800 26px/1 var(--f-display); fill: var(--text); }
.donut-sub { font: 500 11px/1 var(--f-body); fill: var(--muted); }
.legend-list { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.legend-list .ll { display: flex; align-items: center; gap: 9px; font-size: 13px; min-width: 0; }
.legend-list .ll i { width: 10px; height: 10px; border-radius: 3px; background: var(--lc); flex: none; }
.legend-list .ll span { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.legend-list .ll b { font: 600 12.5px/1 var(--f-mono); }
.legend-list .ll em { font: 500 11.5px/1 var(--f-mono); color: var(--faint); font-style: normal; width: 38px; text-align: right; }
.heat { display: grid; gap: 4px; }
.heat .hc { border-radius: 8px; display: grid; place-items: center; font: 700 13px/1 var(--f-mono); min-height: 40px; color: #120E0B; transition: transform .15s; cursor: default; }
.heat .hc:hover { transform: scale(1.05); }
.heat .hl { font: 500 10.5px/1.2 var(--f-mono); color: var(--faint); display: flex; align-items: center; }
.heat .hl.x { justify-content: center; text-align: center; padding-top: 4px; }

/* Score ring */
.ring-score { position: relative; display: grid; place-items: center; }
.ring-score .rs-v { position: absolute; text-align: center; }
.ring-score .rs-v b { display: block; font: 800 30px/1 var(--f-display); letter-spacing: -.02em; }
.ring-score .rs-v span { font: 600 10.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---------- Overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 90; background: var(--scrim); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
	position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(640px, 100%);
	display: flex; flex-direction: column;
	background: var(--solid); border-left: 1px solid var(--stroke-2); box-shadow: var(--shadow-lg);
	transform: translateX(104%); transition: transform .38s var(--ease);
}
[data-theme="dark"] .drawer { background: linear-gradient(180deg, #17120F, #120E0B); }
.drawer.on { transform: none; }
.drawer.wide { width: min(860px, 100%); }
.dr-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--stroke); }
.dr-h h2 { font-size: 19px; font-weight: 800; }
.dr-h .dr-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.dr-b { flex: 1 1 auto; overflow-y: auto; padding: 18px 20px 28px; -webkit-overflow-scrolling: touch; }
.dr-f { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--stroke); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.grab { display: none; }
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.sect { margin-top: 20px; }
.sect > h4 { font: 600 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.callout { border-radius: var(--r-md); padding: 12px 14px; font-size: 13.3px; background: var(--glass-2); border: 1px solid var(--stroke); }
.callout.ai { background: rgba(216, 70, 38, .1); border-color: rgba(216, 70, 38, .3); }
.callout.warn { background: rgba(240, 180, 48, .1); border-color: rgba(240, 180, 48, .3); }
.callout.bad { background: rgba(179, 38, 30, .1); border-color: rgba(179, 38, 30, .3); }
.callout.ok { background: rgba(216, 70, 38, .1); border-color: rgba(216, 70, 38, .3); }
.callout b { color: var(--text); }
.steps { display: flex; flex-direction: column; gap: 0; counter-reset: st; }
.steps .st { position: relative; padding: 0 0 16px 38px; }
.steps .st::before { counter-increment: st; content: counter(st); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font: 700 12px/1 var(--f-mono); background: var(--glass-2); border: 1px solid var(--stroke-2); }
.steps .st.done::before { content: "✓"; background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.steps .st::after { content: ""; position: absolute; left: 12.5px; top: 28px; bottom: 2px; width: 1px; background: var(--stroke-2); }
.steps .st:last-child::after { display: none; }
.steps .st b { display: block; font-size: 13.8px; }
.steps .st span { font-size: 12.8px; color: var(--muted); }

.modal {
	position: fixed; z-index: 110; left: 50%; top: 50%; width: min(560px, calc(100% - 28px)); max-height: calc(100dvh - 40px);
	display: flex; flex-direction: column;
	transform: translate(-50%, -46%) scale(.98); opacity: 0; pointer-events: none;
	transition: transform .3s var(--ease), opacity .25s;
	border-radius: var(--r-xl); background: var(--solid); border: 1px solid var(--stroke-2); box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .modal { background: linear-gradient(180deg, #1E1814, #14100D); }
.modal.on { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
.modal.wide { width: min(820px, calc(100% - 28px)); }
.md-h { padding: 18px 20px 6px; display: flex; gap: 12px; align-items: flex-start; }
.md-h h2 { font-size: 18px; font-weight: 800; }
.md-h p { color: var(--muted); font-size: 13.3px; margin-top: 4px; }
.md-b { padding: 12px 20px; overflow-y: auto; }
.md-f { padding: 12px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label, .field .lbl { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.opt {
	display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border-radius: 12px; text-align: left;
	border: 1px solid var(--stroke-2); background: var(--glass); transition: border-color .2s, background .2s;
}
.opt:hover { background: var(--glass-2); }
.opt.on { border-color: var(--accent); background: rgba(216, 70, 38, .1); }
.opt b { font-size: 13.3px; display: block; }
.opt span { font-size: 12px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; flex: none; border-radius: 24px; background: var(--glass-3); border: 1px solid var(--edge); transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-2); transition: transform .25s var(--ease), background .2s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { transform: translateX(18px); background: var(--accent-ink); }
.switch[disabled] { opacity: .45; cursor: not-allowed; }

/* Toasts */
.toasts { position: fixed; z-index: 130; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
	pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; max-width: 420px;
	padding: 12px 14px; border-radius: 14px; font-size: 13.3px;
	background: rgba(23, 18, 15, .96); color: #F7F3EC; border: 1px solid rgba(255, 236, 220, .2); box-shadow: var(--shadow-lg);
	backdrop-filter: blur(12px);
}
.toast .ic { color: var(--lime-2); margin-top: 1px; }
.toast.warn .ic { color: var(--amber); }
.toast.bad .ic { color: #F28B82; }
.toast.ai .ic { color: var(--sky); }
.toast b { display: block; margin-bottom: 2px; }

/* Popover menu */
.menu {
	position: fixed; z-index: 115; min-width: 220px; padding: 6px; border-radius: 14px;
	background: var(--solid); border: 1px solid var(--stroke-2); box-shadow: var(--shadow-lg);
	opacity: 0; transform: translateY(-4px) scale(.98); pointer-events: none; transition: opacity .16s, transform .16s;
}
[data-theme="dark"] .menu { background: #17120F; }
.menu.on { opacity: 1; transform: none; pointer-events: auto; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; font-size: 13.3px; text-align: left; color: var(--text-2); }
.menu button:hover, .menu a:hover { background: var(--glass-2); color: var(--text); }
.menu .m-sep { height: 1px; background: var(--stroke); margin: 5px 4px; }
.menu .m-cap { font: 600 10.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 9px 10px 5px; }
.menu .m-sub { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.menu button.on { color: var(--text); }
.menu button.on::after { content: "✓"; margin-left: auto; color: var(--accent-t); font-weight: 700; }

/* Command palette */
.cmdk { position: fixed; z-index: 125; left: 50%; top: 12vh; width: min(640px, calc(100% - 24px)); transform: translateX(-50%) scale(.98); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); border-radius: 18px; background: var(--solid); border: 1px solid var(--stroke-2); box-shadow: var(--shadow-lg); overflow: hidden; }
[data-theme="dark"] .cmdk { background: #17120F; }
.cmdk.on { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.cmdk input { width: 100%; height: 56px; padding: 0 18px 0 48px; border: 0; border-bottom: 1px solid var(--stroke); background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C8377' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 18px center / 18px; font-size: 16px; outline: none; }
.cmdk .ck-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmdk .ck-cap { font: 600 10.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 6px; }
.cmdk .ck-i { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; text-align: left; font-size: 13.8px; }
.cmdk .ck-i.on, .cmdk .ck-i:hover { background: var(--glass-2); }
.cmdk .ck-i .ck-s { margin-left: auto; font-size: 12px; color: var(--faint); }

/* ---------- Copilot ---------- */
.copilot {
	position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 34vw); z-index: 40;
	display: flex; flex-direction: column;
	border-left: 1px solid rgba(216, 70, 38, .25);
	background: linear-gradient(180deg, rgba(23, 18, 15, .86), rgba(14, 10, 8, .9));
	backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
	transform: translateX(102%); transition: transform .38s var(--ease);
}
[data-theme="light"] .copilot { background: rgba(255, 255, 255, .88); }
.copilot.on { transform: none; }
.cp-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--stroke); }
.cp-orb { width: 34px; height: 34px; border-radius: 11px; flex: none; position: relative; background: conic-gradient(from 180deg, #D84626, #D84626, #3C3630, #D84626); animation: spin 8s linear infinite; }
.cp-orb::after { content: ""; position: absolute; inset: 3px; border-radius: 9px; background: #17120F; }
[data-theme="light"] .cp-orb::after { background: #fff; }
.cp-orb::before { content: ""; position: absolute; inset: 10px; z-index: 1; border-radius: 50%; background: radial-gradient(circle, #F6C9B8, #D84626); box-shadow: 0 0 12px #D84626; }
@keyframes spin { to { transform: rotate(360deg); } }
.cp-h b { font-family: var(--f-display); font-size: 15px; display: block; }
.cp-h span { font-size: 11.8px; color: var(--muted); }
.cp-b { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 11px 13px; border-radius: 14px; font-size: 13.3px; line-height: 1.55; }
.msg.me { align-self: flex-end; background: rgba(216, 70, 38, .16); border: 1px solid rgba(216, 70, 38, .3); border-bottom-right-radius: 5px; }
.msg.ai { align-self: flex-start; background: var(--glass-2); border: 1px solid var(--stroke); border-bottom-left-radius: 5px; }
.msg.ai .who { font: 600 10.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--t-info); margin-bottom: 6px; display: block; }
.msg ul { margin: 6px 0 0; padding-left: 18px; }
.msg li { margin: 3px 0; }
.msg .cite { display: inline-flex; align-items: center; gap: 4px; font: 600 11px/1 var(--f-mono); color: var(--t-info); padding: 3px 6px; border-radius: 6px; background: rgba(216, 70, 38, .12); margin: 6px 4px 0 0; }
.msg .cite:hover { background: rgba(216, 70, 38, .22); }
.msg .note { font-size: 11.5px; color: var(--faint); margin-top: 8px; display: block; }
.typing i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--sky); margin-right: 4px; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.cp-sug { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.cp-sug button { font-size: 12.3px; padding: 7px 10px; border-radius: 10px; border: 1px solid rgba(216, 70, 38, .3); color: var(--t-info); background: rgba(216, 70, 38, .07); text-align: left; }
.cp-sug button:hover { background: rgba(216, 70, 38, .16); }
.cp-f { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--stroke); display: flex; gap: 8px; }
.cp-f input { flex: 1; height: 44px; border-radius: 12px; border: 1px solid var(--edge); background: var(--glass); padding: 0 12px; outline: none; font-size: 16px; }
.cp-f input:focus { border-color: var(--sky); }

/* ---------- Locked module ---------- */
.locked-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: clamp(18px, 3vw, 36px); overflow: hidden; }
.locked-hero h2 { font-size: clamp(24px, 2.4vw, 34px); font-weight: 800; margin: 10px 0 10px; }
.locked-hero ul { padding: 0; margin: 14px 0 18px; list-style: none; display: grid; gap: 8px; }
.locked-hero li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); }
.locked-hero li .ic { color: var(--accent-t); margin-top: 2px; }
.preview-blur { filter: blur(3px) saturate(.9); opacity: .65; pointer-events: none; user-select: none; }
.price-tag { font: 800 30px/1 var(--f-display); }
.price-tag small { font: 500 13px/1 var(--f-body); color: var(--muted); margin-left: 4px; }

/* Module hero banner */
.mod-hero { display: flex; align-items: center; gap: 14px; }
.mod-ic { width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--mc, var(--lime)), color-mix(in srgb, var(--mc, var(--lime)) 55%, #191512)); box-shadow: 0 12px 26px -12px var(--mc, var(--lime)); }
.mod-ic .ic { width: 22px; height: 22px; }

/* Module tiles (home) */
.mtile { display: flex; flex-direction: column; gap: 10px; padding: 16px; cursor: pointer; min-height: 168px; }
.mtile .mt-top { display: flex; align-items: center; gap: 10px; }
.mtile .mt-top b { font-family: var(--f-display); font-size: 15px; display: block; }
.mtile .mt-top span { font-size: 12px; color: var(--muted); }
.mtile .mt-stat { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.mtile .mt-stat b { font: 800 26px/1 var(--f-display); }
.mtile .mt-stat span { font-size: 12.3px; color: var(--muted); }
.mtile.locked { opacity: .78; }
.mtile.locked .mt-stat { color: var(--muted); }

/* Command Centre hero */
.hero-grid { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 22px; align-items: center; }
.ds-short { display: none; }

/* Radar canvas */
.radar-box { position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 300px; margin: 0 auto; }
.radar-box canvas { width: 100%; height: 100%; }
.radar-box .rb-v { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.radar-box .rb-v b { font: 800 44px/1 var(--f-display); display: block; letter-spacing: -.02em; }
.radar-box .rb-v span { font: 600 10.5px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* Timeline */
.tl { position: relative; }
.tl-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 14px; position: relative; padding-bottom: 14px; }
.tl-row::before { content: ""; position: absolute; left: 117px; top: 22px; bottom: -2px; width: 1px; background: var(--stroke-2); }
.tl-row:last-child::before { display: none; }
.tl-time { font: 500 11.5px/1.3 var(--f-mono); color: var(--faint); text-align: right; padding-top: 3px; }
.tl-card { position: relative; padding: 10px 12px; border-radius: 12px; background: var(--glass); border: 1px solid var(--stroke); margin-left: 12px; }
.tl-card::before { content: ""; position: absolute; left: -19px; top: 9px; width: 11px; height: 11px; border-radius: 50%; background: var(--tc, var(--sky)); box-shadow: 0 0 0 4px var(--bg); }
.tl-card b { font-size: 13.5px; }
.tl-card p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tl-card .tl-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }

/* Matrix (roles x permissions) */
.matrix { font-size: 13px; }
.matrix th { position: sticky; top: 0; z-index: 1; background: var(--solid); }
.matrix th.rot { font-size: 10.5px; }
.matrix td.mx { text-align: center; }
.matrix tr.grp td { font: 600 11px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); background: var(--glass); padding: 9px 12px; }
.pm { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; border: 1px solid var(--stroke-2); color: var(--faint); transition: background .15s, color .15s, border-color .15s; }
.pm.on { background: rgba(216, 70, 38, .18); color: var(--accent-t); border-color: rgba(216, 70, 38, .5); }
.pm[disabled] { cursor: not-allowed; opacity: .55; }

/* Questionnaire */
.qn { display: flex; flex-direction: column; gap: 12px; }
.q { padding: 14px; border-radius: 14px; border: 1px solid var(--stroke); background: var(--glass); }
.q .q-h { display: flex; gap: 10px; align-items: flex-start; }
.q .q-n { font: 600 11.5px/1 var(--f-mono); color: var(--faint); padding-top: 3px; flex: none; }
.q .q-t { font-weight: 600; flex: 1; }
.q .q-a { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.q .q-a button { height: 32px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--edge); font-size: 13px; font-weight: 600; }
.q .q-a button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.q .q-a button.on.no { background: var(--sev-crit); color: #fff; border-color: var(--sev-crit); }
.q .guide { margin-top: 10px; font-size: 12.5px; padding: 10px 12px; border-radius: 10px; background: rgba(216, 70, 38, .1); border: 1px solid rgba(216, 70, 38, .28); color: var(--text-2); }
.q .guide b { color: var(--t-info); }

/* Report builder */
.rep-card { display: flex; flex-direction: column; gap: 10px; }
.rep-card .rc-top { display: flex; gap: 12px; align-items: flex-start; }
.rep-card .rc-top b { font-family: var(--f-display); font-size: 14.5px; display: block; }
.rep-card .rc-top span { font-size: 12.5px; color: var(--muted); }
.rep-card .rc-act { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }
.fmt-ic { width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center; font: 800 10.5px/1 var(--f-mono); color: #fff; letter-spacing: .04em; }
.fmt-ic.pdf { background: linear-gradient(135deg, #E06A2C, #A32019); }
.fmt-ic.xls { background: linear-gradient(135deg, #2E9A57, #27742E); }
.fmt-ic.mix { background: linear-gradient(135deg, var(--sky), var(--navy-2)); }
.progress-ov { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; background: var(--scrim); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.progress-ov.on { opacity: 1; pointer-events: auto; }
.progress-ov .po-card { width: min(380px, calc(100% - 32px)); padding: 22px; border-radius: 20px; background: var(--solid); border: 1px solid var(--stroke-2); box-shadow: var(--shadow-lg); text-align: center; }
[data-theme="dark"] .progress-ov .po-card { background: #17120F; }
.progress-ov .po-card b { font-family: var(--f-display); font-size: 16px; display: block; margin: 12px 0 4px; }
.progress-ov .po-card span { font-size: 13px; color: var(--muted); }
.progress-ov .meter { margin-top: 14px; }

/* Bottom tab bar (phone + small tablet) */
.tabbar { display: none; }
.sheet-menu { display: none; }

/* Skeleton shimmer for loading states */
.sk { background: linear-gradient(90deg, var(--glass) 0%, var(--glass-3) 50%, var(--glass) 100%); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* Reveal fallback: if motion never runs, content is still visible */
[data-reveal] { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1500px) {
	.g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1320px) {
	.app.copilot-open .main-wrap { padding-right: 0; }
	.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.g-main, .g-main-r { grid-template-columns: minmax(0, 1fr); }
	.kpis { grid-template-columns: repeat(min(var(--kn, 4), 4), minmax(0, 1fr)); }
	.search-btn { min-width: 200px; }
	.user-btn .u-meta { display: none; }
}
@media (max-width: 1100px) {
	.app, .app.side-min { grid-template-columns: var(--side-w-min) minmax(0, 1fr); }
	.app .brand img.logo-full { display: none !important; }
	.app .brand img.logo-mark { display: block; margin: 0 auto; }
	.app .brand .portal-tag, .app .plan-card, .app .tenant-pill .t-meta, .app .tenant-pill .ic-chev, .app .collapse-btn { display: none; }
	.app .tenant-pill { justify-content: center; padding: 8px; }
	.app .nav a { justify-content: center; padding: 8px 0; }
	.app .nav a .n-label, .app .nav a .lock, .app .nav a .n-badge { display: none; }
	.app .nav-cap { text-align: center; padding: 12px 0 6px; font-size: 0; }
	.app .nav-cap::after { content: ""; display: block; width: 18px; height: 1px; background: var(--stroke-2); margin: 0 auto; }
	.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.copilot { width: min(420px, 100%); }
	.locked-hero { grid-template-columns: 1fr; }
}

/* Tablet portrait and phones: app chrome */
@media (max-width: 899px) {
	:root { --top-h: 60px; }
	.app, .app.side-min { grid-template-columns: minmax(0, 1fr); }
	.side { display: none; }
	.top { padding: 0 14px; padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); }
	.top .m-brand { display: flex; align-items: center; gap: 8px; min-height: 44px; }
	.top .m-brand img { height: 30px; width: auto; }
	.crumbs { display: none; }
	.search-btn { min-width: 0; width: 40px; padding: 0; justify-content: center; margin-left: auto; }
	.search-btn span, .search-btn .kbd { display: none; }
	.user-btn { padding: 0; }
	.view { padding: 14px 14px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); }
	.tabbar {
		display: grid; grid-template-columns: repeat(5, 1fr);
		position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 50;
		height: var(--tab-h); padding: 6px; border-radius: 22px;
		background: rgba(23, 18, 15, .78); border: 1px solid var(--stroke-2);
		backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
		box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .7);
		transition: transform .3s var(--ease);
	}
	[data-theme="light"] .tabbar { background: rgba(255, 255, 255, .86); }
	.tabbar.hide { transform: translateY(140%); }
	.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 16px; font-size: 11px; font-weight: 600; color: var(--muted); position: relative; }
	.tabbar a.on, .tabbar button.on { color: var(--text); }
	.tabbar a.on .ic, .tabbar button.on .ic { color: var(--accent-t); }
	.tabbar .tb-dot { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; font: 700 10px/16px var(--f-mono); color: #fff; background: var(--sev-crit); padding: 0 4px; }
	.tabbar .tb-main .tb-c { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px -8px rgba(216, 70, 38, .9); margin-top: -18px; }
	.tabbar .tb-main .tb-c .ic { color: var(--accent-ink) !important; }
	.toasts { left: 12px; right: 12px; bottom: calc(var(--tab-h) + 22px + env(safe-area-inset-bottom)); align-items: stretch; }
	.toast { max-width: none; }
	.drawer, .drawer.wide { top: auto; left: 0; right: 0; width: 100%; height: 92dvh; border-radius: 24px 24px 0 0; border-left: 0; border-top: 1px solid var(--stroke-2); transform: translateY(104%); }
	.drawer.on { transform: none; }
	.grab { display: block; width: 44px; height: 5px; border-radius: 5px; background: var(--stroke-2); margin: 8px auto 0; flex: none; }
	.dr-h { padding-top: 10px; }
	.modal { top: auto; bottom: 0; left: 0; width: 100%; max-height: 90dvh; border-radius: 24px 24px 0 0; transform: translateY(100%); }
	.modal.wide { width: 100%; }
	.modal.on { transform: none; }
	.md-f { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
	.copilot { width: 100%; border-left: 0; z-index: 95; }
	.cmdk { top: 10px; }
	.sheet-menu {
		display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
		max-height: 86dvh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 0 14px calc(20px + env(safe-area-inset-bottom));
		background: var(--solid); border-top: 1px solid var(--stroke-2); box-shadow: var(--shadow-lg);
		transform: translateY(104%); transition: transform .38s var(--ease);
	}
	[data-theme="dark"] .sheet-menu { background: linear-gradient(180deg, #17120F, #120E0B); }
	.sheet-menu.on { transform: none; }
	.sheet-menu .sm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
	.sheet-menu .sm-t { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 16px; background: var(--glass); border: 1px solid var(--stroke); text-align: center; font-size: 12px; font-weight: 600; position: relative; }
	.sheet-menu .sm-t.locked { opacity: .6; }
	.sheet-menu .sm-t .mod-ic { width: 42px; height: 42px; border-radius: 13px; }
	.sheet-menu .sm-t .lk { position: absolute; top: 8px; right: 8px; color: var(--faint); }
	.sheet-menu h4 { font: 600 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 18px 2px 10px; }
	.sheet-menu .sm-row { display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--stroke); margin-bottom: 8px; font-weight: 600; font-size: 14px; width: 100%; text-align: left; }
	.ph h1, .ph h2.as-h1 { font-size: 25px; }
	.ph .ph-actions { width: 100%; }
	.ph .ph-actions .btn { flex: 1 1 auto; }
	.tbl-wrap { margin: 0 -16px; padding: 0 16px; }
}

@media (max-width: 720px) {
	/* Card headers with several buttons wrap the buttons under the title. */
	.ch { flex-wrap: wrap; }
	.ch h3 { flex: 1 1 180px; }
	.ch .ch-act { flex: 0 1 auto; flex-wrap: wrap; max-width: 100%; margin-left: 0; }
	/* Long costs in board lists wrap instead of pushing the row wider than the screen. */
	.li .li-r > b.mono, .li .li-r > .mono { white-space: normal; text-align: right; max-width: 38vw; overflow-wrap: anywhere; }
	.rep-row { flex-wrap: wrap; row-gap: 8px; }
	.rep-row .li-main { flex: 1 1 100%; }
	.rep-row .li-r { width: 100%; justify-content: flex-start; }
	.tag[data-act] { min-height: 28px; }
	input[type="checkbox"], input[type="radio"] { min-width: 22px; min-height: 22px; }
	:root { --gap: 12px; }
	.hero-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
	.hero-grid .radar-box { max-width: 230px; }
	.demo-strip { justify-content: flex-start; flex-wrap: nowrap; padding: 6px 14px; font-size: 12px; gap: 8px; }
	.demo-strip .ds-long { display: none; }
	.demo-strip .ds-short { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
	.demo-strip > .ic { display: none; }
	.demo-strip button { white-space: nowrap; min-height: 30px; }
	.demo-strip button.hide-sm { display: none; }
	.link, a.tag, button.tag { min-height: 26px; }
	.btn.xs { height: 32px; padding: 0 11px; }
	.pager button { min-width: 34px; min-height: 34px; }
	.g2, .g3, .g4, .g5 { grid-template-columns: minmax(0, 1fr); }
	.span2, .span3 { grid-column: auto; }
	/* KPI rows become swipe rows */
	.kpis { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -14px var(--gap); padding: 2px 14px 6px; scrollbar-width: none; }
	.kpis::-webkit-scrollbar { display: none; }
	.kpis > .kpi { flex: 0 0 72%; scroll-snap-align: start; min-height: 118px; }
	.swipe { display: flex !important; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -14px; padding: 2px 14px 6px; scrollbar-width: none; }
	.swipe::-webkit-scrollbar { display: none; }
	.swipe > * { flex: 0 0 78%; scroll-snap-align: start; }
	.card { padding: 14px; border-radius: 16px; }
	.kv { grid-template-columns: 1fr; gap: 2px; }
	.kv dd { margin-bottom: 8px; }
	.fields-2 { grid-template-columns: 1fr; }
	.donut-wrap { grid-template-columns: 1fr; justify-items: center; }
	.donut-wrap .legend-list { width: 100%; }
	.meter-row { grid-template-columns: minmax(0, 1fr) 80px 40px; }
	.tl-row { grid-template-columns: 78px minmax(0, 1fr); gap: 10px; }
	.tl-row::before { left: 85px; }
	/* Tables collapse to cards */
	.tbl.stack thead { display: none; }
	.tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
	.tbl.stack tr { padding: 12px 0; border-bottom: 1px solid var(--stroke); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
	.tbl.stack td { border: 0; padding: 0; }
	.tbl.stack td.c-main { grid-column: 1 / -1; }
	.tbl.stack td.c-hide { display: none; }
	.tbl.stack td[data-l]::before { content: attr(data-l); display: block; font: 600 10px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
	.tbl.stack td.r { text-align: left; }
	.feed-item { grid-template-columns: 32px minmax(0, 1fr); }
	.feed-item .fi-time { grid-column: 2; text-align: left; }
	.heat .hc { min-height: 34px; font-size: 12px; }
	.search-btn { width: 40px; }
	.icon-btn.hide-sm { display: none; }
}

/* Touch-target tiers: compact by default, AAA on narrow coarse screens */
@media (pointer: coarse) and (max-width: 899px) {
	.btn { height: 44px; }
	.btn.sm { height: 40px; }
	.icon-btn { width: 44px; height: 44px; }
	.seg button { height: 38px; }
	.tabs button { padding: 13px 14px; }
	.pager button { min-width: 40px; height: 40px; }
	.input { height: 44px; font-size: 16px; }
}
@media (pointer: coarse) and (min-width: 900px) {
	.btn.xs { height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Print: a clean page if someone prints the browser view */
@media print {
	.side, .top, .tabbar, .copilot, .demo-strip, .ph-actions, .toasts { display: none !important; }
	.app { display: block; }
	.card { box-shadow: none; backdrop-filter: none; }
}
