@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&family=Nunito:wght@700;800&family=Nunito+Sans:opsz,wght@6..12,400;6..12,600;6..12,700&family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700&family=Figtree:wght@400;500;600;700&family=Lexend:wght@400;500;600;700&display=swap");

/* Native cross-page transition (Chrome/Edge); browsers without support
   simply ignore this and keep the fade-in below as their only transition. */
@view-transition {
  navigation: auto;
}

/* ==== Themes =========================================================
   Drei Varianten, wählbar unter Einstellungen (data-theme auf <html>):
   klar   – Swiss Style: Inter, Schwarz/Weiss, Schweizer Rot als Akzent
   ruhig  – warm & natürlich: DM Sans + Fraunces, Tannengrün & Terrakotta
   modern – frisch & kräftig: Plus Jakarta Sans + Space Grotesk, Indigo/Violett
   Auf Basis der Logofarben (Sonnengelb, Orange, Ziegelrot, Sandstein, Kastanienbraun):
   sandstein – hell & warm: Nunito, Sandstein-Creme, Ziegelrot als Akzent
   turm      – kräftig: Bricolage Grotesque + Figtree, dunkelbrauner Kopf, Orange
   sonne     – sonnig: Lexend, goldener Verlauf im Kopf, Kastanienbraun
   Jede Variante hat eine helle und eine dunkle Ausprägung (Systemeinstellung). */

:root,
:root[data-theme="klar"] {
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Inter", var(--font-body);
  --display-weight: 800;
  --display-tracking: -0.025em;

  --color-bg: #f3f3f1;
  --color-card: #ffffff;
  --color-text: #111111;
  --color-muted: #5e5e5e;
  --color-border: #dcdcd7;

  --header-bg: #ffffff;
  --header-text: #111111;
  --header-muted: #5e5e5e;
  --header-hover: rgba(0, 0, 0, 0.06);
  --header-border: #dcdcd7;

  --color-accent: #111111;
  --color-accent-hover: #333333;
  --color-on-accent: #ffffff;
  --color-highlight: #e30613;
  --color-figure: #111111;

  --color-link: #111111;
  --color-link-hover: #e30613;

  --color-danger: #c4120f;
  --color-danger-bg: #fdecec;
  --color-success: #0a7f4f;

  --radius: 6px;
  --shadow-card: none;
  --shadow-hover: 0 4px 14px rgba(0, 0, 0, 0.08);
}

:root[data-theme="ruhig"] {
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --display-weight: 600;
  --display-tracking: -0.01em;

  --color-bg: #f5f1e8;
  --color-card: #fffdf8;
  --color-text: #1f2a24;
  --color-muted: #6a736d;
  --color-border: #e4ddcf;

  --header-bg: #2f5d50;
  --header-text: #ffffff;
  --header-muted: rgba(255, 255, 255, 0.72);
  --header-hover: rgba(255, 255, 255, 0.12);
  --header-border: transparent;

  --color-accent: #c8693f;
  --color-accent-hover: #ad5730;
  --color-on-accent: #ffffff;
  --color-highlight: #c8693f;
  --color-figure: #2f5d50;

  --color-link: #2f5d50;
  --color-link-hover: #c8693f;

  --color-danger: #b3412e;
  --color-danger-bg: #f8e9e5;
  --color-success: #2f7d5b;

  --radius: 18px;
  --shadow-card: 0 1px 3px rgba(31, 42, 36, 0.06), 0 6px 18px rgba(31, 42, 36, 0.05);
  --shadow-hover: 0 8px 24px rgba(31, 42, 36, 0.12);
}

:root[data-theme="modern"] {
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-body);
  --display-weight: 700;
  --display-tracking: -0.02em;

  --color-bg: #f4f5fb;
  --color-card: #ffffff;
  --color-text: #14142b;
  --color-muted: #6c6c88;
  --color-border: #e2e3f0;

  --header-bg: linear-gradient(120deg, #4338ca, #7c3aed);
  --header-text: #ffffff;
  --header-muted: rgba(255, 255, 255, 0.75);
  --header-hover: rgba(255, 255, 255, 0.14);
  --header-border: transparent;

  --color-accent: #4f46e5;
  --color-accent-hover: #4338ca;
  --color-on-accent: #ffffff;
  --color-highlight: #7c3aed;
  --color-figure: #4f46e5;

  --color-link: #4f46e5;
  --color-link-hover: #7c3aed;

  --color-danger: #e11d48;
  --color-danger-bg: #ffe8ee;
  --color-success: #059669;

  --radius: 14px;
  --shadow-card: 0 1px 2px rgba(20, 20, 43, 0.05), 0 4px 16px rgba(79, 70, 229, 0.06);
  --shadow-hover: 0 10px 28px rgba(79, 70, 229, 0.18);
}

