:root {
	color-scheme: light dark;
	--bg: #f6f7fb;
	--surface: #ffffff;
	--surface-strong: #f0f2f7;
	--surface-muted: #f8f9fc;
	--text: #0f172a;
	--text-muted: #525a6b;
	/* Used as a subtle backdrop while images are still loading */
	--image-placeholder: rgba(15, 23, 42, 0.06);
	/* Used for "image unavailable" fallbacks */
	--icon-image-unavailable: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M8 13l2-2 3 3'/%3E%3Cpath d='M3 19L21 5'/%3E%3C/g%3E%3C/svg%3E");
	--border: #e2e8f0;
	--accent: #7c3aed;
	--accent-text: #ffffff;
	--focus: #6d28d9;
	--shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
	--input-bg: #ffffff;
	--error-bg: #fef2f2;
	--error-border: #fecaca;
	--error-text: #b91c1c;
}

/* Original dark theme (commented out)
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-strong: #1f2937;
    --surface-muted: #0f172a;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #27324a;
    --accent: #60a5fa;
    --accent-text: #0b1120;
    --focus: #93c5fd;
    --shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
    --input-bg: #0b1120;
  }
}
*/

/* Subtle royal purple dark theme */
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0f0d1a;
		--surface: #1a1628;
		--surface-strong: #25203a;
		--surface-muted: #120f1d;
		--text: #ede9fe;
		--text-muted: #b3b7c3;
		/* Used as a subtle backdrop while images are still loading */
		--image-placeholder: rgba(237, 233, 254, 0.08);
		--border: #3d3552;
		/* --accent: #7c3aed; */
		--accent: #05c76f;
		--accent-text: #0f0d1a;
		--focus: #8b5cf6;
		--shadow: 0 16px 32px rgba(91, 33, 182, 0.2);
		--input-bg: #0f0d1a;
		--error-bg: #2a1520;
		--error-border: #5b1f35;
		--error-text: #fda4af;
	}
}

@supports (background-color: color-mix(in srgb, white 10%, transparent)) {
	:root {
		--image-placeholder: color-mix(in srgb, var(--text) 10%, transparent);
		--text-muted: color-mix(in srgb, var(--text) 62%, transparent);
	}
}

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

html {
	background: var(--bg);
}

body {
	margin: 0;
	min-height: 100vh;
	font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.5;
	background: var(--bg);
	color: var(--text);
}

img {
	/* Shows through while the image is still loading */
	background-color: var(--image-placeholder);
}

/* ============================================
   Image failure fallbacks (professional)
   ============================================ */

.route-media.route-media-error {
	background:
		linear-gradient(135deg,
			color-mix(in srgb, var(--text) 10%, transparent),
			color-mix(in srgb, var(--text) 4%, transparent));
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 12px;
}

.route-media.route-media-error::after {
	content: "";
	width: 40px;
	height: 40px;
	background-color: color-mix(in srgb, var(--text) 42%, transparent);
	-webkit-mask: var(--icon-image-unavailable) center / contain no-repeat;
	mask: var(--icon-image-unavailable) center / contain no-repeat;
	opacity: 0.85;
}

/* Hide content until page is fully loaded */
body:not(.loaded) {
	visibility: hidden;
	opacity: 0;
}

body.loaded {
	visibility: visible;
	opacity: 1;
	transition: opacity 0.2s ease-in;
}

/* Prevent text selection on interactive elements */
button,
a.button,
header .create-button,
header .action-item,
svg,
.icon,
header .logo,
.logo,
.logo-text,
[class*="icon"],
[class*="badge"] {
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
}

header {
	position: sticky;
	top: 0;
	z-index: 1000;
	padding: 8px 0px;
	background: linear-gradient(to bottom,
			rgba(246, 247, 251, 1) 0%,
			rgba(246, 247, 251, 0.95) 20%,
			rgba(246, 247, 251, 0.8) 50%,
			rgba(246, 247, 251, 0.4) 100%);
	backdrop-filter: blur(20px) saturate(180%);
	-webkit-backdrop-filter: blur(20px) saturate(180%);
	border-bottom: 1px solid rgba(226, 232, 240, 0.3);
	overflow: visible;
}

/* Original dark theme header (commented out)
@media (prefers-color-scheme: dark) {
  header {
    background: linear-gradient(
      to bottom,
      rgba(17, 24, 39, 1) 0%,
      rgba(17, 24, 39, 0.95) 20%,
      rgba(17, 24, 39, 0.8) 50%,
      rgba(17, 24, 39, 0.4) 100%
    );
    border-bottom: 1px solid rgba(39, 50, 74, 0.3);
  }
}
*/

/* Subtle royal purple dark theme header */
@media (prefers-color-scheme: dark) {
	header {
		background: linear-gradient(to bottom,
				rgba(26, 22, 40, 1) 0%,
				rgba(26, 22, 40, 0.95) 20%,
				rgba(26, 22, 40, 0.8) 50%,
				rgba(26, 22, 40, 0.4) 100%);
		border-bottom: 1px solid rgba(61, 53, 82, 0.3);
	}
}

/* Subtle gradient overlay for additional depth */
header::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 100%;
	background: linear-gradient(to bottom,
			rgba(255, 255, 255, 0.1) 0%,
			rgba(255, 255, 255, 0.05) 30%,
			transparent 100%);
	pointer-events: none;
	z-index: 0;
}

@media (prefers-color-scheme: dark) {
	header::before {
		background: linear-gradient(to bottom,
				rgba(255, 255, 255, 0.05) 0%,
				rgba(255, 255, 255, 0.02) 30%,
				transparent 100%);
	}
}

/* Ensure header content is above the gradient overlay */
header .header-content {
	position: relative;
	z-index: 1;
}

header .header-content {
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 24px;
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: 56px;
}

app-navigation {
	display: block;
	position: sticky;
	top: 0;
	z-index: 1000;
}

@media (max-width: 768px) {
	* {
		-webkit-tap-highlight-color: transparent;
	}

	app-navigation {
		position: sticky;
		top: 0;
		z-index: 1000;
	}

	header {
		padding: 4px 0px;
		position: sticky;
		top: 0;
		z-index: 1000;
	}

	header .header-content {
		min-height: 48px;
	}
}

header .header-logo {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	margin: 0;
	padding: 0;
	height: 40px;
}

