/* kon-projekte — mobile-first, ein Stylesheet, keine Frameworks. */
:root {
  --navy: #0B3550;
  --navy-dark: #082638;
  --teal: #2BB59A;
  --orange: #E8862E;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2b36;
  --muted: #6b7c8a;
  --line: #dde4ea;
  --danger: #c0392b;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }
button { font: inherit; }

/* ---- Login ---- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card {
  background: var(--card); border-radius: 14px; padding: 36px 28px; width: 100%;
  max-width: 360px; text-align: center; box-shadow: 0 8px 30px rgba(9, 42, 66, .12);
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--navy); color: #fff; font-size: 26px; font-weight: 700;
  display: grid; place-items: center; letter-spacing: -1px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-sub { margin: 0 0 22px; color: var(--muted); }
.dev-login { margin-top: 18px; display: flex; gap: 8px; }
.dev-login input { flex: 1; min-width: 0; }
.login-mail { width: 100%; margin-bottom: 10px; }
.login-meldung { border-radius: 8px; padding: 9px 12px; font-size: 14px; text-align: left; }
.login-meldung.ok { background: #e6f6f1; color: #14735f; }
.login-meldung.warn { background: #fdecea; color: var(--danger); }

/* ---- Grundelemente ---- */
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--card);
  color: var(--text); border-radius: 8px; padding: 9px 14px; cursor: pointer;
  text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--navy); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn-danger { color: var(--danger); }
input, select, textarea {
  font: inherit; color: inherit; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 1px; border-color: transparent;
}
textarea { width: 100%; resize: vertical; }