:root[data-theme="sandstein"] {
  --font-body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Nunito", var(--font-body);
  --display-weight: 800;
  --display-tracking: -0.01em;

  --color-bg: #fbf3e4;
  --color-card: #fffaf1;
  --color-text: #3a1a0e;
  --color-muted: #7d5c49;
  --color-border: #eedcbf;

  --header-bg: #fff3d8;
  --header-text: #3a1a0e;
  --header-muted: #7d5c49;
  --header-hover: rgba(132, 43, 22, 0.08);
  --header-border: #eedcbf;

  --color-accent: #ed592e;
  --color-accent-hover: #d14a22;
  --color-on-accent: #ffffff;
  --color-highlight: #ff9200;
  --color-figure: #842b16;

  --color-link: #c4461f;
  --color-link-hover: #842b16;

  --color-danger: #b42318;
  --color-danger-bg: #fdeae6;
  --color-success: #2e7d4f;

  --radius: 16px;
  --shadow-card: 0 1px 3px rgba(105, 39, 15, 0.06), 0 6px 18px rgba(105, 39, 15, 0.05);
  --shadow-hover: 0 8px 24px rgba(105, 39, 15, 0.14);
}

:root[data-theme="turm"] {
  --font-body: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font-body);
  --display-weight: 700;
  --display-tracking: -0.02em;

  --color-bg: #f7eee0;
  --color-card: #fffbf4;
  --color-text: #2c140b;
  --color-muted: #7a5847;
  --color-border: #e8d6bb;

  --header-bg: linear-gradient(135deg, #69270f, #842b16);
  --header-text: #fff1d5;
  --header-muted: rgba(255, 241, 213, 0.72);
  --header-hover: rgba(255, 241, 213, 0.12);
  --header-border: transparent;

  --color-accent: #ff9200;
  --color-accent-hover: #ec8100;
  --color-on-accent: #2c140b;
  --color-highlight: #ed592e;
  --color-figure: #842b16;

  --color-link: #a8361a;
  --color-link-hover: #69270f;

  --color-danger: #b42318;
  --color-danger-bg: #fbe6e1;
  --color-success: #2e7d4f;

  --radius: 12px;
  --shadow-card: 0 1px 2px rgba(44, 20, 11, 0.06), 0 4px 14px rgba(44, 20, 11, 0.06);
  --shadow-hover: 0 10px 26px rgba(44, 20, 11, 0.16);
}