header .header-nav {
	display: flex;
	align-items: center;
	gap: 0;
	margin-left: auto;
	margin-right: 0;
}

header .header-nav a {
	display: block;
	padding: 8px 12px;
	text-decoration: none;
	color: var(--text-muted);
	font-size: 0.875rem;
	font-weight: 500;
	transition: color 0.2s;
}

header .header-nav a:hover {
	color: var(--text);
}

header .header-nav a.active {
	color: var(--text);
	font-weight: 700;
}

header .header-actions {
	display: flex;
	align-items: center;
	gap: 2px;
	flex-wrap: wrap;
	position: relative;
	flex-shrink: 0;
}

header h1,
header p {
	max-width: 960px;
	margin: 0 auto;
}

header h1 {
	font-size: 1.75rem;
	letter-spacing: -0.02em;
}

header p {
	margin-top: 6px;
	color: var(--text-muted);
}

header .logo {
	display: block;
	margin: 0;
}

header .logo-text {
	font-family: "Montserrat", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 24px;
	font-weight: 700;
	font-style: italic;
	fill: var(--text);
	letter-spacing: -0.02em;
}

main {
	position: relative;
	max-width: 1400px;
	margin: 0 auto;
	padding: 24px 24px 48px;
}

@media (max-width: 768px) {
	main {
		padding: 24px 8px 48px;
	}
}

main>section:first-of-type:not(.hero) {
	margin-top: 16px;
}

/* section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
} */

section {
	overflow-x: auto;
}

section+section {
	margin-top: 16px;
}

h2,
h3 {
	margin: 0 0 8px;
	letter-spacing: -0.01em;
}

p {
	margin: 0;
}

ul {
	margin: 8px 0 0;
	padding-left: 20px;
}

li {
	margin: 6px 0;
}

form {
	display: grid;
	gap: 12px;
}

.alert {
	padding: 12px 14px;
	border-radius: 12px;
	border: 1px solid var(--border);
	background: var(--surface-strong);
	color: var(--text);
}

.alert p {
	margin: 0;
}

.alert.error {
	background: var(--error-bg);
	border-color: var(--error-border);
	color: var(--error-text);
}

.margin-bottom-1 {
	margin-bottom: 8px;
}

label {
	display: grid;
	gap: 6px;
	font-weight: 600;
}

input {
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: var(--input-bg);
	color: inherit;
}

textarea {
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: var(--input-bg);
	color: inherit;
	resize: vertical;
}

input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 8px;
	padding: 0;
	border-radius: 999px;
	border: none;
	background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
	height: 8px;
	background: var(--surface-strong);
	border: 1px solid var(--border);
	border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	margin-top: -5px;
	border-radius: 50%;
	background: var(--accent);
	border: 2px solid var(--surface);
	box-shadow: var(--shadow);
}

input[type="range"]::-moz-range-track {
	height: 8px;
	background: var(--surface-strong);
	border-radius: 999px;
	border: 1px solid var(--border);
}

input[type="range"]::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--accent);
	border: 2px solid var(--surface);
	box-shadow: var(--shadow);
}

input[type="range"]:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--focus);
}

input[type="range"]:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
	-webkit-text-fill-color: var(--text) !important;
	-webkit-box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;
	box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;
	font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
	font-size: 1rem !important;
	line-height: 1.5 !important;
	transition: background-color 5000s ease-in-out 0s;
}

button {
	align-self: start;
	padding: 10px 16px;
	border-radius: 10px;
	border: 1px solid var(--accent);
	background: var(--accent);
	color: var(--accent-text);
	font-weight: 600;
	cursor: pointer;
}

button:hover {
	filter: brightness(0.95);
}

button:active {
	transform: translateY(1px);
}

/* Primary button style */
.btn-primary,
button.btn-primary,
header .action-item.btn-primary,
header .create-button.btn-primary {
	background: var(--accent);
	color: var(--accent-text);
	border-color: var(--accent);
	font-weight: 500;
	transition: background 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover:not(:disabled),
button.btn-primary:hover:not(:disabled),
header .action-item.btn-primary:hover:not(:disabled),
header .create-button.btn-primary:hover:not(:disabled) {
	background: var(--focus);
	border-color: var(--focus);
	transform: translateY(-1px);
}

.btn-primary:active:not(:disabled),
button.btn-primary:active:not(:disabled),
header .action-item.btn-primary:active:not(:disabled),
header .create-button.btn-primary:active:not(:disabled) {
	transform: translateY(0);
}

.btn-primary:disabled,
button.btn-primary:disabled,
header .action-item.btn-primary:disabled,
header .create-button.btn-primary:disabled {
	background: var(--surface-strong);
	color: var(--text);
	border-color: var(--border);
	cursor: not-allowed;
	opacity: 0.6;
}

/* Secondary button style */
.btn-secondary,
a.btn-secondary {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border-radius: 8px;
	background: var(--surface);
	border: 1px solid var(--border);
	color: var(--text);
	text-decoration: none;
	font-size: 0.95rem;
	transition: background-color 0.2s, border-color 0.2s;
	box-shadow: var(--shadow);
	cursor: pointer;
	font: inherit;
}

.btn-secondary:hover,
a.btn-secondary:hover {
	background: var(--surface-strong);
	border-color: var(--accent);
}

.btn-secondary:focus-visible,
a.btn-secondary:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.btn-secondary .icon,
a.btn-secondary .icon {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

input:focus-visible,
button:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--focus);
}

input:focus-visible {
	border-color: var(--focus);
}

table {
	width: 100%;
	border-collapse: collapse;
	background: var(--surface);
	font-size: 0.95rem;
}

th,
td {
	padding: 10px 12px;
	border: 1px solid var(--border);
	text-align: left;
}

thead {
	background: var(--surface-strong);
}

tbody tr:nth-child(even) {
	background: var(--surface-muted);
}

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

/* Field display styles */
.field {
	margin: 12px 0;
}

.field label,
.field .label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.field .value {
	font-size: 1rem;
	color: var(--text);
}

/* Navigation bar with active indicator */
app-nav-bar {
	display: block;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}

.nav-bar {
	display: flex;
	gap: 0;
	max-width: 960px;
	margin: 0 auto;
	padding: 0 20px;
}

.nav-bar ul {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 0;
}

.nav-bar li {
	margin: 0;
}

