/* element.hidden is only honored through the UA stylesheet; any author
   `display` rule beats it. This restores the contract globally — scoped
   per-component rules are how a "hidden" menu rendered expanded on
   every card. It must sit before the first conditional block (the light
   theme below): dark is the base palette, so a scheme-scoped rule never
   reaches the default user. */
[hidden] {
	display: none !important;
}

/* #4588 (ui-standards Row E) — three first-class modes: system / light / dark.
   Base is DARK. The same selector list gives :root[data-theme='dark'] the dark
   values at higher specificity than the light media query, so an explicit dark
   choice wins over the OS. color-scheme moved here from body so the explicit
   blocks below can force it per mode. */
:root,
:root[data-theme='dark'] {
	color-scheme: dark;
	--ankh-bg: rgb(15, 20, 32);
	--ankh-card: rgb(26, 34, 51);
	--ankh-card-2: rgb(32, 48, 64);
	--ankh-card-3: rgb(96, 128, 144);
	--ankh-text: rgb(238, 242, 249);
	--ankh-muted: rgb(139, 150, 171);
	--ankh-green: rgb(52, 211, 153);
	--ankh-red: rgb(248, 113, 113);
	--ankh-amber: rgb(251, 191, 36);
	--ankh-gray: var(--ankh-card-3);
	--ankh-accent: rgb(96, 165, 250);
	--ankh-radius: 16px;
	--space-1: 4px;
	--space-2: 8px;
	--space-3: 14px;
	--space-4: 18px;
	--space-5: 24px;
	/* Tokenised for light theme */
	--ankh-border: 1px solid rgba(255, 255, 255, 0.1);
	--ankh-border-2: 1px solid rgba(255, 255, 255, 0.12);
	--ankh-shadow: rgba(32, 48, 64, 0.65);
	--ankh-overlay: rgba(20, 27, 42, 0.95);
	--ankh-bg-2: #0d1320;
	--ankh-muted-2: #94a3b8;
	--ankh-muted-3: #b48a8a;
	--ankh-muted-4: #bcd7fb;
	--ankh-muted-5: #8b96ab;
	--ankh-muted-6: #e8edf7;
	--ankh-muted-7: #c7d0e0;
	--ankh-muted-8: #9db6ee;
	--ankh-muted-9: #7fd39a;
	--ankh-muted-10: #5dbb7a;
	--ankh-muted-11: #e06c6c;
	--ankh-green-bg: rgba(52, 211, 153, 0.12);
	--ankh-red-bg: rgba(248, 113, 113, 0.12);
	--ankh-amber-bg: rgba(251, 191, 36, 0.12);
	--ankh-gray-bg: rgba(100, 116, 139, 0.15);
	--ankh-accent-bg: rgba(96, 165, 250, 0.1);
	--ankh-accent-border: rgba(96, 165, 250, 0.25);
	--ankh-red-bg-2: rgba(248, 113, 113, 0.1);
	--ankh-amber-bg-2: rgba(251, 191, 36, 0.14);
	--ankh-amber-border: 1px solid rgba(251, 191, 36, 0.45);
	--ankh-amber-bg-3: rgba(251, 191, 36, 0.08);
	--ankh-red-bg-3: rgba(248, 113, 113, 0.16);
	--ankh-red-border: 1px solid rgba(248, 113, 113, 0.5);
	--ankh-green-bg-2: rgba(93, 187, 122, 0.16);
	--ankh-green-border: rgba(93, 187, 122, 0.5);
	--ankh-red-bg-4: rgba(224, 108, 108, 0.12);
	--ankh-red-border-2: rgba(224, 108, 108, 0.45);
	--ankh-green-border-2: rgba(93, 187, 122, 0.7);
	--ankh-amber-bg-4: rgba(224, 164, 88, 0.1);
	--ankh-amber-border-2: 1px solid rgba(224, 164, 88, 0.45);
	--ankh-accent-bg-2: rgba(91, 141, 239, 0.16);
	--ankh-accent-border-2: rgba(91, 141, 239, 0.5);
	--ankh-accent-bg-3: var(--ankh-accent-border);
	--ankh-border-3: 1px solid rgba(96, 165, 250, 0.35);
	--ankh-border-4: 1px solid rgba(91, 141, 239, 0.55);
	--ankh-border-5: rgba(255, 255, 255, 0.05);
	--ankh-border-6: 1px solid rgba(255, 255, 255, 0.06);
	--ankh-border-7: 1px solid rgba(255, 255, 255, 0.08);
	--ankh-border-8: rgba(255, 255, 255, 0.03);
	--ankh-border-9: rgba(255, 255, 255, 0.14);
	--ankh-shadow-2: 0 4px 16px rgba(0, 0, 0, 0.25);
	--ankh-shadow-3: 0 6px 20px rgba(0, 0, 0, 0.4);
	--ankh-yellow-border: 1px solid rgba(255, 176, 32, 0.45);
	--ankh-yellow-bg: rgba(255, 176, 32, 0.08);
	--ankh-accent-stroke: rgba(91, 141, 239, 0.85);
	--ankh-green-stroke: var(--ankh-green-border-2);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	-webkit-tap-highlight-color: transparent;
}

