/* Airtec Assistant — mobil zuerst (PWA auf dem iPhone), ab 760px zweispaltig.
   Farben nach Hausmuster: Airtec-Orange #f29100 auf warmem Grau. */
:root {
  --orange: #f29100;
  --orange-soft: #fff4e2;
  --ink: #1f2328;
  --muted: #6f6a63;
  --line: #e6e3dd;
  --bg: #f6f4f0;
  --card: #fff;
  --rot: #a33025;
  --rot-soft: #fdf0ee;
  --gruen: #16a34a;
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

/* iOS zoomt beim Fokus, wenn die Schrift kleiner als 16px ist. */
input, textarea, select, button { font: inherit; font-size: 16px; }

a { color: var(--orange); }

/* ---------------------------------------------------------------- Kopf */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + var(--safe-top)) 16px 0;
}
.topbar-kopf { display: flex; align-items: baseline; gap: 10px; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topbar h1 span { color: var(--orange); }
.topbar .datum { font-size: 13px; color: var(--muted); margin-left: auto; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 8px 7px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
@media (min-width: 420px) { .tabs button { padding: 8px 10px; font-size: 14px; } }
.tabs button.active { color: var(--ink); border-bottom-color: var(--orange); }

main { padding: 16px 16px calc(32px + var(--safe-bottom)); max-width: 900px; margin: 0 auto; }
.view[hidden] { display: none; }

/* ---------------------------------------------------------------- Karten */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.cardtitle {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
}
.cardtitle .zahl {
  background: var(--bg); border-radius: 10px; padding: 1px 8px; font-size: 12px; color: var(--ink);
}
.cardtitle.warn { color: var(--rot); }

.leitsatz {
  background: var(--orange-soft); border: 1px solid #f6d9a8;
  border-left: 4px solid var(--orange);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px;
  font-size: 15px; font-weight: 600;
}
.leitsatz .detail { font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------------------------------------------------------------- Schnellerfassung */
.schnell { display: flex; gap: 8px; margin-bottom: 14px; }
.schnell input {
  flex: 1; min-width: 0; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.schnell input:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.hilfe { font-size: 12px; color: var(--muted); margin: -8px 0 14px; }
.hilfe code { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* ---------------------------------------------------------------- Knöpfe */
button.primary, button.secondary, button.ghost, button.danger {
  border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 600; cursor: pointer;
}
button.primary { background: var(--orange); color: #fff; }
button.secondary { background: #efece7; color: var(--ink); }
button.ghost { background: none; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
button.danger { background: none; color: var(--rot); border: 1px solid #e5c4c0; }
button:disabled { opacity: .5; cursor: default; }
.knopfzeile { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Listen */
.liste { list-style: none; margin: 0; padding: 0; }
.zeile {
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.liste .zeile:first-child { border-top: 0; }

.haken {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px;
  border: 2px solid var(--line); border-radius: 6px; background: var(--card);
  cursor: pointer; padding: 0; position: relative;
}
.haken:hover { border-color: var(--orange); }
.haken.an { background: var(--orange); border-color: var(--orange); }
.haken.an::after {
  content: ''; position: absolute; left: 6px; top: 2px;
  width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* flex-basis 210px: reicht der Platz nicht fuer Text UND Knoepfe, rutschen die
   Knoepfe in die naechste Zeile, statt den Titel auf drei Zeilen zu quetschen. */
.zeile .text { flex: 1 1 210px; min-width: 0; }
.zeile .titel { display: block; word-break: break-word; }
.zeile.erledigt .titel { text-decoration: line-through; color: var(--muted); }
/* align-items: center — sonst zieht der Flex-Container die Chips auf Zeilenhoehe. */
.zeile .meta {
  font-size: 12px; color: var(--muted); margin-top: 4px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
}
.zeile .aktionen { display: flex; gap: 6px; flex: 0 0 auto; margin-left: auto; }
.zeile .aktionen button {
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font-size: 12px; padding: 4px 8px; cursor: pointer;
}
.zeile .aktionen button:hover { border-color: var(--orange); color: var(--ink); }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 10px; line-height: 1.35;
  font-size: 11px; font-weight: 700; background: var(--bg); color: var(--muted);
  white-space: nowrap;
}
.chip.bereich { color: #fff; }
.chip.prio { background: var(--rot-soft); color: var(--rot); }
.chip.ueberfaellig { background: var(--rot-soft); color: var(--rot); }
.chip.ziel { background: var(--orange-soft); color: #8a5200; }
.chip.serie { background: #e9f7ee; color: var(--gruen); }

.leer { color: var(--muted); font-size: 14px; padding: 6px 0; }

/* ---------------------------------------------------------------- Ziele */
.ziel { padding: 12px 0; border-top: 1px solid var(--line); }
.ziel:first-child { border-top: 0; }
.ziel .kopf { display: flex; align-items: baseline; gap: 8px; }
.ziel .kopf .titel { font-weight: 600; flex: 1; min-width: 0; }
.ziel .stand { font-size: 12px; color: var(--muted); white-space: nowrap; }
.balken { height: 6px; background: var(--bg); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.balken > span { display: block; height: 100%; background: var(--orange); border-radius: 3px; }
.balken.voll > span { background: var(--gruen); }

.kette { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------------------------------------------------------------- Briefing */
.briefing { white-space: normal; }
.briefing h1, .briefing h2, .briefing h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 6px; }
.briefing h1 { font-size: 17px; text-transform: none; letter-spacing: 0; margin-top: 0; }
.briefing ul { margin: 0 0 10px; padding-left: 20px; }
.briefing li { margin-bottom: 4px; }
.briefing p { margin: 0 0 10px; }
.briefing blockquote {
  margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--orange);
  background: var(--orange-soft); border-radius: 0 6px 6px 0;
}

/* ---------------------------------------------------------------- Formulare */
.feld { margin-bottom: 12px; }
.feld label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.feld input, .feld select, .feld textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--ink);
}
.feld textarea { min-height: 90px; resize: vertical; }
.feldreihe { display: flex; gap: 10px; flex-wrap: wrap; }
.feldreihe > .feld { flex: 1; min-width: 130px; }

/* ---------------------------------------------------------------- Rest */
.hinweis {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + var(--safe-bottom)); z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 22px;
  font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: 90vw;
}
.hinweis.fehler { background: var(--rot); }

.zaehlerreihe { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.zaehler {
  min-width: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 6px; text-align: center;
}
.zaehler .n { font-size: 20px; font-weight: 700; display: block; font-variant-numeric: tabular-nums; }
/* Das Label darf umbrechen — «ueberfaellig» passt sonst auf keinem iPhone in die Kachel. */
.zaehler .l { font-size: 10px; color: var(--muted); text-transform: uppercase; line-height: 1.2; }
@media (min-width: 420px) { .zaehler { padding: 10px 12px; } .zaehler .l { font-size: 11px; letter-spacing: .04em; } }
.zaehler.warn .n { color: var(--rot); }

.fusszeile { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 0 0; }
.fusszeile button { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 12px; }

/* ---------------------------------------------------------------- Login */
.loginseite { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.loginbox { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 100%; max-width: 340px; }
.loginbox h1 { font-size: 20px; margin: 0 0 4px; }
.loginbox h1 span { color: var(--orange); }
.loginbox p.unter { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.loginbox input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
.loginbox button { width: 100%; }
.loginbox .fehler { color: var(--rot); font-size: 13px; margin-top: 12px; min-height: 18px; }

@media (min-width: 760px) {
  .spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .spalten > * { min-width: 0; }
}
