/* Shared design tokens and components for the password tool and the app */

/* ---------- Tokens per theme ---------- */

:root,
[data-theme="daylight"] {
	--bg: #f5f6fa; --bg-glow: #e7e8fb; --surface: #ffffff; --surface-2: #eef0f6; --surface-3: #e4e7f0;
	--border: #dfe3ec; --border-strong: #c7cddb; --text: #1c2333; --muted: #5d6679; --faint: #8a92a6;
	--accent: #4f46e5; --accent-hover: #4338ca; --accent-soft: #e8e7fd; --on-accent: #ffffff; --accent-2: #0ea5a4;
	--ok: #16803c; --ok-soft: #dcf5e4; --info: #2563eb; --info-soft: #e0eafe; --warn: #b45309; --warn-soft: #fdf0d9;
	--danger: #c0262d; --danger-soft: #fde4e4; --none: #6b7280; --none-soft: #eceef2;
	--s0: #dc2626; --s1: #ea7a0c; --s2: #ca9a04; --s3: #16a34a; --s4: #0d9488;
	--shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 30px -12px rgba(16, 24, 40, .14);
	--shadow-pop: 0 18px 50px -12px rgba(16, 24, 40, .28);
	--scheme: light;
}
[data-theme="mint"] {
	--bg: #eef8f3; --bg-glow: #d8f1e5; --surface: #fbfffd; --surface-2: #e4f3ec; --surface-3: #d6ece1;
	--border: #cbe6d8; --border-strong: #a9d3bd; --text: #183329; --muted: #4f6e61; --faint: #7f9a8e;
	--accent: #12936b; --accent-hover: #0d7a58; --accent-soft: #d3f0e3; --on-accent: #ffffff; --accent-2: #6d5bd0;
	--ok: #11784f; --ok-soft: #d3f0e3; --info: #1e6fb8; --info-soft: #dcecfa; --warn: #a15c07; --warn-soft: #fbedd5;
	--danger: #b42330; --danger-soft: #fbe2e3; --none: #66786f; --none-soft: #e3ece7;
	--s0: #d6303a; --s1: #e27b13; --s2: #b99208; --s3: #1f9d5a; --s4: #0f8a7e;
	--shadow: 0 1px 2px rgba(20, 60, 45, .06), 0 10px 30px -12px rgba(20, 60, 45, .16);
	--shadow-pop: 0 18px 50px -12px rgba(20, 60, 45, .3);
	--scheme: light;
}
[data-theme="lavender"] {
	--bg: #f4f1fb; --bg-glow: #e6defa; --surface: #fdfcff; --surface-2: #eee8f9; --surface-3: #e3daf5;
	--border: #ddd3f1; --border-strong: #c4b4e6; --text: #2a2140; --muted: #675d80; --faint: #958bad;
	--accent: #7c4ddb; --accent-hover: #6a3ccb; --accent-soft: #ebe2fd; --on-accent: #ffffff; --accent-2: #d1559b;
	--ok: #19804a; --ok-soft: #ddf3e6; --info: #3a64d8; --info-soft: #e3e9fc; --warn: #a65d0b; --warn-soft: #fbeeda;
	--danger: #be2a4d; --danger-soft: #fce3ea; --none: #73698a; --none-soft: #ece7f5;
	--s0: #d53a5a; --s1: #e47c22; --s2: #c09511; --s3: #2a9b5e; --s4: #5b6be0;
	--shadow: 0 1px 2px rgba(50, 30, 90, .06), 0 10px 30px -12px rgba(50, 30, 90, .16);
	--shadow-pop: 0 18px 50px -12px rgba(50, 30, 90, .3);
	--scheme: light;
}
[data-theme="peach"] {
	--bg: #fdf3ee; --bg-glow: #fbe1d6; --surface: #fffbf8; --surface-2: #f9ebe3; --surface-3: #f4dfd3;
	--border: #f0d3c4; --border-strong: #e2b7a2; --text: #3a2219; --muted: #7b5a4d; --faint: #a8887b;
	--accent: #df5b44; --accent-hover: #c94a34; --accent-soft: #fde3da; --on-accent: #ffffff; --accent-2: #3e8e86;
	--ok: #1d7f45; --ok-soft: #dcf2e3; --info: #2f6db8; --info-soft: #e1ebf8; --warn: #a3580a; --warn-soft: #fcecd6;
	--danger: #b8272f; --danger-soft: #fbe0e0; --none: #806b62; --none-soft: #f1e6e0;
	--s0: #d1323c; --s1: #e57421; --s2: #c08f0a; --s3: #2b9354; --s4: #2e8b8b;
	--shadow: 0 1px 2px rgba(90, 40, 20, .06), 0 10px 30px -12px rgba(90, 40, 20, .16);
	--shadow-pop: 0 18px 50px -12px rgba(90, 40, 20, .3);
	--scheme: light;
}
[data-theme="sky"] {
	--bg: #eef5fc; --bg-glow: #d9e9fa; --surface: #fbfdff; --surface-2: #e5effa; --surface-3: #d8e6f6;
	--border: #cbdff2; --border-strong: #a8c6e6; --text: #15283d; --muted: #4d6580; --faint: #7e93ab;
	--accent: #2479d1; --accent-hover: #1a65b4; --accent-soft: #dbeafb; --on-accent: #ffffff; --accent-2: #e0812c;
	--ok: #167a45; --ok-soft: #daf2e4; --info: #2479d1; --info-soft: #dbeafb; --warn: #a3590b; --warn-soft: #fcedd7;
	--danger: #bf2a33; --danger-soft: #fce2e3; --none: #64758a; --none-soft: #e4ebf3;
	--s0: #d2343d; --s1: #e57a1f; --s2: #c19409; --s3: #23995a; --s4: #1f86c9;
	--shadow: 0 1px 2px rgba(20, 50, 90, .06), 0 10px 30px -12px rgba(20, 50, 90, .16);
	--shadow-pop: 0 18px 50px -12px rgba(20, 50, 90, .3);
	--scheme: light;
}
[data-theme="midnight"] {
	--bg: #0f1220; --bg-glow: #1d2045; --surface: #171b2e; --surface-2: #1e2339; --surface-3: #262c48;
	--border: #2a3050; --border-strong: #3a4268; --text: #e7e9f5; --muted: #9aa1c0; --faint: #6c7394;
	--accent: #8b85ff; --accent-hover: #a29dff; --accent-soft: #272653; --on-accent: #0f1220; --accent-2: #3dd6c8;
	--ok: #4ade80; --ok-soft: #173a29; --info: #7aa7ff; --info-soft: #1c2b52; --warn: #fbbf24; --warn-soft: #3d3016;
	--danger: #fb7185; --danger-soft: #45202b; --none: #9aa1c0; --none-soft: #252a42;
	--s0: #f43f5e; --s1: #fb923c; --s2: #facc15; --s3: #4ade80; --s4: #2dd4bf;
	--shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -12px rgba(0, 0, 0, .55);
	--shadow-pop: 0 20px 60px -12px rgba(0, 0, 0, .7);
	--scheme: dark;
}
[data-theme="graphite"] {
	--bg: #121213; --bg-glow: #232220; --surface: #1c1c1e; --surface-2: #232326; --surface-3: #2c2c30;
	--border: #323236; --border-strong: #46464c; --text: #ececee; --muted: #a1a1a8; --faint: #707077;
	--accent: #f5a524; --accent-hover: #ffb84a; --accent-soft: #3a2f19; --on-accent: #121213; --accent-2: #60a5fa;
	--ok: #4ade80; --ok-soft: #183323; --info: #60a5fa; --info-soft: #1b2a40; --warn: #f5a524; --warn-soft: #3a2f19;
	--danger: #f87171; --danger-soft: #3f1f20; --none: #a1a1a8; --none-soft: #2a2a2e;
	--s0: #ef4444; --s1: #f97316; --s2: #eab308; --s3: #22c55e; --s4: #38bdf8;
	--shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
	--shadow-pop: 0 20px 60px -12px rgba(0, 0, 0, .75);
	--scheme: dark;
}
[data-theme="ocean"] {
	--bg: #08171d; --bg-glow: #0d2e38; --surface: #0d2129; --surface-2: #112933; --surface-3: #16333f;
	--border: #1c3d4a; --border-strong: #285566; --text: #def3f7; --muted: #8fb5bf; --faint: #5f8590;
	--accent: #2ec4d6; --accent-hover: #55d4e2; --accent-soft: #0f3b45; --on-accent: #06161b; --accent-2: #f59e7a;
	--ok: #5ee0a0; --ok-soft: #0f3a2c; --info: #6cb8ff; --info-soft: #12304a; --warn: #f8c35c; --warn-soft: #3a3118;
	--danger: #ff7a8a; --danger-soft: #3f1d27; --none: #8fb5bf; --none-soft: #14303a;
	--s0: #ff5d73; --s1: #ff9a4d; --s2: #f8d04a; --s3: #4fe09a; --s4: #2ec4d6;
	--shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
	--shadow-pop: 0 20px 60px -12px rgba(0, 0, 0, .75);
	--scheme: dark;
}
[data-theme="forest"] {
	--bg: #0d1610; --bg-glow: #1a2e20; --surface: #132018; --surface-2: #18281e; --surface-3: #1f3126;
	--border: #26402f; --border-strong: #345a41; --text: #e3f2e7; --muted: #96b39f; --faint: #688572;
	--accent: #7bd389; --accent-hover: #98e2a3; --accent-soft: #1d3a25; --on-accent: #0b150e; --accent-2: #e8b45a;
	--ok: #7bd389; --ok-soft: #1d3a25; --info: #7fb8f0; --info-soft: #18304a; --warn: #e8b45a; --warn-soft: #3a3019;
	--danger: #f28b82; --danger-soft: #401f1d; --none: #96b39f; --none-soft: #1c2e22;
	--s0: #ef6b62; --s1: #f0a04b; --s2: #e8cf5a; --s3: #7bd389; --s4: #5fd0c0;
	--shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
	--shadow-pop: 0 20px 60px -12px rgba(0, 0, 0, .75);
	--scheme: dark;
}
[data-theme="plum"] {
	--bg: #170f1c; --bg-glow: #2e1838; --surface: #21162a; --surface-2: #281b33; --surface-3: #31223e;
	--border: #3d2a4c; --border-strong: #553a69; --text: #f2e8f7; --muted: #b7a1c4; --faint: #84709a;
	--accent: #e07ac7; --accent-hover: #eb96d6; --accent-soft: #3f2140; --on-accent: #170f1c; --accent-2: #8fa8ff;
	--ok: #6ee7a8; --ok-soft: #1c3a2c; --info: #8fa8ff; --info-soft: #232c52; --warn: #f7c46c; --warn-soft: #3d311c;
	--danger: #ff7f9d; --danger-soft: #44202d; --none: #b7a1c4; --none-soft: #2c1f38;
	--s0: #ff5f86; --s1: #ff9c5b; --s2: #f7d05e; --s3: #6ee7a8; --s4: #8fa8ff;
	--shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
	--shadow-pop: 0 20px 60px -12px rgba(0, 0, 0, .75);
	--scheme: dark;
}
[data-theme="contrast-light"] {
	--bg: #ffffff; --bg-glow: #ffffff; --surface: #ffffff; --surface-2: #f2f2f2; --surface-3: #e6e6e6;
	--border: #000000; --border-strong: #000000; --text: #000000; --muted: #1f1f1f; --faint: #3d3d3d;
	--accent: #0033cc; --accent-hover: #002699; --accent-soft: #dde5ff; --on-accent: #ffffff; --accent-2: #8a2be2;
	--ok: #006400; --ok-soft: #e0f5e0; --info: #0033cc; --info-soft: #dde5ff; --warn: #8a4b00; --warn-soft: #fff0d6;
	--danger: #b00000; --danger-soft: #ffe0e0; --none: #000000; --none-soft: #ededed;
	--s0: #b00000; --s1: #c45500; --s2: #8a6d00; --s3: #006400; --s4: #0033cc;
	--shadow: none; --shadow-pop: 0 0 0 2px #000000;
	--scheme: light;
}
[data-theme="contrast-dark"] {
	--bg: #000000; --bg-glow: #000000; --surface: #000000; --surface-2: #121212; --surface-3: #1f1f1f;
	--border: #ffffff; --border-strong: #ffffff; --text: #ffffff; --muted: #e6e6e6; --faint: #c2c2c2;
	--accent: #ffd400; --accent-hover: #ffe14d; --accent-soft: #332b00; --on-accent: #000000; --accent-2: #00e5ff;
	--ok: #00ff7f; --ok-soft: #00331a; --info: #00e5ff; --info-soft: #00303a; --warn: #ffd400; --warn-soft: #332b00;
	--danger: #ff6b6b; --danger-soft: #3a0000; --none: #ffffff; --none-soft: #1f1f1f;
	--s0: #ff4d4d; --s1: #ff9f1a; --s2: #ffd400; --s3: #00ff7f; --s4: #00e5ff;
	--shadow: none; --shadow-pop: 0 0 0 2px #ffffff;
	--scheme: dark;
}

