/* ============================================================
   Goetheanum brand system — shadcn/ui design language
   Fonts:  Titillium Web (headings) · Source Sans Pro (body)
   Gold:   #ebb565   ·   Ink: #37404c   ·   Cream: #f5f1e8
   The palette + fonts are the Goetheanum brand; the component
   shapes, radii, rings, shadows and spacing follow shadcn/ui.
   ============================================================ */
:root {
	--font-body: 'Source Sans 3', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-head: 'Titillium Web', 'Source Sans 3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

	/* shadcn radius scale (base 0.5rem) */
	--radius: 0.5rem;
	--radius-sm: calc(var(--radius) - 4px);   /* 4px  */
	--radius-md: calc(var(--radius) - 2px);   /* 6px  — buttons, inputs, badges */
	--radius-lg: var(--radius);               /* 8px  — tables */
	--radius-xl: calc(var(--radius) + 4px);   /* 12px — cards, dialogs */

	--gold: #ebb565;
	--gold-strong: #e0a23f;
	--gold-tint: rgba(235, 181, 101, 0.14);
	--gold-tint-border: rgba(235, 181, 101, 0.45);

	--bg: #f5f1e8;
	--card-bg: #ffffff;
	--card-border: #e7e0d3;
	/* shadcn shadow scale — light, border-led */
	--shadow-xs: 0 1px 2px 0 rgba(55,64,76,.05);
	--shadow-sm: 0 1px 3px 0 rgba(55,64,76,.07), 0 1px 2px -1px rgba(55,64,76,.07);
	--shadow-md: 0 4px 6px -1px rgba(55,64,76,.08), 0 2px 4px -2px rgba(55,64,76,.08);
	--shadow-lg: 0 10px 24px -6px rgba(55,64,76,.18), 0 4px 8px -4px rgba(55,64,76,.12);
	--card-shadow: var(--shadow-sm);
	--text: #2f3742;
	--text-strong: #21272f;
	--text-muted: #5c6671;
	--text-faint: #9aa3ad;
	--input-bg: #ffffff;
	--input-border: #d8d0c2;
	--input-focus: var(--gold);
	--input-focus-ring: rgba(235, 181, 101, .35);
	--primary-bg: #37404c;
	--primary-bg-hover: #2a313b;
	--primary-fg: #ffffff;
	--ghost-border: #d8d0c2;
	--ghost-fg: #37404c;
	--ghost-hover-bg: #efe9dd;
	--logo-color: #37404c;
	--section-border: #ece6da;
	--sub-border: #e7e0d3;
	--sub-bg: #fbf9f4;
	--badge-bg: #f1ece0;
	--badge-fg: #5b6470;
	--badge-border: #e3dccd;
	--link-color: var(--gold-strong);
	--link-hover: #c08825;
	--toggle-fg: #6b7682;
	--toggle-border: #d8d0c2;
	--toggle-hover-bg: rgba(55,64,76,.05);

	/* shadcn semantic aliases (mapped onto the brand palette) */
	--ring: var(--gold);
	--ring-soft: var(--input-focus-ring);
	--border: var(--card-border);
	--muted: var(--sub-bg);
	--muted-foreground: var(--text-muted);
	--accent: var(--ghost-hover-bg);
	--accent-foreground: var(--text-strong);
	--secondary: #f1ece0;
	--secondary-hover: #e9e2d2;
	--secondary-foreground: var(--text-strong);
	--destructive: #dc2626;
	--destructive-soft: rgba(220, 38, 38, .35);
}

