:root {
	--bn-bg: #111a24;
	--bn-panel: #172330;
	--bn-panel-soft: #1d2b3a;
	--bn-text: #f4f6f8;
	--bn-muted: #aeb9c5;
	--bn-line: rgba(255,255,255,.1);
	--bn-accent: #dbe6ef;
	--bn-highlight: #79b8f2;
	--bn-highlight-soft: #203c57;
	--bn-danger: #e29a9a;
	--bn-radius: 24px;
}

#badnight-app #bn-backbar {position:sticky;top:calc(var(--bn-header-height,61px) + 4px);z-index:19;width:fit-content;margin:4px 0 0 max(18px,calc((100% - 1180px)/2));padding:0;background:transparent;border:0;}
@media(max-width:640px) {#badnight-app #bn-backbar {margin-left:14px;}}
#badnight-app #bn-backbar[hidden] {display:none!important;}
#badnight-app #bn-backbar.bn-has-offer {display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box;width:calc(100% - 36px);max-width:1180px;margin:4px auto 0;padding:8px 0;background:transparent;pointer-events:none;}
#badnight-app #bn-backbar button,#badnight-app #bn-backbar a {pointer-events:auto;}
#badnight-app #bn-trial-offer {display:flex;align-items:center;justify-content:flex-end;margin-left:auto;min-width:0;max-width:380px;}
#badnight-app #bn-trial-remaining {color:inherit;font-size:13px;font-weight:500;line-height:1.35;}
#badnight-app #bn-trial-buy {display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:12px 16px;min-height:54px;box-sizing:border-box;font-size:15px;line-height:1.35;text-align:left;white-space:normal;border:0;border-radius:14px;box-shadow:0 5px 18px #0004;}
#badnight-app #bn-trial-buy strong,#badnight-app #bn-trial-buy strong span {color:#111a24!important;}
#badnight-app #bn-back[hidden],#badnight-app #bn-trial-offer[hidden] {display:none!important;}
@media(max-width:640px) {
 #badnight-app #bn-backbar.bn-has-offer {width:calc(100% - 28px);gap:8px;}
 #badnight-app #bn-trial-remaining {font-size:12px;}
 #badnight-app #bn-trial-buy {font-size:13px;padding:10px 12px;}
 #badnight-app #bn-trial-buy strong span {display:inline;}
 #badnight-app #bn-backbar.bn-has-offer #bn-back {flex-shrink:0;padding:8px 10px;}
}
#badnight-app #bn-back {display:inline-flex;align-items:center;min-height:40px;margin:0;padding:8px 14px;border:1px solid var(--bn-highlight);border-radius:12px;background:var(--bn-highlight-soft);color:var(--bn-text)!important;font:inherit;font-size:15px;font-weight:600;line-height:1.4;cursor:pointer;}
#badnight-app .badnight-main {padding-top:24px;}
#badnight-app.bn-detail-view .badnight-main {padding-top:12px;}
#badnight-app.bn-detail-view .badnight-hero--compact {margin-bottom:20px;}
#badnight-app.bn-detail-view .badnight-hero h1 {font-size:clamp(30px,5vw,48px);margin:0 0 12px;}
#badnight-app.bn-detail-view .badnight-hero p:last-child {margin-bottom:0;}
#badnight-app .bn-notes {display:grid;gap:8px;margin:24px 0;}
#badnight-app .bn-notes textarea {box-sizing:border-box;width:100%;min-height:120px;padding:14px;background:var(--bn-bg);color:var(--bn-text);border:1px solid var(--bn-muted);border-radius:12px;font:inherit;font-size:16px;line-height:1.5;resize:vertical;}
#badnight-app .bn-notes textarea::placeholder {color:var(--bn-muted);opacity:1;}
#badnight-app #bn-insights .bn-main-chart,#badnight-app #bn-log-editor {scroll-margin-top:calc(var(--bn-header-height,61px) + 68px);}

/* Luminous derivative of Noravu Muted Sleep Blue (#667B8D). */
#badnight-app .bn-journey { margin: 24px 0; }
#badnight-app .bn-journey ol { display:flex; gap:8px; padding:0; margin:0; list-style:none; }
#badnight-app .bn-journey li { display:flex; align-items:center; gap:6px; flex:1; font-size:14px; color:var(--bn-muted) !important; }
#badnight-app .bn-journey li > span { display:grid; place-items:center; flex:0 0 24px; height:24px; border:1px solid var(--bn-line); border-radius:50%; }
#badnight-app .bn-journey [aria-current=step] { color:var(--bn-highlight) !important; font-weight:600; }
#badnight-app .bn-journey [aria-current=step] > span { border-color:var(--bn-highlight); background:var(--bn-highlight-soft); }
#badnight-app .bn-sleep-intro { max-width:720px; margin-top:20px; }
#badnight-app .bn-sleep-intro p { font-size:16px; line-height:1.65; margin:12px 0; }
#badnight-app .bn-sleep-intro summary { padding:10px 0; color:var(--bn-highlight); cursor:pointer; text-decoration:underline; text-underline-offset:4px; }
#badnight-app .bn-sleep-intro details[open] { padding-bottom:12px; border-bottom:1px solid var(--bn-line); }

.badnight-app,
.badnight-public {
	box-sizing: border-box;
	background: var(--bn-bg);
	color: var(--bn-text);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	line-height: 1.5;
}

.badnight-app *,
.badnight-public * { box-sizing: border-box; }

.badnight-app {
	min-height: 100vh;
	width: 100%;
	padding-bottom: 80px;
}

.badnight-header {
	position: sticky;
	top: 0;
	z-index: 20;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 16px;
	padding: 18px clamp(18px, 4vw, 56px);
	background: rgba(17,26,36,.92);
	border-bottom: 1px solid var(--bn-line);
	backdrop-filter: blur(18px);
}

.badnight-brand,
.badnight-main-nav button,
.badnight-icon-button,
.badnight-back {
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.badnight-brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	justify-self: start;
	font-weight: 700;
	letter-spacing: -.02em;
}

.badnight-brand__mark {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border: 1px solid rgba(255,255,255,.3);
	border-radius: 50%;
}

.badnight-main-nav {
	display: flex;
	padding: 4px;
	border: 1px solid var(--bn-line);
	border-radius: 999px;
	background: rgba(255,255,255,.035);
}

.badnight-main-nav button {
	min-height: 42px;
	padding: 8px 18px;
	border-radius: 999px;
	color: var(--bn-muted);
}

.badnight-main-nav button.is-active {
	background: var(--bn-text);
	color: var(--bn-bg);
}

.badnight-icon-button {
	justify-self: end;
	width: 44px;
	height: 44px;
	border: 1px solid var(--bn-line);
	border-radius: 50%;
	font-size: 30px;
	line-height: 1;
}

.badnight-main {
	width: min(1180px, calc(100% - 36px));
	margin: 0 auto;
	padding: clamp(44px, 8vw, 100px) 0;
}

.badnight-view[hidden] { display: none !important; }

.badnight-hero {
	max-width: 760px;
	margin-bottom: clamp(50px, 8vw, 92px);
}

.badnight-hero--compact { margin-bottom: 42px; }

.badnight-eyebrow {
	margin: 0 0 10px;
	color: var(--bn-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .13em;
	text-transform: uppercase;
}

.badnight-hero h1,
.badnight-public h1,
.badnight-player h1 {
	margin: 0 0 18px;
	color: var(--bn-text);
	font-size: clamp(38px, 7vw, 76px);
	line-height: 1.02;
	letter-spacing: -.055em;
}

.badnight-hero p,
.badnight-public p,
.badnight-player p {
	color: var(--bn-muted);
	font-size: clamp(16px, 2vw, 20px);
}

.badnight-section { margin: 0 0 68px; }
.badnight-section__head {
	display: flex;
	justify-content: space-between;
	align-items: end;
	margin-bottom: 20px;
}
.badnight-section h2,
.badnight-sleep-panel h2,
.badnight-settings-card h2 {
	margin: 0;
	font-size: clamp(24px, 3vw, 36px);
	letter-spacing: -.035em;
}

.badnight-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: clamp(14px, 2vw, 24px);
}

.badnight-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 0;
	overflow: hidden;
	border: 1px solid var(--bn-line);
	border-radius: var(--bn-radius);
	background: var(--bn-panel);
	color: var(--bn-text);
	text-align: left;
	cursor: pointer;
	transition: transform .2s ease, border-color .2s ease;
}

