/* Arbeitszeit — modern, mobile-first design (light + dark). */

:root {
	color-scheme: light dark;
	--bg: #f6f3f1;
	--bg-glow-1: transparent;
	--bg-glow-2: transparent;
	--surface: #ffffff;
	--surface-solid: #ffffff;
	--surface-2: #faf8f7;
	--fg: #231a20;
	--muted: #64585f;
	--line: #e8e0dc;
	--accent: #166534;
	--accent-2: #0f4a26;
	--accent-soft: rgba(22, 101, 52, 0.1);
	--start: #16a34a;
	--stop: #f43f5e;
	--danger: #e11d48;
	--warn: #d97706;
	--shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
	--shadow-lg: 0 18px 40px -12px rgba(22, 101, 52, 0.45);
	--radius: 22px;
	--radius-sm: 14px;
	--font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--nav-h: 4.25rem;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0e0c0c;
		--bg-glow-1: transparent;
		--bg-glow-2: transparent;
		--surface: #292323;
		--surface-solid: #292323;
		--surface-2: #120f0f;
		--fg: #f5eef6;
		--muted: #b9adb6;
		--line: #2c2526;
		--accent: #4caf78;
		--accent-2: #2e7d4f;
		--accent-soft: rgba(76, 175, 120, 0.14);
		--start: #4ade80;
		--stop: #fb7185;
		--danger: #fb7185;
		--warn: #fbbf24;
		--shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
		--shadow-lg: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
	}
}

* { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

body {
	margin: 0;
	min-height: 100dvh;
	color: var(--fg);
	font-family: var(--font);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	font-variant-numeric: tabular-nums;
	background:
		radial-gradient(60rem 30rem at 10% -10%, var(--bg-glow-1), transparent 60%),
		radial-gradient(50rem 30rem at 110% 10%, var(--bg-glow-2), transparent 60%),
		var(--bg);
	background-attachment: fixed;
}

button, input { font: inherit; }

/* ---------- Layout ---------- */
.shell {
	max-width: 38rem;
	margin: 0 auto;
	padding: max(1.25rem, env(safe-area-inset-top)) 1.1rem 2rem;
}
.shell.app { padding-bottom: calc(var(--nav-h) + 2rem + env(safe-area-inset-bottom)); }
main > .stack { margin-top: 0.5rem; }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; }

.topbar { margin: 0.25rem 0 1rem; }
.topbar h1 { margin: 0; }

