/* ============================================================
   TOKENS - Refined Design System
   ============================================================ */
:root {
	/* Core colors - softer, more refined */
	--color-bg: #fafaf9;
	--color-bg-elevated: #ffffff;
	--color-bg-subtle: #f5f5f4;
	--color-bg-hover: #e7e5e4;
	--color-text: #1c1917;
	--color-text-secondary: #78716c;
	--color-text-tertiary: #726c69;
	--color-border: #e7e5e4;
	--color-border-subtle: #f5f5f4;
	--color-icon-subtle: #c2bbb8;

	/* Accent - muted stone */
	--color-accent: #57534e;
	--color-accent-hover: #44403c;
	--color-accent-subtle: #f5f5f4;

	/* Semantic */
	--color-danger: #dc2626;
	--color-danger-hover: #b91c1c;
	--color-success-bg: #f0fdf4;
	--color-success-text: #166534;
	--color-alert-bg: #fef3f2;
	--color-alert-text: #991b1b;

	/* Typography - refined scale */
	--font-sans: "Lato", -apple-system, BlinkMacSystemFont, sans-serif;
	--font-serif: "Libre Baskerville", Georgia, serif;
	--font-mono: ui-monospace, "SF Mono", Menlo, monospace;

	--text-2xs: 0.6875rem;
	--text-xs: 0.75rem;
	--text-sm: 0.875rem;
	--text-base: 1rem;
	--text-lg: 1.125rem;
	--text-xl: 1.25rem;
	--text-2xl: 1.5rem;
	--text-3xl: 1.875rem;

	--leading-none: 1;
	--leading-tight: 1.25;
	--leading-snug: 1.375;
	--leading-normal: 1.5;
	--leading-relaxed: 1.625;

	/* Spacing - more generous */
	--sp-1: 0.25rem;
	--sp-2: 0.5rem;
	--sp-3: 0.75rem;
	--sp-4: 1rem;
	--sp-5: 1.25rem;
	--sp-6: 1.5rem;
	--sp-8: 2rem;
	--sp-10: 2.5rem;
	--sp-12: 3rem;
	--sp-16: 4rem;
	--sp-20: 5rem;

	/* Radius - softer */
	--radius-sm: 6px;
	--radius: 10px;
	--radius-lg: 14px;
	--radius-xl: 20px;
	--radius-full: 9999px;

	/* Layout */
	--max-feed: 720px;
	--max-article: 680px;
	--max-nav: 1200px;

	/* Transitions */
	--transition-fast: 100ms ease;
	--transition: 200ms ease;
	--transition-slow: 300ms ease;
}

/* Font preference */
body[data-font="serif"] {
	--font-sans: var(--font-serif);
	--article-font-size: 1.0625rem;
	--article-line-height: 1.75;
	--article-title-size: var(--text-xl);
}

body[data-font="figtree"] {
	--font-sans: "Figtree", -apple-system, BlinkMacSystemFont, sans-serif;
	--article-font-size: var(--text-lg);
	--article-line-height: var(--leading-relaxed);
	--article-title-size: var(--text-2xl);
}

body[data-font="newsreader"] {
	--font-sans: "Newsreader", Georgia, serif;
	--article-font-size: 1.0625rem;
	--article-line-height: 1.65;
	--article-title-size: var(--text-xl);
}

body[data-font="sans"],
body:not([data-font]) {
	--article-font-size: var(--text-lg);
	--article-line-height: var(--leading-relaxed);
	--article-title-size: var(--text-2xl);
}

/* Dark mode - manual selection via data-theme */
body[data-theme="dark"] {
	--color-bg: #0c0a09;
	--color-bg-elevated: #1c1917;
	--color-bg-subtle: #292524;
	--color-bg-hover: #44403c;
	--color-text: #fafaf9;
	--color-text-secondary: #a8a29e;
	--color-text-tertiary: #78716c;
	--color-border: #292524;
	--color-border-subtle: #1c1917;
	--color-accent: #d6d3d1;
	--color-accent-hover: #e7e5e4;
	--color-accent-subtle: #292524;
}

/* Light mode - explicit selection via data-theme (same as default) */
body[data-theme="light"] {
	--color-bg: #fafaf9;
	--color-bg-elevated: #ffffff;
	--color-bg-subtle: #f5f5f4;
	--color-bg-hover: #e7e5e4;
	--color-text: #1c1917;
	--color-text-secondary: #78716c;
	--color-text-tertiary: #a8a29e;
	--color-border: #e7e5e4;
	--color-border-subtle: #f5f5f4;
	--color-accent: #57534e;
	--color-accent-hover: #44403c;
	--color-accent-subtle: #f5f5f4;
}

/* Sepia mode - warm, paper-like reading experience */
body[data-theme="sepia"] {
	--color-bg: #faf7f0;
	--color-bg-elevated: #fdfcfa;
	--color-bg-subtle: #f3efe6;
	--color-bg-hover: #eae5da;
	--color-text: #3a3530;
	--color-text-secondary: #7a7269;
	--color-text-tertiary: #9a958c;
	--color-border: #dbd5ca;
	--color-border-subtle: #eeebe6;
	--color-accent: #5a5048;
	--color-accent-hover: #4a4038;
	--color-accent-subtle: #f3efe6;
}