.nav-bar a {
	display: block;
	padding: 10px 16px;
	text-decoration: none;
	color: var(--text-muted);
	font-size: 0.875rem;
	font-weight: 500;
	position: relative;
	transition: color 0.2s, border-color 0.2s;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.nav-bar a:hover {
	color: var(--text);
}

.nav-bar a.active {
	color: var(--text);
	border-bottom-color: var(--accent);
	font-weight: 600;
}

/* Route content sections */
[data-route-content] {
	display: none;
}

[data-route-content].active {
	display: block;
}

/* ============================================
   Header Component Styles
   ============================================ */

/* Header action items */
header .action-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 36px;
	padding: 0 12px;
	border-radius: 6px;
	text-decoration: none;
	color: var(--text);
	background: transparent;
	border: 1px solid transparent;
	font-size: 0.875rem;
	transition: background-color 0.2s, border-color 0.2s;
	cursor: pointer;
	font: inherit;
	align-self: center;
	line-height: 1;
}

/* Square icon buttons for even spacing */
header .action-item.notifications-button,
header .action-item.profile-button {
	width: 36px;
	padding: 0;
	justify-content: center;
}

header .action-item.profile-button.is-avatar-loading {
	visibility: hidden;
	pointer-events: none;
}

header .profile-button .profile-avatar {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	object-fit: cover;
	display: none;
}

header .profile-button.has-avatar .profile-avatar {
	display: block;
}

header .profile-button.has-avatar .icon {
	display: none;
}

/* Credits button includes a label/count, so keep it wider but same height */
header .action-item.credits-button {
	padding: 0 10px;
}

header .action-item:hover:not(.btn-primary) {
	background: var(--surface-strong);
	border-color: var(--border);
}

header .action-item:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

header .action-item .icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	display: block;
}

header .credits-button .icon {
	width: 20px;
	height: 20px;
}

header .credits-button {
	position: relative;
}

header .credits-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 16px;
	height: 16px;
	width: 16px;
	border-radius: 999px;
	background: var(--accent);
	border: 2px solid var(--surface);
	box-sizing: border-box;
	display: none;
	align-items: center;
	justify-content: center;
}

header .credits-button.attention .credits-badge {
	display: inline-flex;
}


header .header-actions>* {
	align-self: center;
}

/* Primary button in header - override action-item base styles */
header .action-item.btn-primary,
header .create-button.btn-primary {
	background: var(--accent);
	color: var(--accent-text);
	border-color: var(--accent);
}

/* Notifications button and badge */
header .notifications-wrapper {
	display: inline-flex;
	align-items: center;
	position: relative;
}

header .notifications-button {
	position: relative;
}

header .notifications-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--accent);
	color: var(--accent-text);
	font-size: 0.65rem;
	font-weight: 700;
	display: none;
	align-items: center;
	justify-content: center;
	border: 2px solid var(--surface);
	box-sizing: border-box;
}

header .notifications-badge:not(:empty) {
	display: inline-flex;
}

/* Notifications menu */
header .notifications-menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: var(--shadow);
	width: 250px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
	z-index: 1000;
	overflow: hidden;
}

header .notifications-menu.open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

header .notifications-menu-item {
	display: block;
	width: 100%;
	padding: 12px 16px;
	text-decoration: none;
	color: var(--text);
	border: none;
	background: transparent;
	text-align: left;
	font-size: 0.95rem;
	cursor: pointer;
	transition: background-color 0.2s;
	font: inherit;
}

header .notifications-menu-item:first-child {
	border-radius: 10px 10px 0 0;
}

header .notifications-menu-item:last-child {
	border-radius: 0 0 10px 10px;
}

header .notifications-menu-item:hover {
	background: var(--surface-strong);
}

header .notifications-menu-item:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: -2px;
}

header .notifications-menu-divider {
	height: 1px;
	background: var(--border);
	margin: 4px 0;
}

header .notifications-preview {
	display: grid;
	gap: 8px;
	padding: 8px 0;
}

header .notification-preview-item {
	display: grid;
	gap: 4px;
	padding: 10px 14px;
	cursor: pointer;
}

header .notification-preview-item+.notification-preview-item {
	border-top: 1px solid var(--border);
}

header .notification-preview-item.is-read {
	opacity: 0.65;
}

header .notification-preview-item.is-new .notification-preview-title {
	color: var(--text);
}

header .notification-preview-title {
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--text);
}