/* ---- Layout ---- */
.topbar {
  background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20;
  padding: 0 max(12px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 10px; height: 52px;
}
.topbar .brand { font-weight: 700; text-decoration: none; color: #fff; white-space: nowrap; }
.topbar .brand em { color: var(--teal); font-style: normal; }
.topbar form { flex: 1; max-width: 480px; }
.topbar input[type=search] {
  width: 100%; background: rgba(255,255,255,.14); border: none; color: #fff;
  border-radius: 7px; padding: 7px 11px;
}
.topbar input[type=search]::placeholder { color: rgba(255,255,255,.65); }
.topbar .user { margin-left: auto; font-size: 13px; opacity: .85; white-space: nowrap; }
.topbar .user a { color: #fff; }

.tabs {
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; gap: 2px; padding: 0 8px; position: sticky; top: 52px; z-index: 19;
  overflow-x: auto;
}
.tabs a {
  padding: 11px 13px; text-decoration: none; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500;
}
.tabs a.active { color: var(--navy); border-bottom-color: var(--orange); }

main { max-width: 980px; margin: 0 auto; padding: 16px 16px 90px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 10px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.leer { color: var(--muted); padding: 14px 4px; }

/* ---- Schnelleingabe ---- */
.quickadd { display: flex; gap: 8px; margin-bottom: 14px; }
.quickadd input { flex: 1; min-width: 0; }

/* ---- Listen ---- */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.liste li:last-child { border-bottom: none; }
.liste .titel { flex: 1; min-width: 0; cursor: pointer; overflow-wrap: anywhere; }
.liste .titel:hover { color: var(--navy-dark); text-decoration: underline; }
.liste .meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.liste input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--teal); flex: none; }
.erledigt .titel { text-decoration: line-through; color: var(--muted); }
.erledigt .titel:hover { color: var(--muted); }
.badge {
  background: var(--bg); border-radius: 20px; padding: 2px 9px; font-size: 12px;
  color: var(--muted); white-space: nowrap;
}
.badge.faellig { background: #fdecea; color: var(--danger); }
.badge.heute { background: #fef3e2; color: #b05f10; }
.projekt-link { text-decoration: none; font-weight: 500; }
.liste li.haupt .projekt-link, .liste li.haupt .titel { font-weight: 600; }
.liste li.teil {
  margin-left: 10px; padding-left: 16px;
  border-left: 2px solid var(--line);
}
.liste li.teil .projekt-link { font-weight: 400; }
.teil-pfeil { color: var(--muted); }
.badge.betrifft { background: #e7f0fe; color: #2c5a8c; }
.betrifft-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -6px 0 12px; }
.betrifft-zeile {
  display: block; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.betrifft-zeile.teil { padding-left: 28px; }
.betrifft-zeile input { accent-color: var(--teal); margin-right: 8px; width: 17px; height: 17px; vertical-align: -3px; }
.gruppe { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); font-weight: 600; }

/* ---- Projektseite ---- */
.projekt-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.projekt-kopf h1 { margin: 0; font-size: 21px; flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.crumb { font-size: 13px; margin-bottom: 2px; }
.zeige-erledigt { background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 8px 4px; font-size: 13px; }
.zeige-erledigt:hover { color: var(--navy); }

/* ---- Detail-Panel (Aufgabe/Notiz) ---- */
.overlay {
  position: fixed; inset: 0; background: rgba(9, 42, 66, .35); z-index: 30;
}
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: var(--card); z-index: 31; display: flex; flex-direction: column;
  box-shadow: -6px 0 30px rgba(9, 42, 66, .2);
}
.panel-kopf {
  display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-kopf .titel-edit {
  flex: 1; font-size: 17px; font-weight: 600; border: none; padding: 2px 4px;
  background: transparent; width: 100%;
}
.panel-kopf .titel-edit:focus { outline: 2px solid var(--teal); border-radius: 4px; }
.panel-close { background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--muted); padding: 0 4px; line-height: 1; }
.panel-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.feldzeile { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.feld { display: flex; flex-direction: column; gap: 4px; }
.feld label { font-size: 12px; color: var(--muted); font-weight: 600; }
.feld select, .feld input { min-width: 150px; }
.abschnitt { margin: 18px 0 8px; font-weight: 600; font-size: 14px; }

.md { overflow-wrap: anywhere; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md code { background: var(--bg); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.md pre { background: var(--bg); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md h1, .md h2, .md h3 { font-size: 15px; margin: 14px 0 6px; }
.md a.jira { background: #e7f0fe; border-radius: 4px; padding: 0 5px; text-decoration: none; }
.md-edit-hinweis { cursor: pointer; color: var(--muted); border: 1px dashed var(--line);
  border-radius: 8px; padding: 10px 12px; }
.md-anzeige { cursor: pointer; border-radius: 8px; padding: 4px; margin: -4px; }
.md-anzeige:hover { background: var(--bg); }

.kommentar { border-top: 1px solid var(--line); padding: 10px 0; }
.kommentar .kopf { font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.kommentar-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.kommentar-form .btnrow { display: flex; justify-content: flex-end; gap: 8px; }

.anhaenge a { display: inline-flex; align-items: center; gap: 6px; margin: 0 10px 6px 0; }
.upload-label { display: inline-block; cursor: pointer; }
.upload-label input { display: none; }

/* ---- Zeitleiste ---- */
.zl-card { padding: 0; overflow: hidden; }
.zl-scroll { overflow-x: auto; }
.zl-inner { position: relative; }
.zl-heute { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--orange); z-index: 1; }
.zl-zeile { display: flex; border-bottom: 1px solid var(--line); }
.zl-zeile.kopf { background: #f8fafb; }
.zl-zeile.monatszeile { border-bottom: 1px solid var(--line); }
.zl-label {
  position: sticky; left: 0; width: 200px; min-width: 200px; z-index: 2;
  background: var(--card); border-right: 1px solid var(--line);
  padding: 6px 10px; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.zl-zeile.kopf .zl-label { background: #f8fafb; font-weight: 600; }
.zl-label.aufgabe { cursor: pointer; color: var(--text); }
.zl-label.aufgabe:hover { text-decoration: underline; }
.zl-track { position: relative; height: 30px; flex: none; }
.zl-monate { height: 24px; }
.zl-monat { position: absolute; top: 4px; font-size: 11px; color: var(--muted);
  padding-left: 4px; border-left: 1px solid var(--line); }
.zl-linie { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .55; }
.zl-balken { position: absolute; top: 7px; height: 16px; border-radius: 8px;
  cursor: pointer; z-index: 1; }
.zl-balken.haupt { background: var(--navy); }
.zl-balken.teil { background: var(--teal); }
.zl-balken.faellig { background: var(--danger); }
.zl-fuss { padding: 10px 12px; }
.zl-lg { display: inline-block; vertical-align: -1px; width: 26px; height: 10px; border-radius: 5px; }
.zl-lg.haupt { background: var(--navy); }
.zl-lg.teil { background: var(--teal); }
.zl-lg.ueber { background: var(--danger); }

/* ---- Zeiterfassung ---- */
.zeit-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.zeit-form #z-stunden { width: 70px; }
.zeit-form #z-bemerkung { flex: 1; min-width: 120px; }
.zeit-zeile { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.feld-mit-knopf { display: flex; gap: 6px; align-items: center; }
.feld-mit-knopf select { flex: 1; }
.betrifft-trenner { flex-basis: 100%; height: 0; }

/* ---- Verwaltung ---- */
table.vw { width: 100%; border-collapse: collapse; }
table.vw th, table.vw td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); }
table.vw th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.vw-scroll { overflow-x: auto; }

/* ---- Meldungen ---- */
#toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--navy-dark); color: #fff; border-radius: 8px; padding: 10px 18px;
  z-index: 50; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: calc(100vw - 32px);
}
#toast.zeigen { opacity: 1; }

@media (max-width: 600px) {
  .topbar .user span.name { display: none; }
  .topbar form { max-width: none; }
  main { padding: 12px 12px 90px; }
  .card { padding: 12px; }
  .panel { width: 100%; }
  .feld select, .feld input { min-width: 130px; }
}
