:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #edf2ff;
  --border: #d7deea;
  --text: #172033;
  --muted: #63708a;
  --accent: #315efb;
  --accent-strong: #2146c7;
  --danger: #c62828;
  --success: #1b7f47;
  --arbeit: #dff7e8;
  --schule: #fff0c7;
  --abwesend: #ffd7d7;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  scrollbar-gutter: stable;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

.topbar h1,
.card h1,
.card h2 {
  margin: 0;
}

.topbar-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  display: grid;
  gap: 1rem;
}

.page-home {
  grid-template-columns: 1fr;
}

.page-admin {
  grid-template-columns: 1fr;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.hero-card {
  background: linear-gradient(135deg, #edf2ff, #ffffff);
}

.hero-content {
  display: grid;
  gap: 0.5rem;
}

.week-card h3 {
  margin: 0;
}

.hero-name {
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 800;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 0.75rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field input,
.field select {
  width: 100%;
  min-height: 3rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 0.75rem 0.9rem;
  background: #fff;
}

.filters,
.inline-form,
.section-header {
  display: grid;
  gap: 0.75rem;
}

.inline-form {
  align-items: end;
}

.grow {
  flex: 1;
}

.primary-button,
.ghost-button,
.cell-button,
.chip-button {
  min-height: 3rem;
  border-radius: 14px;
  border: 0;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.primary-button:hover,
.ghost-button:hover,
.chip-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:active {
  background: var(--accent-strong);
}

.ghost-button,
.chip-button {
  background: transparent;
  border: 1px solid var(--border);
  text-decoration: none;
}

.chip-button.is-active {
  background: var(--surface-strong);
  border-color: #b8c6f2;
}

.message {
  width: min(1100px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.message-success {
  border-color: rgba(27, 127, 71, 0.2);
  color: var(--success);
}

.message-error {
  border-color: rgba(198, 40, 40, 0.2);
  color: var(--danger);
}

.data-card,
.week-card,
.azubi-row {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem;
  background: var(--surface);
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: var(--surface-strong);
}

.login-body {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-layout {
  width: min(900px, 100%);
  display: grid;
  gap: 1rem;
}

.login-grid {
  display: grid;
  gap: 1rem;
}

.table-scroll {
  overflow-x: auto;
}

.availability-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0.45rem;
  min-width: 860px;
}

.availability-table th,
.availability-table td {
  text-align: center;
  vertical-align: middle;
}

.availability-table th:first-child,
.availability-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  text-align: left;
  min-width: 180px;
}

.cell-button {
  width: 100%;
  min-height: 3.2rem;
  border: 1px solid transparent;
}

.status-arbeit {
  background: var(--arbeit);
}

.status-schule {
  background: var(--schule);
}

.status-abwesend {
  background: var(--abwesend);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.legend-item,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.92rem;
}

.badge {
  background: var(--surface-strong);
}

.weekday-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.weekday-row {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.week-head,
.azubi-row {
  display: grid;
  gap: 0.75rem;
}

.planning-view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.azubi-actions,
.week-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.service-select {
  min-width: 220px;
}

details summary {
  cursor: pointer;
  font-weight: 700;
}

@media (min-width: 720px) {
  .page-home {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-card,
  #planning-card {
    grid-column: 1 / -1;
  }

  .filters,
  .inline-form,
  .section-header,
  .week-head,
  .azubi-row,
  .login-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (min-width: 1024px) {
  .page-admin {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-admin > .message,
  .page-admin > .card:nth-child(2),
  .page-admin > .card:last-child {
  grid-column: 1 / -1;
  }
}
