* { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- Schriften (selbst gehostet, DSGVO-freundlich) ---------- */
@font-face {
  font-family: "Open Sans";
  src: url("/static/fonts/opensans.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("/static/fonts/caveat.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Farbwelt nach puenktchen-dortmund.de ---------- */
:root {
  --terracotta: #db9982;       /* Überschriften & Links der Website */
  --terracotta-dark: #c9805f;
  --blue: #749dca;             /* Slogan, Trenner, Seitenüberschriften */
  --blue-dark: #6f98c5;        /* Headline-Hintergrund */
  --blue-light: #bacee5;       /* Unterstreichungen */
  --rose: #f2dbd3;             /* Flächenfarbe */
  --sidebar: #f1f5fa;          /* Seitenleisten-Hintergrund */
  --teal: #15797b;             /* Logo-Schriftzug */
  --ochre: #a9741b;            /* Logo-Punkt */
  --card: #ffffff;
  --text: #565656;
  --muted: #8d8d8d;
  --border: #e9dcd4;
  --holiday: #e4edf7;
  --holiday-border: #bacee5;
  --error: #b3261e;
}

body {
  font-family: "Open Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  min-height: 100vh;
  /* zartes Rosé mit dezenten Pünktchen */
  background-color: var(--rose);
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.55) 4px, transparent 5px),
    radial-gradient(circle, rgba(116, 157, 202, 0.10) 3px, transparent 4px);
  background-size: 84px 84px, 84px 84px;
  background-position: 0 0, 42px 42px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--error); font-size: 0.9rem; margin: 0.4rem 0; }

/* ---------- Logo-Schriftzug ---------- */
.brand { display: flex; align-items: baseline; gap: 0.15em; font-weight: 400; }
.brand-dot {
  align-self: flex-start;
  width: 0.42em; height: 0.38em; border-radius: 50%;
  background: var(--ochre); transform: rotate(-15deg);
  margin: 0.05em 0.05em 0 0;
}
.brand-name {
  font-family: "Caveat", cursive;
  color: var(--teal);
  font-size: 1.55em; font-weight: 600; line-height: 1;
}
.brand-sub {
  font-family: "Caveat", cursive;
  color: var(--blue);
  font-size: 1.25em; font-weight: 600; line-height: 1;
}

/* ---------- Login ---------- */
#login-view {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 2rem; width: min(92vw, 380px);
  box-shadow: 0 6px 24px rgba(120, 90, 75, 0.14);
}
.login-box h1 { margin-bottom: 0.35rem; font-size: 1.7rem; }
.login-box p { margin-bottom: 1.25rem; }

/* ---------- Formulare ---------- */
label { display: block; margin-bottom: 0.7rem; font-size: 0.9rem; }
input, select {
  display: block; width: 100%; margin-top: 0.25rem;
  padding: 0.5rem 0.7rem; font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid #d5dde8; border-radius: 6px;
  background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

.btn {
  padding: 0.5rem 0.95rem; font-size: 0.95rem; cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--blue-light); border-radius: 6px;
  background: #fff; color: var(--text);
}
.btn:hover { background: var(--sidebar); border-color: var(--blue); }
.btn.primary { background: var(--terracotta); border-color: var(--terracotta); color: #fff; width: 100%; }
.btn.primary:hover { background: var(--terracotta-dark); border-color: var(--terracotta-dark); }
.btn.small { padding: 0.3rem 0.75rem; font-size: 0.85rem; }
.btn.danger { color: var(--error); }

/* ---------- Layout ---------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem;
  padding: 0.7rem 1.2rem; background: var(--card);
  border-bottom: 3px solid var(--blue);
}
header h1 { font-size: 1.35rem; }
.header-right { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

main {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px;
  gap: 1rem; padding: 1rem; max-width: 1300px; margin: 0 auto;
}
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }

.card {
  background: var(--sidebar); border: 1px solid #dfe7f1;
  border-radius: 10px; padding: 1rem; margin-bottom: 1rem;
}
.card h3 {
  margin-bottom: 0.75rem; font-size: 1.02rem;
  color: var(--terracotta); font-weight: 700;
  display: flex; align-items: center; gap: 0.45rem;
  padding-bottom: 0.35rem; border-bottom: 2px solid var(--blue-light);
}
.card h3::before {
  content: ""; flex: none; width: 10px; height: 9px; border-radius: 50%;
  background: var(--ochre); transform: rotate(-15deg);
}
.card h4 { margin: 0.9rem 0 0.5rem; font-size: 0.9rem; color: var(--blue-dark); }

/* ---------- Kalender ---------- */
.calendar-panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem;
}
.calendar-nav {
  display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem;
}
.calendar-nav h2 {
  flex: 1; text-align: center; font-size: 1.35rem;
  color: var(--blue); font-weight: 600;
}
.calendar-nav .btn { border-radius: 50%; width: 2.2rem; height: 2.2rem; padding: 0; color: var(--blue-dark); }
.calendar-nav .btn.small { border-radius: 6px; width: auto; padding: 0.3rem 0.75rem; }

