/* Tickets im Agentur-Panel (app/tickets.js): Liste, Formular, Verlauf. Schlicht wie das übrige Panel. */

/* ---- Eintrag in der Seitenleiste direkt über „Werkzeuge“ (in .top-rechts, gleiche Optik wie die Nachbarn), Zähler wie bei den Nav-Links ---- */
.tickets-knopf { text-decoration: none; }
.tickets-knopf.active { background: var(--text); color: #fff; }
.tickets-knopf.active svg { stroke: var(--gruen); }
.tickets-knopf .nav-count { margin-left: auto; }
body.einrichtung-modus .tickets-knopf { display: none; }
@media (max-width: 820px) { .top .tickets-knopf { display: none; } }
@media (min-width: 821px) {
  body.panel:not(.einrichtung-modus) .tickets-knopf.active { background: var(--text); color: #fff; }
  html.leiste-zu body.panel:not(.einrichtung-modus) .tickets-knopf .nav-count { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; font-size: 10.5px; box-shadow: 0 0 0 2px var(--surface); }
}

/* ---- Status-Pillen ---- */
.tk-status.tk-offen { background: #e8f0ff; color: #1d4ed8; }
.tk-status.tk-in_bearbeitung { background: #fff4d6; color: #8a5a00; }
.tk-status.tk-warten { background: #ffe4d4; color: #a3400c; }
.tk-status.tk-geloest { background: var(--gruen-soft); color: var(--gruen-dunkel); }
.tk-status.tk-geschlossen { background: var(--grau); color: var(--muted); }

/* ---- Liste ---- */
.tk-tabs { margin-top: 26px; }
.tk-tab-zahl { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--grau); font-size: 12px; line-height: 20px; text-align: center; }
.tab.active .tk-tab-zahl { background: var(--bg); }
.tk-liste { margin-top: 16px; background: var(--surface); border-radius: 24px; box-shadow: var(--schatten); overflow: hidden; }
.tk-zeile { display: grid; grid-template-columns: 10px 64px minmax(0, 1fr) 130px 140px 110px; align-items: center; gap: 14px; padding: 14px 22px; color: var(--text); text-decoration: none; border-top: 1px solid var(--line); }
.tk-zeile:first-child { border-top: 0; }
@media (hover: hover) { a.tk-zeile:hover { background: var(--bg); } }
a.tk-zeile:focus-visible { outline: 3px solid var(--gruen); outline-offset: -3px; }
.tk-zeile-kopf { padding-top: 12px; padding-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tk-punkt { width: 9px; height: 9px; border-radius: 50%; }
.tk-zeile.ungelesen .tk-punkt { background: #2f9e1f; box-shadow: 0 0 0 3px var(--gruen-soft); }
.tk-nr { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.tk-betreff { display: flex; flex-direction: column; min-width: 0; }
.tk-betreff b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-zeile.ungelesen .tk-betreff b, .tk-zeile.ungelesen .tk-nr { font-weight: 800; color: var(--text); }
.tk-vorschau { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-kat, .tk-zeit { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-zeile.ungelesen .tk-zeit { color: var(--text); font-weight: 700; }
.tk-hinweis-leer { margin-top: 18px; color: var(--muted); }
.tk-hinweis-leer .text-btn { text-decoration: underline; text-underline-offset: 3px; }
.tk-leer h2 { margin-top: 14px; color: var(--text); font-size: 22px; font-weight: 800; letter-spacing: -0.035em; }
.tk-leer p { max-width: 460px; margin: 8px auto 0; }
.tk-symbol { display: inline-flex; width: 56px; height: 56px; border-radius: 18px; background: var(--text); color: var(--gruen); align-items: center; justify-content: center; }
.tk-symbol svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Formular ---- */
.tk .back { margin-bottom: 14px; }
.tk-form { max-width: 760px; }
.tk-felder { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.tk-felder[disabled] { opacity: .6; }
.tk-form textarea { min-height: 180px; }
.tk-form-fuss { margin-top: 0; }
.tk-ablage { border: 1.5px dashed var(--line-strong); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: background .15s, border-color .15s; }
.tk-ablage-zeile { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tk-ablage-zeile .sub.small { margin: 0; flex: 1 1 220px; }
.tk-zieht .tk-ablage, .tk-antwort.tk-zieht { background: var(--gruen-soft); border-color: var(--gruen-dunkel); }
.tk-datei-knopf { cursor: pointer; flex-direction: row; font-weight: 700; color: var(--text); }
.tk-datei-knopf svg, .tk-senden svg, .tk-geloest svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tk-datei-knopf.aus { opacity: .5; cursor: not-allowed; }
.tk-datei-knopf:focus-within { outline: 3px solid var(--gruen); outline-offset: 2px; }
.tk-anhaenge { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tk-anhaenge[hidden] { display: none; }
.tk-anhang { position: relative; display: flex; align-items: center; gap: 10px; width: 230px; max-width: 100%; padding: 6px 6px 6px 6px; border-radius: 12px; background: var(--bg); }
.tk-anhang img, .tk-anhang-pdf { flex: none; width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; }
.tk-anhang-pdf svg { width: 24px; height: 24px; fill: none; stroke: var(--error); stroke-width: 1.8; stroke-linejoin: round; }
.tk-anhang-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); line-height: 1.35; }
.tk-anhang-text b { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-anhang.laedt img { opacity: .5; }
.tk-anhang.fehler { background: #fde8e6; }
.tk-anhang.fehler .tk-anhang-text span { color: var(--error); }
.tk-anhang-weg { all: unset; cursor: pointer; flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.tk-anhang-weg:hover { background: var(--surface); color: var(--text); }
.tk-anhang-weg:focus-visible { outline: 2px solid var(--text); }
.tk-anhang-weg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tk-demo { display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 0 0 16px; background: #fff4d6; color: #6b4e00; }
.tk-demo svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Detail: Kopf, Verlauf (max. ~760 px), Antwortfeld unten fest ---- */
.tk-detail { max-width: 760px; margin: 0 auto; }
.tk-detail-kopf h1 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.15; overflow-wrap: anywhere; }
.tk-detail-kopf h1 .tk-nr { font-size: .8em; font-weight: 700; }
.tk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.tk-meta .pill:not(.tk-status) { background: var(--surface); }
.tk-bezug-text { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.tk-verlauf { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; padding-bottom: 16px; }
.tk-tag { align-self: center; margin: 8px 0 2px; }
.tk-tag span { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); padding: 4px 12px; border-radius: 8px; box-shadow: var(--schatten); }
.tk-nachricht { display: flex; }
.tk-nachricht.eigen { justify-content: flex-end; }
.tk-blase { max-width: min(600px, 86%); background: var(--surface); border-radius: 16px; padding: 10px 14px 8px; box-shadow: var(--schatten); overflow-wrap: anywhere; }
.tk-nachricht.dfy .tk-blase { border-top-left-radius: 4px; }
.tk-nachricht.eigen .tk-blase { background: var(--gruen-soft); border-top-right-radius: 4px; }
.tk-wer { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.tk-nachricht.dfy .tk-wer { color: var(--text); }
.tk-text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; }
.tk-text a, .tk-system a { color: #1a5fb4; }
.tk-zeit-klein { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 4px; }
.tk-anhang-liste { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tk-bild img { display: block; max-width: 240px; max-height: 200px; border-radius: 10px; object-fit: cover; background: var(--bg); }
.tk-datei { display: flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, .04); border-radius: 10px; padding: 8px 12px; text-decoration: none; max-width: 100%; }
.tk-datei svg { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--error); stroke-width: 1.8; stroke-linejoin: round; }
.tk-datei > span { display: flex; flex-direction: column; min-width: 0; font-size: 12px; color: var(--muted); }
.tk-datei b { font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-system { align-self: center; text-align: center; max-width: 90%; }
.tk-system span { display: inline-block; font-size: 12.5px; color: var(--muted); white-space: pre-wrap; }

.tk-antwort { position: sticky; bottom: 0; z-index: 5; margin: 0 -12px; padding: 12px; background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, .06); }
.tk-antwort .tk-felder { gap: 8px; }
.tk-antwort textarea { min-height: 52px; max-height: 260px; resize: none; background: var(--bg); border-color: transparent; }
.tk-antwort textarea:focus { background: var(--surface); }
.tk-antwort-zeile { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tk-antwort-zeile .btn-small { height: 42px; padding: 0 14px; font-size: 14px; }
.tk-senden { margin-left: auto; }
.tk-antwort .msg:empty { display: none; }
.tk-antwort .msg { margin: 0; }
.tk-unveraenderbar { margin: 0; font-size: 12px; }
.tk-antwort .tk-demo { margin: 0 0 8px; }
.tk-antwort.geschlossen { position: static; margin: 8px 0 0; border-radius: 20px; box-shadow: var(--schatten); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px; color: var(--muted); font-size: 15px; }

/* ---- Handy: Liste als Karten, Verlauf über die ganze Breite, Antwortfeld über der unteren Leiste ---- */
@media (max-width: 820px) {
  .tk-kopf.with-action { flex-direction: column; align-items: stretch; gap: 16px; }
  .tk-kopf .btn-small { align-self: flex-start; }
  .tk-liste { background: none; box-shadow: none; border-radius: 0; overflow: visible; display: flex; flex-direction: column; gap: 10px; }
  .tk-zeile-kopf { display: none; }
  .tk-zeile { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "nr zeit zeit" "betreff betreff betreff" "st kat kat"; gap: 6px 10px; padding: 14px 16px; border: 0; border-radius: 18px; background: var(--surface); box-shadow: var(--schatten); position: relative; }
  .tk-punkt { position: absolute; top: 14px; right: 14px; }
  .tk-zeile.ungelesen .tk-zeit { margin-right: 18px; }
  .tk-nr { grid-area: nr; font-size: 13px; }
  .tk-zeit { grid-area: zeit; justify-self: end; font-size: 12.5px; }
  .tk-betreff { grid-area: betreff; }
  .tk-betreff b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tk-st { grid-area: st; }
  .tk-kat { grid-area: kat; font-size: 13px; }
  .tk-form { padding: 20px 16px; border-radius: 22px; }
  .tk-form .field-row { grid-template-columns: minmax(0, 1fr); }
  .tk-form-fuss { flex-direction: column-reverse; align-items: stretch; }
  .tk-form-fuss .btn-small { width: 100%; }
  .tk-form-fuss .sub { margin-right: 0; text-align: center; }
  .tk-detail-kopf h1 { font-size: 24px; }
  .tk-verlauf { margin-top: 18px; }
  .tk-blase { max-width: 90%; }
  .tk-bild img { max-width: 200px; }
  .tk-antwort { bottom: calc(68px + env(safe-area-inset-bottom)); margin: 0 -16px; padding: 10px 12px; border-radius: 18px 18px 0 0; }
  .tk-antwort-zeile .tk-datei-knopf span, .tk-antwort-zeile .tk-senden span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tk-antwort-zeile .tk-datei-knopf, .tk-antwort-zeile .tk-senden { width: 42px; padding: 0; }
  .tk-unveraenderbar { text-align: center; }
}