.badnight-card:hover,
.badnight-card:focus-visible {
	transform: translateY(-3px);
	border-color: rgba(255,255,255,.28);
	outline: none;
}

.badnight-card__media {
	position: relative;
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	background: linear-gradient(145deg, #233347, #607791);
}

.badnight-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.badnight-card__fallback {
	display: block;
	width: 100%;
	height: 100%;
	background: radial-gradient(circle at 72% 20%, rgba(255,255,255,.16), transparent 27%), linear-gradient(145deg, #1d2a39, #5d7087);
}

.badnight-card__favorite {
	position: absolute;
	top: 12px;
	right: 12px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(17,26,36,.72);
	font-size: 22px;
}

.badnight-card__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 18px;
}

.badnight-card__body strong {
	font-size: 18px;
	line-height: 1.25;
	display: block;
	overflow-wrap: anywhere;
	min-height: 2.5em;
}

.badnight-card__body > span {
	display: -webkit-box;
	overflow: hidden;
	color: var(--bn-muted);
	font-size: 14px;
	-webkit-line-clamp: 2;
	line-height: 1.5;
	min-height: 3em;
	-webkit-box-orient: vertical;
}

.badnight-card__body small { color: var(--bn-accent); }

.badnight-back {
	min-height: 44px;
	margin-bottom: 28px;
	padding: 0;
	color: var(--bn-muted);
}

.badnight-player {
	display: grid;
	grid-template-columns: minmax(280px, 480px) minmax(0, 1fr);
	gap: clamp(34px, 7vw, 92px);
	align-items: center;
}

.badnight-player__cover {
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 34px;
	background: var(--bn-panel);
}
.badnight-player__cover img { width: 100%; height: 100%; object-fit: cover; }
.badnight-player__content { max-width: 620px; }
.badnight-player audio { width: 100%; margin-top: 28px; }
.badnight-player__status { font-size: 14px !important; }

#badnight-app .bn-share-button {display:inline-flex;align-items:center;gap:8px;min-height:48px;margin:8px 0 8px 16px;padding:8px 12px;border:1px solid var(--bn-line);border-radius:12px;background:var(--bn-panel);color:var(--bn-text);font:inherit;cursor:pointer;}
#badnight-app .bn-share-button svg {width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
#badnight-app .bn-share-fallback input {width:100%;box-sizing:border-box;}
#badnight-app .bn-audio-panel {margin-top:24px;padding:20px;border:1px solid var(--bn-line);border-radius:22px;background:var(--bn-panel);}
#badnight-app .bn-audio-toggle {display:flex;align-items:center;justify-content:center;gap:14px;min-height:72px;width:100%;padding:12px 18px;border:0;border-radius:16px;background:#79B8F2;color:#111A24;font:inherit;font-size:18px;font-weight:700;cursor:pointer;}
#badnight-app .bn-audio-toggle svg {width:36px;height:36px;flex:none;fill:currentColor;}
#badnight-app .bn-audio-panel audio {display:block;width:100%;height:54px;margin:16px 0 0;}
#badnight-app .bn-audio-feedback {margin:10px 0 0;font-size:14px;}
#badnight-app .bn-audio-feedback:empty {display:none;}
#badnight-app .bn-audio-toggle:focus-visible,#badnight-app .bn-share-button:focus-visible {outline:3px solid var(--bn-text);outline-offset:3px;}

.badnight-favorite-button {
	min-height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--bn-text);
	font: inherit;
	cursor: pointer;
}
.badnight-favorite-button span { color: #f0b6b6; font-size: 22px; }

.badnight-sleep-panel,
.badnight-settings-card,
.badnight-log-form,
.badnight-consent,
.badnight-empty {
	margin-bottom: 28px;
	padding: clamp(22px, 4vw, 38px);
	border: 1px solid var(--bn-line);
	border-radius: var(--bn-radius);
	background: var(--bn-panel);
}

.badnight-calendar__head {
	display: grid;
	grid-template-columns: 44px 1fr 44px;
	align-items: center;
	margin-bottom: 20px;
	text-align: center;
}
.badnight-calendar__head h2 { text-transform: capitalize; }
.badnight-calendar__head button {
	width: 44px;
	height: 44px;
	border: 1px solid var(--bn-line);
	border-radius: 50%;
	background: transparent;
	color: var(--bn-text);
	cursor: pointer;
}

.badnight-calendar__week,
.badnight-calendar {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 8px;
}
.badnight-calendar__week {
	margin-bottom: 8px;
	color: var(--bn-muted);
	font-size: 12px;
	text-align: center;
}

.badnight-calendar__day {
	position: relative;
	aspect-ratio: 1;
	min-width: 0;
	border: 1px solid var(--bn-line);
	border-radius: 14px;
	background: rgba(255,255,255,.025);
	color: var(--bn-text);
	cursor: pointer;
}
.badnight-calendar__day:disabled { opacity: .28; cursor: default; }
.badnight-calendar__day i {
	position: absolute;
	right: 8px;
	bottom: 8px;
	width: 7px;
	height: 7px;
	border-radius: 50%;
}
.badnight-calendar__day.has-session { border-color: rgba(121,184,242,.5); }
.badnight-calendar__day.has-session i { background: var(--bn-highlight); }
.badnight-calendar__day.has-log { background: rgba(255,255,255,.08); }
.badnight-calendar__day.has-log i { box-shadow: -10px 0 0 #dbe6ef; }

.badnight-calendar__legend {
	display: flex;
	gap: 18px;
	margin-top: 18px;
	color: var(--bn-muted);
	font-size: 13px;
}
.badnight-calendar__legend i {
	display: inline-block;
	width: 8px;
	height: 8px;
	margin-right: 6px;
	border-radius: 50%;
}
.badnight-calendar__legend .is-session { background: var(--bn-highlight); }
.badnight-calendar__legend .is-log { background: var(--bn-accent); }

.badnight-chart svg { width: 100%; height: auto; overflow: visible; }
.badnight-chart line { stroke: var(--bn-line); }
.badnight-chart polyline { fill: none; stroke: var(--bn-accent); stroke-width: 3; }
.badnight-chart circle { fill: var(--bn-panel); stroke: var(--bn-accent); stroke-width: 3; }
.badnight-chart circle.has-session { fill: var(--bn-highlight); stroke: var(--bn-highlight); }
.badnight-chart p { color: var(--bn-muted); font-size: 13px; }

.badnight-form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px;
	margin: 26px 0;
}
.badnight-form-grid label { display: flex; flex-direction: column; gap: 8px; }
.badnight-form-grid label span { font-weight: 600; }
.badnight-form-grid select,
.badnight-form-grid input,
.badnight-email-form input[type="email"],
.badnight-login input[type="email"],
.badnight-login input[type="text"],
.badnight-login input[type="password"] {
	width: 100%;
	min-height: 48px;
	padding: 10px 12px;
	border: 1px solid var(--bn-line);
	border-radius: 12px;
	background: #0d151d;
	color: var(--bn-text);
	font: inherit;
}

.badnight-button,
.badnight-login input[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 50px;
	padding: 12px 22px;
	border: 1px solid var(--bn-text);
	border-radius: 999px;
	background: var(--bn-text);
	color: var(--bn-bg);
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
	text-decoration: none;
	cursor: pointer;
}
.badnight-button--ghost { background: transparent; color: var(--bn-text); border-color: var(--bn-line); }
.badnight-button--danger { background: transparent; color: var(--bn-danger); border-color: rgba(226,154,154,.45); }
.badnight-form-actions,
.badnight-sales__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.badnight-link {
	display: inline-block;
	margin-top: 18px;
	color: var(--bn-accent);
	text-underline-offset: 4px;
}

.badnight-public {
	min-height: min(760px, 100vh);
	display: grid;
	place-items: center;
	padding: 60px 20px;
	border-radius: 28px;
}
.badnight-sales,
.badnight-login,
.badnight-access-denied { width: min(680px, 100%); }
.badnight-login form { margin-top: 28px; }
.badnight-email-form { margin: 28px 0; }
.badnight-email-form > label { display: block; margin-bottom: 8px; color: var(--bn-muted); }
.badnight-email-form__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.badnight-divider { display: flex; align-items: center; gap: 12px; margin: 30px 0 0; font-size: 14px !important; }
.badnight-divider::before,
.badnight-divider::after { content: ""; height: 1px; flex: 1; background: var(--bn-line); }
.badnight-notice { margin: 18px 0; padding: 14px 16px; border: 1px solid var(--bn-line); border-radius: 12px; background: var(--bn-panel); }
.badnight-login label { color: var(--bn-muted); }
.badnight-login .login-remember label { display: flex; align-items: center; gap: 8px; }
.badnight-login .login-submit { margin-bottom: 0; }
.badnight-public .bn-password-page { min-width: 0; }
.badnight-public .bn-password-page h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.2; overflow-wrap: anywhere; }
.badnight-public .bn-password-page p { overflow-wrap: anywhere; }