html,
body {
	min-height: 100%;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	background: var(--ankh-bg);
	color: var(--ankh-text);
	overflow-x: hidden;
}

header {
	position: sticky;
	top: 0;
	z-index: 10;
	padding: calc(var(--space-4) + env(safe-area-inset-top)) 20px 10px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background-color: var(--ankh-card-2);
	backdrop-filter: blur(14px);
	border-bottom: solid 1px var(--ankh-card-3);
	border-bottom-left-radius: var(--ankh-radius);
	border-bottom-right-radius: var(--ankh-radius);
	box-shadow: var(--ankh-shadow) 0px 6px 18px 0px;
}

header h1 {
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -0.3px;
}

.policy-chip {
	font-size: 12px;
	color: var(--ankh-muted);
	background: var(--ankh-card);
	border-radius: 999px;
	padding: 6px 12px;
}
.policy-chip.blocking {
	color: var(--ankh-amber);
}
main {
	padding: 10px 16px var(--space-5);
	max-width: 560px;
	margin: 0 auto;
}

/* ankh-group-card */
[is='ankh-group-card'] {
	background: var(--ankh-card);
	border-radius: var(--ankh-radius);
	padding: var(--space-4);
	margin-bottom: var(--space-3);
	box-shadow: 0 4px 16px var(--ankh-shadow-2);
	opacity: 1;
	transition: opacity 300ms;
}

[is='ankh-group-card'] .card-head {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

[is='ankh-group-card'] .group-detail {
	margin-top: var(--space-3);
	padding-top: var(--space-3);
	border-top: 1px solid var(--ankh-card-2);
}

[is='ankh-group-card'] .detail-row {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-2) 0;
}

[is='ankh-group-card'] .detail-row .dname {
	flex: 1;
	min-width: 0;
	font-size: 15px;
}
[is='ankh-group-card'] .add-row {
	display: flex;
	gap: var(--space-2);
	margin-top: var(--space-2);
}
[is='ankh-group-card'] .add-row select {
	flex: 1;
	min-width: 0;
}
@starting-style {
	[is='ankh-group-card'] {
		opacity: 0;
	}
}
[is='ankh-group-card'] .info {
	flex: 1;
	min-width: 0;
}
[is='ankh-group-card'] .name {
	font-size: 18px;
	font-weight: 650;
	margin-bottom: 3px;
}
[is='ankh-group-card'] .meta {
	font-size: 13px;
	color: var(--ankh-muted);
}
[is='ankh-group-card'] .toggle {
	border: none;
	border-radius: 14px;
	padding: var(--space-3) 20px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	min-width: 108px;
	min-height: 52px;
	transition:
		transform 80ms ease,
		opacity 200ms;
	color: #06281a;
	background: var(--ankh-green);
}
[is='ankh-group-card'] .toggle.paused {
	background: var(--ankh-red);
	color: #310b0b;
}
/* #4231: the members disagree, and that was invisible — the button kept the
   active green while some devices were paused. Amber is the "some, not all"
   point on the green→amber→red ordering already used by the unenforced chip.
   The dark text stays readable on the fixed amber token in both themes. */
[is='ankh-group-card'] .toggle.mixed {
	background: var(--ankh-amber);
	color: #2b2300;
}
/* The amber token darkens under the light theme; dark text that reads on
   the dark-theme amber fails there, so the light theme re-pairs the token. */
@media (prefers-color-scheme: light) {
	[is='ankh-group-card'] .toggle.mixed {
		color: #fff8e7;
	}
}
/* #4588 — explicit light must match the OS-light rule above (keep in lockstep). */
:root[data-theme='light'] [is='ankh-group-card'] .toggle.mixed {
	color: #fff8e7;
}
[is='ankh-group-card'] .toggle:active {
	transform: scale(0.96);
}
[is='ankh-group-card'] .toggle:disabled {
	opacity: 0.5;
}
[is='ankh-group-card'] .toggle:focus-visible {
	box-shadow: 0 0 0 3px var(--ankh-accent);
	transition: box-shadow 200ms;
	outline: none;
}

/* Home restructure: counts strip + pseudo-group cards */
.counts-strip {
	display: flex;
	gap: var(--space-2);
	margin-bottom: var(--space-3);
}
.count-box {
	flex: 1;
	background: var(--ankh-card);
	border-radius: var(--ankh-radius);
	padding: var(--space-3) 16px;
}
.count-label {
	font-size: 12px;
	color: var(--ankh-muted);
}
.count-value {
	font-size: 22px;
	font-weight: 700;
	margin-top: 2px;
}
.pseudo-card {
	background: var(--ankh-card);
	border-radius: var(--ankh-radius);
	padding: var(--space-4);
	margin-bottom: var(--space-3);
	box-shadow: 0 4px 16px var(--ankh-shadow-2);
}
.pseudo-card .card-head {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}
.pseudo-card .info {
	flex: 1;
	min-width: 0;
}
.pseudo-card .name {
	font-size: 18px;
	font-weight: 650;
	margin-bottom: 3px;
}
.pseudo-card .meta {
	font-size: 13px;
	color: var(--ankh-muted);
}
.pseudo-card .group-detail {
	margin-top: var(--space-3);
	padding-top: var(--space-3);
	border-top: 1px solid var(--ankh-card-2);
}