:root[data-theme="sonne"] {
  --font-body: "Lexend", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Lexend", var(--font-body);
  --display-weight: 600;
  --display-tracking: -0.015em;

  --color-bg: #fffaf0;
  --color-card: #ffffff;
  --color-text: #33170c;
  --color-muted: #806252;
  --color-border: #f3e2c4;

  --header-bg: linear-gradient(120deg, #ffcf19, #ff9200);
  --header-text: #3a1a0e;
  --header-muted: rgba(58, 26, 14, 0.7);
  --header-hover: rgba(58, 26, 14, 0.1);
  --header-border: transparent;

  --color-accent: #842b16;
  --color-accent-hover: #69270f;
  --color-on-accent: #fff1d5;
  --color-highlight: #ff9200;
  --color-figure: #ed592e;

  --color-link: #c4461f;
  --color-link-hover: #842b16;

  --color-danger: #b42318;
  --color-danger-bg: #fdeae6;
  --color-success: #2e7d4f;

  --radius: 20px;
  --shadow-card: 0 1px 3px rgba(255, 146, 0, 0.08), 0 6px 20px rgba(255, 146, 0, 0.08);
  --shadow-hover: 0 10px 28px rgba(255, 146, 0, 0.22);
}

@media (prefers-color-scheme: dark) {
  :root,
  :root[data-theme="klar"] {
    --color-bg: #0e0e0e;
    --color-card: #1a1a1a;
    --color-text: #f2f2f2;
    --color-muted: #a3a3a3;
    --color-border: #2e2e2e;
    --header-bg: #141414;
    --header-text: #f2f2f2;
    --header-muted: #a3a3a3;
    --header-hover: rgba(255, 255, 255, 0.08);
    --header-border: #2e2e2e;
    --color-accent: #f2f2f2;
    --color-accent-hover: #d4d4d4;
    --color-on-accent: #111111;
    --color-highlight: #ff3b3b;
    --color-figure: #f2f2f2;
    --color-link: #f2f2f2;
    --color-link-hover: #ff3b3b;
    --color-danger: #ff6b6b;
    --color-danger-bg: #2c1414;
    --color-success: #3ccf8e;
    --shadow-hover: 0 4px 14px rgba(0, 0, 0, 0.5);
  }

  :root[data-theme="ruhig"] {
    --color-bg: #141a17;
    --color-card: #1d2621;
    --color-text: #eee9df;
    --color-muted: #a3aca5;
    --color-border: #2f3a34;
    --header-bg: #1f3d34;
    --color-accent: #e08a5f;
    --color-accent-hover: #ec9d76;
    --color-on-accent: #1f1a16;
    --color-highlight: #e08a5f;
    --color-figure: #8fcfb3;
    --color-link: #8fcfb3;
    --color-link-hover: #e08a5f;
    --color-danger: #f08a77;
    --color-danger-bg: #331a16;
    --color-success: #6fd3a3;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.5);
  }

  :root[data-theme="modern"] {
    --color-bg: #0d0d1a;
    --color-card: #17172b;
    --color-text: #eeeefa;
    --color-muted: #9d9dbb;
    --color-border: #2a2a45;
    --header-bg: linear-gradient(120deg, #2e2785, #4c1d95);
    --color-accent: #818cf8;
    --color-accent-hover: #a5b4fc;
    --color-on-accent: #14142b;
    --color-highlight: #a78bfa;
    --color-figure: #a5b4fc;
    --color-link: #a5b4fc;
    --color-link-hover: #c4b5fd;
    --color-danger: #fb7185;
    --color-danger-bg: #2d1020;
    --color-success: #34d399;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.55);
  }

  :root[data-theme="sandstein"] {
    --color-bg: #1b120d;
    --color-card: #261a13;
    --color-text: #f6eadb;
    --color-muted: #bba48f;
    --color-border: #3b2a20;
    --header-bg: #22160f;
    --header-text: #f6eadb;
    --header-muted: #bba48f;
    --header-hover: rgba(255, 243, 216, 0.08);
    --header-border: #3b2a20;
    --color-accent: #ff7a45;
    --color-accent-hover: #ff9466;
    --color-on-accent: #1b120d;
    --color-highlight: #ffb340;
    --color-figure: #ffcf7a;
    --color-link: #ffb340;
    --color-link-hover: #ffcf7a;
    --color-danger: #ff7a6b;
    --color-danger-bg: #331a14;
    --color-success: #6fcf97;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.5);
  }

  :root[data-theme="turm"] {
    --color-bg: #160c08;
    --color-card: #22130c;
    --color-text: #fbeedd;
    --color-muted: #c3a58f;
    --color-border: #3a2116;
    --header-bg: linear-gradient(135deg, #3d150a, #5a1e0d);
    --color-accent: #ffa21f;
    --color-accent-hover: #ffb44d;
    --color-on-accent: #2a1208;
    --color-highlight: #ff7448;
    --color-figure: #ffc56b;
    --color-link: #ffb44d;
    --color-link-hover: #ffd18a;
    --color-danger: #ff7a6b;
    --color-danger-bg: #331611;
    --color-success: #6fcf97;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 10px 26px rgba(0, 0, 0, 0.55);
  }

  :root[data-theme="sonne"] {
    --color-bg: #17120a;
    --color-card: #231b0f;
    --color-text: #fff3df;
    --color-muted: #c6ad8f;
    --color-border: #3b2e1a;
    --header-bg: linear-gradient(120deg, #8a5a00, #a34f00);
    --header-text: #fff3df;
    --header-muted: rgba(255, 243, 223, 0.75);
    --header-hover: rgba(255, 243, 223, 0.12);
    --color-accent: #ffb12e;
    --color-accent-hover: #ffc35c;
    --color-on-accent: #231b0f;
    --color-highlight: #ff9200;
    --color-figure: #ffd36b;
    --color-link: #ffc35c;
    --color-link-hover: #ffdd8f;
    --color-danger: #ff7a6b;
    --color-danger-bg: #331a14;
    --color-success: #6fcf97;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

/* Scroll container for wide tables, so they never force the whole
   page to scroll horizontally on narrow screens. */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--color-link) 40%, transparent);
  text-underline-offset: 2px;
  font-weight: 500;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-link-hover);
}

header.app-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
  padding: 1.1rem 1.25rem 0;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--header-text);
  text-decoration: none;
}

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