header .notification-preview-message {
	font-size: 0.85rem;
	color: var(--text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	overflow-wrap: anywhere;
	word-break: break-word;
}

header .notification-preview-time {
	font-size: 0.75rem;
	color: var(--text-muted);
}

header .notifications-loading {
	padding: 8px 12px;
	color: var(--text-muted);
	font-size: 0.9rem;
}

/* Hamburger button */
header .hamburger-button {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 24px;
	height: 24px;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	margin-block: auto;
	margin-inline: 0;
	z-index: 1001;
	position: relative;
	gap: 4px;
	flex-shrink: 0;
}

header .hamburger-button span {
	width: 20px;
	height: 2px;
	background: var(--text);
	border-radius: 1px;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	transform-origin: center;
	display: block;
}

header .hamburger-button.active span:nth-child(1) {
	transform: rotate(45deg) translate(5px, 5px);
}

header .hamburger-button.active span:nth-child(2) {
	opacity: 0;
	transform: scale(0);
}

header .hamburger-button.active span:nth-child(3) {
	transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu */
.mobile-menu {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: 330px;
	max-width: 85vw;
	height: 100vh;
	background: var(--surface);
	z-index: 1001;
	transform: translateX(-100%);
	transition: transform 0.3s ease;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.mobile-menu.open {
	transform: translateX(0);
}

.mobile-menu-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 1000;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-backdrop.open {
	opacity: 1;
	visibility: visible;
}

@media (min-width: 769px) {
	.mobile-menu {
		display: none;
	}

	.mobile-menu-backdrop {
		display: none;
	}
}

.mobile-menu-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 5px 0 25px;
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
	min-height: 57px;
}

.mobile-menu-header .header-logo {
	flex: 1;
	display: flex;
	align-items: center;
	line-height: 0;
	margin: 0;
	padding: 0;
}

.mobile-menu-header .logo {
	height: 36px;
	width: auto;
	display: block;
}

.mobile-menu-header .logo-text {
	font-family: "Montserrat", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 24px;
	font-weight: 700;
	font-style: italic;
	fill: var(--text);
	letter-spacing: -0.02em;
}

.mobile-menu-close {
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 6px;
	color: var(--text);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: background-color 0.2s;
	margin: auto;
}

.mobile-menu-close:hover {
	background: var(--surface-strong);
}

.mobile-menu-close svg {
	width: 25px;
	height: 25px;
}

.mobile-menu-content {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.mobile-menu-nav {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-bottom: 20px;
}

.mobile-menu-nav .nav-link {
	display: block;
	padding: 14px 16px;
	text-decoration: none;
	color: var(--text-muted);
	font-size: 0.95rem;
	font-weight: 500;
	border-radius: 8px;
	transition: background-color 0.2s, color 0.2s;
}

.mobile-menu-nav .nav-link:hover {
	background: var(--surface-strong);
	color: var(--text);
}

.mobile-menu-nav .nav-link.active {
	color: var(--text);
	font-weight: 600;
	background: var(--surface-strong);
}

.mobile-menu-actions {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-top: 20px;
}

.mobile-menu-actions .create-button {
	width: 100%;
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 0.95rem;
	font-weight: 600;
}

.mobile-menu-actions .action-item {
	display: block;
	width: 100%;
	padding: 14px 16px;
	text-decoration: none;
	color: var(--text-muted);
	font-size: 0.95rem;
	font-weight: 500;
	border-radius: 8px;
	transition: background-color 0.2s, color 0.2s;
	border: none;
	background: transparent;
	text-align: left;
	cursor: pointer;
	font: inherit;
}

.mobile-menu-actions .action-item:hover {
	background: var(--surface-strong);
	color: var(--text);
}

.mobile-menu-profile {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.mobile-menu-profile-item {
	display: block;
	padding: 14px 16px;
	text-decoration: none;
	color: var(--text-muted);
	border-radius: 8px;
	background: transparent;
	text-align: left;
	font-size: 0.95rem;
	font-weight: 500;
	transition: background-color 0.2s, color 0.2s;
	border: none;
	cursor: pointer;
	font: inherit;
}

.mobile-menu-profile-item:hover {
	background: var(--surface-strong);
	color: var(--text);
}

.mobile-menu-profile button[type="submit"].mobile-menu-profile-item {
	background: var(--surface-strong);
	color: var(--text);
	text-align: center;
	margin-top: 8px;
}

.mobile-menu-profile button[type="submit"].mobile-menu-profile-item:hover {
	background: var(--border);
}

@media (max-width: 768px) {

	header .hamburger-button,
	header .action-item,
	header .header-nav a,
	.mobile-menu .nav-link,
	.mobile-menu .action-item,
	.mobile-menu-close {
		-webkit-tap-highlight-color: transparent;
	}

	header .hamburger-button {
		display: flex;
		margin-right: 12px;
		margin-left: 0;
		flex-shrink: 0;
	}

	header .header-nav {
		display: none;
	}

	header .header-actions {
		display: flex;
		gap: 4px;
	}

	header .header-actions .create-button {
		display: none;
	}

	/* If Create is rendered outside header-actions, still hide it on mobile */
	header .header-content .create-button {
		display: none;
	}

	header .header-content {
		padding: 0 16px;
		gap: 0;
		align-items: center;
		min-height: 48px;
	}

	header .header-logo {
		margin: 0;
		height: 36px;
		display: flex;
		align-items: center;
	}

	header .header-logo .logo {
		height: 36px;
		width: auto;
	}

	header .header-actions {
		margin-left: auto;
	}
}

@media (min-width: 769px) {
	header .hamburger-button {
		display: none;
	}
}

/* Mobile bottom nav */
.mobile-bottom-nav-wrap {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	display: none;
	pointer-events: none;
	z-index: 999;
}

@media (max-width: 768px) {
	.mobile-bottom-nav-wrap {
		display: flex;
	}

	body:not(.landing-page) main {
		padding-bottom: calc(96px + env(safe-area-inset-bottom));
	}
}

.mobile-bottom-nav-bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 55px;
	background: linear-gradient(to top,
			rgba(246, 247, 251, 1) 0%,
			rgba(246, 247, 251, 0.95) 20%,
			rgba(246, 247, 251, 0.8) 50%,
			rgba(246, 247, 251, 0.4) 100%);
	border-top: 1px solid rgba(226, 232, 240, 0.3);
	backdrop-filter: blur(20px) saturate(180%);
	-webkit-backdrop-filter: blur(20px) saturate(180%);
	box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.12);
}

.mobile-bottom-nav-bar::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 100%;
	background: linear-gradient(to top,
			rgba(255, 255, 255, 0.1) 0%,
			rgba(255, 255, 255, 0.05) 30%,
			transparent 100%);
	pointer-events: none;
}

@media (prefers-color-scheme: dark) {
	.mobile-bottom-nav-bar {
		background: linear-gradient(to top,
				rgba(26, 22, 40, 1) 0%,
				rgba(26, 22, 40, 0.95) 20%,
				rgba(26, 22, 40, 0.8) 50%,
				rgba(26, 22, 40, 0.4) 100%);
		border-top: 1px solid rgba(61, 53, 82, 0.3);
	}

	.mobile-bottom-nav-bar::before {
		background: linear-gradient(to top,
				rgba(255, 255, 255, 0.05) 0%,
				rgba(255, 255, 255, 0.02) 30%,
				transparent 100%);
	}
}

.mobile-bottom-nav-buttons {
	position: relative;
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	align-items: end;
	gap: 0;
	height: 65px;
	padding: 0 20px 13px;
	width: 100%;
	pointer-events: auto;
}

.mobile-bottom-nav-slot {
	height: 1px;
}

.mobile-bottom-nav-item {
	background: none;
	border: none;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	color: var(--text-muted);
	font: inherit;
	cursor: pointer;
	margin-top: auto;
}

.mobile-bottom-nav-item:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

.mobile-bottom-nav-item.is-active {
	color: var(--text);
}

.mobile-bottom-nav-icon {
	width: 16px;
	height: 16px;
}

.mobile-bottom-nav-icon-home {
	fill: none;
}

.mobile-bottom-nav-icon-home .home-house,
.mobile-bottom-nav-icon-home .home-door-outline,
.mobile-bottom-nav-icon-home .home-door-fill {
	fill: none;
	transition: fill 0.2s, stroke 0.2s, opacity 0.2s;
}

.mobile-bottom-nav-icon-home .home-door-fill {
	opacity: 0;
}

.mobile-bottom-nav-item.is-active .mobile-bottom-nav-icon-home .home-house {
	fill: currentColor;
	stroke: transparent;
}

.mobile-bottom-nav-item.is-active .mobile-bottom-nav-icon-home .home-door-outline {
	opacity: 0;
}

.mobile-bottom-nav-item.is-active .mobile-bottom-nav-icon-home .home-door-fill {
	fill: var(--bg);
	stroke: none;
	opacity: 1;
}

.mobile-bottom-nav-text {
	font-size: 0.6rem;
	letter-spacing: 0.02em;
	line-height: 1;
}

.mobile-bottom-nav-buttons .create-button {
	background: none;
	border: none;
	box-shadow: none;
	justify-self: center;
	font-weight: inherit;
}

.mobile-bottom-nav-buttons .create-button .create-button-icon {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--focus);
	border: 1px solid var(--focus);
	color: var(--accent-text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--shadow);
}