/* Schedules in the group card */
.sched-title {
	font-size: 13px;
	font-weight: 700;
	color: var(--ankh-muted);
	text-transform: uppercase;
	letter-spacing: 0.4px;
	margin-top: var(--space-3);
	padding-top: var(--space-3);
	border-top: 1px solid var(--ankh-card-2);
}
.sched-row {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-2) 0;
}
.sched-row.sched-off .sched-info {
	opacity: 0.55;
}
.sched-info {
	flex: 1;
	min-width: 0;
}
.sched-name {
	font-size: 14.5px;
	font-weight: 600;
}
.sched-meta {
	font-size: 12px;
	color: var(--ankh-muted);
	margin-top: 1px;
}
.sched-add {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	margin-top: var(--space-2);
}
.sched-add input {
	width: 100%;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid var(--ankh-border);
	background: var(--ankh-card-2);
	color: var(--ankh-text);
	font-size: 14px;
}
.day-chips {
	display: flex;
	gap: 5px;
}
.day-chip {
	flex: 1;
	border: 1px solid var(--ankh-border-2);
	background: none;
	color: var(--ankh-muted);
	border-radius: 9px;
	padding: 8px 0;
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
}
.day-chip.active {
	background: var(--ankh-accent);
	color: #08213f;
	border-color: var(--ankh-accent);
}
.sched-times {
	display: flex;
	align-items: center;
	gap: var(--space-2);
}
.sched-times input {
	flex: 1;
	min-width: 0;
}
.sched-times span {
	color: var(--ankh-muted);
}

.sched-strip {
	position: relative;
	height: 26px;
	border-radius: 8px;
	background: var(--ankh-card-2);
	border: 1px solid var(--ankh-border);
	overflow: hidden;
	margin-top: 2px;
}
.sched-seg {
	position: absolute;
	top: 0;
	bottom: 0;
	background: var(--ankh-accent);
	opacity: 0.75;
}
.sched-tick {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 1px;
	background: var(--ankh-border-2);
	opacity: 0.8;
}
.sched-strip-label {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	color: var(--ankh-muted);
}

.search-input {
	width: 100%;
	padding: 12px 14px;
	border-radius: var(--ankh-radius);
	border: 1px solid var(--ankh-border);
	background: var(--ankh-card);
	color: var(--ankh-text);
	font-size: 15px;
	margin-bottom: var(--space-3);
}
.search-input::placeholder {
	color: var(--ankh-muted);
}
.search-wrap {
	position: relative;
}
/* Safari draws its own clear glyph on desktop; we supply one everywhere. */
.search-input::-webkit-search-cancel-button {
	display: none;
}
.search-clear {
	position: absolute;
	right: 6px;
	top: 0;
	height: 45px;
	width: 38px;
	border: 0;
	background: none;
	color: var(--ankh-muted);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}
.search-clear:hover {
	color: var(--ankh-text);
}

[is='ankh-state-chip'] {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	font-weight: 600;
	border-radius: 999px;
	padding: var(--space-1) 10px;
}
[is='ankh-state-chip'] .dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
}
[is='ankh-state-chip'].online {
	background: var(--ankh-green-bg);
	color: var(--ankh-green);
}
[is='ankh-state-chip'].online .dot {
	background: var(--ankh-green);
}
[is='ankh-state-chip'].blocked {
	background: var(--ankh-red-bg);
	color: var(--ankh-red);
}
[is='ankh-state-chip'].blocked .dot {
	background: var(--ankh-red);
}
[is='ankh-state-chip'].offline {
	background: var(--ankh-gray-bg);
	color: var(--ankh-muted-2);
}
[is='ankh-state-chip'].offline .dot {
	background: var(--ankh-gray);
}
[is='ankh-state-chip'].offline-paused {
	background: var(--ankh-red-bg-2);
	color: var(--ankh-muted-3);
}
[is='ankh-state-chip'].offline-paused .dot {
	background: var(--ankh-red);
}
[is='ankh-state-chip'].unknown {
	background: var(--ankh-amber-bg);
	color: var(--ankh-amber);
}
[is='ankh-state-chip'].unknown .dot {
	background: var(--ankh-amber);
}

[is='ankh-device-row'] {
	background: var(--ankh-card);
	border-radius: var(--ankh-radius);
	padding: var(--space-3) 16px;
	margin-bottom: 10px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}