.badnight-toast {
	position: fixed;
	z-index: 99;
	right: 20px;
	bottom: 20px;
	max-width: min(420px, calc(100vw - 40px));
	padding: 14px 18px;
	border: 1px solid var(--bn-line);
	border-radius: 14px;
	background: #f4f6f8;
	color: #111a24;
	box-shadow: 0 18px 50px rgba(0,0,0,.3);
}

@media (max-width: 920px) {
	.badnight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.badnight-player { grid-template-columns: minmax(0, 1fr); }
	.badnight-player__cover { width: min(520px, 100%); }
}

@media (max-width: 640px) {
	.badnight-email-form__row { grid-template-columns: 1fr; }
	.badnight-header {
		grid-template-columns: 1fr auto;
		padding: 12px 16px 68px;
	}
	.badnight-brand > span:last-child { display: none; }
	.badnight-main-nav {
		position: absolute;
		right: 16px;
		bottom: 10px;
		left: 16px;
		display: grid;
		grid-template-columns: 1fr 1fr;
	}
	.badnight-icon-button { grid-column: 2; grid-row: 1; }
	.badnight-main { width: min(100% - 28px, 1180px); padding-top: 46px; }
	.badnight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
	.badnight-card { border-radius: 18px; }
	.badnight-card__body { padding: 13px; }
	.badnight-card__body strong { font-size: 15px; }
	.badnight-card__body > span { display: none; }
	.badnight-form-grid { grid-template-columns: 1fr; }
	.badnight-calendar { gap: 5px; }
	.badnight-calendar__day { border-radius: 10px; }
	.badnight-player__cover { border-radius: 24px; }
}