.mobile-bottom-nav-buttons .create-button.is-active .create-button-icon {
	background: transparent;
	border-color: transparent;
	box-shadow: none;
	margin-bottom: -8px;
}

.mobile-bottom-nav-buttons .create-button svg {
	width: 18px;
	height: 18px;
	stroke: var(--text);
}

/* ============================================
   Common Route Component Styles
   ============================================ */

.route-header {
	margin-bottom: 12px;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.route-header h3 {
	margin: 0;
}

.route-header p {
	color: var(--text-muted);
	margin: 0;
}

@media (max-width: 768px) {
	.route-header p {
		font-size: 0.9rem;
	}
}

.route-header button {
	align-self: flex-start;
}

.route-section {
	margin-top: 28px;
}

.route-cards {
	display: grid;
	gap: 12px;
}

.admin-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 16px;
	margin-top: 0;
}

app-route-feed {
	margin-top: -16px;
}

.feed-route .route-cards.feed-cards {
	display: flex;
	flex-direction: column;
	gap: 0;
}

@media (min-width: 769px) {
	.feed-route .route-cards.feed-cards {
		max-width: 600px;
		margin: 0 auto;
	}
}

.feed-card {
	background: transparent;
	border: none;
	border-radius: 0;
	padding: 6px 0 16px;
	box-shadow: none;
	display: flex;
	flex-direction: column;
	gap: 12px;
	position: relative;
}

.feed-card+.feed-card {
	padding-top: 16px;
}


.feed-card-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 4px;
}

.feed-card-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 0.95rem;
	flex-shrink: 0;
}

.feed-card-avatar-img {
	width: 100%;
	height: 100%;
	display: block;
	border-radius: 50%;
	object-fit: cover;
}

.user-link {
	color: inherit;
	text-decoration: none;
}

.user-link:hover {
	text-decoration: underline;
}

.user-link:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 6px;
}

.user-avatar-link:hover {
	text-decoration: none;
}

.feed-card-footer-grid {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 12px;
	align-items: start;
	padding: 0px 4px 0;
}