h1 { margin: 0 0 1rem; font-size: clamp(1.75rem, 6vw, 2.2rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; }
h2 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.section-title { font-size: 0.8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.eyebrow {
	margin: 0 0 0.15rem;
	font-weight: 700;
	font-size: 0.75rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.hint { margin: 0; color: var(--muted); font-size: 0.9rem; }
.hint.warn { color: var(--warn); }
.ok { margin: 0; color: var(--start); font-weight: 600; }
.muted { color: var(--muted); }
.date-line { margin: -0.5rem 0 0; color: var(--muted); font-weight: 500; }

/* ---------- Cards ---------- */
.card {
	background: var(--surface);
	-webkit-backdrop-filter: blur(16px) saturate(140%);
	backdrop-filter: blur(16px) saturate(140%);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.15rem;
	box-shadow: var(--shadow);
}

/* ---------- Hero (live timer + start/stop) ---------- */
.hero {
	position: relative;
	overflow: hidden;
	border-radius: 28px;
	padding: 1.4rem 1.25rem 1.25rem;
	color: #fff;
	text-align: center;
	background: linear-gradient(145deg, #3d4a42, #232b26);
	box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.55);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
	transition: background 0.4s ease;
}
.hero::before {
	content: "";
	position: absolute;
	inset: -40% -20% auto auto;
	width: 70%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 65%);
	pointer-events: none;
}
.hero.is-running {
	background: linear-gradient(145deg, #166534, #0b3a1f);
	box-shadow: var(--shadow-lg);
}
.hero .status {
	margin: 0;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.3rem 0.75rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	font-size: 0.85rem;
	font-weight: 600;
}
.hero-time {
	margin: 0.4rem 0 0;
	font-size: clamp(3.2rem, 16vw, 4.6rem);
	font-weight: 800;
	letter-spacing: -0.04em;
	line-height: 1;
}
.hero-sub { margin: 0 0 0.9rem; opacity: 0.85; font-size: 0.92rem; }
.hero .hint.warn { color: #fde68a; }

.dot {
	width: 0.55rem;
	height: 0.55rem;
	border-radius: 50%;
	background: #6ee7b7;
	box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.7);
	animation: pulse 1.8s infinite;
}
@keyframes pulse {
	70% { box-shadow: 0 0 0 0.6rem rgba(110, 231, 183, 0); }
	100% { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0); }
}

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 2.9rem;
	padding: 0.6rem 1.15rem;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	color: #fff;
	font-weight: 650;
	cursor: pointer;
	transition: transform 0.12s ease, filter 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn:focus-visible, .tab:focus-visible, .input:focus-visible, .entry-button:focus-visible, .day-button:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
	outline-offset: 2px;
}
.btn-secondary { background: var(--surface-2); color: var(--fg); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.big-btn {
	width: 100%;
	min-height: 4.2rem;
	font-size: 1.2rem;
	font-weight: 750;
	border-radius: 20px;
	background: #fff;
	color: #0f172a;
	box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.45);
}
.big-btn-icon {
	display: inline-grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	font-size: 0.8rem;
	color: #fff;
}
.btn-start .big-btn-icon { background: var(--start); }
.btn-stop { color: #be123c; }
.btn-stop .big-btn-icon { background: var(--stop); }

.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 1.6rem;
	height: 1.6rem;
	border: 0;
	border-radius: 50%;
	background: color-mix(in srgb, var(--danger) 12%, transparent);
	color: var(--danger);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}

/* ---------- Bottom navigation ---------- */
.tabs {
	position: fixed;
	left: 50%;
	bottom: calc(0.75rem + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	width: min(26rem, calc(100% - 1.5rem));
	height: var(--nav-h);
	z-index: 10;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.25rem;
	padding: 0.4rem;
	border-radius: 24px;
	background: var(--surface);
	-webkit-backdrop-filter: blur(20px) saturate(160%);
	backdrop-filter: blur(20px) saturate(160%);
	border: 1px solid var(--line);
	box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.25);
}
.tab {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.1rem;
	border: 0;
	border-radius: 18px;
	background: transparent;
	color: var(--muted);
	font-size: 0.72rem;
	font-weight: 650;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}
.tab.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Forms ---------- */
.field, .entry-form label, .pick-day {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	flex: 1;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--muted);
}
.input {
	width: 100%;
	min-height: 2.9rem;
	padding: 0.6rem 0.85rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	color: var(--fg);
	font-weight: 500;
	transition: border-color 0.2s ease, background 0.2s ease;
}
.input:focus { border-color: var(--accent); background: var(--surface-solid); outline: none; }
.input:disabled { opacity: 0.5; }

.switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; color: var(--fg); font-weight: 500; }
.switch input {
	appearance: none;
	-webkit-appearance: none;
	flex: none;
	position: relative;
	width: 2.4rem;
	height: 1.4rem;
	margin: 0;
	border-radius: 999px;
	background: color-mix(in srgb, var(--muted) 35%, transparent);
	cursor: pointer;
	transition: background 0.2s ease;
}
.switch input::after {
	content: "";
	position: absolute;
	top: 0.15rem;
	left: 0.15rem;
	width: 1.1rem;
	height: 1.1rem;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s ease;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(1rem); }