@media (prefers-reduced-motion: reduce) {
	.badnight-card { transition: none; }
	* { scroll-behavior: auto !important; }
}

.badnight-main-nav button:focus-visible,
.badnight-icon-button:focus-visible,
.badnight-brand:focus-visible,
.badnight-back:focus-visible,
.badnight-button:focus-visible,
.badnight-calendar__day:focus-visible,
.badnight-calendar__head button:focus-visible,
.badnight-favorite-button:focus-visible,
.badnight-link:focus-visible {
	outline: 3px solid #dbe6ef;
	outline-offset: 3px;
}

html:has(body.badnight-shell),
body.badnight-shell {
	min-height: 100%;
	margin: 0;
	background: #111a24;
}
body.badnight-shell > .badnight-shell__content {
	min-height: 100vh;
}
body.badnight-shell .badnight-public {
	border-radius: 0;
}

/*
 * Theme isolation and contrast guard.
 *
 * Astra, Elementor and other themes may declare their own heading and form
 * colors after this stylesheet. Keep all Bad Night typography inside the
 * component palette without changing the surrounding site.
 */
#badnight-app h1,
#badnight-app h2,
#badnight-app h3,
#badnight-app h4,
#badnight-app h5,
#badnight-app h6,
.badnight-public h1,
.badnight-public h2,
.badnight-public h3,
.badnight-public h4,
.badnight-public h5,
.badnight-public h6 {
	color: var(--bn-text) !important;
}

#badnight-app p,
#badnight-app li,
#badnight-app label,
#badnight-app label > span,
#badnight-app legend,
#badnight-app strong,
.badnight-public li,
.badnight-public strong {
	color: var(--bn-text) !important;
}

#badnight-app .badnight-eyebrow,
#badnight-app .badnight-hero p,
#badnight-app .badnight-player p,
#badnight-app .badnight-chart p,
#badnight-app .badnight-settings-card > p,
#badnight-app .badnight-consent > p,
#badnight-app .badnight-calendar__week,
#badnight-app .badnight-calendar__legend,
#badnight-app .badnight-card__body > span,
#badnight-app .badnight-back,
#badnight-app .badnight-main-nav button:not(.is-active),
.badnight-public p,
.badnight-public label {
	color: var(--bn-muted) !important;
}

#badnight-app .badnight-card,
#badnight-app .badnight-calendar__day,
#badnight-app .badnight-calendar__head button,
#badnight-app .badnight-favorite-button {
	color: var(--bn-text) !important;
}

#badnight-app .badnight-main-nav button.is-active {
	color: var(--bn-bg) !important;
}

#badnight-app .badnight-card__body small {
	color: var(--bn-accent) !important;
}

#badnight-app .badnight-link,
#badnight-app .badnight-link:visited,
.badnight-public .badnight-link,
.badnight-public .badnight-link:visited {
	color: var(--bn-accent) !important;
	text-decoration: underline !important;
	text-decoration-thickness: 1px !important;
	text-underline-offset: 4px;
}

#badnight-app .badnight-button,
#badnight-app .badnight-button:visited,
.badnight-public .badnight-button,
.badnight-public .badnight-button:visited {
	color: var(--bn-bg) !important;
}

#badnight-app .badnight-button--ghost,
#badnight-app .badnight-button--ghost:visited,
.badnight-public .badnight-button--ghost,
.badnight-public .badnight-button--ghost:visited {
	color: var(--bn-text) !important;
}

#badnight-app .badnight-button--danger,
#badnight-app .badnight-button--danger:visited {
	color: var(--bn-danger) !important;
}

#badnight-app select,
#badnight-app input,
.badnight-public select,
.badnight-public input {
	color-scheme: dark;
}

