:root {
  /* Hausfarben Grimm Spedition (aus dem Logo): Blau #005492, Gelb #FDCD00 */
  --grimm-blue: #005492;
  --grimm-yellow: #fdcd00;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #17212c;
  --muted: #5a6776;
  --line: #dbe2ea;
  --accent: #005492;
  --accent-hover: #00406f;
  --accent-ink: #ffffff;
  --accent-soft: #e4eef7;
  --green: #2e7d4f;  --green-bg: #e2f2e8;
  --yellow: #8a6200; --yellow-bg: #fbf0d0;
  --red: #b3261e;    --red-bg: #fbe3e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(10, 30, 60, .06), 0 2px 8px rgba(10, 30, 60, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161d; --surface: #18212b; --ink: #e6ecf2; --muted: #98a6b5; --line: #2a3644;
    --accent: #5ba7e0; --accent-hover: #7db9e8; --accent-ink: #08131d; --accent-soft: #172b3d;
    --green: #6fcf97; --green-bg: #1f3328; --yellow: #e6c25a; --yellow-bg: #362d14; --red: #f28b82; --red-bg: #3b1f1d;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .3rem; }
p { margin: 0 0 .75rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted, .meta { color: var(--muted); }
.meta { font-size: .82rem; }
.small { font-size: .85rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }

/* Kopf */
.top { background: var(--surface); border-bottom: 3px solid var(--grimm-yellow); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; gap: 1rem; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; font-size: 1rem; padding: 6px 0; }
.brand-text { font-weight: 600; color: var(--accent); border-left: 1px solid var(--line); padding-left: .7rem; }

.nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.nav a, .nav .link { padding: .4rem .6rem; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: .92rem; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a:hover, .nav .link:hover { background: var(--accent-soft); }

main.wrap { padding-top: 24px; padding-bottom: 32px; }
.page-head { margin-bottom: 1.25rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.foot { color: var(--muted); font-size: .8rem; padding-bottom: 24px; }

/* Karten und Raster */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: 16px; }
.grid.tight { gap: 12px; }
.grid > .card { margin-bottom: 0; }

.topic-card { display: flex; flex-direction: column; color: var(--ink); text-decoration: none; transition: border-color .15s; }
.topic-card:hover { border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.card-head h2 { margin: 0 0 .4rem; }
.goal { color: var(--muted); font-size: .9rem; }
.kpis { margin: 0 0 .75rem; display: grid; gap: .35rem; }
.kpis div { display: flex; justify-content: space-between; gap: .5rem; border-top: 1px dashed var(--line); padding-top: .35rem; font-size: .88rem; }
.kpis dt { color: var(--muted); }
.kpis dd { margin: 0; font-weight: 600; text-align: right; }
.target { font-weight: 400; color: var(--muted); }
.card-foot { margin-top: auto; display: flex; gap: .75rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .6rem; }

/* Ampel */
.badge { font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.badge.big { font-size: .85rem; padding: .3rem .8rem; }
.b-gruen { background: var(--green-bg); color: var(--green); }
.b-gelb { background: var(--yellow-bg); color: var(--yellow); }
.b-rot { background: var(--red-bg); color: var(--red); }
.overdue { color: var(--red); font-weight: 600; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .65rem 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list.compact > li { padding: .45rem 0; font-size: .9rem; }
.list.compact .when { min-width: 120px; }
.list.compact .who { min-width: 120px; font-weight: 600; font-size: .88rem; }
.task-title { font-weight: 500; }
.task.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.notes p { margin: .2rem 0 0; white-space: normal; overflow-wrap: anywhere; }
.doc .ext { font-size: .7rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); border-radius: 5px; padding: .25rem .4rem; min-width: 44px; text-align: center; }

/* Tabelle Kennzahlen */
.table { display: grid; gap: 0; }
.tr { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: .5rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--line); margin: 0; }
.tr.th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-top: 0; }
.tr .actions { display: flex; gap: .35rem; }
@media (max-width: 640px) {
  .tr { grid-template-columns: 1fr 1fr; }
  .tr .label { grid-column: 1 / -1; font-weight: 600; }
  .tr .actions { grid-column: 1 / -1; }
  .tr.th { display: none; }
}

/* Formulare */
label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  padding: .5rem .6rem; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }
.stack { display: grid; gap: .8rem; margin-top: .8rem; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.inline-form > input, .inline-form > select { flex: 1 1 140px; width: auto; }
.inline-form > .grow { flex: 3 1 260px; }
.filter { margin: 0 0 .8rem; }
.upload { display: grid; gap: .8rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.card > .upload:first-of-type { border-top: 0; padding-top: 0; }
.drop { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: .8rem; font-weight: 500; }
.drop input { border: 0; padding: .3rem 0; background: transparent; }

.btn { font: inherit; font-weight: 600; font-size: .9rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: .5rem .9rem; border-radius: 7px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { font-size: .8rem; padding: .3rem .6rem; }
.btn:hover { filter: brightness(.96); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); filter: none; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link.small { font-size: .8rem; color: var(--muted); }

.status-select { width: auto; font-size: .8rem; padding: .25rem .4rem; font-weight: 600; }
.s-offen { color: var(--red); }
.s-in_arbeit { color: var(--yellow); }
.s-erledigt { color: var(--green); }

details.edit { margin-top: .6rem; }
details.edit > summary { cursor: pointer; font-size: .85rem; color: var(--accent); font-weight: 600; }
details.edit[open] > summary { margin-bottom: .2rem; }

.flash { background: var(--accent-soft); color: var(--accent); border-left: 4px solid var(--grimm-yellow); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 16px; font-weight: 500; }
.error { background: var(--red-bg); color: var(--red); border-radius: 7px; padding: .6rem .8rem; margin: .6rem 0; font-weight: 500; }

.auth { max-width: 420px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--grimm-blue); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }

/* Statusauswahl bleibt neben langen Titeln */
.list > li.row, .task > .row { flex-wrap: nowrap; align-items: flex-start; }
.list > li.row > form, .task > .row > form { flex: 0 0 auto; }
@media (max-width: 480px) { .nav a, .nav .link { padding: .35rem .45rem; font-size: .88rem; } }

/* Grimm-Logo */
.logo { display: block; width: 100px; height: 42px; background: url("/static/grimm-logo.png") no-repeat left center / contain; }
.logo.big { width: 180px; height: 76px; margin: 0 auto 1rem; }
@media (prefers-color-scheme: dark) {
  /* auf weisser Plakette, damit das Blau lesbar bleibt */
  .logo { background-color: #fff; border-radius: 6px; padding: 3px 6px; background-origin: content-box; }
}