[is='ankh-device-row'] .device-icon {
	width: 24px;
	height: 24px;
	margin-right: var(--space-2);
	flex-shrink: 0;
}
[is='ankh-device-row'] .dname {
	font-weight: 600;
	font-size: 15px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
[is='ankh-device-row'] .dsub {
	font-size: 12px;
	color: var(--ankh-muted);
	margin-top: 2px;
}
[is='ankh-device-row'] .dinfo {
	min-width: 0;
	flex: 1;
}
[is='ankh-device-row'] .row-side {
	display: flex;
	align-items: center;
	gap: var(--space-2);
}

.icon-button {
	border: none;
	background: var(--ankh-card-2);
	color: var(--ankh-muted);
	border-radius: var(--ankh-radius);
	min-width: 40px;
	min-height: 40px;
	font-size: 15px;
	cursor: pointer;
}
.icon-button:focus-visible {
	box-shadow: 0 0 0 3px var(--ankh-accent);
	outline: none;
}
.small-button {
	border: none;
	border-radius: var(--ankh-radius);
	padding: 10px 14px;
	font-size: 13.5px;
	font-weight: 700;
	background: var(--ankh-accent);
	color: #08213f;
	cursor: pointer;
	min-height: 40px;
}
.small-button.danger {
	background: var(--ankh-red-bg-3);
	color: var(--ankh-red);
}
.small-button:disabled {
	opacity: 0.5;
}
.small-button.pending {
	opacity: 0.8;
	animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
	0%,
	100% {
		opacity: 0.8;
	}
	50% {
		opacity: 0.4;
	}
}
.small-button:focus-visible {
	box-shadow: 0 0 0 3px var(--ankh-text);
	outline: none;
}
.edit-form {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding-top: var(--space-2);
}
.edit-form input,
.edit-form select,
[is='ankh-group-card'] .add-row select {
	width: 100%;
	padding: 11px 12px;
	border-radius: var(--ankh-radius);
	border: 1px solid var(--ankh-border);
	background: var(--ankh-card-2);
	color: var(--ankh-text);
	font-size: 14.5px;
}
.edit-form .edit-actions {
	display: flex;
	gap: var(--space-2);
	justify-content: flex-end;
}

[is='ankh-unknown-row'] {
	background: var(--ankh-card);
	border-radius: var(--ankh-radius);
	padding: var(--space-3) 16px;
	margin-bottom: 10px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}
[is='ankh-unknown-row'] .uname {
	font-weight: 600;
	font-size: 14.5px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
[is='ankh-unknown-row'] .usub {
	font-size: 12px;
	color: var(--ankh-muted);
	margin-top: 2px;
	font-variant-numeric: tabular-nums;
}
[is='ankh-unknown-row'] .uinfo {
	min-width: 0;
	flex: 1;
}

.inline-create {
	display: flex;
	gap: var(--space-2);
	margin-top: var(--space-2);
}
.inline-create input {
	flex: 1;
	min-width: 0;
	padding: 11px 12px;
	border-radius: var(--ankh-radius);
	border: 1px solid var(--ankh-border);
	background: var(--ankh-card-2);
	color: var(--ankh-text);
	font-size: 14.5px;
}

nav {
	position: sticky;
	bottom: 0;
	background: var(--ankh-card-2);
	backdrop-filter: blur(14px);
	display: flex;
	justify-content: space-around;
	padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
	border-top: solid 1px var(--ankh-card-3);
	border-top-left-radius: var(--ankh-radius);
	border-top-right-radius: var(--ankh-radius);
	box-shadow: var(--ankh-shadow) 0 -6px 18px;
	z-index: 10;
}
nav button {
	position: relative;
	background: none;
	border: none;
	color: var(--ankh-muted);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	padding: var(--space-1) 18px;
	border-radius: var(--ankh-radius);
}
nav button.active {
	color: var(--ankh-accent);
}
nav button:focus-visible {
	box-shadow: 0 0 0 3px var(--ankh-accent);
	transition: box-shadow 200ms;
	outline: none;
}
nav button .icon {
	font-size: 22px;
	line-height: 1;
}
nav button .badge {
	position: absolute;
	margin-left: 32px;
	margin-top: -8px;
	background: var(--ankh-amber);
	color: #3a2b00;
	font-size: 11px;
	font-weight: 800;
	border-radius: 999px;
	padding: 2px 7px;
}

.panel {
	background: var(--ankh-card);
	border-radius: var(--ankh-radius);
	padding: 20px;
	margin-bottom: var(--space-3);
}
.panel .panel-title {
	font-weight: 700;
	margin-bottom: var(--space-1);
}
.panel label {
	display: block;
	font-size: 13px;
	color: var(--ankh-muted);
	margin: 12px 0 6px;
}
.panel input,
.panel select {
	width: 100%;
	padding: 13px 14px;
	border-radius: var(--ankh-radius);
	border: 1px solid var(--ankh-border);
	background: var(--ankh-card-2);
	color: var(--ankh-text);
	font-size: 15px;
}
.primary-button {
	width: 100%;
	margin-top: 16px;
	padding: 15px;
	border: none;
	border-radius: var(--ankh-radius);
	background: var(--ankh-accent);
	color: #08213f;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
}
.primary-button:disabled {
	opacity: 0.5;
}
.primary-button:focus-visible {
	box-shadow: 0 0 0 3px var(--ankh-text);
	transition: box-shadow 200ms;
	outline: none;
}
.hint {
	font-size: 12.5px;
	color: var(--ankh-muted);
	margin-top: 10px;
	line-height: 1.5;
}
.welcome-title {
	font-size: 20px;
	font-weight: 700;
	margin-bottom: 6px;
}
.group-manage-row {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-2) 0;
	border-bottom: 1px solid var(--ankh-border-5);
}
.group-manage-row:last-of-type {
	border-bottom: none;
}
.group-manage-row .gname {
	flex: 1;
	min-width: 0;
	font-weight: 600;
	font-size: 15px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

[is='ankh-toast'] {
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	bottom: calc(96px + env(safe-area-inset-bottom));
	background: var(--ankh-card-2);
	color: var(--ankh-text);
	padding: 12px 18px;
	border-radius: var(--ankh-radius);
	font-size: 14px;
	box-shadow: 0 6px 20px var(--ankh-shadow-3);
	opacity: 0;
	transition: opacity 250ms;
	max-width: 90vw;
	text-align: center;
	pointer-events: none;
}
[is='ankh-toast'].show {
	opacity: 1;
}

.empty {
	text-align: center;
	color: var(--ankh-muted);
	padding: 40px 20px;
	font-size: 14.5px;
	line-height: 1.6;
}
.section-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--ankh-muted);
	text-transform: uppercase;
	letter-spacing: 0.6px;
	margin: 22px 4px 10px;
}
.notice {
	background: var(--ankh-accent-bg);
	border: 1px solid var(--ankh-accent-border);
	color: var(--ankh-muted-4);
	border-radius: var(--ankh-radius);
	padding: 12px 14px;
	font-size: 13px;
	line-height: 1.5;
	margin-bottom: var(--space-3);
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
		animation: none !important;
	}
}

