:root {
  --bg: #1a1f1c;
  --panel: #232a26;
  --line: #3a4540;
  --text: #e8eee9;
  --muted: #9aaba0;
  --accent: #6fbf73;
  --accent-dim: #3d7a42;
  --warn: #c9a227;
  --err: #d45d5d;
  --ok: #6fbf73;
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #2a3830 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #243028 0%, transparent 50%),
    var(--bg);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(26, 31, 28, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
}
nav { display: flex; flex-wrap: wrap; gap: 0.85rem; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
nav a:hover { color: var(--accent); }
nav a.muted { opacity: 0.75; }

.wrap {
  width: min(960px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
}

h1 { font-size: 1.6rem; margin: 0 0 0.35rem; font-weight: 600; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 1.25rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.week-fields {
  display: grid;
  grid-template-columns: 8rem 8rem 1fr;
  gap: 1rem;
  align-items: end;
}
@media (max-width: 720px) {
  .grid-2, .week-fields { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.65rem 0 0.25rem;
}
input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1a211d;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; font-family: var(--mono); font-size: 0.9rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #102014;
  font-weight: 600;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-danger {
  background: transparent;
  color: var(--err);
  border: 1px solid var(--err);
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
  margin-top: 0;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

.flashes { margin-bottom: 1rem; }
.flash {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.4rem;
  white-space: pre-wrap;
  font-size: 0.92rem;
  border: 1px solid var(--line);
}
.flash-ok { background: #1e3324; border-color: var(--accent-dim); }
.flash-err { background: #3a2222; border-color: var(--err); }
.flash-warn { background: #3a3420; border-color: var(--warn); }

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.88rem;
}
.list li:last-child { border-bottom: none; }
.empty { color: var(--muted); font-size: 0.92rem; }

.auth-card {
  max-width: 420px;
  margin: 3rem auto;
}
.auth-card .links {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.auth-card a { color: var(--accent); }

.meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.mode-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.mode-tab {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.mode-tab.active { color: #102014; background: var(--accent); border-color: var(--accent); }
.hero-cta { text-align: left; }
details.panel summary { cursor: pointer; font-weight: 600; }
.links a { color: var(--accent); }
.day-checks { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.35rem 0 0.85rem; }
.check { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text); font-size: 0.92rem; cursor: pointer; }
.check input { width: auto; margin: 0; }
.check.inline { margin: 0.15rem 0 0.35rem; font-size: 0.85rem; color: var(--muted); }
.day-block { margin-bottom: 0.75rem; }

.day-row {
  display: grid;
  grid-template-columns: 1fr minmax(160px, 200px);
  gap: 0.85rem;
  align-items: stretch;
  padding: 0.85rem;
  margin-bottom: 0.65rem;
}
.day-row__main {
  display: flex;
  flex-direction: column;
  min-height: 140px;
}
.day-row__title { margin-bottom: 0.35rem; }
.day-row__side {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.15rem;
}
.day-row__side label { margin-top: 0.15rem; }
.day-note {
  flex: 1;
  min-height: 120px;
  height: 100%;
  resize: vertical;
  font-family: var(--font);
}
@media (max-width: 720px) {
  .day-row { grid-template-columns: 1fr; }
}

.vorlage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
}
.vorlage-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #1a211d;
  cursor: pointer;
  margin: 0;
}
.vorlage-card input { position: absolute; opacity: 0; pointer-events: none; }
.vorlage-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}
.vorlage-card.is-disabled { opacity: 0.45; cursor: not-allowed; }
.vorlage-nr {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 1;
  background: var(--accent);
  color: #102014;
  font-weight: 700;
  font-size: 0.75rem;
  min-width: 1.35rem;
  text-align: center;
  border-radius: 6px;
  padding: 0.1rem 0.3rem;
}
.vorlage-preview {
  width: 100%;
  aspect-ratio: 1 / 1.35;
  object-fit: cover;
  object-position: top;
  border-radius: 6px;
  background: #121714;
  border: 1px solid var(--line);
}
.vorlage-preview--empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.8rem;
}
.vorlage-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.82rem;
  line-height: 1.25;
}
.vorlage-meta .meta { color: var(--muted); font-size: 0.75rem; }

.year-nav {
  display: flex;
  align-items: end;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.year-nav label { margin: 0; }
.year-nav input { width: 7rem; }
.year-nav .btn { margin-top: 0; }

.kw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.55rem;
}
.kw-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}
.kw-card:hover { border-color: var(--accent); }
.kw-card.is-geschrieben { box-shadow: inset 4px 0 0 var(--warn); }
.kw-card.is-generiert { box-shadow: inset 4px 0 0 var(--accent); }
.kw-card.is-geschrieben.is-generiert {
  box-shadow: inset 4px 0 0 var(--warn), inset -4px 0 0 var(--accent);
}
.kw-card__nr { font-weight: 600; }
.kw-card__date, .kw-card__state { font-size: 0.8rem; color: var(--muted); }
.kw-marks { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem; }
.kw-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.mark {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
}
.mark-geschrieben { color: #1a1404; background: var(--warn); }
.mark-generiert { color: #102014; background: var(--accent); }

.eingabe-text { white-space: pre-wrap; }

.sheet {
  background: #f4f1ea;
  color: #1c1c1c;
  border-radius: 12px;
  padding: 1.25rem 1.35rem 1.5rem;
  margin: 1rem 0 2rem;
}
.sheet__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid #1c1c1c;
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
}
.sheet__kicker {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sheet .meta { color: #555; }
.sheet__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.sheet__table th, .sheet__table td {
  border: 1px solid #c8c2b6;
  padding: 0.45rem 0.55rem;
  vertical-align: top;
  text-align: left;
}
.sheet__table th { background: #e7e1d6; font-weight: 600; }
.sheet__day { width: 7.5rem; font-weight: 600; }
.sheet__hours { width: 4rem; text-align: right; white-space: nowrap; }
.sheet__line {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.35;
  min-height: 1.35em;
}
.sheet__block { margin-top: 1rem; }
.sheet__block h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.sheet__block p { margin: 0.15rem 0; }
.sheet__title { font-weight: 700; }
.sheet__foot {
  margin-top: 0.85rem;
  font-weight: 600;
}
.sheet__foot input { max-width: 8rem; }
.sheet label { color: #3d3d3d; }
.sheet input, .sheet textarea {
  background: #fff;
  color: #1c1c1c;
  border: 1px solid #c8c2b6;
  border-radius: 4px;
  min-height: 0;
  margin-bottom: 0.28rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.28rem 0.45rem;
}
.sheet textarea { min-height: 5.5rem; }
.sheet__fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.15rem 0.7rem;
}
.sheet-day { margin-top: 0.9rem; }
.sheet-day > strong { display: block; margin-bottom: 0.3rem; }
.sheet-line {
  display: grid;
  grid-template-columns: 1fr 4.2rem;
  gap: 0.35rem;
}
.sheet-hours-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.2rem;
}
.sheet-hours-row input { width: 4.2rem; }
.sheet-total input { max-width: 6rem; }
@media (max-width: 720px) {
  .sheet__fields { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sheet__head { flex-direction: column; }
}

