:root {
  --bg:        #f5f5f7;
  --card:      #ffffff;
  --ink:       #1d1d1f;
  --muted:     #6e6e73;
  --line:      #e3e3e6;
  --accent:    #0071e3;
  --accent-d:  #0066cc;
  --green:     #34c759;
  --red:       #ff3b30;
  --amber:     #ff9f0a;
  --radius:    16px;
  --shadow:    0 1px 3px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue",
               Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-d); }

/* --- Topbar ------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,.8);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 980px; margin: 0 auto; padding: 0 24px;
  height: 52px; display: flex; align-items: center; gap: 28px;
}
.brand { font-weight: 600; font-size: 17px; color: var(--ink); letter-spacing: -.01em; }
.nav { display: flex; gap: 22px; flex: 1; }
.nav a { color: var(--muted); font-size: 14px; font-weight: 500; }
.nav a.active, .nav a:hover { color: var(--ink); }
.topbar .logout { color: var(--muted); font-size: 13px; }

/* --- Layout ------------------------------------------------------------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 48px 24px 96px; }
.head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 32px; gap: 16px; flex-wrap: wrap;
}
h1 { font-size: 32px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 21px; font-weight: 600; letter-spacing: -.01em; margin: 40px 0 16px; }
.sub { color: var(--muted); font-size: 15px; margin: 4px 0 0; }

/* --- Cards & Grid ------------------------------------------------------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
}
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 760px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

.stat { text-align: left; }
.stat .num { font-size: 40px; font-weight: 600; letter-spacing: -.03em; }
.stat .lbl { color: var(--muted); font-size: 14px; margin-top: 2px; }
.stat a { color: inherit; display: block; }

/* --- Lists -------------------------------------------------------------- */
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; }
.row .meta { color: var(--muted); font-size: 13px; }
.row .meta a { color: var(--muted); }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: none;
  padding: 9px 18px; border-radius: 980px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s; font-family: inherit;
}
.btn:hover { background: var(--accent-d); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); padding: 9px 12px; }
.btn.ghost:hover { background: rgba(0,113,227,.08); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--red); }
.btn.danger:hover { background: rgba(255,59,48,.08); }

/* --- Badges ------------------------------------------------------------- */
.badge {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 980px;
  background: #ececef; color: var(--muted);
}
.badge.aktiv   { background: rgba(52,199,89,.14);  color: #248a3d; }
.badge.beendet { background: #ececef; color: var(--muted); }
.badge.entwurf { background: rgba(255,159,10,.16); color: #b15c00; }
.badge.faellig { background: rgba(255,59,48,.12);  color: #c0271f; }

/* --- Forms -------------------------------------------------------------- */
form.stack { display: grid; gap: 18px; max-width: 560px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 6px; }
input, textarea, select {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0,113,227,.12);
}
textarea { resize: vertical; min-height: 90px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }

/* --- Search ------------------------------------------------------------- */
.search input {
  border-radius: 980px; padding: 9px 16px; width: 220px; font-size: 14px;
}

/* --- Task checkbox ------------------------------------------------------ */
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #c7c7cc;
  background: #fff; cursor: pointer; flex-shrink: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.check.done { background: var(--green); border-color: var(--green); color: #fff; }
.row.done .title { color: var(--muted); text-decoration: line-through; }

/* --- Detail key/value --------------------------------------------------- */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 20px; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; }

.flash { background: rgba(255,59,48,.1); color: #c0271f; padding: 12px 16px;
         border-radius: 12px; font-size: 14px; margin-bottom: 20px; }

.notes { white-space: pre-wrap; color: var(--ink); }