/* Pending "more time" request cards on Home */
.request-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	background: var(--ankh-amber-bg-4);
	border: 1px solid var(--ankh-amber-border-2);
	border-radius: 12px;
	padding: 12px 14px;
	margin: 0 0 12px;
}
.request-who {
	font-weight: 600;
	font-size: 14px;
}
.request-when {
	color: var(--ankh-muted, var(--ankh-muted-5));
	font-size: 12px;
	margin-top: 2px;
}
.request-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}
.request-actions button {
	padding: 8px 14px;
	border-radius: 9px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	border: 1px solid transparent;
}
.request-approve {
	background: var(--ankh-green-bg-2);
	border-color: var(--ankh-green-border);
	color: var(--ankh-muted-10);
}
.request-deny {
	background: var(--ankh-red-bg-4);
	border-color: var(--ankh-red-border-2);
	color: var(--ankh-muted-11);
}

/* The kid's requested duration is highlighted among the parent's options */
.request-asked {
	outline: 2px solid var(--ankh-green-border-2);
}
.request-card {
	flex-wrap: wrap;
}

/* Pull-to-refresh indicator */
.pull-indicator {
	position: fixed;
	top: -40px;
	left: 50%;
	transform: translateX(-50%);
	padding: 8px 16px;
	border-radius: 999px;
	background: var(--ankh-overlay);
	border: 1px solid var(--ankh-border);
	color: var(--ankh-muted-5);
	font-size: 13px;
	z-index: 30;
	transition: top 0.15s ease;
	pointer-events: none;
}
.pull-indicator.visible {
	top: 14px;
}

/* App-lock overlay */
.lock-overlay {
	position: fixed;
	inset: 0;
	background: var(--ankh-bg-2);
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
}
.lock-box {
	text-align: center;
	display: flex;
	flex-direction: column;
	gap: 14px;
	align-items: center;
}
.lock-icon {
	font-size: 44px;
}
.lock-title {
	font-size: 17px;
	font-weight: 600;
}

/* Device page */
.back-button {
	margin: 0 0 10px;
	font-size: 15px;
}
.device-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}
.device-title {
	font-size: 19px;
	font-weight: 700;
}
.device-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}
.conn-row {
	font-size: 13px;
	color: var(--ankh-muted, var(--ankh-muted-5));
	padding: 6px 0;
	border-bottom: 1px solid var(--ankh-border-6);
	word-break: break-all;
}
.conn-row:last-child {
	border-bottom: none;
}
/* The MAC row gains a remove control, so it becomes a two-part row:
   detail on the left, the affordance on the right. */
.conn-row {
	display: flex;
	align-items: center;
	gap: var(--space-2, 8px);
	justify-content: space-between;
}
.conn-attach {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2, 8px);
	margin-top: 10px;
}
.conn-attach select {
	flex: 1;
	min-width: 0;
}
/* The one place the app admits a pause may not be covering the machine.
   Loud enough to be believed, quiet enough not to look like an outage. */
.conn-warn {
	margin-top: 12px;
	padding: 10px 12px;
	border-radius: 8px;
	border: 1px solid var(--ankh-yellow-border);
	background: var(--ankh-yellow-bg);
	font-size: 13px;
}
.conn-warn .hint {
	margin-top: 4px;
}
.attach-existing {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2, 8px);
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid var(--ankh-border-6);
}
.attach-existing select {
	flex: 1;
	min-width: 0;
}
.attach-existing .hint {
	flex-basis: 100%;
	margin-top: 0;
}
.traffic-live {
	font-size: 14px;
	margin: 4px 0 10px;
}
.graph-tabs {
	display: flex;
	gap: 6px;
	margin-bottom: 8px;
}
.graph-tab {
	padding: 6px 14px;
	border-radius: 999px;
	font-size: 13px;
	background: var(--ankh-border-5);
	border: 1px solid var(--ankh-border-7);
	color: var(--ankh-muted, var(--ankh-muted-5));
	cursor: pointer;
}
.graph-tab.active {
	background: var(--ankh-accent-bg-2);
	border-color: var(--ankh-accent-border-2);
	color: var(--ankh-muted-6);
}
.graph {
	display: flex;
	align-items: flex-end;
	gap: 2px;
	height: 110px;
	padding: 6px 0;
}
.gbar {
	flex: 1;
	height: 100%;
	display: flex;
	align-items: flex-end;
	background: var(--ankh-border-8);
	border-radius: 3px;
	min-width: 2px;
}
.gbar-fill {
	width: 100%;
	background: linear-gradient(to top, var(--ankh-accent-stroke), var(--ankh-green-border-2));
	border-radius: 3px;
}