/* Navigation and sleep insights */
#badnight-app .badnight-header { grid-template-columns:44px 1fr 44px; padding:8px 20px; }
#badnight-app .badnight-icon-button {display:grid;place-items:center;font-size:inherit;justify-self:stretch;grid-column:auto;grid-row:auto;}
#badnight-app .badnight-icon-button svg {width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;}
.bn-logo {justify-self:center;display:flex;align-items:center;}
.bn-logo img {width:140px;height:auto;max-height:44px;object-fit:contain;}
#badnight-app .bn-tabs {position:static;display:flex;width:max-content;max-width:95%;margin:18px auto 0;}
#badnight-app .bn-drawer {margin:0;height:100dvh;max-height:100dvh;width:min(340px,88vw);max-width:88vw;padding:24px;background:var(--bn-panel);color:var(--bn-text);border:0;}
.bn-drawer::backdrop {background:rgba(0,0,0,.6);}
.bn-drawer nav {display:grid;gap:12px;margin-top:36px;}
#badnight-app .bn-drawer nav button,#badnight-app .bn-drawer nav a {padding:16px;background:transparent;color:var(--bn-text);border:1px solid var(--bn-line);border-radius:12px;text-align:left;font:inherit;text-decoration:none;}
.badnight-calendar__head button {display:grid;place-items:center;padding:0;line-height:1;}
.bn-filters {display:flex;gap:16px;flex-wrap:wrap;margin:24px 0;}
.bn-filters label {display:grid;gap:8px;align-content:center;}
#badnight-app .bn-filters select {background:var(--bn-bg);color:var(--bn-text);padding:12px;border:1px solid var(--bn-line);border-radius:10px;}
.bn-metric-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:28px;}
#badnight-app .bn-metric-card {display:grid;gap:10px;padding:20px;text-align:left;border:1px solid var(--bn-line);background:var(--bn-bg);color:var(--bn-text);border-radius:18px;cursor:pointer;}
.bn-metric-card strong {font-size:28px;}
.bn-metric-card small {color:var(--bn-muted);font-size:12px;}
#badnight-app .bn-metric-card[aria-pressed=true] {border-color:var(--bn-highlight);}
.badnight-chart text {fill:var(--bn-muted);font-size:12px;}
.badnight-chart [role=button] {cursor:pointer;}
.badnight-chart [role=button]:focus circle:last-child {stroke:var(--bn-highlight);stroke-width:5;}
.bn-rating {border:0;padding:0;margin:0;min-width:0;grid-column:1/-1;}
.bn-rating legend {margin-bottom:12px;font-weight:600;}
.bn-rating > div {display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;}
.bn-rating label {position:relative;cursor:pointer;}
.bn-rating input {position:absolute;opacity:0;width:1px;height:1px;}
.bn-rating label span {display:grid;gap:6px;min-height:84px;padding:10px 4px;text-align:center;align-content:center;border:1px solid var(--bn-line);border-radius:12px;background:var(--bn-bg);}
.bn-rating small {font-size:11px;line-height:1.25;}
.bn-rating input:checked + span {border-color:var(--bn-highlight);background:var(--bn-highlight-soft);}
.bn-rating input:focus-visible + span {outline:2px solid var(--bn-text);outline-offset:2px;}
@media(max-width:640px) {.bn-metric-grid {grid-template-columns:repeat(2,minmax(0,1fr));}.bn-metric-card {padding:14px!important;}.bn-logo img {width:118px;}}

