/*
 * Alovio Protect - admin interface.
 *
 * Everything is scoped to #alovio-app: WordPress admin styles are wide-reaching
 * and change between releases, so nothing here relies on them and nothing here
 * escapes into them.
 */

#alovio-app {
	--bg: #FBFAF8;
	--surf: #FFFFFF;
	--sunk: #F4F1EC;
	--line: #E6E1D9;
	--line2: #D3CCC0;
	--ink: #1A1714;
	--ink2: #56503F;
	--ink3: #6B6358;
	--acc: #C2410C;
	--acc2: #9A3412;
	--accsoft: #FCF0E7;
	--accline: #F0CDB4;
	--dan: #A32318;
	--dansoft: #FCF1EF;
	--danline: #EEBFB6;
	--danstrong: #B3291C;
	--wrn: #8A4B0B;
	--wrnsoft: #FCF5EA;
	--wrnline: #E9D2A8;
	--ok: #0F6B4A;
	--oksoft: #EFF6F1;
	--okline: #BBD9C5;
	--neu: #4B5563;
	--neusoft: #F4F3F0;
	--neuline: #DDD8CF;

	margin: 0 20px 0 0;
	padding: 24px 0 48px;
	background: var(--bg);
	color: var(--ink);
	font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

/*
 * The dark palette is opt-in through data-ap-theme, and deliberately not tied
 * to prefers-color-scheme.
 *
 * It used to follow the operating system, which looked right in isolation and
 * wrong on a real screen: WordPress keeps its admin content light in every one
 * of its colour schemes, so a visitor whose laptop was in dark mode got a
 * near-black panel sitting inside a white admin page, with WordPress's own
 * notices above it and its footer below it still light. Reported from a real
 * install as "the layout is dark and messed up", and that is exactly what it
 * was. A panel that lives inside someone else's interface matches that
 * interface; the preference to read is WordPress's, not the OS's, and when
 * WordPress offers one this is where it gets read.
 */
#alovio-app[data-ap-theme="dark"] {
	--bg: #131110;
	--surf: #1B1916;
	--sunk: #221F1B;
	--line: #322D26;
	--line2: #433C33;
	--ink: #F3F0EA;
	--ink2: #BDB5A8;
	--ink3: #9A9184;
	--acc: #F97316;
	--acc2: #FDBA74;
	--accsoft: #2A1B10;
	--accline: #4A2E17;
	--dan: #F2837A;
	--dansoft: #2B1614;
	--danline: #53241F;
	--danstrong: #E1584B;
	--wrn: #E8B15F;
	--wrnsoft: #271E11;
	--wrnline: #4B3A1C;
	--ok: #65C79C;
	--oksoft: #12211B;
	--okline: #234536;
	--neu: #A0A8B4;
	--neusoft: #1F1E1B;
	--neuline: #3A352E;
}

#alovio-app * {
	box-sizing: border-box;
}

/*
 * The scope is wrapped in :where() so this reset carries no more weight than
 * the rules it exists to cancel.
 *
 * Written as `#alovio-app h3` it was specificity (1,0,1), which beat every
 * class in this file - so `.ap-kicker { margin: 22px 0 10px }` and every other
 * class trying to space a heading, paragraph or list silently did nothing, and
 * the only spacing that worked was inline styles. :where() contributes nothing,
 * leaving (0,0,1): still a tie with wp-admin's own `h2, h3 { margin: 1em 0 }`
 * and `p { margin: 1em 0 }`, which this sheet wins by loading after them, while
 * any class here now wins in turn.
 */
