:root {
  --dlrg-red: #b3241c;
  --dlrg-red-dark: #8f1c16;
  --sunday-bg: #f6cccb;
  --special-bg: #fdf1c7;
  --border: #333;
  --text: #1a1a1a;
  --focus: #1a56db;
  --page-bg: #f4f4f4;
  --card-bg: #ffffff;
  --saturday-bg: #ffffff;
  --slot-empty-text: #444;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.4;
}

a { color: var(--dlrg-red-dark); }

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

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

.site-header {
  background: var(--dlrg-red);
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.site-header h1 {
  font-size: 1.1rem;
  margin: 0;
}
.site-header h1 a {
  color: inherit;
  text-decoration: none;
}
.site-header h1 a:hover, .site-header h1 a:focus-visible {
  text-decoration: underline;
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.btn-nav {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn-nav:hover, .btn-nav:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  border-color: #fff;
}

main {
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  box-sizing: border-box;
}

.card {
  background: var(--card-bg);
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 1.25rem;
  max-width: 420px;
  margin: 2rem auto;
}

.card h2 { margin-top: 0; }

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.6rem;
  font-size: 1rem;
  border: 1px solid #888;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.password-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}
.password-row input {
  flex: 1;
}
.btn-toggle-password {
  white-space: nowrap;
  flex-shrink: 0;
}

button, .btn {
  background: var(--dlrg-red);
  color: #fff;
  border: none;
  padding: 0.6rem 1.1rem;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--dlrg-red-dark); }

.btn-secondary {
  background: #555;
}
.btn-secondary:hover { background: #333; }

.btn-danger {
  background: #6b0f0f;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

.error-message {
  background: #ffe0e0;
  border: 1px solid #c00;
  color: #6b0000;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.flash-success {
  background: #e2f4e2;
  border: 1px solid #2e7d32;
  color: #1b4d1e;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.year-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.year-nav .current-year {
  font-weight: 700;
  font-size: 1.2rem;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.slot-free {
  display: block;
  min-height: 2.5rem;
  padding: 0.4rem 0.5rem;
  color: var(--slot-empty-text);
  font-size: 0.85rem;
  font-style: italic;
}

.legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.legend i {
  width: 0.9rem;
  height: 0.9rem;
  display: inline-block;
  border: 1px solid #999;
}
.legend-saturday { background: var(--saturday-bg); }
.legend-sunday { background: var(--sunday-bg); }
.legend-special { background: var(--special-bg); }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

table.wachplan {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
  min-width: 1100px;
  font-size: 0.9rem;
}

table.wachplan caption {
  text-align: left;
  font-weight: 700;
  padding: 0.5rem;
}

table.wachplan th,
table.wachplan td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}

table.wachplan td:not(.remark-cell) {
  text-align: center;
}

table.wachplan thead th {
  background: var(--dlrg-red);
  color: #fff;
}

table.wachplan tbody th[scope="row"] {
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
  white-space: nowrap;
  font-weight: 600;
}

tr.row-saturday { background: var(--saturday-bg); }
tr.row-sunday { background: var(--sunday-bg); }
tr.row-special { background: var(--special-bg); }

.special-badge {
  display: inline-block;
  background: #a06a00;
  color: #fff;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-right: 0.35rem;
}

.slot-filled {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.slot-name {
  font-weight: 600;
}

.slot-note {
  font-weight: 400;
  font-style: italic;
  font-size: 0.85em;
}

.slot-empty a {
  display: block;
  min-height: 2.5rem;
  min-width: 2.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px dashed #888;
  border-radius: 4px;
  text-align: center;
  text-decoration: none;
  color: var(--slot-empty-text);
  font-size: 0.85rem;
}
.slot-empty a:hover, .slot-empty a:focus-visible {
  background: #fff3f3;
  border-color: var(--dlrg-red);
  color: var(--dlrg-red-dark);
}

.inline-form {
  display: inline;
}

form.remove-form button {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}

.remark-cell {
  min-width: 10rem;
}

.admin-banner {
  background: #222;
  color: #fff;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.admin-section {
  background: var(--card-bg);
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.admin-section h2 { margin-top: 0; }

ul.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.plain-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #eee;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hint {
  font-size: 0.85rem;
  color: #555;
}

@media (max-width: 600px) {
  table.wachplan { font-size: 0.8rem; }
  main { padding: 0.5rem; }
  .site-header h1 { font-size: 1rem; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #121212;
    --card-bg: #1e1e1e;
    --text: #eaeaea;
    --border: #555;
    --sunday-bg: #4a2323;
    --special-bg: #4a3d18;
    --saturday-bg: #262626;
    --slot-empty-text: #ddd;
  }
  input[type="text"], input[type="password"] {
    background: #2a2a2a;
    color: #eaeaea;
    border-color: #666;
  }
}