.brand .logo {
  flex: none;
}



.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.2;
}

.tagline {
  font-size: 0.68rem;
  color: var(--header-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

nav.tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

nav.tabs a {
  color: var(--header-muted);
  text-decoration: none;
  font-weight: 500;
  padding: 0.6rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}

nav.tabs a:hover:not(.active) {
  color: var(--header-text);
  background: var(--header-hover);
}

nav.tabs a.active {
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 600;
}

:root[data-theme="klar"] nav.tabs a.active,
:root:not([data-theme]) nav.tabs a.active {
  box-shadow: inset 0 -3px 0 var(--color-highlight);
}

main {
  animation: fadeIn 0.35s ease;
  max-width: 780px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  padding-bottom: 3rem;
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.1rem;
  margin-bottom: 1.1rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card h2 {
  margin-top: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
}

.employee-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.employee-bar label {
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.employee-bar select {
  flex: 1;
}

.stat-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat {
  flex: 1 1 120px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.8rem;
  text-align: center;
}

.stat .value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: var(--display-weight);
  color: var(--color-figure);
}

.stat .label {
  font-size: 0.78rem;
  color: var(--color-muted);
}

form.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
}

form.inline-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

input, select {
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-body);
  min-width: 0;
  background: var(--color-card);
  color: var(--color-text);
}

input:focus, select:focus {
  outline: 2px solid var(--color-highlight);
  outline-offset: 1px;
}

button {
  background: var(--color-accent);
  color: var(--color-on-accent);
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:hover {
  background: var(--color-accent-hover);
}

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

button.secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

button.secondary:hover {
  background: var(--color-bg);
}

button.danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--color-border);
  font-weight: 500;
  padding: 0.3rem 0.55rem;
}

button.danger:hover {
  background: var(--color-danger-bg);
  border-color: var(--color-danger);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--color-bg);
}

th {
  color: var(--color-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

fieldset.week-plan {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem 0.75rem;
  margin: 0;
}

fieldset.week-plan legend {
  font-size: 0.85rem;
  color: var(--color-muted);
  padding: 0 0.25rem;
}

fieldset.week-plan input {
  width: 4.5rem;
}

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

.empty {
  color: var(--color-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.month-nav strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.month-nav button {
  padding: 0.35rem 0.7rem;
}

.badge {
  display: inline-block;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.positive { color: var(--color-success); }
.negative { color: var(--color-danger); }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.person-tile {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.person-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--color-highlight);
}

.person-tile-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}

.avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-highlight) 16%, transparent);
  color: var(--color-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
}

.person-name {
  font-family: var(--font-display);
  font-weight: 600;
}

.person-tile-stats {
  display: flex;
  gap: 0.75rem;
}

.tile-stat {
  flex: 1;
  text-align: center;
  background: var(--color-bg);
  border-radius: 10px;
  padding: 0.6rem 0.4rem;
}

.tile-stat .value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.tile-stat .label {
  font-size: 0.72rem;
  color: var(--color-muted);
}

/* ---- Anmeldung ---- */

body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  margin: 0;
  padding: 1.5rem;
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.25rem;
}

.auth-brand h1 {
  font-family: var(--font-display);
  margin: 0.4rem 0 0.15rem;
  font-size: 1.6rem;
}

.auth-brand p {
  margin: 0;
}

.auth-card .field,
form.stack-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

form.stack-form {
  max-width: 380px;
}

.hint {
  font-size: 0.78rem;
  color: var(--color-muted);
}