html.dark {
	--gold: #ebb565;
	--gold-strong: #ebb565;
	--gold-tint: rgba(235, 181, 101, 0.12);
	--gold-tint-border: rgba(235, 181, 101, 0.35);

	--bg: #131519;
	--card-bg: #1e2228;
	--card-border: #31363e;
	--shadow-xs: 0 1px 2px 0 rgba(0,0,0,.4);
	--shadow-sm: 0 1px 3px 0 rgba(0,0,0,.5);
	--shadow-md: 0 4px 8px -2px rgba(0,0,0,.5);
	--shadow-lg: 0 12px 28px -8px rgba(0,0,0,.65);
	--card-shadow: 0 0 0 1px rgba(255,255,255,.02), var(--shadow-sm);
	--text: #e2e7ed;
	--text-strong: #ffffff;
	--text-muted: #a3acb6;
	--text-faint: #79828d;
	--input-bg: #181b20;
	--input-border: #3c424c;
	--input-focus: var(--gold);
	--input-focus-ring: rgba(235, 181, 101, .3);
	--primary-bg: var(--gold);
	--primary-bg-hover: var(--gold-strong);
	--primary-fg: #2a313b;
	--ghost-border: #3c424c;
	--ghost-fg: #e2e7ed;
	--ghost-hover-bg: #2b3037;
	--logo-color: #ffffff;
	--section-border: #2f343c;
	--sub-border: #31363e;
	--sub-bg: #181b20;
	--badge-bg: #2b3037;
	--badge-fg: #e2e7ed;
	--badge-border: #3c424c;
	--link-color: var(--gold);
	--link-hover: #f3cd8e;
	--toggle-fg: #d7dce2;
	--toggle-border: #434954;
	--toggle-hover-bg: rgba(255,255,255,.06);

	--secondary: #2b3037;
	--secondary-hover: #343a42;
	--destructive: #f87171;
	--destructive-soft: rgba(248, 113, 113, .3);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { font-size: 16.5px; }
body {
	margin: 0;
	font-family: var(--font-body);
	font-weight: 500;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	min-height: 100%;
	transition: background-color .2s, color .2s;
}

/* shadcn focus ring — border turns to ring colour + a soft 3px ring */
:focus-visible { outline: none; }

/* Signature Goetheanum gold bar across the very top of the viewport */
body::before {
	content: "";
	position: fixed;
	top: 0; left: 0; right: 0;
	height: 5px;
	background: var(--gold);
	z-index: 1000;
}

/* Logo header */
.logo-shell {
	padding: 2.75rem 3rem 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}
.logo-link { display: inline-block; text-decoration: none; }
.logo {
	display: block;
	width: auto;
	height: 48px;
	color: var(--logo-color);
	fill: currentColor;
}
/* Image logo — full-color in light mode, white in dark mode */
.logo-img { display: block; height: 48px; width: auto; }
.logo-img-dark { display: none; }
html.dark .logo-img-light { display: none; }
html.dark .logo-img-dark { display: block; }

/* Theme toggle */
.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border-radius: var(--radius-md);
	border: 1px solid var(--toggle-border);
	background: transparent;
	color: var(--toggle-fg);
	cursor: pointer;
	transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.theme-toggle:hover { background: var(--toggle-hover-bg); color: var(--text); }
.theme-toggle:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft); }
/* Icon shows the mode you'd switch TO (matches the label): light → moon, dark → sun. */
.theme-icon { display: block; }
.theme-icon-sun { display: none; }
html.dark .theme-icon-sun { display: block; }
html.dark .theme-icon-moon { display: none; }

/* Centered shell */
.shell {
	display: flex;
	justify-content: center;
	padding: 2.5rem 1.5rem 4rem;
}
@media (max-width: 720px) {
	.shell { padding: 1.5rem 1rem 3rem; }
	.logo-shell { padding: 1.5rem 1rem 0; }
}

/* Card */
.card {
	width: 100%;
	max-width: 28rem;
	background: var(--card-bg);
	border: 1px solid var(--card-border);
	border-radius: var(--radius-xl);
	padding: 2rem;
	box-shadow: var(--card-shadow);
	transition: background-color .2s, border-color .2s;
}
.account-card { max-width: 36rem; }

/* Typography */
h1 {
	font-family: var(--font-head);
	font-size: 1.875rem;
	line-height: 1.2;
	font-weight: 700;
	font-style: normal;
	letter-spacing: 0.01em;
	margin: 0 0 0.5rem;
	color: var(--text-strong);
}
h2 {
	font-family: var(--font-head);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-muted);
	margin: 0;
}
.hint {
	color: var(--text-muted);
	font-size: 0.875rem;
	line-height: 1.4;
	margin: 0 0 1.5rem;
}
.muted { color: var(--text-faint); font-size: 0.875rem; }
.code { font-family: var(--font-mono); font-size: 0.6875rem; }