/* Auto mode - respect system preference (default when no data-theme) */
@media (prefers-color-scheme: dark) {
	body[data-theme="auto"],
	:root:not([data-theme]) body[data-theme="auto"] {
		--color-bg: #0c0a09;
		--color-bg-elevated: #1c1917;
		--color-bg-subtle: #292524;
		--color-bg-hover: #44403c;
		--color-text: #fafaf9;
		--color-text-secondary: #a8a29e;
		--color-text-tertiary: #78716c;
		--color-border: #292524;
		--color-border-subtle: #1c1917;
		--color-accent: #d6d3d1;
		--color-accent-hover: #e7e5e4;
		--color-accent-subtle: #292524;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

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

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

body {
	margin: 0;
	font-family: var(--font-sans);
	font-size: var(--text-base);
	line-height: var(--leading-normal);
	color: var(--color-text);
	background-color: var(--color-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Article detail page - ensure next link stays at bottom */
body.article-detail-page .site-main {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - 57px);
}

body.article-detail-page .site-main.native {
	min-height: 100vh;
}

/* View Transitions API for smooth page navigation */
@view-transition {
	navigation: auto;
}

/* Header stays fixed during transitions */
::view-transition-old(header),
::view-transition-new(header) {
	animation: none;
}

/* Default transition - simple fade for most navigations */
::view-transition-old(main-content) {
	animation: fade-out 0.2s ease-out forwards;
}

::view-transition-new(main-content) {
	animation: fade-in 0.2s ease-out forwards;
}

@keyframes fade-out {
	from {
		opacity: 1;
	}
	to {
		opacity: 0;
	}
}

@keyframes fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Article-to-article transition - slide up animation */
.vt-article-to-article::view-transition-old(main-content) {
	animation: slide-up-out 0.4s ease-out forwards;
}

.vt-article-to-article::view-transition-new(main-content) {
	animation: slide-up-in 0.4s ease-out forwards;
}

@keyframes slide-up-out {
	from {
		opacity: 1;
		transform: translateY(0);
	}
	to {
		opacity: 0;
		transform: translateY(-50px);
	}
}

@keyframes slide-up-in {
	from {
		opacity: 0;
		transform: translateY(50px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

body.article-detail-page .article-detail {
	flex: 1;
	display: flex;
	flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0;
	font-weight: 600;
	line-height: var(--leading-tight);
	letter-spacing: -0.02em;
}

p {
	margin: 0;
}

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

a {
	color: inherit;
	text-decoration: none;
}

img {
	display: block;
	max-width: 100%;
	height: auto;
}

button {
	cursor: pointer;
	font: inherit;
	background: none;
	border: none;
}

.hide {
	display: none !important;
}

/* ============================================================
   LAYOUT
   ============================================================ */
body:not(.article-detail-page) .site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-border-subtle);
	view-transition-name: header;
}

.site-header__inner {
	max-width: var(--max-feed);
	margin-inline: auto;
	padding: var(--sp-3) var(--sp-6);
	display: flex;
	justify-content: space-between;
	align-items: center;
	min-height: 52px;
}

.site-header__left,
.site-header__center,
.site-header__right {
	display: flex;
	align-items: center;
}

.site-header__left {
	flex: 1;
	justify-content: flex-start;
}

.site-header__center {
	flex: 0;
	justify-content: center;
}

.site-header__right {
	flex: 1;
	justify-content: flex-end;
}

.site-header__link {
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-text-secondary);
	transition: color var(--transition-fast);
}

.site-header__link:hover {
	color: var(--color-text);
}

.site-header__link {
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-text-secondary);
	transition: color var(--transition-fast);
}

.site-header__link:hover {
	color: var(--color-text);
}

.site-header__logo {
	display: flex;
	align-items: center;
	gap: var(--sp-1);
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--color-text);
	letter-spacing: -0.01em;
	background: none;
	border: none;
	cursor: pointer;
	padding: var(--sp-1) var(--sp-2);
	border-radius: var(--radius);
	transition: background var(--transition-fast);
	anchor-name: --menu-button;
}

.site-header__logo:hover {
	background: var(--color-bg-hover);
}

.site-header__logo-indicator {
	width: 12px;
	height: 12px;
	color: var(--color-text-secondary);
	transition: transform var(--transition);
}

.site-header__bar {
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-border-subtle);
}

.site-header__logo {
	display: flex;
	align-items: center;
	gap: var(--sp-1);
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--color-text);
	letter-spacing: -0.01em;
	background: none;
	border: none;
	cursor: pointer;
	padding: var(--sp-1) var(--sp-2);
	border-radius: var(--radius);
	transition: background var(--transition-fast);
	anchor-name: --menu-button;
}

.site-header__logo:hover {
	background: var(--color-bg-hover);
}

.site-header__logo-indicator {
	width: 12px;
	height: 12px;
	color: var(--color-text-secondary);
	transition: transform var(--transition);
}

.site-header__menu {
	margin: 0.5rem 0;
	padding: var(--sp-3);
	inset: auto;
	position-area: bottom center;
	position-try-fallbacks: flip-block;
	background: var(--color-bg-elevated);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	min-width: 180px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.site-header__menu-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--sp-2);
}

.site-header__menu-button {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	width: 140px;
	height: 100px;
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-text);
	background: var(--color-bg-subtle);
	border-radius: var(--radius);
	border: none;
	transition: all var(--transition-fast);
}

.site-header__menu-button:hover {
	background: var(--color-bg-hover);
	transform: translateY(-1px);
}

.site-header__menu-button--small {
	flex-direction: row;
	height: 48px;
	width: auto;
	padding: 0 var(--sp-4);
	justify-content: flex-start;
}

.site-header__menu-button--ghost {
	background-color: transparent;
	justify-content: center;
}

.site-header__menu-button--small.site-header__menu-button--wide {
	grid-column: 1 / -1;
	width: 100%;
}

.site-header__menu-icon {
	width: 28px;
	height: 28px;
	color: var(--color-text-secondary);
}

.site-header__menu-button--small .site-header__menu-icon {
	width: 20px;
	height: 20px;
}

.site-header__menu-grid form.button_to {
	display: contents;
}

.site-main {
	max-width: var(--max-feed);
	margin-inline: auto;
	view-transition-name: main-content;
	padding: var(--sp-2) var(--sp-6) 0;
}