:where(#alovio-app) h1,
:where(#alovio-app) h2,
:where(#alovio-app) h3,
:where(#alovio-app) h4,
:where(#alovio-app) h5,
:where(#alovio-app) p,
:where(#alovio-app) ul {
	margin: 0;
	padding: 0;
	font-weight: inherit;
	font-size: inherit;
	color: inherit;
}

#alovio-app ul {
	list-style: none;
}

#alovio-app a {
	color: var(--acc2);
	text-decoration: none;
	box-shadow: none;
}

#alovio-app a:hover {
	color: var(--acc);
	text-decoration: underline;
}

#alovio-app a:focus-visible,
#alovio-app button:focus-visible {
	outline: 2px solid var(--acc);
	outline-offset: 2px;
	box-shadow: none;
}

#alovio-app abbr[title] {
	text-decoration: underline dotted var(--line2);
	text-underline-offset: 3px;
	cursor: help;
}

.ap-mono {
	font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --------------------------------------------------------------- scaffold */

.ap-shell {
	max-width: 1180px;
	padding: 0 32px;
}

.ap-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
	padding-bottom: 16px;
}

.ap-brand {
	display: flex;
	align-items: center;
	gap: 11px;
}

.ap-brand h1 {
	font-size: 19px;
	font-weight: 600;
	letter-spacing: -0.012em;
}

.ap-ver {
	font-size: 11px;
	color: var(--ink3);
	border: 1px solid var(--line);
	background: var(--surf);
	border-radius: 4px;
	padding: 2px 6px;
}

.ap-headside {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.ap-muted {
	font-size: 12.5px;
	color: var(--ink3);
}

.ap-tabs {
	display: flex;
	gap: 2px;
	border-bottom: 1px solid var(--line);
	margin-bottom: 22px;
	overflow-x: auto;
	scrollbar-width: none;
}

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

.ap-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 13px;
	font-size: 13.5px;
	font-weight: 500;
	color: var(--ink3);
	border: 0;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	background: none;
	cursor: pointer;
	white-space: nowrap;
	font-family: inherit;
}

.ap-tab[aria-current="page"] {
	font-weight: 600;
	color: var(--ink);
	border-bottom-color: var(--acc);
}

.ap-tab-badge {
	display: inline-grid;
	place-items: center;
	min-width: 17px;
	height: 17px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--danstrong);
	color: #FFFFFF;
	font-size: 10.5px;
	font-weight: 600;
}

.ap-kicker {
	margin: 22px 0 10px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ink3);
}

.ap-stack {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.ap-grid2 {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
}

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

.ap-spacer {
	flex-grow: 1;
}

/* ------------------------------------------------------------- primitives */

.ap-card {
	background: var(--surf);
	border: 1px solid var(--line);
	border-radius: 10px;
}

.ap-card-head {
	display: flex;
	align-items: center;
	gap: 11px;
	flex-wrap: wrap;
	padding: 13px 16px;
	border-bottom: 1px solid var(--line);
}

.ap-card-body {
	padding: 14px 16px;
}

.ap-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	height: 38px;
	padding: 0 14px;
	border-radius: 6px;
	border: 1px solid var(--line2);
	background: var(--surf);
	color: var(--ink);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
}

.ap-btn:hover:not(:disabled) {
	border-color: var(--ink3);
	color: var(--ink);
	text-decoration: none;
}

.ap-btn:disabled {
	opacity: 0.55;
	cursor: default;
}

.ap-btn--primary {
	border-color: var(--acc);
	background: var(--acc);
	color: #FFFFFF;
}

.ap-btn--primary:hover:not(:disabled) {
	border-color: var(--acc2);
	background: var(--acc2);
	color: #FFFFFF;
}

.ap-btn--dark {
	height: 40px;
	padding: 0 16px;
	border-color: var(--ink);
	background: var(--ink);
	color: var(--bg);
	font-size: 13.5px;
}

.ap-btn--dark:hover:not(:disabled) {
	border-color: var(--ink2);
	background: var(--ink2);
	color: var(--bg);
}

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

.ap-btn--ghost:hover:not(:disabled) {
	border-color: var(--line2);
}

.ap-btn--sm {
	height: 32px;
	padding: 0 12px;
	font-size: 12.5px;
}