/* Persistent navigation sits inside the browser viewport, above the home indicator. */
#badnight-app {padding-bottom:calc(112px + env(safe-area-inset-bottom, 0px));}
#badnight-app .bn-bottom-nav {position:fixed;z-index:50;bottom:0;left:50%;transform:translateX(-50%);width:min(620px,100%);display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;padding:10px 12px calc(10px + env(safe-area-inset-bottom, 0px));background:rgba(28,35,37,.97);border:1px solid var(--bn-line);border-radius:24px 24px 0 0;box-shadow:0 -8px 30px #0003;backdrop-filter:blur(16px);box-sizing:border-box;}
#badnight-app .bn-bottom-nav button,#badnight-app .bn-bottom-nav a {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-height:56px;padding:7px 2px;border:0;border-radius:16px;background:transparent;color:var(--bn-text)!important;font:inherit;font-size:12px;line-height:1.3;text-decoration:none;cursor:pointer;}
#badnight-app .bn-bottom-nav .is-active {background:var(--bn-highlight-soft);box-shadow:inset 0 0 0 1px var(--bn-highlight);}
.bn-bottom-nav svg,.bn-lock svg {width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
#badnight-app .bn-bell {position:relative;}
#badnight-app #bn-unread {position:absolute;top:-4px;right:-4px;display:grid;place-items:center;box-sizing:border-box;min-width:22px;height:22px;padding:0 5px;border-radius:999px;background:#d70015;color:#fff!important;font-size:12px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums;border:2px solid var(--bn-bg);}
#badnight-app #bn-unread[hidden] {display:none;}
#badnight-app .bn-notifications,#badnight-app .bn-paywall {box-sizing:border-box;width:min(460px,calc(100vw - 24px));max-height:80dvh;padding:24px;border:1px solid var(--bn-line);border-radius:24px;background:var(--bn-panel);color:var(--bn-text);overflow:auto;}
#badnight-app .bn-notifications {margin:16px 12px auto auto;}
.bn-notifications::backdrop,.bn-paywall::backdrop {background:#0009;}
.bn-panel-head {display:flex;align-items:center;justify-content:space-between;gap:12px;}
#badnight-app .bn-panel-head button,#badnight-app #bn-paywall-close {background:transparent;border:1px solid var(--bn-line);border-radius:12px;color:var(--bn-text)!important;padding:12px;font:inherit;cursor:pointer;}
#badnight-app .bn-notification {display:grid;gap:8px;width:100%;text-align:left;background:var(--bn-bg);color:var(--bn-text);border:1px solid var(--bn-line);border-radius:16px;padding:18px;margin-top:12px;font:inherit;cursor:pointer;}
.bn-notification small {color:var(--bn-muted);}
#badnight-app .bn-upgrade-card {padding:clamp(22px,4vw,38px);margin:0 0 32px;border:1px solid #638daf;border-radius:24px;background:linear-gradient(125deg,#234563,#172d42);max-width:900px;}
#badnight-app .bn-upgrade-card h2 {font-size:clamp(24px,3vw,34px);line-height:1.2;margin:8px 0 12px;}
#badnight-app .bn-upgrade-card ul,#badnight-app .bn-paywall ul {padding-left:22px;margin:18px 0 24px;line-height:1.65;}
#badnight-app .bn-paywall[open] {animation:bn-dialog-in .2s ease-out;}
@keyframes bn-dialog-in {from {opacity:0;transform:translateY(16px);}to {opacity:1;transform:translateY(0);}}
.bn-loading-spinner {display:inline-block;flex:0 0 18px;width:18px;height:18px;box-sizing:border-box;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:bn-spin .8s linear infinite;}
.bn-purchase-loading {cursor:progress;}
@keyframes bn-spin {to {transform:rotate(360deg);}}
@media(prefers-reduced-motion:reduce) {.bn-loading-spinner {animation:none;}#badnight-app .bn-paywall[open] {animation:none;}}
.bn-lock {position:absolute;bottom:12px;left:12px;display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:12px;background:#182023;color:#fff;font-size:12px;}
.bn-lock svg {width:18px;height:18px;}
#badnight-app :is(.bn-bottom-nav button,.bn-bottom-nav a,.bn-notification):focus-visible {outline:2px solid var(--bn-text);outline-offset:2px;}
#badnight-app .badnight-toast {bottom:calc(104px + env(safe-area-inset-bottom, 0px));}
@media(min-width:800px) {#badnight-app .bn-bottom-nav {bottom:16px;border-radius:24px;}}
@media(prefers-reduced-motion:reduce) {#badnight-app * {scroll-behavior:auto!important;transition:none!important;}}

/* v0.5: explicit sizing and colors protect app controls from theme defaults. */
#badnight-app .badnight-header .badnight-icon-button {display:flex!important;align-items:center!important;justify-content:center!important;width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;padding:0!important;margin:0!important;border:0!important;background:transparent!important;color:var(--bn-text)!important;line-height:1!important;box-shadow:none!important;}
#badnight-app .badnight-header .badnight-icon-button svg {display:block!important;flex:none;width:24px!important;height:24px!important;margin:0!important;padding:0!important;transform:none!important;}
#badnight-app .badnight-button {background:var(--bn-accent)!important;color:var(--bn-bg)!important;}
#badnight-app #bn-trial-buy,#badnight-app .bn-upgrade-buy {background:#79b8f2!important;color:#111a24!important;}
#badnight-app .bn-paywall {width:min(560px,calc(100vw - 24px));max-height:90dvh;padding:0;}
#badnight-app .bn-paywall-hero {position:relative;min-height:165px;display:flex;align-items:flex-end;padding:24px;box-sizing:border-box;background:#203c57;overflow:hidden;}
#badnight-app .bn-paywall-hero img {position:absolute;inset:0;width:100%;height:100%;object-fit:cover;}
#badnight-app .bn-paywall-hero::after {content:'';position:absolute;inset:0;background:linear-gradient(transparent,#111a24db);}
#badnight-app .bn-paywall-hero p {position:relative;z-index:1;color:#fff;font-size:25px;line-height:1.2;font-weight:700;max-width:80%;margin:40px 0 0;}
#badnight-app .bn-paywall-hero #bn-paywall-close {position:absolute;right:12px;top:12px;z-index:2;border-radius:50%;width:44px;height:44px;padding:0;font-size:32px;line-height:1;background:#111a24d9!important;color:#fff!important;}
#badnight-app .bn-paywall-body {padding:24px 26px 8px;}
#badnight-app .bn-paywall-body h2 {font-size:26px;line-height:1.2;margin:0 0 14px;}
#badnight-app .bn-paywall-benefits {list-style:none;padding:0;}
#badnight-app .bn-paywall-benefits li {position:relative;padding-left:30px;margin:18px 0;}
#badnight-app .bn-paywall-benefits li::before {content:'✓';position:absolute;left:0;color:var(--bn-highlight);font-weight:700;}
#badnight-app .bn-paywall-benefits strong,#badnight-app .bn-paywall-benefits span {display:block;}
#badnight-app .bn-paywall-benefits span {color:var(--bn-muted);font-size:14px;line-height:1.5;margin-top:4px;}
#badnight-app .bn-paywall-footer {position:sticky;bottom:0;padding:16px 24px;background:var(--bn-panel);border-top:1px solid var(--bn-line);}
#badnight-app .bn-paywall-footer a {display:flex;width:100%;box-sizing:border-box;justify-content:center;}
#badnight-app .bn-paywall-footer p {text-align:center;font-size:12px;color:var(--bn-muted);margin:10px 0 0;}
@media(max-width:640px) {#badnight-app .bn-paywall {width:100%;max-width:100%;max-height:94dvh;margin:auto 0 0;border-radius:24px 24px 0 0;border-bottom:0;}#badnight-app .bn-paywall-footer {padding-bottom:calc(16px + env(safe-area-inset-bottom));}}
#badnight-app .badnight-button--ghost,#badnight-app .badnight-button--danger,#badnight-app #bn-menu-close,#badnight-app #bn-paywall-close,#badnight-app #bn-notifications-close {background:transparent!important;color:var(--bn-text)!important;border:1px solid var(--bn-line)!important;}
#badnight-app .bn-drawer nav :is(button,a),#badnight-app .bn-notification {color:var(--bn-text)!important;}
#badnight-app .bn-filters {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:16px;}
#badnight-app .bn-filters label {min-width:0;}
#badnight-app .bn-filters label:last-child {grid-column:1/-1;display:flex;align-items:center;gap:10px;}
#badnight-app .bn-filters input[type=checkbox] {width:20px!important;height:20px!important;min-height:0!important;margin:0!important;flex:none;}
#badnight-app .bn-filters select {appearance:none!important;-webkit-appearance:none!important;box-sizing:border-box!important;width:100%!important;max-width:100%!important;height:52px!important;min-height:52px!important;padding:0 36px 0 14px!important;font-family:inherit!important;font-size:16px!important;font-weight:400!important;line-height:1.5!important;text-indent:0!important;letter-spacing:normal!important;background-color:var(--bn-bg)!important;color:var(--bn-text)!important;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10'%3E%3Cpath d='m2 2 5 5 5-5' fill='none' stroke='%23f4f6f8' stroke-width='2'/%3E%3C/svg%3E")!important;background-repeat:no-repeat!important;background-position:right 14px center!important;}
#badnight-app .bn-metric-card {min-width:0;font-weight:400!important;line-height:1.4!important;}
#badnight-app .bn-metric-card > span {font-size:16px;font-weight:600;overflow-wrap:anywhere;}
#badnight-app .bn-metric-card small {font-weight:400!important;line-height:1.5;}
#badnight-app .bn-scale {display:grid;gap:4px;}
#badnight-app .bn-scale > span {display:block;}
#badnight-app .bn-main-chart {scroll-margin-top:104px;}
#badnight-app .bn-score-info {margin:16px 0;}
#badnight-app .bn-score-info summary {cursor:pointer;color:var(--bn-text);}
#badnight-app .bn-session-tags {display:flex;flex-wrap:wrap;gap:6px;margin:12px 0;}
#badnight-app .bn-session-tags > span {display:block;background:#172330;color:#f4f6f8!important;border:1px solid #aeb9c5;border-radius:8px;padding:4px 8px;font-size:12px;font-weight:500;line-height:1.35;}
#badnight-app .badnight-card__media .bn-session-tags {position:absolute;top:8px;left:8px;right:40px;margin:0;}
body.badnight-shell #ast-scroll-top,body.badnight-shell .ast-scroll-top-icon,body.badnight-shell #scroll-to-top,body.badnight-shell .scroll-to-top {display:none!important;visibility:hidden!important;pointer-events:none!important;}
#badnight-app .badnight-header {background:var(--bn-bg)!important;}
#badnight-app .bn-bottom-nav {background:#172330;}
@media(max-width:640px) {#badnight-app .bn-filters {grid-template-columns:minmax(0,1fr);}#badnight-app .bn-metric-card {padding:12px!important;}#badnight-app .bn-metric-card > span {font-size:14px;overflow-wrap:normal;hyphens:auto;}#badnight-app .badnight-chart text {font-size:24px;}}

/* 0.21: clear purchase actions, readable registration links and long account names. */
#badnight-app [data-bn-purchase], .badnight-public .bn-purchase-cta {
 background:var(--bn-highlight)!important;color:var(--bn-bg)!important;border:0!important;
 font-family:inherit;font-weight:900!important;font-size:17px;line-height:1.35;
 gap:10px;padding:14px 22px;max-width:100%;text-align:center;text-decoration:none;
 box-shadow:none;cursor:pointer;transition:background-color .15s ease,transform .15s ease;
}
#badnight-app [data-bn-purchase]:hover,.badnight-public .bn-purchase-cta:hover {background:#a9d2f8!important;transform:translateY(-1px);}
#badnight-app [data-bn-purchase]:active,.badnight-public .bn-purchase-cta:active {transform:translateY(0);}
#badnight-app [data-bn-purchase]:focus-visible,.badnight-public .bn-purchase-cta:focus-visible {outline:2px solid var(--bn-highlight);outline-offset:4px;}
#badnight-app [data-bn-purchase] span {color:inherit!important;}
#badnight-app #bn-trial-buy {font-size:15px;padding:12px 18px;gap:4px;box-shadow:0 5px 18px #0004;}
#badnight-app #bn-trial-buy strong {display:flex;align-items:center;gap:9px;white-space:nowrap;font-weight:900;}
#badnight-app #bn-trial-buy .bn-purchase-label {text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:3px;}
#badnight-app .bn-account-hero h1 {font-size:clamp(23px,3vw,34px);line-height:1.25;overflow-wrap:anywhere;word-break:normal;max-width:100%;}
#badnight-app .bn-account-hero p,#badnight-app #bn-view-settings .badnight-settings-card {overflow-wrap:anywhere;min-width:0;}
.badnight-public .bn-register-callout {margin-top:30px;padding-top:24px;border-top:1px solid var(--bn-line);}
.badnight-public .bn-register-callout p {margin:0 0 8px;}
.badnight-public .bn-register-callout p:last-child {margin:10px 0 0;font-size:14px;color:var(--bn-muted);}
.badnight-public .bn-register-link {margin-top:0;font-size:18px;font-weight:800;color:var(--bn-highlight)!important;text-decoration:underline!important;text-underline-offset:4px;}
.badnight-public .bn-register-link:focus-visible {outline:2px solid var(--bn-highlight);outline-offset:4px;}
@media(max-width:640px) {
 #badnight-app #bn-trial-buy {font-size:13px;padding:10px 12px;}
 #badnight-app .bn-account-hero h1 {font-size:24px;}
}
@media(max-width:380px) {
 #badnight-app #bn-backbar.bn-has-offer {flex-wrap:wrap;}
 #badnight-app #bn-trial-offer {flex-basis:100%;width:100%;max-width:none;}
 #badnight-app #bn-trial-buy {width:100%;align-items:center;}
 #badnight-app .bn-paywall-footer [data-bn-purchase],#badnight-app .bn-upgrade-card [data-bn-purchase] {font-size:15px;padding:14px 12px;gap:7px;}
}

/* Post-request guidance stays readable even when scripts or dialog support are unavailable. */
:is(#badnight-offer,.badnight-public) .bn-email-status {padding:22px;margin-bottom:24px;border:2px solid #79b8f2;border-radius:16px;background:#203c57;}
:is(#badnight-offer,.badnight-public) .bn-email-status h2 {font-size:23px;line-height:1.25;letter-spacing:-.02em;margin:0 0 12px;}
:is(#badnight-offer,.badnight-public) .bn-email-status p {color:#e2ebf3!important;font-size:16px;line-height:1.6;}
:is(#badnight-offer,.badnight-public) .bn-email-dialog {position:fixed;inset:0;width:min(560px,calc(100% - 24px));max-width:none;max-height:calc(100% - 32px);max-height:calc(100dvh - 32px);margin:auto;padding:28px;border:1px solid #59758e;border-radius:22px;background:#172330;color:#f4f6f8;font:inherit;overflow:auto;overscroll-behavior:contain;box-shadow:0 24px 90px #0008;}
:is(#badnight-offer,.badnight-public) .bn-email-dialog:not([open]) {display:none;}
:is(#badnight-offer,.badnight-public) .bn-email-dialog::backdrop {background:rgba(5,12,20,.82);}
:is(#badnight-offer,.badnight-public) .bn-email-dialog h2 {font-size:clamp(27px,5vw,34px);line-height:1.15;letter-spacing:-.035em;margin:10px 0 24px;overflow-wrap:anywhere;}
:is(#badnight-offer,.badnight-public) .bn-email-dialog h2:focus {outline:none;}
:is(#badnight-offer,.badnight-public) .bn-email-close {display:flex;align-items:center;justify-content:center;gap:10px;min-height:44px;margin:-12px -10px 10px auto;padding:8px 10px!important;border:0;border-radius:8px;background:transparent!important;color:#dbe6ef!important;font:inherit;font-size:14px;cursor:pointer;}
:is(#badnight-offer,.badnight-public) .bn-email-close span {font-size:26px;line-height:1;}
:is(#badnight-offer,.badnight-public) .bn-email-steps {padding-left:27px;margin:0;list-style:decimal;display:grid;gap:20px;}
:is(#badnight-offer,.badnight-public) .bn-email-steps li {padding-left:5px;font-size:18px;line-height:1.45;}
:is(#badnight-offer,.badnight-public) .bn-email-steps li::marker {color:#79b8f2;font-weight:800;}
:is(#badnight-offer,.badnight-public) .bn-email-steps p {font-size:16px;line-height:1.6;margin:5px 0 0;}
:is(#badnight-offer,.badnight-public) .bn-email-help {padding:16px;margin:24px 0;border-radius:12px;background:#203447;font-size:15px;line-height:1.6;}
:is(#badnight-offer,.badnight-public) .bn-email-help strong {display:block;margin-bottom:4px;}
:is(#badnight-offer,.badnight-public) .bn-email-dialog .bn-email-done {width:100%;font-size:17px!important;font-weight:800!important;border:0!important;}
:is(#badnight-offer,.badnight-public) .bn-email-text-button {display:block;min-height:44px;height:auto;margin:12px 0 0;padding:8px 0!important;border:0;border-radius:4px;background:transparent!important;color:#b2d6f8!important;font:inherit;font-size:15px;line-height:1.5;text-align:left;text-decoration:underline;text-underline-offset:4px;white-space:normal;cursor:pointer;}
:is(#badnight-offer,.badnight-public) .bn-email-text-button[hidden] {display:none;}
:is(#badnight-offer,.badnight-public) .bn-email-dialog .bn-email-text-button {margin:10px auto 0;text-align:center;}
@media(max-width:360px) {:is(#badnight-offer,.badnight-public) .bn-email-dialog {padding:22px;}:is(#badnight-offer,.badnight-public) .bn-email-status {padding:18px;}}

:is(#badnight-offer,.badnight-public) .bn-email-dialog .bn-email-kicker {color:#79b8f2!important;font-size:11px;font-weight:650;letter-spacing:.14em;line-height:1.6;margin:0;}
:is(#badnight-offer,.badnight-public) .bn-email-dialog :is(button):focus-visible {outline:3px solid #79b8f2!important;outline-offset:4px;}
:is(#badnight-offer,.badnight-public) .bn-email-dialog .bn-email-done {background:#79b8f2!important;color:#111a24!important;min-height:52px;border-radius:12px;padding:14px 22px!important;cursor:pointer;}
:is(#badnight-app,.badnight-public) a.bn-purchase-loading {position:relative;cursor:progress;}
:is(#badnight-app,.badnight-public) .bn-purchase-original {display:contents;visibility:hidden!important;}
:is(#badnight-app,.badnight-public) .bn-purchase-progress {position:absolute;inset:0;display:flex!important;flex-direction:row;align-items:center;justify-content:center;gap:9px;padding:8px;box-sizing:border-box;pointer-events:none;visibility:visible!important;color:inherit!important;font:inherit;line-height:1.3;white-space:normal;text-align:center;}
:is(#badnight-app,.badnight-public) .bn-purchase-progress .bn-loading-spinner {display:inline-block!important;flex:0 0 18px;width:18px;height:18px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;}
