@import url("/fonts/archivo/500.css");
@import url("/fonts/archivo/700.css");
@import url("/fonts/ibm-plex-sans/400.css");
@import url("/fonts/ibm-plex-sans/500.css");
@import url("/fonts/ibm-plex-sans/600.css");
@import url("/fonts/ibm-plex-mono/400.css");

/* Layout: Kopfzeile mit Logo und Navigation, darunter Liste | Detail bzw. einspaltige Formulare */
:root {
  --bg: #f4f6f7; --surface: #ffffff; --sunken: #eaeef0; --line: #d6dcdf; --fg: #1f2523; --muted: #5d6865; --logo-ink: #292d2a;
  --accent: #0a76a6; --accent-fg: #ffffff; --accent-soft: #dff1fa; --green: #4d9a2a;
  --crit: #b3261e; --crit-soft: #fbe4e2; --high: #b45d00; --high-soft: #fdebd6; --mid: #2f5fa7; --mid-soft: #e0e9f7; --low: #5b6b73; --low-soft: #e6eaec;
  --ok: #2e7d4f; --ok-soft: #dcf0e3; --wait: #7a5aa6; --wait-soft: #ece4f6; --note: #8a6d00; --note-soft: #fdf5d8;
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615; --surface: #1a201e; --sunken: #222a27; --line: #323c38; --fg: #e6ebe9; --muted: #9aa6a2; --logo-ink: #eef2f0;
    --accent: #4cc0ef; --accent-fg: #06222f; --accent-soft: #16323f; --green: #8fd36a;
    --crit: #ff8a80; --crit-soft: #3d1c1a; --high: #f2a55a; --high-soft: #3a2a17; --mid: #8fb3ec; --mid-soft: #1c2a42; --low: #93a6ae; --low-soft: #223137;
    --ok: #7fd3a0; --ok-soft: #173326; --wait: #c3a8ea; --wait-soft: #2b2240; --note: #e8c95a; --note-soft: #2f2a14;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--f-body); padding-inline: 16px; padding-block: 0 48px; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; letter-spacing: -.01em; font-weight: 700; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1180px; margin: 0 auto; }
.narrow { max-width: 760px; margin: 0 auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hint { font-size: 13px; color: var(--muted); }
.mono { font-family: var(--f-mono); }

/* Kopfzeile */
header.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding-block: 18px 14px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.logowrap { color: var(--logo-ink); display: flex; align-items: center; padding-right: 14px; border-right: 1px solid var(--line); }
.logo { height: 40px; width: auto; display: block; }
.brand .name { font-family: var(--f-display); font-weight: 700; font-size: 18px; line-height: 1.2; }
.brand .name small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 12.5px; color: var(--muted); }
nav.main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
nav.main a, nav.main button { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: var(--r); font-size: 14px; background: none; border: 0; cursor: pointer; }
nav.main a:hover, nav.main button:hover { background: var(--sunken); color: var(--fg); }
nav.main a[aria-current="page"] { color: var(--fg); font-weight: 600; background: var(--sunken); }
nav.main .who { color: var(--muted); font-size: 13px; padding-inline: 8px 2px; }
nav.main form { margin: 0; }
@media (max-width: 560px) { .logo { height: 30px; } .logowrap { padding-right: 10px; } .brand .name small { display: none; } }

/* Bausteine */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.pad { padding: 20px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: var(--r); cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; color: var(--fg); line-height: 1.3; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--crit); border-color: var(--crit); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; font-weight: 400; }
.flash { padding: 10px 14px; border-radius: var(--r); background: var(--accent-soft); margin-bottom: 18px; }
.alert { padding: 10px 14px; border-radius: var(--r); background: var(--crit-soft); color: var(--crit); }
.invite { padding: 14px; border-radius: var(--r); background: var(--note-soft); margin-bottom: 18px; display: grid; gap: 8px; }
.invite code { font-family: var(--f-mono); font-size: 13px; overflow-wrap: anywhere; background: var(--surface); padding: 6px 8px; border-radius: 4px; }