/* ---------- Base ---------- */

:root {
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
	--radius: 14px;
	--radius-sm: 9px;
	--ease: cubic-bezier(.2, .8, .2, 1);
	--spring: cubic-bezier(.34, 1.56, .64, 1);
	color-scheme: var(--scheme);
}

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

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

body {
	margin: 0;
	font: 15px/1.5 var(--font);
	color: var(--text);
	background: var(--bg);
	background-image: radial-gradient(1200px 600px at 10% -10%, var(--bg-glow), transparent 60%),
		radial-gradient(900px 500px at 110% 10%, var(--bg-glow), transparent 55%);
	background-attachment: fixed;
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
}

.theme-transition, .theme-transition * {
	transition: background-color .35s var(--ease), border-color .35s var(--ease), color .2s var(--ease), fill .35s, stroke .35s !important;
}

::selection { background: var(--accent); color: var(--on-accent); }

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

.icon { flex: none; display: block; }

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

.hidden { display: none !important; }

/* ---------- Card ---------- */

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) + 4px);
	box-shadow: var(--shadow);
}

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

.btn {
	--btn-bg: var(--surface-2);
	--btn-fg: var(--text);
	display: inline-flex; align-items: center; justify-content: center; gap: .5em;
	min-height: 40px; padding: 0 16px;
	font: 600 14px/1 var(--font);
	color: var(--btn-fg); background: var(--btn-bg);
	border: 1px solid var(--border); border-radius: var(--radius-sm);
	cursor: pointer; user-select: none; white-space: nowrap;
	transition: background-color .15s, border-color .15s, transform .12s var(--ease), box-shadow .2s;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); border-color: transparent; box-shadow: 0 6px 16px -8px var(--accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { --btn-bg: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon-only { width: 40px; padding: 0; }
.btn.small { min-height: 32px; padding: 0 11px; font-size: 13px; }
.btn.small.icon-only { width: 32px; }

/* ---------- Inputs ---------- */

.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }

.input, .select, .textarea {
	width: 100%; min-height: 42px; padding: 9px 12px;
	font: 15px/1.4 var(--font); color: var(--text);
	background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
	transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono, .textarea.mono { font-family: var(--mono); font-size: 14px; }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 46px; }
.input-group .btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-group .btn:active { transform: translateY(-50%) scale(.94); }

/* ---------- Switch ---------- */

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 6px 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
	flex: none; position: relative; width: 40px; height: 24px; margin-top: 1px;
	background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 999px;
	transition: background-color .2s, border-color .2s;
}
.switch .track::after {
	content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
	background: var(--surface); border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	transition: transform .25s var(--spring);
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch .switch-text { display: grid; gap: 1px; }
.switch .switch-text strong { font-size: 14px; font-weight: 600; }
.switch .switch-text span { font-size: 12.5px; color: var(--muted); }

/* ---------- Chips (toggle buttons) ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
	display: inline-flex; align-items: center; gap: 6px;
	min-height: 36px; padding: 0 13px;
	font: 600 13.5px/1 var(--font); color: var(--muted);
	background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px;
	cursor: pointer; user-select: none;
	transition: background-color .15s, color .15s, border-color .15s, transform .12s var(--ease);
}
.chip:hover { border-color: var(--faint); color: var(--text); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"], .chip.selected { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip code { font-family: var(--mono); font-size: 12.5px; }

/* ---------- Segmented control ---------- */

.segmented {
	display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
	padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.segmented button {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	min-height: 36px; padding: 0 14px;
	font: 600 14px/1 var(--font); color: var(--muted);
	background: transparent; border: 0; border-radius: 9px; cursor: pointer;
	transition: background-color .2s, color .2s, box-shadow .2s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-selected="true"] { color: var(--text); background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 1px var(--border); }

/* ---------- Badges ---------- */

.badge {
	display: inline-flex; align-items: center; gap: 5px;
	padding: 3px 9px; font: 700 11px/1.3 var(--font); letter-spacing: .02em; text-transform: uppercase;
	border-radius: 999px; white-space: nowrap;
}
.badge.strong { color: var(--ok); background: var(--ok-soft); }
.badge.ok { color: var(--info); background: var(--info-soft); }
.badge.weak { color: var(--warn); background: var(--warn-soft); }
.badge.none { color: var(--none); background: var(--none-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }

/* ---------- Range slider ---------- */

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--surface-3) var(--fill, 50%)); }
.range::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-3); }
.range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .15s var(--spring); }
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.range:active::-webkit-slider-thumb { transform: scale(1.15); }