.ap-btn--icon {
	width: 28px;
	height: 28px;
	padding: 0;
	flex: none;
}

.ap-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 200px;
}

.ap-field > label {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--ink2);
}

.ap-input,
.ap-select {
	height: 38px;
	padding: 0 11px;
	border-radius: 6px;
	border: 1px solid var(--line2);
	background: var(--surf);
	color: var(--ink);
	font-family: inherit;
	font-size: 13px;
	max-width: 100%;
}

.ap-select {
	padding-right: 28px;
}

.ap-input:focus,
.ap-select:focus {
	outline: 2px solid var(--acc);
	outline-offset: 1px;
	border-color: var(--acc);
}

.ap-check {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	font-size: 13px;
	color: var(--ink2);
	cursor: pointer;
}

.ap-check input {
	margin: 2px 0 0;
	accent-color: var(--acc);
	width: 16px;
	height: 16px;
	flex: none;
}

.ap-pill {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 22px;
	padding: 0 8px;
	border-radius: 5px;
	border: 1px solid var(--line2);
	background: var(--surf);
	color: var(--ink);
	font-size: 11.5px;
	font-weight: 600;
	white-space: nowrap;
}

.ap-pill--ok {
	background: var(--oksoft);
	border-color: var(--okline);
	color: var(--ok);
}

.ap-pill--dan {
	background: var(--dansoft);
	border-color: var(--danline);
	color: var(--dan);
}

.ap-pill--wrn {
	background: var(--wrnsoft);
	border-color: var(--wrnline);
	color: var(--wrn);
}

.ap-pill--neu {
	background: var(--neusoft);
	border-color: var(--neuline);
	color: var(--neu);
}

.ap-pill--strong {
	background: var(--danstrong);
	border-color: var(--danstrong);
	color: #FFFFFF;
}

.ap-pill--quiet {
	background: var(--sunk);
	border-color: transparent;
	color: var(--ink3);
	height: 20px;
	padding: 0 7px;
	font-size: 11px;
}

.ap-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 24px;
	padding: 0 9px;
	border-radius: 5px;
	background: var(--surf);
	border: 1px solid var(--line);
	color: var(--ink2);
	font-size: 12px;
	white-space: nowrap;
}

.ap-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
}

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

/* ---------------------------------------------------------------- banners */

.ap-banner {
	display: flex;
	gap: 16px;
	padding: 20px 22px;
	border-radius: 12px;
	background: var(--surf);
	border: 1px solid var(--line);
}

.ap-banner--dan {
	background: var(--dansoft);
	border-color: var(--danline);
}

.ap-banner--wrn {
	background: var(--wrnsoft);
	border-color: var(--wrnline);
}

.ap-banner--neu {
	border-color: var(--line2);
}

.ap-banner__icon {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--oksoft);
	border: 1px solid var(--okline);
	color: var(--ok);
	flex: none;
}

.ap-banner__icon--dan {
	width: 44px;
	height: 44px;
	border-radius: 11px;
	background: var(--danstrong);
	border-color: var(--danstrong);
	color: #FFFFFF;
}

.ap-banner__icon--wrn {
	width: 38px;
	height: 38px;
	border-radius: 9px;
	background: var(--surf);
	border-color: var(--wrnline);
	color: var(--wrn);
}

.ap-banner__icon--neu {
	width: 38px;
	height: 38px;
	border-radius: 9px;
	background: var(--neusoft);
	border-color: var(--neuline);
	color: var(--neu);
}