/* Formulare */
form.stack { display: grid; gap: 16px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; min-width: 0; }
legend { font-family: var(--f-display); font-weight: 500; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; padding: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > label, .field > .label { font-size: 13.5px; font-weight: 500; }
.field input, .field select, .field textarea { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); width: 100%; }
.field textarea { min-height: 130px; resize: vertical; }
.req { color: var(--crit); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.prio-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.prio-pick label { position: relative; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; cursor: pointer; display: grid; gap: 2px; font-size: 12.5px; color: var(--muted); }
.prio-pick label b { font-size: 14px; color: var(--fg); }
.prio-pick input { position: absolute; top: 8px; left: 8px; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.prio-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.prio-pick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.formfoot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.auth { max-width: 420px; margin: 6vh auto 0; }
.auth h1 { font-size: 24px; margin-bottom: 6px; }

/* Ticketliste */
.listhead { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.listhead h1 { font-size: 24px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 380px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; color: var(--muted); text-decoration: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip:hover { border-color: var(--muted); }
.chip[aria-current="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.toolbar form { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 300px; justify-content: flex-end; }
.toolbar input[type=search], .toolbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); min-width: 0; flex: 1 1 160px; max-width: 280px; }
.tlist { list-style: none; margin: 0; padding: 0; }
.trow { display: grid; grid-template-columns: 4px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.trow a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 14px; text-decoration: none; color: inherit; align-items: center; }
.trow a:hover { background: var(--sunken); }
.trow .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .sub { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; color: var(--muted); grid-column: 1; }
.trow .side { grid-column: 2; grid-row: 1 / span 2; display: grid; justify-items: end; gap: 4px; font-size: 12.5px; color: var(--muted); text-align: right; }
@media (max-width: 560px) { .trow a { grid-template-columns: minmax(0, 1fr); } .trow .side { grid-column: 1; grid-row: auto; justify-items: start; text-align: left; display: flex; gap: 10px; flex-wrap: wrap; } }
.stripe { background: var(--low); }
.p-kritisch.stripe { background: var(--crit); } .p-hoch.stripe { background: var(--high); } .p-mittel.stripe { background: var(--mid); }
.nr { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); }
.when { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--fg); font-family: var(--f-display); font-size: 17px; margin-bottom: 4px; }

.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.s-neu { background: var(--mid-soft); color: var(--mid); }
.s-bearbeitung { background: var(--high-soft); color: var(--high); }
.s-warten { background: var(--wait-soft); color: var(--wait); }
.s-geloest { background: var(--ok-soft); color: var(--ok); }
.s-geschlossen { background: var(--low-soft); color: var(--low); }
.prio { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.prio.p-kritisch { color: var(--crit); } .prio.p-hoch { color: var(--high); } .prio.p-mittel { color: var(--mid); } .prio.p-niedrig { color: var(--low); }

/* Ticketdetail */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
.back { font-size: 14px; text-decoration: none; display: inline-block; margin-bottom: 12px; }
.dhead { display: grid; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.dhead h1 { font-size: 24px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: var(--muted); }
.desc { padding-block: 16px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
.facts { display: grid; gap: 12px; margin: 0; }
.facts div { display: grid; gap: 1px; }
.facts dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.side-panel { display: grid; gap: 16px; }
.side-panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.side-panel form .field select { background: var(--surface); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.msg { display: grid; gap: 4px; max-width: 76ch; }
.msg .mh { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.msg .mh b { color: var(--fg); font-weight: 600; }
.msg .tag { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.msg .mb { padding: 10px 12px; border-radius: var(--r); background: var(--sunken); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.staff .mb { background: var(--accent-soft); }
.msg.note .mb { background: var(--note-soft); border: 1px dashed var(--note); }
.msg.note .tag { color: var(--note); }
.msg.sys { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg.sys::before { content: ""; width: 18px; height: 1px; background: var(--line); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r); padding: 4px 8px; font-size: 13px; text-decoration: none; color: var(--fg); background: var(--surface); max-width: 100%; }
.file img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply { display: grid; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.reply textarea { min-height: 110px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); resize: vertical; width: 100%; }
.reply.internal textarea { background: var(--note-soft); border-color: var(--note); }
.reply select { padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.filepick { font-size: 13px; color: var(--muted); }
.filepick input { font-size: 13px; max-width: 100%; }
.section-title { font-size: 15px; margin: 22px 0 12px; }

/* Verwaltung */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; align-items: start; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.muted-row td { color: var(--muted); }
details.edit summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; }
details.edit summary::-webkit-details-marker { display: none; }
details.edit[open] { margin-top: 6px; }
details.edit form { display: grid; gap: 10px; padding: 12px; background: var(--sunken); border-radius: var(--r); margin-top: 8px; min-width: 260px; }
details.edit .field input, details.edit .field select { background: var(--surface); }
.badge { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.badge.off { background: var(--crit-soft); color: var(--crit); }
.badge.pending { background: var(--note-soft); color: var(--note); }

@media (prefers-reduced-motion: no-preference) { .trow a, .btn, .chip { transition: background .12s, border-color .12s; } }
.side-panel p { margin: 0; }