.feed-card-content {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.feed-card-title {
	font-weight: 500;
	font-size: 0.95rem;
	line-height: 1.4;
	color: var(--text);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
	text-overflow: ellipsis;
	word-break: break-word;
}

.feed-card-metadata {
	color: var(--text-muted);
	font-size: 0.85rem;
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.feed-card-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.feed-card-author {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.95rem;
	min-width: 0;
	flex-wrap: wrap;
}

.feed-card-name {
	font-weight: 600;
	color: var(--text);
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.feed-card-time {
	color: var(--text-muted);
	font-size: 0.85rem;
}

.feed-card-follow {
	background: transparent;
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 0.85rem;
	cursor: pointer;
}

.feed-card-image {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 0;
	overflow: hidden;
	background: var(--surface-muted);
}

.feed-card-image.loading {
	background: linear-gradient(90deg, var(--surface-muted), var(--surface-strong), var(--surface-muted));
	background-size: 200% 100%;
	animation: loading 4s linear infinite;
}

@media (prefers-color-scheme: light) {
	.feed-card-image.loading {
		background: linear-gradient(90deg,
				rgba(124, 58, 237, 0.2),
				rgba(124, 58, 237, 0.4),
				rgba(124, 58, 237, 0.2));
		background-size: 200% 100%;
	}
}

.feed-card-image.loaded {
	background: var(--surface-muted);
}

.feed-card-image .feed-card-img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	border-radius: 0;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.feed-card-image.loaded .feed-card-img {
	opacity: 1;
}

.feed-card-actions {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 4px 0 12px;
}

.feed-card-action {
	background: transparent;
	border: none;
	color: var(--text-muted);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0;
	cursor: pointer;
	font-size: 0.9rem;
}

.feed-card-action svg {
	width: 18px;
	height: 18px;
}

.feed-card-action[data-like-button] {
	transition: color 0.15s ease;
}

.feed-card-action[data-like-button] svg {
	color: inherit;
}

.feed-card-action[data-like-button] svg path {
	fill: none;
	stroke: currentcolor;
	transition: fill 0.15s ease;
}

.feed-card-action[data-like-button][aria-pressed="true"] svg path {
	fill: currentcolor;
	stroke: currentcolor;
}

.feed-card-action[data-like-button].is-like-animating svg {
	animation: like-beat 1.35s cubic-bezier(0.2, 0.9, 0.2, 1);
	transform-origin: center;
}

.feed-card-action[data-like-button].is-like-animating svg path {
	fill: currentcolor;
}

.feed-card-action-count {
	color: var(--text-muted);
	font-size: 0.85rem;
}

.feed-card-action-more {
	margin-left: auto;
}

/* Comments */

.creation-detail-comments-link {
	color: var(--text-muted);
	text-decoration: none;
}

.creation-detail-comments-link:hover {
	text-decoration: none;
	color: var(--text);
}

.comments-sort {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.comments-toolbar {
	display: flex;
	justify-content: flex-end;
	margin: 16px 0 4px;
}

.comments-sort-icon {
	width: 18px;
	height: 18px;
	color: var(--text-muted);
}

.comments-sort-label {
	color: var(--text-muted);
	font-size: 0.85rem;
}

.comments-sort-select {
	background: transparent;
	border: none;
	color: var(--text);
	padding: 4px 2px;
	font-size: 0.9rem;
}

.comment-input {
	display: grid;
	grid-template-columns: 32px 1fr;
	gap: 10px;
	margin-top: 16px;
	margin-bottom: 12px;
}

.comment-avatar {
	width: 32px;
	height: 32px;
	margin-top: 0.25em;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	color: var(--text);
	overflow: hidden;
	flex: 0 0 auto;
}

.comment-avatar-img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
}

.comment-input-body {
	min-width: 0;
}

.comment-textarea {
	width: 100%;
	resize: none;
	background: var(--surface-muted);
	border: 1px solid var(--border);
	border-radius: 6px;
	color: var(--text);
	padding: 10px 12px;
	line-height: 1.35;
	overflow: hidden;
}

.comment-textarea:focus {
	outline: none;
	border-color: var(--accent);
}

.comment-submit-row {
	margin-top: 8px;
	display: flex;
	justify-content: flex-end;
}

.comment-submit-btn {
	padding: 8px 12px;
	font-size: 0.9rem;
}

.comment-list {
	display: grid;
	gap: 12px;
}

.comment-item {
	display: grid;
	grid-template-columns: 32px 1fr;
	gap: 10px;
	align-items: start;
}

.comment-item+.comment-item {
	padding-top: 12px;
	border-top: 1px solid var(--border);
}

.comment-body {
	min-width: 0;
}

.comment-top {
	display: flex;
	align-items: center;
	gap: 10px;
}

.comment-top-left {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.comment-author-link:hover {
	text-decoration: underline;
}

.comment-author-name {
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100%;
}

.comment-author-handle {
	color: var(--text-muted);
	font-size: 0.85rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.comment-time {
	color: var(--text-muted);
	font-size: 0.85rem;
	white-space: nowrap;
	flex: 0 0 auto;
}

.comment-time-row {
	margin-top: 6px;
}

.comment-text {
	margin-top: 4px;
	white-space: pre-wrap;
	word-break: break-word;
}

/* Image grid layouts */
.route-cards-image-grid {
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 6px;
}

@media (max-width: 1024px) {
	.route-cards-image-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (max-width: 860px) {
	.route-cards-image-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 860px) {
	.route-cards-image-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.feed-card {
		border-radius: 0;
		padding: 6px 0 24px;
	}

	.feed-card+.feed-card {
		padding-top: 16px;
	}

	.feed-card-image {
		width: 100%;
		margin: 0;
		border-radius: 0;
	}

}

.route-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 14px;
	box-shadow: var(--shadow);
	display: grid;
	gap: 8px;
}

/* Image card variant */
.route-card-image {
	background: transparent;
	border: none;
	border-radius: 0;
	box-shadow: none;
	position: relative;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: stretch;
	padding: 0;
}

.route-media {
	position: absolute;
	inset: 0;
	border-radius: 6px;
	background-color: var(--image-placeholder);
	background-size: cover;
	background-position: center;
	border: none;
}

.route-media.loading {
	background: linear-gradient(90deg, var(--surface-muted), var(--surface-strong), var(--surface-muted));
	background-size: 200% 100%;
	animation: loading 4s linear infinite;
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
}

@media (prefers-color-scheme: light) {
	.route-media.loading {
		background: linear-gradient(90deg,
				rgba(124, 58, 237, 0.2),
				rgba(124, 58, 237, 0.4),
				rgba(124, 58, 237, 0.2));
		background-size: 200% 100%;
	}

	.route-media.loading::after {
		color: rgba(255, 255, 255, 0.9);
		font-weight: 500;
	}
}

@keyframes loading {
	0% {
		background-position: 200% 0;
	}

	100% {
		background-position: -200% 0;
	}
}

@keyframes like-beat {
	0% {
		transform: scale(1);
	}

	12% {
		transform: scale(1.25);
	}

	22% {
		transform: scale(1);
	}

	42% {
		transform: scale(1.18);
	}

	52% {
		transform: scale(1);
	}

	72% {
		transform: scale(1.12);
	}

	82% {
		transform: scale(1);
	}

	100% {
		transform: scale(1.02);
	}
}

.route-media.loading::after {
	content: 'Creating...';
	position: relative;
	z-index: 1;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.route-details {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	background: rgba(15, 13, 26, 0.92);
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	color: var(--text);
	z-index: 2;
}

@media (prefers-color-scheme: light) {
	.route-details {
		background: rgba(255, 255, 255, 0.9);
		color: var(--text);
	}
}

.route-details-content {
	padding: 12px;
}

.route-card:focus-within .route-details {
	opacity: 1;
	transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
	.route-card:hover .route-details {
		opacity: 1;
		transform: translateY(0);
	}
}

.route-title {
	font-weight: 600;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	line-height: 1.2;
	max-height: calc(1.2em * 2);
	height: calc(1.2em * 2);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: normal;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.route-meta {
	font-size: 0.85rem;
	color: var(--text-muted);
}

.route-meta-spacer {
	height: 6px;
}

.route-summary {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	line-height: 1.3;
	max-height: calc(1.3em * 2);
	height: calc(1.3em * 2);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: normal;
	overflow-wrap: anywhere;
	word-break: break-word;
	font-size: 0.85rem;
	color: rgba(237, 233, 254, 0.7);
	margin-top: 0;
}

@media (prefers-color-scheme: light) {
	.route-summary {
		color: rgba(15, 23, 42, 0.65);
	}
}

.route-tags {
	font-size: 0.8rem;
	color: var(--text-muted);
}

.route-empty {
	text-align: center;
	padding: 24px;
	color: var(--text-muted);
}

.route-empty-image-grid {
	grid-column: 1 / -1;
	text-align: center;
	padding: 48px 24px;
	color: var(--text-muted);
}

.feed-empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 80px 24px;
	min-height: 400px;
}

.feed-empty-icon {
	margin-bottom: 24px;
	opacity: 0.4;
	color: var(--text-muted);
}

.feed-empty-state .route-empty-title {
	margin-bottom: 12px;
}

.feed-empty-state .route-empty-message {
	max-width: 500px;
	margin: 0 auto;
}

.route-empty-title {
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--text);
	margin-bottom: 8px;
}

.route-empty-message {
	font-size: 0.95rem;
	color: var(--text-muted);
	margin-bottom: 24px;
	line-height: 1.5;
}

.route-empty-button {
	display: inline-block;
	padding: 10px 24px;
	background: var(--accent);
	color: var(--accent-text);
	border: none;
	border-radius: 6px;
	font-size: 0.95rem;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.2s ease, transform 0.1s ease;
	margin-top: 1em;
}

.route-empty-button:hover {
	background: var(--focus);
	transform: translateY(-1px);
}

.route-empty-button:active {
	transform: translateY(0);
}

/* ============================================
   Common Card Patterns
   ============================================ */

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 16px;
	box-shadow: var(--shadow);
	transition: transform 0.2s, box-shadow 0.2s;
}

@media (hover: hover) and (pointer: fine) {
	.card:hover {
		transform: translateY(-2px);
		box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
	}
}

/* Grid layouts for cards */
.cards-grid {
	display: grid;
	gap: 16px;
}

.cards-grid-auto {
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

@media (max-width: 768px) {
	.cards-grid-auto {
		grid-template-columns: 1fr;
	}
}

/* General grid utility classes */
.grid-auto-fit {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 12px;
}

.grid-auto-fit-sm {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 12px;
}

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

@media (max-width: 768px) {

	.grid-auto-fit,
	.grid-auto-fit-sm {
		grid-template-columns: 1fr;
	}

	.grid-2-col {
		grid-template-columns: 1fr;
	}
}

/* ============================================
   Loading, Empty, and Error States
   ============================================ */

.loading,
.empty,
.error {
	text-align: center;
	padding: 24px;
	color: var(--text-muted);
}

.error {
	color: var(--accent);
}

/* ============================================
   Route Loading Spinner (delayed reveal)
   ============================================ */

.route-loading {
	display: flex;
	align-items: center;
	justify-content: center;
}

.route-loading-spinner {
	width: 28px;
	height: 28px;
	border: 3px solid var(--border);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.8s linear infinite, spinner-reveal 0.18s ease-out forwards;
	opacity: 0;
	animation-delay: 0s, 2000ms;
}

@keyframes spinner-reveal {
	to {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.route-loading-spinner {
		animation: spin 0.8s linear infinite;
		opacity: 1;
	}
}

/* ============================================
   Status Badge/Indicator
   ============================================ */

.badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 6px;
	background: var(--surface-strong);
	color: var(--text);
	font-size: 0.875rem;
	font-weight: 600;
	text-transform: capitalize;
}

/* ============================================
   Standardized Modal Pattern
   ============================================ */

/* Prevent body scrolling when any modal is open */
body:has(.modal-overlay.open),
body:has(.publish-modal-overlay.open),
body:has([data-publish-modal].open),
body:has([data-todo-modal].open),
body:has([data-todo-readonly].open),
body:has([data-server-modal].open),
body.modal-open {
	overflow: hidden;
}

/* Modal Overlay - base class for all modals */
.modal-overlay,
.publish-modal-overlay,
[data-publish-modal],
[data-todo-modal],
[data-todo-readonly],
[data-server-modal],
#todo-modal,
#todo-readonly-modal,
#server-modal {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	background: rgba(0, 0, 0, 0.5) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	z-index: 99999 !important;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.open,
.publish-modal-overlay.open,
[data-publish-modal].open,
[data-todo-modal].open,
[data-todo-readonly].open,
[data-server-modal].open,
#todo-modal.open,
#todo-readonly-modal.open,
#server-modal.open {
	opacity: 1;
	visibility: visible;
}

/* Modal Container */
.modal,
.publish-modal {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: var(--shadow);
	max-width: 500px;
	width: 90%;
	max-height: 90vh;
	overflow: hidden;
	transform: scale(0.95);
	transition: transform 0.2s;
	display: flex;
	flex-direction: column;
	pointer-events: auto;
	position: relative;
	z-index: 1;
}

.modal-overlay.open .modal,
.publish-modal-overlay.open .publish-modal,
[data-publish-modal].open .publish-modal,
[data-todo-modal].open .publish-modal,
[data-todo-readonly].open .publish-modal,
[data-server-modal].open .publish-modal,
#todo-modal.open .publish-modal,
#todo-readonly-modal.open .publish-modal,
#server-modal.open .publish-modal {
	transform: scale(1);
}

/* Modal Header */
.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid var(--border);
}

.modal-header h2,
.modal-header h3 {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 600;
}

.modal-header h3 {
	font-size: 1.2rem;
}

/* Publish Modal Header */
.publish-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid var(--border);
}

.publish-modal-header h2,
.publish-modal-header h3 {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 600;
}

.publish-modal-header h3 {
	font-size: 1.2rem;
}

/* Modal Close Button */
.modal-close,
.publish-modal-close {
	background: transparent;
	border: none;
	color: var(--text);
	cursor: pointer;
	padding: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: background-color 0.2s;
	min-width: 32px;
	min-height: 32px;
	font-size: 1.2rem;
	line-height: 1;
}

.modal-close:hover,
.publish-modal-close:hover {
	background: var(--surface-strong);
}

.modal-close-icon {
	width: 24px;
	height: 24px;
}

/* Modal Body */
.modal-body {
	padding: 20px;
	flex: 1;
}

/* Publish Modal Body */
.publish-modal-body {
	padding: 20px;
	flex: 1;
}

/* Modal Footer */
.modal-footer,
.publish-modal-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-top: 1px solid var(--border);
	gap: 12px;
}