.ap-banner__body {
	flex-grow: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.ap-banner h2 {
	font-size: 21px;
	font-weight: 600;
	letter-spacing: -0.014em;
}

.ap-banner h3 {
	font-size: 15.5px;
	font-weight: 600;
}

.ap-title-sm {
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.008em;
}

.ap-lead {
	font-size: 14.5px;
	color: var(--ink2);
	max-width: 820px;
}

.ap-body {
	font-size: 13.5px;
	color: var(--ink2);
	max-width: 760px;
}

.ap-note {
	padding-top: 13px;
	border-top: 1px solid var(--danline);
	font-size: 12.5px;
	color: var(--ink2);
	max-width: 820px;
}

.ap-strong {
	color: var(--ink);
	font-weight: 600;
}

/* ----------------------------------------------------------- module cards */

.ap-mod {
	display: flex;
	flex-direction: column;
	gap: 9px;
	padding: 16px 18px;
	background: var(--surf);
	border: 1px solid var(--line);
	border-radius: 10px;
}

/* The card is a column flex container, so a button would otherwise stretch to
   its full width. */
.ap-mod .ap-btn {
	align-self: flex-start;
	margin-top: auto;
}

.ap-mod__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.ap-mod__name {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.ap-mod__name h4 {
	font-size: 14.5px;
	font-weight: 600;
}

.ap-mod p {
	font-size: 13px;
	color: var(--ink2);
}

.ap-mod__foot {
	margin-top: auto;
	padding-top: 10px;
	border-top: 1px solid var(--line);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 12.5px;
	color: var(--ink3);
}

/* ------------------------------------------------------------------ files */

.ap-file {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 7px;
	background: var(--bg);
	border: 1px solid var(--line);
	min-width: 0;
}

.ap-file--dan {
	background: var(--dansoft);
	border-color: var(--danline);
}

.ap-file--wrn {
	background: var(--wrnsoft);
	border-color: var(--wrnline);
}

.ap-file__path {
	flex-grow: 1;
	min-width: 0;
	font-size: 12.5px;
	color: var(--ink);
	overflow-x: auto;
	white-space: nowrap;
}

.ap-findgroup {
	display: flex;
	flex-direction: column;
	gap: 7px;
}

.ap-findgroup__head {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13.5px;
	font-weight: 600;
}

.ap-trace {
	margin: 0;
	padding: 13px 14px;
	background: var(--sunk);
	border: 1px solid var(--line);
	border-radius: 8px;
	font-size: 12px;
	line-height: 1.65;
	color: var(--ink2);
	max-height: 260px;
	overflow: auto;
	white-space: pre;
}

.ap-progress {
	height: 6px;
	border-radius: 3px;
	background: var(--sunk);
	overflow: hidden;
}

.ap-progress__bar {
	height: 100%;
	background: var(--acc);
	transition: width 0.3s ease;
}

.ap-empty {
	padding: 18px;
	font-size: 13px;
	color: var(--ink3);
}

.ap-error {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	margin-bottom: 16px;
	border-radius: 8px;
	background: var(--dansoft);
	border: 1px solid var(--danline);
	color: var(--dan);
	font-size: 13px;
}

.ap-spin {
	animation: ap-spin 0.9s linear infinite;
}

/* Shown in the header for as long as anything is running, including work whose
   own button has gone from the screen. role="status" so a screen reader is told
   too, rather than only the people watching the spinner. */
.ap-working {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 12.5px;
	font-weight: 500;
	color: var(--acc);
}

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

@media (prefers-reduced-motion: reduce) {
	.ap-spin {
		animation: none;
	}

	.ap-progress__bar {
		transition: none;
	}
}

/* ----------------------------------------------------------------- narrow */

@media (max-width: 782px) {
	#alovio-app {
		margin-right: 0;
		padding-top: 12px;
	}

	.ap-shell {
		padding: 0 14px;
	}

	.ap-grid2,
	.ap-grid3 {
		grid-template-columns: minmax(0, 1fr);
	}

	.ap-banner {
		flex-direction: column;
		gap: 14px;
		padding: 18px;
	}

	.ap-banner h2 {
		font-size: 18px;
	}

	.ap-lead {
		font-size: 13.5px;
	}

	.ap-btn,
	.ap-btn--dark {
		height: 44px;
	}

	.ap-actions .ap-btn {
		flex-grow: 1;
	}
}