/* Form */
form label {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	margin-bottom: 1rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--text);
}
form input, form select {
	height: 2.25rem;
	padding: 0.5rem 0.75rem;
	font-size: 0.875rem;
	color: var(--text-strong);
	background: var(--input-bg);
	border: 1px solid var(--input-border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs);
	transition: border-color .15s, box-shadow .15s, background-color .2s;
	font-family: inherit;
}
form select { padding-right: 0.5rem; }
form textarea {
	font-family: inherit;
	font-size: 0.875rem;
	color: var(--text-strong);
	background: var(--input-bg);
	border: 1px solid var(--input-border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs);
	padding: 0.5rem 0.75rem;
}
form input::placeholder, form textarea::placeholder { color: var(--text-faint); }
form input:focus, form select:focus, form textarea:focus {
	outline: none;
	border-color: var(--input-focus);
	box-shadow: 0 0 0 3px var(--input-focus-ring);
}

/* Buttons — shadcn variants. Base = outline variant. */
button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	height: 2.25rem;
	padding: 0.5rem 1rem;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1;
	border-radius: var(--radius-md);
	border: 1px solid var(--ghost-border);
	background: var(--card-bg);
	color: var(--ghost-fg);
	cursor: pointer;
	white-space: nowrap;
	box-shadow: var(--shadow-xs);
	transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
	font-family: inherit;
}
button:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft); }
button:not(.primary):not(.link):not(.nav-tab):not(.icon-button):not(.theme-toggle):not(.mit-back):not(.mit-subtab):not(.admin-subtab):not(.tools-subtab):hover {
	background: var(--accent);
	color: var(--accent-foreground);
}
button[disabled] { opacity: .5; pointer-events: none; box-shadow: none; }
/* default (primary) variant — solid */
button.primary {
	background: var(--primary-bg);
	color: var(--primary-fg);
	border-color: var(--primary-bg);
	font-weight: 500;
	box-shadow: var(--shadow-xs);
}
button.primary:hover { background: var(--primary-bg-hover); border-color: var(--primary-bg-hover); }
button.primary:focus-visible { box-shadow: 0 0 0 3px var(--ring-soft); }
button.primary[disabled] { opacity: .5; cursor: progress; }
/* secondary variant */
button.secondary {
	background: var(--secondary);
	color: var(--secondary-foreground);
	border-color: transparent;
}
button.secondary:hover { background: var(--secondary-hover); }
/* outline (ghost) variant */
button.ghost {
	background: transparent;
	border-color: var(--ghost-border);
	color: var(--ghost-fg);
}
button.ghost:hover { background: var(--accent); color: var(--accent-foreground); }
/* destructive variant */
button.destructive {
	background: var(--destructive);
	color: #fff;
	border-color: var(--destructive);
}
button.destructive:hover { filter: brightness(.94); }
/* link variant */
.link {
	height: auto;
	background: transparent;
	border: none;
	box-shadow: none;
	color: var(--link-color);
	padding: 0.25rem 0.5rem;
	font-size: 0.8125rem;
	font-weight: 500;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 4px;
}
.link:hover { color: var(--link-hover); }
.link:focus-visible { border-radius: var(--radius-sm); box-shadow: 0 0 0 3px var(--ring-soft); }
.link.danger { color: var(--destructive); }

/* Login: secondary action (toggle between email-link and password) */
.login-alt { text-align: left; margin: 0.75rem 0 0; }
#login-link-sent { color: var(--link-color); margin-top: 1.25rem; line-height: 1.5; }

/* Account header */
.account-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
	margin-bottom: 0.5rem;
}
.account-header h1 { margin: 0; }
.account-header p { margin: 0.25rem 0 0; }

/* Section header */
.section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 1.75rem 0 0.75rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--section-border);
}