/* Modal Loading Overlay */
.modal-loading {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.7);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 10;
	border-radius: 14px;
}

.modal-loading.active {
	display: flex;
}

.modal-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid var(--border);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

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

/* Modal Size Variants */
.modal.modal-small {
	max-width: 400px;
}

.modal.modal-medium {
	max-width: 500px;
}

.modal.modal-large {
	max-width: 700px;
}

.modal.modal-extra-large {
	max-width: 900px;
}

.modal.modal-full-height {
	height: 90vh;
	max-height: 90vh;
}

/* ============================================
   Server Badges
   ============================================ */
.server-badge {
	display: inline-block;
	font-size: 0.75rem;
	font-weight: 600;
	padding: 0.25rem 0.5rem;
	border-radius: 4px;
	margin-left: 0.5rem;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.server-badge-owner {
	background: color-mix(in srgb, var(--accent) 20%, transparent);
	color: var(--accent);
}

.server-badge-member {
	background: var(--surface-strong);
	color: var(--text-muted);
}

.server-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.server-card-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.server-card-ghost {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 6px;
	height: 100%;
	border-style: dashed;
	border-color: var(--border);
	background: color-mix(in srgb, var(--surface) 80%, transparent);
	color: var(--text-muted);
	text-align: left;
	cursor: pointer;
}

.server-card-ghost:hover {
	background: color-mix(in srgb, var(--surface-strong) 85%, transparent);
	border-color: var(--accent);
}

.server-card-ghost:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.server-card-ghost-title {
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--text);
}