body.article-detail-page .site-main {
	position: relative;
	z-index: 110;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
	position: fixed;
	top: var(--sp-4);
	right: var(--sp-4);
	z-index: 100;
	max-width: 320px;
	padding: var(--sp-3) var(--sp-4);
	border-radius: var(--radius);
	font-size: var(--text-sm);
	font-weight: 500;
	background: var(--color-bg-elevated);
	color: var(--color-text-secondary);
	border: 1px solid var(--color-border);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.flash--notice {
	color: var(--color-text);
	border-color: var(--color-accent);
}

.flash--alert {
	color: var(--color-danger);
	border-color: var(--color-danger);
}

.flash:empty {
	display: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--sp-2) var(--sp-4);
	border-radius: var(--radius);
	font-size: var(--text-sm);
	font-weight: 500;
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
	transition: all var(--transition-fast);
	white-space: nowrap;
}

.btn--primary {
	background: var(--color-accent);
	color: var(--color-bg);
}
.btn--primary:hover {
	background: var(--color-accent-hover);
}

.btn--secondary {
	background: var(--color-bg-elevated);
	color: var(--color-text);
	border-color: var(--color-border);
}
.btn--secondary:hover {
	background: var(--color-bg-subtle);
	border-color: var(--color-text-tertiary);
}

.btn--ghost {
	background: transparent;
	color: var(--color-text-secondary);
}
.btn--ghost:hover {
	color: var(--color-text);
	background: var(--color-bg-subtle);
}

.btn--danger {
	color: var(--color-danger);
}
.btn--danger:hover {
	background: var(--color-alert-bg);
}

.btn--danger-solid {
	background: var(--color-danger);
	color: var(--color-bg-elevated);
	border-color: var(--color-danger);
}
.btn--danger-solid:hover {
	background: var(--color-danger-hover);
	border-color: var(--color-danger-hover);
}

.btn--full {
	width: 100%;
}

.btn--small {
	padding: var(--sp-1) var(--sp-3);
	font-size: var(--text-xs);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	margin-bottom: var(--sp-4);
}

.form-label {
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-text);
}

.form-input {
	padding: var(--sp-3) var(--sp-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	font-size: var(--text-base);
	color: var(--color-text);
	background: var(--color-bg-elevated);
	transition: all var(--transition-fast);
	width: 100%;
}
.form-input:focus {
	outline: none;
	border-color: var(--color-text-secondary);
	box-shadow: 0 0 0 3px
		color-mix(in srgb, var(--color-text-secondary) 15%, transparent);
}

.form-inline {
	display: flex;
	gap: var(--sp-2);
	align-items: stretch;
}

/* ============================================================
   AUTH
   ============================================================ */
.auth-container {
	min-height: calc(100vh - var(--header-height, 0px));
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--sp-8) var(--sp-4);
}

.auth-card {
	width: 100%;
	max-width: 400px;
}

.auth-title {
	font-size: var(--text-3xl);
	font-weight: 700;
	margin-bottom: var(--sp-2);
	letter-spacing: -0.03em;
}

.auth-subtitle {
	color: var(--color-text-secondary);
	margin-bottom: var(--sp-8);
}

.auth-form {
	display: flex;
	flex-direction: column;
	gap: var(--sp-4);
}

.auth-help {
	margin-top: var(--sp-4);
	text-align: center;
	font-size: var(--text-sm);
	color: var(--color-text-secondary);
}

.code-input-group {
	display: flex;
	gap: var(--sp-2);
	justify-content: center;
	margin-bottom: var(--sp-4);
}

.code-input__digit {
	width: 48px;
	height: 56px;
	text-align: center;
	font-size: var(--text-xl);
	font-weight: 600;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: var(--color-bg-elevated);
	color: var(--color-text);
	transition: all var(--transition-fast);
}
.code-input__digit:focus {
	outline: none;
	border-color: var(--color-text-secondary);
	box-shadow: 0 0 0 3px
		color-mix(in srgb, var(--color-text-secondary) 15%, transparent);
}

/* ============================================================
   FEED VIEW - Completely Redesigned
   ============================================================ */
.feed-header {
	display: flex;
	justify-content: center;
	margin-bottom: var(--sp-8);
}

.feed-filter-bar {
	display: flex;
	align-items: center;
	gap: 2px;
	background: var(--color-bg-subtle);
	padding: 3px;
	border-radius: var(--radius-full);
	width: fit-content;
}