/* Address view */
.address-view {
	font-size: 0.9375rem;
	line-height: 1.6;
	color: var(--text);
	padding: 0.75rem 0;
}
.address-view .muted { margin-top: 0.5rem; }

/* Address form rows */
.row { display: flex; gap: 0.75rem; }
.row > label { flex: 1 1 0; margin-bottom: 1rem; }
.grow { flex: 1 1 0; }

.actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-top: 0.5rem;
	flex-wrap: wrap;
}

/* Subscriptions */
.subs { display: flex; flex-direction: column; gap: 0.5rem; }
.sub {
	border: 1px solid var(--sub-border);
	border-radius: var(--radius-lg);
	padding: 0.875rem 1rem;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
	background: var(--sub-bg);
}
.sub-main { display: flex; flex-direction: column; gap: 0.125rem; }
.sub-main strong { font-weight: 600; color: var(--text-strong); font-size: 0.9375rem; }
.sub-meta { display: flex; gap: 0.75rem; align-items: center; font-size: 0.8125rem; }

/* Badge — shadcn badge (rounded-md, border, xs semibold) */
.badge {
	display: inline-flex;
	align-items: center;
	padding: 0.125rem 0.5rem;
	border-radius: var(--radius-md);
	font-size: 0.6875rem;
	font-weight: 600;
	line-height: 1.3;
	background: var(--badge-bg);
	color: var(--badge-fg);
	border: 1px solid var(--badge-border);
}
.badge-live { background: rgb(220 252 231); color: rgb(22 101 52); border-color: rgb(187 247 208); }
.badge-non_renewing { background: rgb(219 234 254); color: rgb(30 64 175); border-color: rgb(191 219 254); }
.badge-paused { background: rgb(254 243 199); color: rgb(146 64 14); border-color: rgb(253 230 138); }
.badge-cancelled, .badge-expired, .badge-unpaid {
	background: rgb(254 226 226); color: rgb(153 27 27); border-color: rgb(254 202 202);
}
.badge-mitglied { background: rgb(237 233 254); color: rgb(91 33 182); border-color: rgb(221 214 254); }
html.dark .badge-live { background: rgba(22,101,52,.25); color: rgb(187 247 208); border-color: rgba(22,101,52,.5); }
html.dark .badge-non_renewing { background: rgba(30,64,175,.25); color: rgb(191 219 254); border-color: rgba(30,64,175,.5); }
html.dark .badge-paused { background: rgba(146,64,14,.25); color: rgb(253 230 138); border-color: rgba(146,64,14,.5); }
html.dark .badge-cancelled, html.dark .badge-expired, html.dark .badge-unpaid {
	background: rgba(153,27,27,.25); color: rgb(254 202 202); border-color: rgba(153,27,27,.5);
}
html.dark .badge-mitglied { background: rgba(91,33,182,.25); color: rgb(221 214 254); border-color: rgba(91,33,182,.5); }

.error { color: var(--destructive); font-size: 0.875rem; margin: 0.5rem 0 0; }

.add-form {
	display: flex;
	align-items: flex-end;
	gap: 0.75rem;
	flex-wrap: wrap;
}
.add-form .grow { flex: 1 1 280px; }
.add-form select {
	width: 100%;
}

/* Animations */
@keyframes fade-in-up {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-out-down {
	from { opacity: 1; transform: translateY(0); }
	to   { opacity: 0; transform: translateY(-8px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-in {
	from { opacity: 0; transform: translateY(8px) scale(.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.boot-screen {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg);
	z-index: 100;
}
.boot-screen[hidden] { display: none; }
.boot-spinner {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 3px solid var(--gold);
	border-right-color: transparent;
	animation: spin .9s linear infinite;
}

.card { animation: fade-in-up .4s cubic-bezier(.2,.7,.2,1) both; }
.card.leaving { animation: fade-out-down .25s ease-in both; pointer-events: none; }

.spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 2px solid currentColor;
	border-right-color: transparent;
	animation: spin .7s linear infinite;
	margin-right: 0.5rem;
	vertical-align: -2px;
}

button.primary[disabled] { opacity: .6; cursor: progress; pointer-events: none; }