.switch input:disabled { opacity: 0.5; }
.switch input:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* ---------- Day summary ---------- */
.summary-main, .month-total > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.summary-label { font-weight: 700; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.summary-value { font-size: 2.3rem; font-weight: 800; letter-spacing: -0.035em; }
.live { color: var(--accent); }
.summary-rows { margin: 0.75rem 0 0; display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.92rem; }
.summary-rows > div {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
	padding: 0.45rem 0;
	border-top: 1px solid var(--line);
}
.summary-rows dt { color: var(--muted); }
.summary-rows dd { margin: 0; font-weight: 650; white-space: nowrap; }
.break-row .switch { font-size: 0.9rem; }
.break-row.skipped dd { color: var(--muted); font-weight: 500; }
.extra-row dt { display: inline-flex; align-items: center; gap: 0.5rem; }
.extra-row dd { color: var(--start); }

.sheet {
	margin-top: 0.75rem;
	padding: 0.9rem;
	border-radius: var(--radius-sm);
	background: var(--accent-soft);
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.sheet-grid > div { display: flex; flex-direction: column; }
.sheet-grid small { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.sheet-grid strong { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.sheet .hint { font-size: 0.78rem; }

/* ---------- Widget "Zeit hinzufügen" ---------- */
.widget { border-left: 4px solid var(--accent); }
.minutes-field { max-width: 8rem; }

/* ---------- Entries ---------- */
.entries, .days { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.entry, .day {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 18px;
	box-shadow: var(--shadow);
	overflow: hidden;
}
.entry.running { border-color: color-mix(in srgb, var(--start) 55%, transparent); }
.entry-button, .day-button {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
	background: transparent;
	border: 0;
	color: inherit;
	text-align: left;
	cursor: pointer;
}
.entry-time { flex: 1; font-weight: 600; }
.entry-duration { font-weight: 750; }
.entry-edit { color: var(--muted); }
.split-note { color: var(--muted); font-weight: 500; }
.entry-form { display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 1rem; }
.entry-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; width: 100%; }
.entry-form .alert { width: 100%; }
.add-entry { align-self: flex-start; }

/* ---------- History ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.month-nav h2 { font-size: 1.25rem; }
.month-nav .btn { width: 2.9rem; padding: 0; font-size: 1.4rem; border-radius: 50%; }
.month-total {
	color: #fff;
	border: 0;
	background: linear-gradient(145deg, #166534, #0b3a1f);
	box-shadow: var(--shadow-lg);
}
.month-total .summary-label, .month-total .hint { color: rgba(255, 255, 255, 0.82); }
.week-header {
	display: flex;
	justify-content: space-between;
	margin: 0.6rem 0.25rem 0;
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.day-button > span:first-child { flex: 1; font-weight: 600; }
.day-meta { color: var(--muted); font-size: 0.82rem; }
.day-button strong { font-size: 1.05rem; }
.day.open { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.day-detail { padding: 0 1rem 1rem; }
.day-detail .card { background: var(--surface-2); box-shadow: none; }

/* ---------- Settings ---------- */
.break-rule {
	margin: 0;
	padding: 0.6rem 1rem 1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--surface-2);
}
.break-rule legend { padding: 0 0.3rem; font-weight: 650; }
.weekdays { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.weekday {
	position: relative;
	display: inline-grid;
	place-items: center;
	min-width: 2.8rem;
	min-height: 2.6rem;
	border-radius: 12px;
	background: var(--surface-2);
	border: 1px solid var(--line);
	color: var(--muted);
	font-weight: 700;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}
.weekday.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.weekday input { position: absolute; opacity: 0; pointer-events: none; }
.weekday:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.push-box { border-top: 1px solid var(--line); padding-top: 0.9rem; }

/* ---------- Login ---------- */
.auth { padding-top: max(3rem, env(safe-area-inset-top)); }
.auth-logo {
	display: grid;
	place-items: center;
	width: 4rem;
	height: 4rem;
	margin-bottom: 1rem;
	border-radius: 20px;
	color: #fff;
	background: linear-gradient(145deg, #166534, #0b3a1f);
	box-shadow: var(--shadow-lg);
}

/* ---------- States ---------- */
.loading { display: flex; align-items: center; gap: 0.6rem; padding: 1.5rem 0; color: var(--muted); }
.spinner {
	width: 1.1rem;
	height: 1.1rem;
	border-radius: 50%;
	border: 2px solid var(--line);
	border-top-color: var(--accent);
	animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 2rem 0; }
.empty-title { margin: 0; font-weight: 650; color: var(--muted); }
.alert {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.7rem 0.9rem;
	border-radius: var(--radius-sm);
	background: color-mix(in srgb, var(--danger) 10%, transparent);
	color: var(--danger);
	font-weight: 500;
}
.alert .btn { min-height: 2.25rem; }

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

/* ---------- Family ---------- */
.members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.member {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.7rem 0.9rem;
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	border: 1px solid var(--line);
}
.member.inactive { opacity: 0.6; }
.member-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.member-info small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.member .btn { min-height: 2.4rem; padding: 0.4rem 0.8rem; }
.invite-box { padding: 0.9rem; border-radius: var(--radius-sm); background: var(--accent-soft); }
h3.section-title { margin: 0; }