/* Device-page polish — inline header, shared control row, graph readouts */
.device-head-row {
	display: flex;
	align-items: center;
	gap: 10px;
}
.head-back {
	font-size: 24px;
	line-height: 1;
	padding: 2px 10px;
}
.device-head-row .device-title {
	flex: 1;
}
.device-controls button {
	flex: 1;
	min-width: 120px;
}
.graph-meta {
	font-size: 12px;
	color: var(--ankh-muted, var(--ankh-muted-5));
	margin-bottom: 4px;
}
.graph-tip {
	font-size: 13px;
	color: var(--ankh-muted-6);
	min-height: 18px;
	margin-bottom: 4px;
}
.gbar.scrubbed {
	outline: 1px solid rgba(232, 237, 247, 0.8);
}

/* Fix — the head panel must stack (row, then edit form full-width);
 * the earlier flex on .device-head made the edit form a squeezed flex
 * sibling that overflowed off-screen right. */
.device-head {
	display: block;
}
.device-head .edit-form {
	margin-top: 12px;
	width: 100%;
}
/* Fix — equal-height, aligned control buttons regardless of label length */
.device-controls {
	align-items: stretch;
}
.device-controls button {
	margin: 0;
	padding: 12px 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

/* Devices tab sort/filter controls */
.list-controls {
	display: flex;
	gap: 8px;
	margin: 8px 0 10px;
}
.list-controls select {
	flex: 1;
	font-size: 13px;
	padding: 8px 10px;
}

/* Secondary/safety actions: same footprint, lighter weight */
.outline-button {
	background: transparent;
	border: 1px solid var(--ankh-border-4);
	color: var(--ankh-muted-8);
}
.outline-button.outline-active {
	background: rgba(93, 187, 122, 0.14);
	border-color: rgba(93, 187, 122, 0.6);
	color: var(--ankh-muted-9);
}
/* An ambient count (unknown devices) rather than a call to action. */
.badge-quiet {
	position: absolute;
	margin-left: 32px;
	margin-top: -8px;
	background: var(--ankh-border-9);
	color: var(--ankh-muted-7);
	border-radius: 999px;
	font-size: 11px;
	padding: 1px 6px;
	font-weight: 600;
}

/* Policy presets: one-tap chips on Home + active-application banner */
.preset-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin-bottom: var(--space-3);
}
.preset-chip {
	background: var(--ankh-card-2);
	color: var(--ankh-text);
	border: 1px solid var(--ankh-border-3);
	border-radius: 999px;
	padding: 8px 14px;
	font-size: 14px;
	cursor: pointer;
}
.preset-chip:active {
	background: var(--ankh-accent-border);
}
.preset-active {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2);
	background: var(--ankh-amber-bg);
	border: 1px solid var(--ankh-amber-border);
	border-radius: var(--ankh-radius);
	padding: 10px 14px;
	margin-bottom: var(--space-2);
}
.preset-active-text {
	color: var(--ankh-amber);
	font-weight: 600;
	font-size: 14px;
}
.preset-cancel {
	background: rgba(248, 113, 113, 0.14);
	border: 1px solid var(--ankh-red-border);
	color: var(--ankh-red);
	border-radius: 10px;
	padding: 7px 12px;
	font-size: 13px;
	cursor: pointer;
	white-space: nowrap;
}

/* Per-group preset opt-in */
.preset-optin-row {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: 8px 0;
	color: var(--ankh-text);
	font-size: 14px;
	cursor: pointer;
}
.preset-optin-hint {
	color: var(--ankh-muted);
	font-size: 13px;
	margin: -6px 0 var(--space-3);
}

/* "Paused, but not actually blocked". Amber, not red: red is the
   working-pause colour and this must never be mistaken for one. */
[is='ankh-state-chip'].unenforced {
	background: var(--ankh-amber-bg-2);
	color: var(--ankh-amber);
	border: 1px solid var(--ankh-amber-border);
}
[is='ankh-state-chip'].unenforced .dot {
	background: var(--ankh-amber);
}
.unenforced-panel {
	border: 1px solid var(--ankh-amber-border);
	background: var(--ankh-amber-bg-3);
}
.unenforced-title {
	color: var(--ankh-amber);
	font-weight: 700;
	margin-bottom: var(--space-1);
}
.unenforced-body {
	color: var(--ankh-text);
	font-size: 13.5px;
	line-height: 1.45;
}

