:root {
  --grund: #f4f5f7;
  --karte: #ffffff;
  --text: #1d232b;
  --leise: #66707c;
  --linie: #dde1e6;
  --akzent: #1f6feb;
  --akzent-text: #ffffff;
  --ein: #eef1f5;
  --aus: #dcebff;
  --warn: #b42318;
  --warn-grund: #fdecea;
  --hinweis-grund: #fff6e0;
  --hinweis-linie: #f0c36d;
  --ok: #1a7f37;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #111418;
    --karte: #1a1f25;
    --text: #e6e9ed;
    --leise: #98a2ae;
    --linie: #2c333c;
    --akzent: #4c8dff;
    --ein: #232a32;
    --aus: #1d3557;
    --warn: #ff8a80;
    --warn-grund: #3a1d1d;
    --hinweis-grund: #3a3020;
    --hinweis-linie: #8a6d2f;
    --ok: #56d364;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--grund);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; margin-top: 1.1rem; color: var(--leise); text-transform: uppercase; letter-spacing: .04em; }

.kopf {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem;
  background: var(--karte);
  border-bottom: 1px solid var(--linie);
}
.kopf .marke { font-weight: 700; color: var(--text); }
.kopf .titel { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopf .zurueck { white-space: nowrap; }
.kopf > button { margin-left: auto; }

main { padding: 1rem; max-width: 1200px; margin: 0 auto; display: grid; gap: 1rem; }
main.schmal { max-width: 420px; }
.karte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: 12px;
  padding: 1rem;
  min-width: 0;
}

button {
  font: inherit; cursor: pointer;
  border: 1px solid var(--linie); border-radius: 8px;
  background: var(--karte); color: var(--text);
  padding: .45rem .8rem;
}
button:hover { border-color: var(--akzent); }
button.haupt { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); font-weight: 600; }
button.leise { background: transparent; color: var(--leise); padding: .3rem .6rem; font-size: .9rem; }
button.gefahr:hover { color: var(--warn); border-color: var(--warn); }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--grund);
  border: 1px solid var(--linie); border-radius: 8px; padding: .5rem .6rem;
  width: 100%; min-width: 0;
}
textarea { resize: vertical; }
label { display: grid; gap: .25rem; margin-bottom: .8rem; }

.fehler { color: var(--warn); background: var(--warn-grund); padding: .5rem .7rem; border-radius: 8px; margin: .5rem 0; }
.status { color: var(--leise); font-style: italic; margin: .4rem 0; }
.leer { color: var(--leise); list-style: none; }
.klein { font-size: .85rem; color: var(--leise); }
.hinweis { color: var(--leise); margin-top: 0; }

.netz {
  display: inline-block; min-width: 2.1em; text-align: center;
  font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  padding: .1rem .3rem; border-radius: 5px;
  background: var(--ein); color: var(--leise);
}

/* Übersicht */
@media (min-width: 900px) {
  main.uebersicht { grid-template-columns: 2fr 1fr; align-items: start; }
}
.kontaktliste { list-style: none; margin: 0; padding: 0; }
.kontakt {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "netz name zeit" "netz vorschau zahl";
  column-gap: .7rem; row-gap: .1rem; align-items: center;
  padding: .65rem .4rem; border-bottom: 1px solid var(--linie);
  color: var(--text);
}
.kontakt:hover { background: var(--grund); text-decoration: none; }
.kontakt .netz { grid-area: netz; }
.kontakt .name { grid-area: name; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kontakt .name small { color: var(--leise); font-weight: 400; }
.kontakt .zeit { grid-area: zeit; font-size: .8rem; color: var(--leise); }
.kontakt .vorschau { grid-area: vorschau; color: var(--leise); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kontakt .zahl {
  grid-area: zahl; justify-self: end;
  background: var(--akzent); color: var(--akzent-text);
  border-radius: 999px; font-size: .75rem; font-weight: 700; padding: .05rem .5rem;
}
.kontakt.ungelesen .name, .kontakt.ungelesen .vorschau { font-weight: 700; color: var(--text); }
.kontakt.ungelesen { border-left: 3px solid var(--akzent); }
.netzgruppe { margin-bottom: .8rem; }
.kanaele { margin: .3rem 0 0; padding-left: 1.2rem; }

/* Gespräch */
@media (min-width: 900px) {
  main.kontaktseite { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); align-items: start; }
  .steckbrief { position: sticky; top: 4rem; max-height: calc(100vh - 5rem); overflow: auto; }
}
.verlauf {
  display: flex; flex-direction: column; gap: .4rem;
  max-height: 55vh; overflow-y: auto; padding: .2rem .2rem .6rem;
}
.blase {
  max-width: 85%; padding: .45rem .7rem; border-radius: 12px;
  background: var(--ein); overflow-wrap: anywhere;
}
.blase.aus { align-self: flex-end; background: var(--aus); }
.blase .zeit { display: block; font-size: .72rem; color: var(--leise); text-align: right; }
.blase .ort { display: block; font-size: .72rem; color: var(--leise); }
.blase:target { outline: 2px solid var(--hinweis-linie); }

.stichwoerter { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0 .4rem; align-items: center; }
.stichwort { border-radius: 999px; background: var(--grund); }
.stichwort:hover { background: var(--aus); }
.eigene-richtung { display: flex; gap: .4rem; margin: .4rem 0; }
.eigene-richtung button { white-space: nowrap; }
.entwurf textarea { margin-top: .4rem; }
.sendezeile { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-top: .4rem; }
.sendezeile .ziel { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .2rem .8rem; color: var(--leise); font-size: .9rem; }
.sendezeile .ziel label { display: inline-flex; align-items: center; gap: .3rem; margin: 0; }
.sendezeile .ziel input { width: auto; }
.sendezeile .haupt { margin-left: auto; min-width: 7rem; }

/* Steckbrief */
.dieselbe {
  background: var(--hinweis-grund); border: 1px solid var(--hinweis-linie);
  border-radius: 10px; padding: .6rem .8rem; margin-bottom: .8rem;
}
.dieselbe p { margin: 0 0 .3rem; font-weight: 600; }
.dieselbe ul { margin: 0 0 .5rem; padding-left: 1.1rem; font-size: .9rem; }
.fakten { margin: 0; }
.fakten dt { font-weight: 600; margin-top: .5rem; font-size: .9rem; }
.fakten dd { margin: .25rem 0 .4rem; }
.fakt form { display: flex; gap: .3rem; }
.fakt.vorgeschlagen input { border-style: dashed; }
.faktfuss { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; font-size: .8rem; margin-top: .2rem; }
.marke-vorschlag { color: var(--hinweis-linie); font-weight: 600; }
.marke-ok { color: var(--ok); font-weight: 600; }
.fakt-neu { display: grid; grid-template-columns: auto 1fr auto; gap: .3rem; margin: .7rem 0 .4rem; }
.notizen { display: grid; gap: .4rem; justify-items: start; }
.sichtungen { list-style: none; padding: 0; margin: 0; font-size: .88rem; overflow-wrap: anywhere; }
.sichtungen li { padding: .35rem 0; border-bottom: 1px solid var(--linie); }
.sichtungen .klein { display: block; }

/* Kanal */
.kanalseite .verlauf { max-height: none; }
.zeile { overflow-wrap: anywhere; padding: .15rem 0; }
.zeile .zeit { color: var(--leise); font-size: .8rem; margin-right: .3rem; }
.zeile .nick { font-weight: 600; margin-right: .3rem; }
.zeile.genannt { background: var(--hinweis-grund); border-radius: 6px; padding: .15rem .3rem; }

.login { display: grid; }
