:root {
  --beige: #efe6d6;
  --beige-deep: #e4d5bc;
  --paper: #fffdf8;
  --white: #ffffff;
  --line: #d9cbb3;
  --ink: #3b3126;
  --muted: #7a6c5a;
  --gold: #9c7b4a;
  --ok: #5c6b4a;
  --warn: #9a6a32;
  --done: #6b5c4a;
  --shadow: 0 18px 40px rgba(59, 49, 38, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(255,255,255,0.7), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(255,253,248,0.5), transparent 50%),
    var(--beige);
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 80px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 4px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
}

h1, h2, h3 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  margin: 0;
}

h1 { font-size: clamp(40px, 6vw, 58px); line-height: 0.95; }
h2 { font-size: 32px; }
h3 { font-size: 24px; }

.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-btn, .btn, .icon-btn, select, input, textarea, button {
  font-family: inherit;
}

.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.nav-btn.is-active {
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
}

.view { display: none; }
.view.is-visible { display: block; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat, .card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat { padding: 18px 20px; }
.stat b {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 34px;
  line-height: 1;
  margin-top: 6px;
}
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.btn {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}
.btn.ghost {
  background: var(--white);
  color: var(--ink);
  border-color: var(--line);
}
.btn.danger {
  background: transparent;
  color: #8a3f32;
  border-color: #e3c1ba;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.card { padding: 18px; cursor: pointer; }
.card.static { cursor: default; }
.card h3 { margin-bottom: 8px; }
.meta, .muted { color: var(--muted); font-size: 13px; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip, .badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--white);
  border: 1px solid var(--line);
}
.badge.offen { color: var(--warn); }
.badge.aktiv { color: var(--ok); }
.badge.erledigt { color: var(--done); }
.badge.rohstoff { color: var(--warn); background: #f7f1e6; }
.badge.custom { color: #6b5c4a; background: #f3ead3; }

.crate-card { margin-bottom: 22px; }
.crate-bar { margin: 8px 0 4px; }
.badge.crate-offen { color: #8a3f32; background: #f6ece8; }
.badge.crate-teil { color: var(--warn); background: #f7f1e6; }
.badge.crate-fertig { color: var(--ok); background: #eef3e8; }
.quota-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin: 0 0 14px;
}
.quota-form label { min-width: 160px; flex: 1; }
.quota-form .btn { margin-bottom: 2px; }
.job-recipes { margin-top: 8px; }
.job-recipes .link-block { margin-top: 8px; }
.link-block .meta { margin-bottom: 6px; }

#material-fields {
  display: grid;
  gap: 12px;
}
#material-fields[hidden] { display: none; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}
.activity-list li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.activity-list b { color: var(--ink); font-weight: 600; }
.leader-table td:nth-child(4) { min-width: 220px; }
.dimmed { opacity: 0.62; }

.form {
  display: grid;
  gap: 12px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
  font-size: 15px;
}
textarea { min-height: 90px; resize: vertical; }

.table-wrap { overflow: auto; }
.table-wrap .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(59, 49, 38, 0.28);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--paper);
  border-radius: 22px;
  border: 1px solid var(--line);
  padding: 20px;
  box-shadow: var(--shadow);
}
.modal-card.wide { width: min(760px, 100%); }

.need-row {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.recipe-panels {
  display: grid;
  gap: 12px;
}
.recipe-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: var(--white);
}
.badge.recipe-normal { color: var(--ink); background: #f7f1e6; }
.badge.recipe-profi { color: var(--ok); background: #eef3e8; }
.badge.recipe-bauplan { color: #6b4e16; background: #f3ead3; }

.recipe-panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.recipe-panel-head label { flex: 1; min-width: 140px; }
.bauplan-stufe[hidden] { display: none; }
.recipe-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.job-drop {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}
.job-drop > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.job-drop > summary::-webkit-details-marker { display: none; }
.job-drop > summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 14px;
  transition: transform 0.15s ease;
}
.job-drop[open] > summary::after { transform: rotate(180deg); }
.job-drop-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}
  height: 8px;
  background: #efe6d6;
  border-radius: 99px;
  overflow: hidden;
  min-width: 80px;
}
.bar span {
  display: block;
  height: 100%;
  background: var(--gold);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.check-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 500;
}
.check-list input { width: auto; }

.member-actions {
  margin-top: 14px;
  align-items: flex-end;
}
.actions { display: flex; gap: 8px; flex-shrink: 0; }

.notice {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7f1e6;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.user-bar .muted { margin: 0; }

.linkish {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
.linkish:hover { text-decoration-color: var(--ink); }

.absence-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.absence-fields[hidden] { display: none; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.profile-meta {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}
.profile-meta div {
  display: grid;
  gap: 2px;
}
.profile-meta dt {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.profile-meta dd { margin: 0; }
.profile-activity { margin-top: 10px; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 6px 8px;
  display: grid;
  gap: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: none; }
.timeline span { color: var(--muted); font-size: 13px; }
.timeline b { font-weight: 600; }
.timeline small { color: var(--muted); font-size: 12px; }

button.chip {
  cursor: pointer;
  font: inherit;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 400px at 20% 0%, rgba(255,255,255,0.7), transparent 55%),
    var(--beige);
}
.auth-gate[hidden] { display: none; }
.auth-card {
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 42px; margin-bottom: 8px; }
.auth-error { color: #8a3f32; font-size: 13px; font-weight: 600; min-height: 1.2em; }

@media (max-width: 720px) {
  .top { flex-direction: column; align-items: flex-start; }
  .stats { grid-template-columns: 1fr; }
  .user-bar { margin-left: 0; }
  .profile-grid, .absence-fields, .timeline li, .quota-form, .recipe-fields { grid-template-columns: 1fr; }
}