.feed-filter-bar__link {
	font-size: var(--text-2xs);
	font-weight: 600;
	color: var(--color-text-tertiary);
	padding: var(--sp-1) var(--sp-3);
	border-radius: var(--radius-full);
	transition: all var(--transition-fast);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.feed-filter-bar__link:hover {
	color: var(--color-text-secondary);
}

.feed-filter-bar__link--active {
	color: var(--color-text);
	background: var(--color-bg-elevated);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Article List - Minimal Design */
.article-list {
	display: flex;
	flex-direction: column;
	gap: var(--sp-1);
}

.article-card {
	position: relative;
	padding: var(--sp-4);
	margin-left: calc(var(--sp-4) * -1);
	margin-right: calc(var(--sp-4) * -1);
	border-radius: var(--radius);
	transition: all var(--transition-fast);
	cursor: pointer;
	/* Let the browser own vertical scrolling; we only arbitrate horizontal swipes. */
	touch-action: pan-y;
}

.article-card:hover {
	background: var(--color-bg-subtle);
}

.article-card--new::before {
	content: "";
	position: absolute;
	top: calc(var(--sp-4) + 0.3em);
	left: 0.175rem;
	width: 2px;
	height: 40%;
	background: linear-gradient(
		to bottom,
		var(--color-accent) 0%,
		var(--color-accent) 40%,
		transparent 100%
	);
}

.article-card__content {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
}

.article-card__title {
	font-size: var(--text-xl);
	font-weight: 600;
	line-height: var(--leading-snug);
	color: var(--color-text);
	letter-spacing: -0.02em;
}

.article-card__source {
	font-weight: 600;
	color: var(--color-text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.article-card:hover .article-card__title {
	color: var(--color-text-secondary);
}

.article-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
	font-size: var(--text-base);
	font-weight: 400;
	line-height: var(--leading-normal);
	color: var(--color-text);
}

.article-card__body-link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.article-card:hover .article-card__body-link {
	color: var(--color-text-secondary);
}

.article-card__meta {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	font-size: var(--text-xs);
	color: var(--color-text-tertiary);
}

.article-card__source {
	font-weight: 500;
	color: var(--color-text-secondary);
}

.article-card__time {
	font-weight: 400;
}

.article-card__time::before {
	content: "·";
	margin-right: var(--sp-2);
}

/* Feed triage — active card, action button, swipe, dismiss */
.article-card.is-active:not(.article-card.is-swiping) {
	background: var(--color-bg-subtle);
	box-shadow: 0 0 4px -3px var(--color-text);
}

.article-card__content {
	position: relative;
	z-index: 1;
	transition: transform var(--transition);
}

/* Whole-card tap target, no JS. The title link's overlay covers the card; if an
   item has no title, the body link is stretched instead. The mark-read button
   raises itself above this overlay (see .article-card__action). */
.article-card__title-link::after,
.article-card:not(:has(.article-card__title-link))
	.article-card__body-link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

/* Home page legal cards have no inner links, so the whole content is one link. */
.article-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}
.article-card {
	padding: 0;
}

.article-card.is-swiping-enough .article-card__swipe-bg {
	color: red;
	color: var(--color-success-text);
}

.article-card.is-swiping-enough .article-card__swipe-label {
	font-weight: 800;
}

.article-card .article-card__content {
	padding: var(--sp-4);
	border-radius: var(--radius);
}
.article-card.is-swiping .article-card__content {
	background: var(--color-bg-subtle);
	transition: none;
	padding: var(--sp-4);
}

.article-card.is-dismissing {
	transform: translateX(-100%);
	opacity: 0;
	pointer-events: none;
	transition:
		transform var(--transition),
		opacity var(--transition);
}

.article-card.is-restoring {
	animation: article-card-restore var(--transition) ease;
}

@keyframes article-card-restore {
	from {
		opacity: 0;
		transform: translateX(-12px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* One-click "mark read" button (mouse) */
.article-card__action {
	align-items: center;
	color: var(--color-icon-subtle);
	cursor: pointer;
	display: inline-flex;
	justify-content: center;
	margin-left: auto;
	padding: 0;
	/* Above the stretched card link so a click hits the button, not the link. */
	position: relative;
	z-index: 2;
	opacity: 0;
	transition:
		opacity var(--transition-fast),
		color var(--transition-fast),
		border-color var(--transition-fast);
}

.article-card__action svg {
	color: var(--color-secondary-text);
	width: 1.25rem;
	height: 1.25rem;
}

.article-card:hover .article-card__action,
.article-card__action:focus-visible {
	opacity: 1;
}

.article-card__action:hover {
	color: var(--color-success-text);
	border-color: var(--color-success-text);
}

/* Swipe-left reveal (touch) */
.article-card__swipe-bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--sp-2);
	padding-right: var(--sp-4);
	border-radius: var(--radius);
	color: var(--color-text-secondary);
	opacity: 0;
	box-shadow: inset -100px 0px 0px 0px var(--color-success-bg);
}

.article-card__swipe-bg svg {
	width: 1.25rem;
	height: 1.25rem;
}

.article-card__swipe-label {
	font-size: var(--text-sm);
	font-weight: 300;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.article-card.is-swiping .article-card__swipe-bg {
	opacity: 1;
}

.article-card.is-swiping .article-card__action {
	opacity: 0;
}

/* Undo toast */
.toast-region {
	position: fixed;
	right: 4%;
	bottom: calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
	z-index: 50;
	opacity: 0;
	pointer-events: none;
	transition:
		opacity var(--transition),
		transform var(--transition);
}

.toast-region.is-visible {
	opacity: 1;
	pointer-events: auto;
}

.toast {
	display: flex;
	align-items: center;
	gap: var(--sp-4);
	padding: var(--sp-2) var(--sp-5);
	border-radius: var(--radius-full);
	background: var(--color-text);
	color: var(--color-bg);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
	font-size: var(--text-sm);
}

.toast__msg {
	font-weight: 500;
}

.toast__undo {
	padding: 0;
	border: none;
	background: none;
	color: var(--color-bg);
	font-size: var(--text-sm);
	font-weight: 700;
	text-decoration: underline;
	cursor: pointer;
}

/* End of Feed */
.feed-end {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: var(--sp-16) 0 var(--sp-8);
	color: var(--color-text-tertiary);
}

.feed-end__icon {
	width: 40px;
	height: 40px;
	opacity: 0.4;
}

/* Empty States */
.empty-state {
	text-align: center;
	padding: var(--sp-16) var(--sp-4);
}

.empty-state__icon {
	width: 48px;
	height: 48px;
	margin: 0 auto var(--sp-4);
	color: var(--color-text-tertiary);
}

.empty-state__title {
	font-size: var(--text-xl);
	font-weight: 600;
	margin-bottom: var(--sp-2);
	color: var(--color-text);
}

.empty-state__body {
	color: var(--color-text-secondary);
	margin-bottom: var(--sp-6);
	max-width: 320px;
	margin-inline: auto;
	line-height: var(--leading-relaxed);
}

/* Load More Sentinel */
.load-more-sentinel {
	height: 1px;
	margin-top: var(--sp-4);
}

/* ============================================================
   ADD FEED FORM
   ============================================================ */
.add-feed-section {
	margin-bottom: var(--sp-8);
	padding: var(--sp-5);
	background: var(--color-bg-elevated);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.add-feed-form__input-wrap {
	display: flex;
	gap: var(--sp-2);
}

.add-feed-form__input {
	flex: 1;
	padding: var(--sp-3) var(--sp-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: var(--color-bg);
	font-size: var(--text-base);
	color: var(--color-text);
	transition: border-color var(--transition-fast);
}

.add-feed-form__input:focus {
	outline: none;
	border-color: var(--color-text-secondary);
}

.add-feed-form__input::placeholder {
	color: var(--color-text-tertiary);
}

.add-feed-form__button {
	padding: var(--sp-3) var(--sp-5);
	background: var(--color-accent);
	color: var(--color-bg);
	font-size: var(--text-sm);
	font-weight: 500;
	border: none;
	border-radius: var(--radius);
	cursor: pointer;
	transition: background var(--transition-fast);
}

.add-feed-form__button:hover {
	background: var(--color-accent-hover);
}

.add-feed-form__hint {
	margin-top: var(--sp-3);
	font-size: var(--text-xs);
	color: var(--color-text-tertiary);
}

/* Add Feed Dialog Trigger Button */
.add-feed-trigger-wrap {
	display: flex;
	justify-content: flex-end;
	margin-bottom: var(--sp-4);
	gap: var(--sp-3);
}

.add-feed-trigger {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
}

.add-feed-trigger svg {
	width: 18px;
	height: 18px;
}

/* Import OPML Button */
.import-opml-trigger {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
}

.import-opml-trigger svg {
	width: 18px;
	height: 18px;
}

/* File input styling */
.add-feed-form__input--file {
	padding: var(--sp-2) var(--sp-3);
	cursor: pointer;
}

.add-feed-form__input--file::file-selector-button {
	font-family: inherit;
	font-size: var(--text-sm);
	font-weight: 500;
	padding: var(--sp-2) var(--sp-3);
	margin-right: var(--sp-3);
	background: var(--color-bg-subtle);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	color: var(--color-text);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.add-feed-form__input--file::file-selector-button:hover {
	background: var(--color-bg-hover);
	border-color: var(--color-text-secondary);
}

/* Add Feed Dialog */
.add-feed-dialog {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	background: transparent;
	padding: 0;
	border: none;
	margin: auto;
	overflow: visible;
}

.add-feed-dialog::backdrop {
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
}

.add-feed-dialog:popover-open {
	display: flex;
	align-items: center;
	justify-content: center;
}

.add-feed-dialog__content {
	width: 90%;
	max-width: 520px;
	background: var(--color-bg-elevated);
	border-radius: var(--radius-lg);
	border: 1px solid var(--color-border);
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
	padding: var(--sp-6);
	animation: dialog-enter 200ms ease-out;
	margin: auto;
}

@keyframes dialog-enter {
	from {
		opacity: 0;
		transform: scale(0.95);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.add-feed-dialog__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: var(--sp-5);
}

.add-feed-dialog__title {
	font-size: var(--text-xl);
	font-weight: 600;
	color: var(--color-text);
	margin: 0;
}

.add-feed-dialog__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	background: var(--color-bg-subtle);
	border: none;
	border-radius: var(--radius);
	color: var(--color-text-secondary);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.add-feed-dialog__close:hover {
	background: var(--color-bg-hover);
	color: var(--color-text);
}

.add-feed-dialog__close svg {
	width: 18px;
	height: 18px;
}

/* Update add-feed-section for dialog context */
.add-feed-section {
	margin-bottom: var(--sp-8);
	padding: var(--sp-5);
	background: var(--color-bg-elevated);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.subscription-list {
	display: flex;
	flex-direction: column;
	gap: var(--sp-1);
	margin-bottom: var(--sp-12);
}

.subscription-card {
	padding: var(--sp-4) 0;
	border-radius: var(--radius);
	transition: all var(--transition-fast);
}

.subscription-card:hover {
	background: var(--color-bg-subtle);
}

.subscription-card--error {
	opacity: 0.7;
}

.subscription-card--error:hover {
	opacity: 1;
}

.subscription-card__content {
	display: flex;
	align-items: center;
	gap: var(--sp-4);
}

.subscription-card__icon {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: var(--radius);
	object-fit: contain;
}

.subscription-card__icon--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-bg-subtle);
	color: var(--color-text-tertiary);
}

.subscription-card__icon--placeholder svg {
	width: 20px;
	height: 20px;
}

.subscription-card__info {
	flex: 1;
	min-width: 0;
}

.subscription-card__name {
	font-size: var(--text-lg);
	font-weight: 600;
	line-height: var(--leading-snug);
	margin-bottom: var(--sp-1);
	color: var(--color-text);
	letter-spacing: -0.01em;
	word-break: break-word;
	overflow-wrap: break-word;
}

.subscription-card__name a {
	color: inherit;
}

.subscription-card__name a:hover {
	color: var(--color-text-secondary);
}

.subscription-card__meta {
	display: flex;
	align-items: center;
	gap: 0 var(--sp-2);
	font-size: var(--text-xs);
	flex-wrap: wrap;
	color: var(--color-text-tertiary);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.subscription-card__count {
	color: var(--color-text-secondary);
	font-weight: 600;
}

.subscription-card__fetched {
	font-size: var(--text-xs);
	color: var(--color-text-secondary);
	font-weight: 500;
	text-transform: none;
	letter-spacing: 0;
}

.subscription-card__fetched + .subscription-card__fetched::before {
	content: "·";
	margin-right: var(--sp-1);
	color: var(--color-text-tertiary);
}

.subscription-card__status--error {
	color: var(--color-danger);
}

.subscription-card__status--dead {
	color: var(--color-text-tertiary);
	font-style: italic;
}

.subscription-card__remove {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	background: none;
	border: none;
	color: var(--color-text-tertiary);
	cursor: pointer;
	border-radius: var(--radius);
	transition: all var(--transition-fast);
	opacity: 0;
}

.subscription-card:hover .subscription-card__remove {
	opacity: 1;
}

.subscription-card__remove:hover {
	color: var(--color-danger);
	background: var(--color-alert-bg);
}

.subscription-card__remove svg {
	width: 16px;
	height: 16px;
}

/* Mobile: always show remove button */
@media (max-width: 640px) {
	.subscription-card__remove {
		opacity: 1;
	}
}

/* ============================================================
   ARTICLE DETAIL
   ============================================================ */
.article-detail {
	max-width: var(--max-article);
	width: 100%;
	padding: var(--sp-4) 0 var(--sp-4);
	gap: var(--sp-2);
	margin-inline: auto;
	display: flex;
	flex-direction: column;
	flex: 1;
	position: relative;
	overflow: visible;
}

.article-detail__header {
	position: -webkit-sticky;
	position: sticky;
	top: 0;
	z-index: 110;
	background: var(--color-bg);
	padding: var(--sp-1) 0 var(--sp-3) 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas:
		"title actions"
		"meta actions";
	column-gap: var(--sp-3);
	row-gap: var(--sp-1);
	align-items: start;
}

/* A soft shadow under the header, fading in once it pins to the top while
   scrolling. A pseudo-element (not box-shadow) keeps it to the bottom edge only,
   and avoids clipping child focus rings. */
.article-detail__header::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	height: 18px;
	/* Elliptical fade: darkest under the centre, tapering toward the bottom and the
	   side edges so there are no hard vertical ends. */
	background: radial-gradient(
		ellipse 50% 80% at 50% 0%,
		rgba(0, 0, 0, 0.18),
		rgba(0, 0, 0, 0)
	);
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--transition);
}

.article-detail__header.is-stuck::after {
	opacity: 1;
}

.article-detail__title {
	grid-area: title;
	font-size: var(--article-title-size);
	font-weight: 700;
	line-height: var(--leading-tight);
	letter-spacing: -0.02em;
}

.article-detail__meta {
	grid-area: meta;
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	font-size: var(--text-xs);
	color: var(--color-text-tertiary);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.article-detail__meta-info {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--sp-2);
	min-width: 0;
}

.article-detail__meta-info .article-detail__dot,
.article-detail__meta-info time {
	white-space: nowrap;
}

.article-detail__meta-info span:not(.article-detail__dot) {
	overflow-wrap: anywhere;
}

.article-detail__meta-actions {
	grid-area: actions;
	display: flex;
	align-items: center;
	justify-self: end;
	align-self: center;
	gap: var(--sp-2);
	flex-shrink: 0;
}

.article-detail__meta-actions .article-detail__read-state {
	margin-left: 0;
}

.article-detail__save-state {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: none;
	border: none;
	color: var(--color-text-secondary);
	cursor: pointer;
	transition: color var(--transition-fast);
}

.article-detail__save-state:hover {
	color: var(--color-text);
}

.article-detail__save-state svg {
	width: 20px;
	height: 20px;
}

.article-detail__save-state.is-saved {
	color: var(--color-accent);
}

.article-detail__dot {
	width: 3px;
	height: 3px;
	border-radius: var(--radius-full);
	background: var(--color-text-tertiary);
}

.article-detail__read-state {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: none;
	border: none;
	color: var(--color-text-secondary);
	cursor: pointer;
	transition: color var(--transition-fast);
}

.article-detail__read-state:hover {
	color: var(--color-text);
}

.article-detail__read-state svg {
	width: 20px;
	height: 20px;
	stroke: currentColor;
}

.article-detail__read-state.is-unread {
	color: var(--color-accent);
}

.article-detail__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--color-text-secondary);
	transition: color var(--transition-fast);
}

.article-detail__link:hover {
	color: var(--color-text);
}

.article-detail__link svg {
	width: 20px;
	height: 20px;
}

/* Next Article Navigation */
.article-detail__next {
	margin-top: auto;
	padding-top: var(--sp-12);
	flex-shrink: 0;
}

.article-detail__next-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--sp-1);
	color: var(--color-text-tertiary);
	transition: color var(--transition-fast);
}

.article-detail__next-link:hover {
	color: var(--color-text);
}

.article-detail__next-label {
	font-size: var(--text-xs);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.article-detail__next-title {
	font-size: var(--text-base);
	font-weight: 500;
	text-align: center;
	line-height: var(--leading-snug);
}

.article-detail__next-source {
	font-size: var(--text-sm);
	color: var(--color-text-secondary);
}

.article-detail__next-icon {
	width: 16px;
	height: 16px;
	margin-top: var(--sp-1);
}

/* PROSE */
.prose {
	font-size: var(--article-font-size);
	line-height: var(--article-line-height);
	color: var(--color-text);
}

.prose p {
	margin-bottom: 1.25em;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
	font-family: var(--font-sans);
	font-weight: 600;
	line-height: var(--leading-tight);
	margin-top: 1.5em;
	margin-bottom: 0.5em;
	letter-spacing: -0.02em;
}

.prose h1 {
	font-size: var(--text-2xl);
}
.prose h2 {
	font-size: var(--text-xl);
}
.prose h3 {
	font-size: var(--text-lg);
}

.prose a {
	color: var(--color-accent);
	display: inline-block;
	text-decoration: underline;
	text-decoration-color: color-mix(
		in srgb,
		var(--color-accent) 30%,
		transparent
	);
	text-underline-offset: 3px;
}

.prose a:hover {
	text-decoration-color: var(--color-accent);
}

.prose img {
	border-radius: var(--radius-lg);
	margin: 1.5em 0;
}

.prose video,
.prose img {
	max-width: 100% !important;
}

.prose blockquote {
	border-left: 2px solid var(--color-border);
	padding-left: var(--sp-4);
	color: var(--color-text-secondary);
	font-style: italic;
	margin: 1.25em 0;
}

.prose pre {
	background: var(--color-bg-subtle);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	padding: var(--sp-2) var(--sp-3);
	overflow-x: auto;
	font-family: var(--font-mono);
	font-size: var(--text-sm);
	line-height: 1.5;
	white-space: pre;
	word-wrap: normal;
}

.prose code {
	font-family: var(--font-mono);
	font-size: 0.8125em;
	background: var(--color-bg-subtle);
	padding: 0.1em 0.3em;
	border-radius: 3px;
	color: var(--color-text);
}

.prose pre code {
	background: transparent;
	padding: 0;
	border-radius: 0;
	font-size: inherit;
	white-space: pre;
	word-wrap: normal;
}

.prose ul,
.prose ol {
	padding-left: 1.5em;
	margin-bottom: 1.25em;
	list-style: revert;
}

.prose li {
	margin-bottom: 0.375em;
}

/* ============================================================
   ACCOUNT PAGE
   ============================================================ */
.account-section {
	margin-bottom: var(--sp-8);
}

.account-section__title {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text-secondary);
	margin-bottom: var(--sp-1);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.account-section__hint {
	font-size: var(--text-sm);
	color: var(--color-text-tertiary);
	margin-bottom: var(--sp-4);
}

.account-section__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--sp-4);
	flex-wrap: wrap;
}

.account-section__titles {
	flex: 1;
	min-width: 0;
}

.account-section__header .btn {
	flex-shrink: 0;
}

.font-preference-form {
	margin: 0;
}

.font-options {
	display: flex;
	gap: var(--sp-3);
	flex-wrap: wrap;
}

.font-option {
	width: calc(50% - var(--sp-2));
	padding: var(--sp-3);
	background: var(--color-bg-subtle);
	border: 2px solid transparent;
	border-radius: var(--radius);
	cursor: pointer;
	transition: all var(--transition-fast);
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.font-option:hover {
	background: var(--color-bg-hover);
}

.font-option--selected {
	border-color: var(--color-text);
	background: var(--color-bg-elevated);
}

.font-option input[type="radio"] {
	position: absolute;
	opacity: 0;
}

.font-option__sample {
	font-size: var(--text-3xl);
	font-weight: 400;
	color: var(--color-text);
	margin-bottom: var(--sp-3);
	order: -1;
}

.font-option__sample--serif {
	font-family: var(--font-serif);
}

.font-option__sample--sans {
	font-family:
		"Lato",
		-apple-system,
		sans-serif;
}

.font-option__sample--figtree {
	font-family:
		"Figtree",
		-apple-system,
		sans-serif;
}

.font-option__sample--newsreader {
	font-family: "Newsreader", Georgia, serif;
}

.font-option__label {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text);
	margin-bottom: var(--sp-1);
}

.font-option__description {
	font-size: var(--text-xs);
	color: var(--color-text-secondary);
}

/* Theme preference - similar to font options */
.theme-preference-form {
	margin: 0;
}

.theme-options {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--sp-3);
}

