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

html, body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol {
	margin: 0;
}

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

body {
	min-height: 100%;
	background: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-sans);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.flowstate-wordmark {
	display: inline-flex;
	align-items: center;
	color: var(--color-text);
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 1;
	text-decoration: none;
}

.flowstate-brand-lockup {
	display: flex;
	align-items: center;
	gap: 5px;
	height: 20px;
	line-height: 1;
	white-space: nowrap;
}

.flowstate-beta-badge {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	height: 14px;
	padding: 2px 6px;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent-strong);
	font-size: 0.5rem;
	font-weight: 750;
	letter-spacing: 0.035em;
	line-height: 10px;
	text-transform: uppercase;
}

a.flowstate-wordmark:hover {
	color: var(--color-text);
	text-decoration: none;
}

a.flowstate-wordmark:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 4px;
	border-radius: var(--radius-sm);
}

img, svg, video, canvas {
	display: block;
	max-width: 100%;
}

/*
 * Author-origin rules beat the browser's user-agent stylesheet in the CSS
 * cascade regardless of selector specificity (when neither side uses
 * !important), so the `img, svg, video, canvas { display: block; }` rule
 * above silently overrides the browser's built-in `[hidden] { display:
 * none }` rule for exactly those elements. Restated here so the hidden
 * attribute keeps working on icons/media throughout the app.
 */
[hidden] {
	display: none !important;
}

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

button {
	--hover-duration: var(--duration-hover-normal);
	background: none;
	border: none;
	cursor: pointer;
	transition-property: color, background-color, border-color, opacity, fill, stroke;
	transition-duration: var(--hover-duration);
	transition-timing-function: var(--ease-hover);
}

button:where(.icon-btn, .icon-button, .btn-sm, [data-tool], [data-action], [role="menuitem"], [role="tab"]),
.context-menu button,
.breadcrumbs button,
.dash-nav button {
	--hover-duration: var(--duration-hover-compact);
}

button svg,
.btn svg {
	transition-property: color, fill, stroke, opacity;
	transition-duration: var(--hover-duration, var(--duration-hover-normal));
	transition-timing-function: var(--ease-hover);
}

a {
	color: var(--accent);
}

ul, ol {
	padding-left: 0;
	list-style: none;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

/* Blanket default so every native checkbox/radio/range in the app uses the
   theme accent instead of the browser/OS default (blue on most platforms)
   a handful of specific controls (checklist items, the color-swatch
   picker) already set this explicitly, but several others (the inspector's
   "Hide title"/"Locked" checkboxes, its progress range slider) never did
   and rendered in whatever color the browser felt like. Setting it once,
   globally, means no future checkbox/radio/range anywhere in the app can
   be missed the same way again. */
input[type="checkbox"], input[type="radio"], input[type="range"] {
	accent-color: var(--accent);
}

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

.skip-link {
	position: fixed;
	/* Far enough above the viewport that its shadow never peeks in. */
	top: -96px;
	left: var(--space-4);
	z-index: 1000;
	padding: var(--space-2) var(--space-4);
	background: var(--color-surface);
	color: var(--color-text);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
	transition: top var(--duration-base) var(--ease-standard);
}

.skip-link:focus {
	top: var(--space-4);
}

.consent-dialog {
	width: min(560px, calc(100% - 32px));
	padding: 0;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-xl);
	background: var(--color-surface);
	color: var(--color-text);
	box-shadow: var(--shadow-xl);
}

.consent-dialog::backdrop {
	background: rgba(16, 18, 22, 0.58);
	backdrop-filter: blur(3px);
}

.consent-dialog form,
.consent-dialog header,
.consent-dialog footer,
.consent-categories,
.consent-categories label,
.consent-storage-row {
	display: flex;
}

.consent-dialog form,
.consent-categories {
	flex-direction: column;
}

.consent-dialog header,
.consent-dialog footer,
.consent-categories label,
.consent-storage-row {
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
}

.consent-dialog header,
.consent-dialog footer {
	padding: var(--space-5);
}

.consent-dialog header {
	border-bottom: 1px solid var(--color-border);
}

.consent-dialog header h2 {
	font-size: 1.2rem;
}

.consent-dialog header p,
.consent-categories small {
	color: var(--color-text-muted);
}

.consent-dialog header button {
	padding: var(--space-2);
	font-size: 1.4rem;
}

.consent-categories {
	gap: var(--space-3);
	padding: var(--space-5);
}

.consent-categories label,
.consent-storage-row {
	padding: var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.consent-categories label span,
.consent-storage-row span {
	display: grid;
	gap: var(--space-1);
}
.consent-storage-row button {
	flex: 0 0 auto;
	padding: var(--space-2) var(--space-3);
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius-md);
	background: var(--color-surface);
	color: var(--color-text);
	font-size: 0.75rem;
}


.consent-dialog footer {
	justify-content: flex-end;
	border-top: 1px solid var(--color-border);
}

.consent-dialog footer button {
	padding: var(--space-2) var(--space-4);
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius-md);
}

.consent-dialog footer button.is-primary {
	border-color: var(--accent);
	background: var(--accent);
	color: var(--accent-contrast);
}

@media (forced-colors: active) {
	:focus-visible {
		outline: 2px solid CanvasText;
	}
}

/* Update notice (update-notice.js): a quiet corner card on every page shell.
   It is a manual popover so it stays above open dialogs; the UA popover
   border, padding and centering are reset explicitly. */
.update-notice {
	position: fixed;
	inset: auto 20px 20px auto;
	z-index: 2000;
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: min(360px, calc(100vw - 32px));
	margin: 0;
	padding: 14px 16px;
	overflow: visible;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg, 12px);
	background: var(--color-surface-raised);
	color: var(--color-text);
	box-shadow: var(--shadow-lg);
	font-size: 0.875rem;
}
.update-notice-copy { display: flex; flex-direction: column; gap: 4px; }
.update-notice-copy strong { font-size: 0.875rem; }
.update-notice-copy span { color: var(--color-text-muted); font-size: 0.8125rem; line-height: 1.45; }
.update-notice-actions { display: flex; justify-content: flex-end; gap: 8px; }
.update-notice-actions button { min-height: 36px; padding: 0 14px; border-radius: var(--radius-md, 8px); font: inherit; font-size: 0.8125rem; font-weight: 650; cursor: pointer; }
.update-notice-later { border: 1px solid var(--color-border-strong); background: transparent; color: var(--color-text); }
.update-notice-later:hover { background: var(--color-surface); }
.update-notice-now { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.update-notice-now:hover { filter: brightness(1.05); }
.update-notice-now:disabled { cursor: progress; opacity: 0.8; }
.update-notice button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html[data-device="phone"] .update-notice { inset: auto 8px calc(var(--mobile-chrome-height, 60px) + 20px + env(safe-area-inset-bottom, 0px)) 8px; width: auto; }
@media (max-width: 480px) {
	.update-notice { inset: auto 12px 12px 12px; width: auto; }
}