.form-error {
  margin: 0 0 0.9rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: var(--color-danger-bg);
  color: var(--color-danger);
  font-size: 0.88rem;
}

button.full {
  width: 100%;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- Rückmeldungen ---- */

#toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  z-index: 100;
  pointer-events: none;
}

.toast {
  max-width: 420px;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(20, 40, 75, 0.3);
  background: var(--color-text);
  color: var(--color-card);
  animation: fadeIn 0.2s ease;
  transition: opacity 0.4s ease;
}

.toast-error { background: var(--color-danger); }
.toast-success { background: var(--color-success); }
.toast-out { opacity: 0; }

td.actions {
  white-space: nowrap;
  text-align: right;
}

:focus-visible {
  outline: 2px solid var(--color-highlight);
  outline-offset: 2px;
}

/* ---- Admin-Ansicht als Mitarbeiter ---- */

.impersonation-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  padding: 0.5rem 1rem;
  background: var(--color-highlight);
  color: #fff;
  font-size: 0.9rem;
}

.impersonation-bar button {
  background: #fff;
  color: #111;
  padding: 0.35rem 0.85rem;
  min-height: 36px;
  font-size: 0.85rem;
  border-radius: 999px;
}

.impersonation-bar button:hover { background: rgba(255, 255, 255, 0.85); }

/* ---- Kopfzeile: Icons & Menü ---- */

.header-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--header-text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-button:hover,
.icon-button.active {
  background: var(--header-hover);
  color: var(--header-text);
}

/* ---- Abschnitte, Tabellen, Badges ---- */

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

table.month-table th[scope="row"] { color: var(--color-text); text-transform: none; font-size: 0.9rem; }
table.month-table tfoot td, table.month-table tfoot th { border-top: 2px solid var(--color-border); border-bottom: none; font-weight: 600; }
table.month-table tfoot tr + tr td, table.month-table tfoot tr + tr th { border-top: 1px solid var(--color-border); }

tr.clickable { cursor: pointer; }
tr.clickable:focus-visible { outline-offset: -2px; }
tr.selected { background: color-mix(in srgb, var(--color-highlight) 10%, transparent); }
tr.current td:first-child { font-weight: 700; }
tr.future td { color: var(--color-muted); font-style: italic; }
tr.future td.positive { color: var(--color-success); }
tr.future td.negative { color: var(--color-danger); }

.badge-extra {
  background: color-mix(in srgb, var(--color-highlight) 15%, transparent);
  border-color: transparent;
  color: var(--color-highlight);
  font-weight: 600;
}

.badge-vacation {
  background: color-mix(in srgb, var(--color-success) 18%, transparent);
  border-color: transparent;
  color: var(--color-success);
  font-weight: 600;
}

.stat .value.positive { color: var(--color-success); }
.stat .value.negative { color: var(--color-danger); }

details summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
}

details[open] summary { margin-bottom: 0.75rem; }

button.person-tile-button {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--color-card);
  font-weight: inherit;
}

button.person-tile-button:hover { background: var(--color-card); }
.person-tile.selected { border-color: var(--color-highlight); box-shadow: 0 0 0 2px var(--color-highlight); }

#personTiles { margin-bottom: 1.1rem; }

/* ---- Dialoge ---- */

dialog.modal {
  width: min(480px, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-card);
  color: var(--color-text);
  box-shadow: 0 20px 60px rgba(10, 20, 40, 0.35);
  overflow: auto;
}

dialog.modal::backdrop { background: rgba(10, 20, 40, 0.55); }
dialog.modal[open] { animation: fadeIn 0.2s ease; }

.modal-card { padding: 1.1rem 1.25rem 1.25rem; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; }

.modal-close {
  background: transparent;
  color: var(--color-muted);
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.1rem 0.6rem;
}

.modal-close:hover { background: var(--color-bg); color: var(--color-text); }

.dialog-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.dialog-form .field input,
.dialog-form .field select { width: 100%; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.duration { margin: -0.3rem 0 0.9rem; font-size: 0.9rem; color: var(--color-muted); }
.duration strong { color: var(--color-text); }

.dialog-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.dialog-actions .spacer { flex: 1; }

/* ---- Fixierter Erfassen-Button ---- */

body.has-fab main { padding-bottom: 6.5rem; }

.fab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--color-bg) 55%, transparent);
  pointer-events: none;
}