/* Light theme — follows the OS setting */
@media (prefers-color-scheme: light) {
	:root {
		--ankh-bg: rgb(245, 247, 250);
		--ankh-card: rgb(255, 255, 255);
		--ankh-card-2: rgb(235, 240, 248);
		--ankh-card-3: rgb(200, 210, 225);
		--ankh-text: rgb(30, 41, 59);
		--ankh-muted: rgb(100, 116, 139);
		--ankh-green: rgb(13, 124, 86);
		--ankh-red: rgb(190, 44, 44);
		--ankh-amber: rgb(150, 95, 0);
		--ankh-gray: rgb(100, 116, 139);
		--ankh-accent: rgb(37, 99, 235);
		--ankh-border: rgba(30, 41, 59, 0.12);
		--ankh-border-2: rgba(30, 41, 59, 0.14);
		--ankh-border-3: rgba(37, 99, 235, 0.35);
		--ankh-border-4: rgba(37, 99, 235, 0.55);
		--ankh-border-5: rgba(30, 41, 59, 0.05);
		--ankh-border-6: rgba(30, 41, 59, 0.06);
		--ankh-border-7: rgba(30, 41, 59, 0.08);
		--ankh-border-8: rgba(30, 41, 59, 0.03);
		--ankh-border-9: rgba(30, 41, 59, 0.14);
		--ankh-shadow: rgba(30, 41, 59, 0.12);
		--ankh-shadow-2: rgba(30, 41, 59, 0.08);
		--ankh-shadow-3: rgba(30, 41, 59, 0.15);
		--ankh-overlay: rgba(245, 247, 250, 0.95);
		--ankh-bg-2: rgb(245, 247, 250);
		--ankh-muted-2: rgb(100, 116, 139);
		--ankh-muted-3: rgb(140, 100, 100);
		--ankh-muted-4: rgb(70, 120, 200);
		--ankh-muted-5: rgb(100, 116, 139);
		--ankh-muted-6: rgb(30, 41, 59);
		--ankh-muted-7: rgb(60, 70, 90);
		--ankh-muted-8: rgb(60, 100, 200);
		--ankh-muted-9: rgb(20, 140, 80);
		--ankh-muted-10: rgb(13, 124, 86);
		--ankh-muted-11: rgb(190, 44, 44);
		--ankh-green-bg: rgba(13, 124, 86, 0.12);
		--ankh-red-bg: rgba(190, 44, 44, 0.12);
		--ankh-amber-bg: rgba(150, 95, 0, 0.12);
		--ankh-gray-bg: rgba(100, 116, 139, 0.15);
		--ankh-accent-bg: rgba(37, 99, 235, 0.1);
		--ankh-accent-border: rgba(37, 99, 235, 0.25);
		--ankh-red-bg-2: rgba(190, 44, 44, 0.1);
		--ankh-amber-bg-2: rgba(150, 95, 0, 0.14);
		--ankh-amber-border: rgba(150, 95, 0, 0.45);
		--ankh-amber-bg-3: rgba(150, 95, 0, 0.08);
		--ankh-red-bg-3: rgba(190, 44, 44, 0.16);
		--ankh-red-border: rgba(190, 44, 44, 0.5);
		--ankh-green-bg-2: rgba(13, 124, 86, 0.16);
		--ankh-green-border: rgba(13, 124, 86, 0.5);
		--ankh-red-bg-4: rgba(190, 44, 44, 0.12);
		--ankh-red-border-2: rgba(190, 44, 44, 0.45);
		--ankh-green-border-2: rgba(13, 124, 86, 0.7);
		--ankh-amber-bg-4: rgba(180, 120, 40, 0.1);
		--ankh-amber-border-2: rgba(180, 120, 40, 0.45);
		--ankh-accent-bg-2: rgba(37, 99, 235, 0.16);
		--ankh-accent-border-2: rgba(37, 99, 235, 0.5);
		--ankh-accent-bg-3: rgba(37, 99, 235, 0.25);
		--ankh-yellow-border: rgba(200, 140, 0, 0.45);
		--ankh-yellow-bg: rgba(200, 140, 0, 0.08);
		--ankh-accent-stroke: rgba(37, 99, 235, 0.85);
		--ankh-green-stroke: rgba(13, 124, 86, 0.7);
	}
}
/* #4588 — explicit light: SAME variable set as the OS-light media block above;
   keep the two in lockstep (this block sits after the dark pair so it wins at
   equal specificity). color-scheme forced to light. */