.theme-option {
	width: 100%;
	padding: var(--sp-4);
	background: var(--color-bg-subtle);
	border: 2px solid transparent;
	border-radius: var(--radius);
	cursor: pointer;
	transition: all var(--transition-fast);
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.theme-option:hover {
	background: var(--color-bg-hover);
}

.theme-option--selected {
	border-color: var(--color-text);
	background: var(--color-bg-elevated);
}

.theme-option input[type="radio"] {
	position: absolute;
	opacity: 0;
}

.theme-option__preview {
	width: 48px;
	height: 48px;
	border-radius: var(--radius);
	margin-bottom: var(--sp-3);
	border: 2px solid var(--color-border);
	position: relative;
}

.theme-option__preview::after {
	content: "";
	position: absolute;
	bottom: 6px;
	left: 6px;
	right: 6px;
	height: 3px;
	border-radius: 1px;
}

.theme-option__preview--auto {
	background: linear-gradient(135deg, #fafaf9 50%, #1c1917 50%);
}

.theme-option__preview--auto::after {
	background: linear-gradient(90deg, #57534e 50%, #d6d3d1 50%);
}

.theme-option__preview--light {
	background: #fafaf9;
}

.theme-option__preview--light::after {
	background: #57534e;
}

.theme-option__preview--dark {
	background: #1c1917;
}

.theme-option__preview--dark::after {
	background: #d6d3d1;
}

.theme-option__preview--sepia {
	background: #faf7f0;
}

.theme-option__preview--sepia::after {
	background: #5a5048;
}

.theme-option__label {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text);
	margin-bottom: var(--sp-1);
}

.theme-option__description {
	font-size: var(--text-xs);
	color: var(--color-text-secondary);
}

/* Responsive theme options */
@media (max-width: 640px) {
	.theme-options {
		grid-template-columns: repeat(2, 1fr);
	}

	.theme-option__preview {
		width: 40px;
		height: 40px;
	}
}

/* ============================================================
   TURBO FRAME
   ============================================================ */
#feed-next-page[complete] {
	display: contents;
}

.turbo-progress-bar {
	background: var(--color-text);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
	.article-detail__title {
		font-size: var(--text-xl);
	}

	.prose {
		font-size: var(--article-font-size);
		line-height: var(--article-line-height);
	}

	.code-input__digit {
		width: 40px;
		height: 48px;
		font-size: var(--text-lg);
	}

	.form-inline {
		flex-direction: column;
	}

	.feed-list__item {
		flex-wrap: wrap;
	}

	.feed-list__actions {
		width: 100%;
		margin-top: var(--sp-2);
	}

	.font-options {
		gap: var(--sp-3);
	}

	.font-option__sample {
		font-size: var(--text-2xl);
	}

	.font-option__label {
		font-size: var(--text-sm);
	}

	.font-option__description {
		font-size: var(--text-xs);
	}

	.add-feed-form__input-wrap {
		flex-direction: column;
	}

	.add-feed-form__input {
		width: 100%;
	}

	.add-feed-form__button {
		width: 100%;
		padding: var(--sp-3) var(--sp-4);
	}
}

/* ============================================================
   KEYBOARD SHORTCUTS HELP PANEL
   ============================================================ */
.keyboard-help-overlay {
	position: fixed;
	inset: 0;
	z-index: 200;
	background: rgba(0, 0, 0, 0.4);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
}

.keyboard-help-panel {
	background: var(--color-bg-elevated);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	padding: var(--sp-6);
	min-width: 280px;
	max-width: 400px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.keyboard-help-panel h2 {
	font-size: var(--text-xl);
	font-weight: 600;
	margin: 0 0 var(--sp-4);
	color: var(--color-text);
}

.keyboard-help-panel dl {
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
}

.keyboard-help-panel dl > div {
	display: flex;
	align-items: center;
	gap: var(--sp-4);
}

.keyboard-help-panel dt {
	font-family: var(--font-mono);
	font-size: var(--text-sm);
	font-weight: 600;
	background: var(--color-bg-subtle);
	padding: var(--sp-1) var(--sp-2);
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
	min-width: 32px;
	text-align: center;
	color: var(--color-text);
}

.keyboard-help-panel dd {
	margin: 0;
	font-size: var(--text-sm);
	color: var(--color-text-secondary);
}

.keyboard-help-panel p {
	margin: var(--sp-4) 0 0;
	font-size: var(--text-xs);
	color: var(--color-text-tertiary);
	text-align: center;
}

/* ============================================================
   KEYBOARD SHORTCUT INDICATORS
   ============================================================ */
.key-indicator {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-mono);
	font-size: var(--text-xs);
	font-weight: 600;
	color: var(--color-text-secondary);
	background: var(--color-bg-subtle);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 0.125em 0.375em;
	min-width: 1.5em;
	line-height: 1;
	margin-left: var(--sp-2);
}

/* Key indicators are hidden by default (don't take up space), shown when shift is held */
.key-indicator {
	display: none;
}

/* Show key indicators when shift key is held down */
body.show-key-indicators .key-indicator,
body.show-key-indicators a .key-indicator,
body.show-key-indicators button .key-indicator {
	display: inline-flex;
}

/* Header help trigger is always visible */
.site-header__right .key-indicator--help {
	display: inline-flex;
	cursor: pointer;
	margin-left: 0;
}

/* ============================================================
   BILLING
   ============================================================ */
.billing-status {
	margin-bottom: var(--sp-8);
}

.billing-badge {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	padding: var(--sp-2) var(--sp-3);
	border-radius: var(--radius);
	font-size: var(--text-sm);
	font-weight: 500;
	margin-bottom: var(--sp-3);
}

.billing-badge svg {
	width: 1rem;
	height: 1rem;
}

.billing-badge--active {
	background: var(--color-success-bg);
	color: var(--color-success-text);
}

.billing-badge--trialing {
	background: #eff6ff;
	color: #1d4ed8;
}

.billing-badge--past-due {
	background: var(--color-alert-bg);
	color: var(--color-alert-text);
}

.billing-badge--canceled {
	background: #f3f4f6;
	color: #6b7280;
}

.billing-badge--free {
	background: var(--color-bg-subtle);
	color: var(--color-text-secondary);
}

.billing-badge--incomplete {
	background: #fefce8;
	color: #854d0e;
}

.billing-badge--grandfathered {
	background: #f0fdf4;
	color: #166534;
}

.billing-badge--unknown {
	background: var(--color-bg-hover);
	color: var(--color-text-secondary);
}

.billing-description {
	font-size: var(--text-base);
	color: var(--color-text);
	margin-bottom: var(--sp-4);
	line-height: var(--leading-relaxed);
}

.billing-plan-details {
	background: var(--color-bg-subtle);
	border-radius: var(--radius);
	padding: var(--sp-4);
}

.billing-plan-details[open] {
	padding-bottom: var(--sp-4);
}

.billing-plan-details[open] .billing-plan-item:last-child {
	border-bottom: none;
}

.billing-plan-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--sp-2) 0;
	border-bottom: 1px solid var(--color-border);
}