.fab-bar[hidden] { display: none; }

.fab {
  pointer-events: auto;
  width: 100%;
  max-width: 420px;
  min-height: 52px;
  font-size: 1rem;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.fab span { font-size: 1.25rem; line-height: 1; margin-right: 0.15rem; }

body.has-fab #toasts { bottom: 5.5rem; }

/* ---- Darstellung ---- */

.theme-options { display: grid; gap: 0.6rem; }

button.theme-option {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.8rem 0.9rem;
  text-align: left;
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-weight: 400;
}

button.theme-option:hover { background: var(--color-bg); }
button.theme-option.selected { border-color: var(--color-highlight); box-shadow: 0 0 0 2px var(--color-highlight); }

.theme-sample {
  flex: none;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border-radius: 10px;
  background: var(--color-bg);
}

.theme-text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.theme-name { font-weight: 700; }
.theme-desc { font-size: 0.82rem; color: var(--color-muted); }
.theme-swatches { display: flex; gap: 0.3rem; margin-top: 0.2rem; }
.theme-swatches span { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.15); }

/* ---- Einstellungen ---- */

.settings-list { display: flex; flex-direction: column; margin: 0 -0.4rem; }

a.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.6rem 0.4rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  border-radius: 6px;
}

a.settings-row:hover { background: var(--color-bg); color: var(--color-text); }
a.settings-row span { display: flex; flex-direction: column; }
a.settings-row small { font-weight: 400; font-size: 0.8rem; color: var(--color-muted); }
a.settings-row .chev { flex: none; color: var(--color-muted); }

button.logout-button {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 0.5rem;
  background: var(--color-danger);
  color: #fff;
  font-size: 1rem;
  border-radius: var(--radius);
}

button.logout-button:hover { background: color-mix(in srgb, var(--color-danger) 85%, #000); }

.back-link {
  display: inline-block;
  margin: 0 0 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.card.narrow { max-width: 460px; }

.password-input { position: relative; display: flex; }
.password-input input { flex: 1; padding-right: 3rem; }

button.toggle-visibility {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  min-height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--color-muted);
}

button.toggle-visibility:hover { background: var(--color-bg); color: var(--color-text); }
button.toggle-visibility[aria-pressed="true"] { color: var(--color-highlight); }

.requirements { list-style: none; margin: 0.35rem 0 0; padding: 0; font-size: 0.8rem; }
.requirements li { color: var(--color-muted); padding-left: 1.3rem; position: relative; margin: 0.15rem 0; }
.requirements li::before { content: "○"; position: absolute; left: 0; }
.requirements li.ok { color: var(--color-success); }
.requirements li.ok::before { content: "✓"; }

.dialog-note { margin: -0.3rem 0 0.9rem; }
.hint.positive { color: var(--color-success); }
.hint.negative { color: var(--color-danger); }

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

@media (max-width: 600px) {
  /* Touch-Ziele mindestens 44px */
  button, input, select { min-height: 44px; }
  button.danger { min-height: 40px; }
  nav.tabs a { display: inline-flex; align-items: center; min-height: 44px; }
  .tagline { display: none; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions button { flex: 1 1 auto; }
  .dialog-actions .spacer { display: none; }
  td.num, th.num { padding-left: 0.2rem; padding-right: 0.2rem; }
  .month-table { font-size: 0.82rem; }

  form.inline-form { flex-direction: column; align-items: stretch; }
  form.inline-form .field { width: 100%; flex: none !important; }
  form.inline-form button { width: 100%; }
  .employee-bar { flex-direction: column; align-items: stretch; }

  main {
    padding: 1rem 0.75rem 2.5rem;
  }

  .card {
    padding: 0.9rem;
  }

  header.app-header {
    padding: 0.9rem 1rem 0;
  }

  .brand-name {
    font-size: 1.15rem;
  }

  nav.tabs a {
    padding: 0.55rem 0.7rem;
    font-size: 0.85rem;
  }

  .stat {
    flex-basis: 90px;
    padding: 0.6rem;
  }

  .stat .value {
    font-size: 1.2rem;
  }

  .tile-grid {
    grid-template-columns: 1fr;
  }

  .person-tile-stats {
    gap: 0.5rem;
  }
}