:root[data-theme='light'] {
	--ankh-bg: rgb(245, 247, 250);
	--ankh-card: rgb(255, 255, 255);
	--ankh-card-2: rgb(235, 240, 248);
	--ankh-card-3: rgb(200, 210, 225);
	--ankh-text: rgb(30, 41, 59);
	--ankh-muted: rgb(100, 116, 139);
	--ankh-green: rgb(13, 124, 86);
	--ankh-red: rgb(190, 44, 44);
	--ankh-amber: rgb(150, 95, 0);
	--ankh-gray: rgb(100, 116, 139);
	--ankh-accent: rgb(37, 99, 235);
	--ankh-border: rgba(30, 41, 59, 0.12);
	--ankh-border-2: rgba(30, 41, 59, 0.14);
	--ankh-border-3: rgba(37, 99, 235, 0.35);
	--ankh-border-4: rgba(37, 99, 235, 0.55);
	--ankh-border-5: rgba(30, 41, 59, 0.05);
	--ankh-border-6: rgba(30, 41, 59, 0.06);
	--ankh-border-7: rgba(30, 41, 59, 0.08);
	--ankh-border-8: rgba(30, 41, 59, 0.03);
	--ankh-border-9: rgba(30, 41, 59, 0.14);
	--ankh-shadow: rgba(30, 41, 59, 0.12);
	--ankh-shadow-2: rgba(30, 41, 59, 0.08);
	--ankh-shadow-3: rgba(30, 41, 59, 0.15);
	--ankh-overlay: rgba(245, 247, 250, 0.95);
	--ankh-bg-2: rgb(245, 247, 250);
	--ankh-muted-2: rgb(100, 116, 139);
	--ankh-muted-3: rgb(140, 100, 100);
	--ankh-muted-4: rgb(70, 120, 200);
	--ankh-muted-5: rgb(100, 116, 139);
	--ankh-muted-6: rgb(30, 41, 59);
	--ankh-muted-7: rgb(60, 70, 90);
	--ankh-muted-8: rgb(60, 100, 200);
	--ankh-muted-9: rgb(20, 140, 80);
	--ankh-muted-10: rgb(13, 124, 86);
	--ankh-muted-11: rgb(190, 44, 44);
	--ankh-green-bg: rgba(13, 124, 86, 0.12);
	--ankh-red-bg: rgba(190, 44, 44, 0.12);
	--ankh-amber-bg: rgba(150, 95, 0, 0.12);
	--ankh-gray-bg: rgba(100, 116, 139, 0.15);
	--ankh-accent-bg: rgba(37, 99, 235, 0.1);
	--ankh-accent-border: rgba(37, 99, 235, 0.25);
	--ankh-red-bg-2: rgba(190, 44, 44, 0.1);
	--ankh-amber-bg-2: rgba(150, 95, 0, 0.14);
	--ankh-amber-border: rgba(150, 95, 0, 0.45);
	--ankh-amber-bg-3: rgba(150, 95, 0, 0.08);
	--ankh-red-bg-3: rgba(190, 44, 44, 0.16);
	--ankh-red-border: rgba(190, 44, 44, 0.5);
	--ankh-green-bg-2: rgba(13, 124, 86, 0.16);
	--ankh-green-border: rgba(13, 124, 86, 0.5);
	--ankh-red-bg-4: rgba(190, 44, 44, 0.12);
	--ankh-red-border-2: rgba(190, 44, 44, 0.45);
	--ankh-green-border-2: rgba(13, 124, 86, 0.7);
	--ankh-amber-bg-4: rgba(180, 120, 40, 0.1);
	--ankh-amber-border-2: rgba(180, 120, 40, 0.45);
	--ankh-accent-bg-2: rgba(37, 99, 235, 0.16);
	--ankh-accent-border-2: rgba(37, 99, 235, 0.5);
	--ankh-accent-bg-3: rgba(37, 99, 235, 0.25);
	--ankh-yellow-border: rgba(200, 140, 0, 0.45);
	--ankh-yellow-bg: rgba(200, 140, 0, 0.08);
	--ankh-accent-stroke: rgba(37, 99, 235, 0.85);
	--ankh-green-stroke: rgba(13, 124, 86, 0.7);
	color-scheme: light;
}

/* Boost button */
.toggle.boost {
	background: rgba(251, 191, 36, 0.14);
	border: 1px solid rgba(251, 191, 36, 0.45);
	color: var(--ankh-amber);
}

/* Timeline */
.timeline {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.timeline-row {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: 8px 0;
	border-bottom: 1px solid var(--ankh-card-2);
}
.timeline-time {
	color: var(--ankh-muted);
	font-size: 12px;
	min-width: 60px;
}
.timeline-label {
	color: var(--ankh-text);
	font-size: 13px;
	flex: 1;
}
.timeline-device {
	color: var(--ankh-muted);
	font-size: 12px;
	font-style: italic;
}
.timeline-date {
	color: var(--ankh-amber);
	font-weight: 600;
	font-size: 13px;
	padding: 12px 0 6px;
}
.timeline-view {
	padding: var(--space-2);
}

/* Boost duration chooser — revealed by the ⚡ control on device rows
   and group cards. */
.boost-menu {
	display: flex;
	gap: 6px;
	align-items: center;
}

.boost-status {
	display: inline-flex;
	gap: 6px;
	align-items: center;
	font-size: 12px;
	font-weight: 600;
	color: var(--ankh-green, #0d7c56);
	background: rgba(13, 124, 86, 0.12);
	border-radius: 999px;
	padding: 2px 8px;
}

.boost-cancel {
	padding: 0 6px;
	line-height: 1.2;
}

/* #4217 — apply-time preset modal */
.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
}
.modal {
	background: var(--ankh-card);
	border: 1px solid var(--ankh-card-2);
	border-radius: 12px;
	padding: var(--space-4);
	width: min(420px, 92vw);
	max-height: 80vh;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.modal .preset-optin-row {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: 6px 0;
}
.modal .preset-optin-header {
	font-weight: 600;
	border-bottom: 1px solid var(--ankh-card-2);
}
.modal .modal-confirm {
	color: var(--ankh-amber);
	font-weight: 600;
}
.modal .modal-buttons {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-2);
	margin-top: var(--space-2);
}