/* ---------- Toast ---------- */

.toast-host { position: fixed; z-index: 1000; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast-host[popover] { inset: auto auto max(20px, env(safe-area-inset-bottom)) 50%; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible; width: max-content; max-width: calc(100vw - 32px); }
.toast {
	display: flex; align-items: center; gap: 10px; padding: 11px 16px;
	font-weight: 600; color: var(--on-accent); background: var(--text);
	border-radius: 12px; box-shadow: var(--shadow-pop);
	animation: toast-in .35s var(--spring) both;
}
[data-theme] .toast { color: var(--bg); }
.toast.leaving { animation: toast-out .25s var(--ease) both; }
.toast.with-action { pointer-events: auto; }
.toast.bump { animation: toast-bump .3s var(--spring); }
@keyframes toast-bump { 40% { transform: scale(1.06); } }
.toast-action { margin-left: 6px; padding: 5px 10px; font: 700 13px/1 var(--font); color: inherit; background: rgba(127, 127, 127, .22); border: 0; border-radius: 7px; cursor: pointer; }
.toast-action:hover { background: rgba(127, 127, 127, .35); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Popover ---------- */

.popover {
	position: absolute; z-index: 50; padding: 12px;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow-pop);
	transform-origin: top right; animation: pop-in .22s var(--spring) both;
}
@keyframes pop-in { from { opacity: 0; transform: scale(.94) translateY(-4px); } }

/* ---------- Top bar ---------- */

.topbar {
	display: flex; align-items: center; justify-content: space-between; gap: 16px;
	max-width: 1240px; margin: 0 auto;
	padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 8px max(24px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark {
	display: grid; place-items: center; flex: none; width: 48px; height: 48px;
	color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2));
	border-radius: 15px; box-shadow: 0 10px 24px -10px var(--accent);
	animation: mark-in .7s var(--spring) both;
}
@keyframes mark-in { from { opacity: 0; transform: rotate(-20deg) scale(.6); } }
.brand h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.tagline { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.tagline .icon { color: var(--ok); }
.topbar-actions { position: relative; }

/* ---------- Theme picker ---------- */

.theme-popover { right: 0; top: calc(100% + 8px); width: min(320px, calc(100vw - 32px)); }
.theme-sections { display: grid; gap: 12px; }
.theme-sections h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.theme-option {
	display: grid; gap: 6px; padding: 8px; text-align: left;
	font: 600 12px/1.25 var(--font); color: var(--text);
	background: var(--surface); border: 1px solid var(--border); border-radius: 11px; cursor: pointer;
	transition: border-color .15s, transform .15s var(--spring);
}
.theme-option:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.theme-option[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.theme-swatch { display: flex; height: 26px; overflow: hidden; border-radius: 7px; border: 1px solid rgba(127, 127, 127, .25); }
.theme-swatch span { flex: 1; }
.theme-swatch span:last-child { flex: 0 0 38%; }
.theme-option.auto .theme-swatch span:first-child { background: linear-gradient(135deg, #f5f6fa 50%, #0f1220 50%); }

@media (max-width: 640px) {
	.topbar { padding-left: 16px; padding-right: 16px; }
	.brand h1 { font-size: 19px; }
	.tagline { font-size: 12px; }
}

/* ---------- Motion preference ---------- */

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