.weekday-row, .calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.weekday-row { margin-bottom: 4px; }
.weekday-row div {
  text-align: center; font-size: 0.78rem; font-weight: 600;
  color: #fff; background: var(--blue-dark);
  padding: 0.28rem 0; border-radius: 6px;
}
.week-banner {
  grid-column: 1 / -1;
  padding: 2px 10px; border-radius: 6px;
  font-size: 0.74rem; color: var(--blue-dark);
  background: var(--sidebar); border: 1px dashed var(--blue-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.week-banner.mine {
  background: #faeade; border-color: var(--terracotta);
  color: var(--terracotta-dark); font-weight: 600;
}
.absence-list li.mine .who { color: var(--terracotta-dark); }

.day {
  min-height: 98px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0.28rem; font-size: 0.8rem; background: #fff;
  cursor: pointer; overflow: hidden; position: relative;
  display: flex; flex-direction: column;
}
.day:hover { border-color: var(--terracotta); }
.day.other-month { opacity: 0.38; }
.day.weekend { background: #f8f1ed; }
.day.holiday { background: var(--holiday); border-color: var(--holiday-border); }
.day.today { outline: 3px solid var(--terracotta); outline-offset: -3px; }
.day .daynum { font-weight: 700; }
.day.today .daynum { color: var(--terracotta-dark); }
.day .holiday-name {
  display: block; font-size: 0.66rem; color: var(--blue-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.day-stats {
  margin-top: auto; padding: 1px 7px; border-radius: 999px;
  font-size: 0.64rem; line-height: 1.5;
  background: var(--sidebar); color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.day-stats.warn { background: #ffe3b3; color: #7a4d00; font-weight: 600; }
.day-stats.critical { background: #f8d0cd; color: #8f1d16; font-weight: 600; }
.day-stats.demo { margin-top: 0; display: inline-block; }
.day.holiday .day-stats { background: rgba(255, 255, 255, 0.7); }
.day.holiday .day-stats.warn { background: #ffe3b3; }
.day.holiday .day-stats.critical { background: #f8d0cd; }
#day-dialog-content .entry.presence { color: var(--muted); }

.chip {
  display: block; margin-top: 2px; padding: 1px 7px;
  border-radius: 999px; font-size: 0.7rem; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip.more { background: #a5a5a5; }
.chip.demo { display: inline-block; color: #fff; }
.kind-chip { background: var(--terracotta); }
.erz-chip { background: var(--blue); }

.legend {
  display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.9rem;
  font-size: 0.82rem; color: var(--muted); align-items: center;
}
.legend-item { display: flex; align-items: center; gap: 0.35rem; }
.swatch {
  width: 16px; height: 16px; border-radius: 50%; display: inline-block;
  border: 1px solid var(--border);
}
.holiday-swatch { background: var(--holiday); border-color: var(--holiday-border); }
.today-swatch { background: #fff; outline: 3px solid var(--terracotta); outline-offset: -3px; }

/* ---------- Listen ---------- */
.absence-list, .user-list { list-style: none; font-size: 0.86rem; }
.absence-list li, .user-list li {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0; border-bottom: 1px dotted var(--blue-light);
}
.absence-list li:last-child, .user-list li:last-child { border-bottom: none; }
.absence-list .who { font-weight: 600; }
.absence-list .grow, .user-list .grow { flex: 1; min-width: 0; }
.absence-list .note { color: var(--muted); }

/* ---------- Dialoge ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 1.2rem; width: min(92vw, 420px);
  font-family: "Open Sans", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  box-shadow: 0 10px 40px rgba(90, 70, 60, 0.25);
}
dialog::backdrop { background: rgba(86, 86, 86, 0.4); }
dialog h3 { margin-bottom: 0.8rem; color: var(--terracotta); }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.8rem; }
.dialog-buttons .btn.primary { width: auto; }
#day-dialog-content .entry { padding: 0.35rem 0; border-bottom: 1px dotted var(--blue-light); font-size: 0.9rem; }
#day-dialog-content .entry:last-child { border-bottom: none; }