.billing-plan-item:last-child {
	border-bottom: none;
}

.billing-plan-action {
	margin-top: var(--sp-4);
}

.billing-plan-action .btn {
	width: 100%;
}

.billing-accordion__summary {
	font-size: var(--text-sm);
	color: var(--color-text-secondary);
	font-weight: 500;
	cursor: pointer;
	list-style: none;
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}

.billing-accordion__summary > div,
.billing-accordion__summary > .billing-plan-item {
	flex: 1;
	min-width: 0;
	width: 100%;
}

.billing-accordion__summary::after {
	content: "";
	width: 0.5rem;
	height: 0.5rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform var(--transition-fast);
	margin-left: auto;
}

.billing-plan-details[open] .billing-accordion__summary::after {
	transform: rotate(-135deg);
}

.billing-plan-label {
	font-size: var(--text-sm);
	color: var(--color-text-secondary);
}

.billing-plan-value {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text);
}

.trial-banner {
	background: #eff6ff;
	color: #1e40af;
	padding: var(--sp-3) var(--sp-4);
	border-radius: var(--radius);
	margin-bottom: var(--sp-6);
	font-size: var(--text-sm);
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}

.trial-banner svg {
	width: 1rem;
	height: 1rem;
	flex-shrink: 0;
}

/* Empty state enhancements */
.empty-state__onboarding {
	background: var(--color-bg-elevated);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	padding: var(--sp-6);
	margin-bottom: var(--sp-6);
	max-width: 28rem;
	margin-left: auto;
	margin-right: auto;
}

.empty-state__onboarding h3 {
	font-size: var(--text-lg);
	font-weight: 600;
	margin-bottom: var(--sp-2);
	color: var(--color-text);
}

.empty-state__onboarding p {
	font-size: var(--text-sm);
	color: var(--color-text-secondary);
	margin-bottom: var(--sp-4);
	line-height: var(--leading-relaxed);
}

.onboarding-tips {
	list-style: none;
	margin: 0;
	padding: 0;
}

.onboarding-tips li {
	font-size: var(--text-sm);
	color: var(--color-text-secondary);
	padding: var(--sp-1) 0;
	display: flex;
	align-items: flex-start;
	gap: var(--sp-2);
}

.onboarding-tips li::before {
	content: "→";
	color: var(--color-accent);
	display: inline-block;
	flex-shrink: 0;
}