.server-card-ghost-subtitle {
	font-size: 0.85rem;
	color: var(--text-muted);
}

/* AI Server Generator Modal */
.ai-generator-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	padding: 1rem;
}

.ai-generator-modal {
	background: var(--surface);
	border-radius: 12px;
	width: 100%;
	max-width: 560px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.ai-generator-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--border);
}

.ai-generator-modal-header h3 {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 600;
	color: var(--text);
}

.ai-generator-modal-close {
	background: none;
	border: none;
	font-size: 1.5rem;
	cursor: pointer;
	color: var(--text-muted);
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: background 0.2s ease;
}

.ai-generator-modal-close:hover {
	background: var(--surface-strong);
}

.ai-generator-modal-body {
	flex: 1;
	overflow-y: auto;
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.ai-generator-intro {
	margin: 0;
	font-size: 0.9rem;
	color: var(--text-muted);
	line-height: 1.5;
}

.ai-generator-label {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.ai-generator-label > span {
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--text);
}

.ai-generator-textarea {
	padding: 0.75rem 1rem;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--input-bg);
	color: var(--text);
	font-size: 0.9rem;
	font-family: inherit;
	resize: vertical;
	min-height: 80px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ai-generator-textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.ai-generator-textarea::placeholder {
	color: var(--text-muted);
	opacity: 0.7;
}

.ai-generator-checkbox-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9rem;
	color: var(--text);
	cursor: pointer;
}

.ai-generator-checkbox-label input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--accent);
	cursor: pointer;
}

.ai-generator-security-note {
	padding: 0.875rem;
	background: color-mix(in srgb, var(--warning, #f59e0b) 10%, var(--surface));
	border: 1px solid color-mix(in srgb, var(--warning, #f59e0b) 30%, var(--border));
	border-radius: 8px;
	font-size: 0.8rem;
	color: var(--text);
	line-height: 1.5;
}

.ai-generator-security-note strong {
	color: var(--warning, #f59e0b);
}

.ai-generator-details {
	font-size: 0.85rem;
	color: var(--text-muted);
}

.ai-generator-details summary {
	cursor: pointer;
	font-weight: 500;
	color: var(--text);
	padding: 0.5rem 0;
}

.ai-generator-details summary:hover {
	color: var(--accent);
}

.ai-generator-requirements {
	padding: 1rem;
	background: var(--surface-strong);
	border-radius: 8px;
	margin-top: 0.5rem;
}

.ai-generator-requirements p {
	margin: 0 0 0.75rem 0;
	line-height: 1.5;
}

.ai-generator-requirements p:last-child {
	margin-bottom: 0;
}

.ai-generator-requirements ul {
	margin: 0 0 1rem 0;
	padding-left: 1.25rem;
}

.ai-generator-requirements li {
	margin: 0.35rem 0;
	line-height: 1.4;
}

.ai-generator-requirements code {
	background: var(--surface);
	padding: 0.125rem 0.375rem;
	border-radius: 4px;
	font-size: 0.8rem;
}

.ai-generator-modal-actions {
	padding: 1rem 1.5rem;
	border-top: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.75rem;
}

.ai-generator-btn {
	padding: 0.75rem 1.25rem;
	border-radius: 8px;
	border: none;
	font-size: 0.9rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.1s ease;
}

.ai-generator-btn:hover {
	transform: translateY(-1px);
}

.ai-generator-btn:active {
	transform: translateY(0);
}

.ai-generator-btn-primary {
	background: var(--accent);
	color: var(--accent-text);
}

.ai-generator-btn-primary:hover {
	background: var(--focus);
}

.ai-generator-btn-secondary {
	background: var(--surface-strong);
	color: var(--text);
	border: 1px solid var(--border);
}

.ai-generator-btn-secondary:hover {
	background: var(--surface);
}

.ai-generator-copied {
	display: none;
	align-items: center;
	padding: 0.5rem 0.875rem;
	background: color-mix(in srgb, var(--accent) 15%, var(--surface));
	border-radius: 6px;
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--accent);
	margin-right: auto;
}

/* AI Markdown Modal (for viewing instructions) */
.ai-markdown-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1001;
	padding: 1rem;
}

.ai-markdown-modal {
	background: var(--surface);
	border-radius: 12px;
	width: 100%;
	max-width: 800px;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.ai-markdown-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--border);
}

.ai-markdown-header h3 {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--text);
}

.ai-markdown-close {
	background: none;
	border: none;
	font-size: 1.5rem;
	cursor: pointer;
	color: var(--text-muted);
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: background 0.2s ease;
}

.ai-markdown-close:hover {
	background: var(--surface-strong);
}

.ai-markdown-content {
	flex: 1;
	overflow-y: auto;
	padding: 1.5rem;
}

.ai-markdown-pre {
	margin: 0;
	white-space: pre-wrap;
	word-wrap: break-word;
	font-size: 0.8rem;
	font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
	line-height: 1.6;
	color: var(--text);
}

.ai-markdown-actions {
	padding: 1rem 1.5rem;
	border-top: 1px solid var(--border);
	display: flex;
	justify-content: flex-end;
}

/* Shared admin detail text (always muted) */
.admin-detail {
	font-size: 0.875rem;
	color: var(--text-muted);
	margin-top: 4px;
}

/* Server owner display */
.server-owner {
	margin-top: 8px;
	margin-bottom: 2px;
}

.server-owner-link {
	display: flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	color: inherit;
}

.server-owner-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	color: #ffffff;
	font-weight: 600;
	flex-shrink: 0;
}

.server-owner-avatar-img {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

.server-owner-text {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 0.875rem;
}

.server-owner-name {
	color: var(--text);
	font-weight: 500;
}

.server-owner-handle {
	color: var(--text-muted);
}

/* ============================================
   Creation Detail Page Styles
   ============================================ */