/* SAPify Ticketing — SAPify-Solutions Design (wie Basis-Checklisten und Portal): gleiche Variablen, Hell/Dunkel */
:root {
  --sap-blue: #0a6ed1;
  --sap-blue-dark: #0854a0;
  --sap-dark: #32363a;
  --sap-navy: #1c2b3a;
  --bg: #f5f6f7;
  --border: #d9d9d9;
  --hot: #bb0000;
  --high: #e9730c;
  --ok: #107e3e;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 6px rgba(0,0,0,0.04);
  --surface: #ffffff;
  --surface-alt: #fafcff;
  --surface-hover: #f0f2f4;
  --table-header-bg: #f7f8f9;
  --text: #1a1a1a;
  --text-muted: #6a6d70;
  --ok-bg: #e5f5e8; --ok-fg: #0d6b32;
  --nok-bg: #fde8e8; --nok-fg: #a30000;
  --na-bg: #ececec; --na-fg: #595959;
}
[data-theme="dark"] {
  --sap-dark: #e4e7ea;
  --bg: #14171a;
  --border: #3a4048;
  --surface: #20242a;
  --surface-alt: #262b32;
  --surface-hover: #2b313a;
  --table-header-bg: #262b32;
  --text: #e4e7ea;
  --text-muted: #9aa3ad;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 6px rgba(0,0,0,0.25);
  --ok-bg: #16331f; --ok-fg: #6fd48f;
  --nok-bg: #3b1b1d; --nok-fg: #ff8e8e;
  --na-bg: #2f343b; --na-fg: #aab2bb;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "72", "Segoe UI", Arial, sans-serif;
  margin: 0; background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1 0 auto; padding: 32px 0 48px; }
.page-container { --seitenrand: clamp(16px, 2.2vw, 40px); width: 100%; max-width: 1760px; margin: 0 auto; padding: 0 var(--seitenrand); }
[hidden] { display: none !important; }

/* Header */
header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 20px; padding-top: 14px; padding-bottom: 14px; }
header .logo { height: 40px; width: auto; display: block; }
.wordmark { font-weight: 800; font-size: 24px; color: var(--sap-blue); letter-spacing: -0.01em; }
header .header-text { border-left: 1px solid var(--border); padding-left: 20px; }
header h1 { margin: 0; font-size: 19px; font-weight: 700; color: var(--sap-dark); }
.subtitle { margin: 2px 0 0; opacity: 0.65; font-size: 12.5px; }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--text-muted); white-space: nowrap; }

/* Tabs */
nav.tabs { background: var(--surface); border-bottom: 1px solid var(--border); }
.tabs-inner { display: flex; flex-wrap: wrap; }
.tab-btn { border: none; background: none; padding: 14px 22px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500; color: var(--sap-dark); border-bottom: 3px solid transparent; transition: color .15s ease, border-color .15s ease; }
.tab-btn:hover { color: var(--sap-blue); }
.tab-btn.active { border-bottom-color: var(--sap-blue); color: var(--sap-blue); font-weight: 700; }
.tab-btn:focus-visible { outline: 2px solid var(--sap-blue); outline-offset: -3px; border-radius: 2px; }
h2 { color: var(--sap-dark); font-size: 20px; font-weight: 700; margin: 0 0 16px; }
h3 { color: var(--sap-dark); font-size: 15px; margin: 0 0 10px; }
h4 { color: var(--sap-dark); font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .03em; }
.view { animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Buttons / Inputs */
button, .btn { font: inherit; }
.btn { background: var(--sap-blue); color: #fff; border: 1px solid var(--sap-blue); border-radius: 6px; padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--sap-blue-dark); border-color: var(--sap-blue-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border); }
.btn-danger { background: var(--surface); color: var(--hot); border: 1px solid var(--border); }
.btn-danger:hover { background: var(--nok-bg); border-color: var(--hot); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-icon { background: transparent; color: var(--sap-dark); border: none; font-size: 18px; line-height: 1; padding: 6px; cursor: pointer; border-radius: 6px; }
.btn-icon:hover { background: var(--surface-hover); }
.link { background: none; border: none; color: var(--sap-blue); cursor: pointer; padding: 0; font-size: 12.5px; }
.link:hover { text-decoration: underline; }
input, select, textarea { font: inherit; font-size: 13.5px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 9px 11px; width: 100%; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: var(--surface-alt); }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sap-blue); outline-offset: -1px; border-color: var(--sap-blue); }
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--sap-dark); margin-bottom: 5px; }
.req::after { content: " *"; color: var(--hot); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.hint { color: var(--text-muted); font-size: 12.5px; }
.err { color: var(--hot); font-size: 13px; margin-top: 8px; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; background: var(--surface); }
.tbl-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
th { background: var(--surface-hover); color: var(--sap-dark); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; user-select: none; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: center; white-space: nowrap; }
.sub { display: block; color: var(--text-muted); font-size: 12px; margin-top: 3px; font-family: Consolas, "Courier New", monospace; }
.muted { color: var(--text-muted); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; font-size: 13px; margin-bottom: 14px; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* Status */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border); }
.ico { white-space: nowrap; color: var(--text-muted); font-size: 12.5px; }

/* Summary */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.tile .v { font-size: 26px; font-weight: 700; color: var(--sap-dark); }
.tile .l { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 700; }
.tile.t-ok .v { color: var(--ok-fg); } .tile.t-nok .v { color: var(--nok-fg); }
.bar { height: 8px; background: var(--surface-hover); border-radius: 4px; overflow: hidden; margin-top: 8px; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; background: var(--sap-blue); width: 0; transition: width .25s; }
.bar.sm { width: 120px; margin-top: 0; }

/* Bilder / Kommentare */
.comment { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); padding: 10px 12px; margin-bottom: 10px; }
.comment .meta { display: flex; gap: 8px; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; align-items: center; }
.comment .meta b { color: var(--sap-dark); }
.comment .txt { white-space: pre-wrap; word-break: break-word; font-size: 13px; }

/* Modal / Toast / Lightbox */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.4); width: 100%; max-width: 640px; padding: 22px; }
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--sap-navy); color: #fff; padding: 11px 16px; border-radius: 6px; box-shadow: var(--shadow); z-index: 100; font-size: 13.5px; max-width: 420px; }
.toast.bad { background: var(--hot); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 120; display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 4px; }

/* Footer */
footer.site-footer { flex-shrink: 0; background: var(--surface); border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted); }
footer .footer-inner { display: flex; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
footer .wordmark { font-size: 16px; }
footer img { height: 22px; }

@media (max-width: 980px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; }
}


/* Hilfsklassen */
.flush { margin: 0 !important; }
.w150 { width: 150px; } .w200 { width: 200px; } .w300 { width: 300px; max-width: 100%; }
.filter-row { margin-bottom: 16px; }
.chk-lbl { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; cursor: pointer; }
.chk-lbl input { width: auto; }
.pad { padding: 16px 20px; }
.mt { margin-top: 18px; }
.narrow { max-width: 440px; }

.badge.big { font-size: 12px; padding: 3px 10px; vertical-align: middle; }
.note-box { background: var(--surface-hover); border-left: 4px solid var(--sap-blue); border-radius: 4px; padding: 10px 14px; margin: 10px 0; font-size: 13.5px; }
.chip { display: inline-block; font-size: 12px; background: var(--surface-hover); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; margin: 2px 4px 2px 0; }
.panel.flat { box-shadow: none; margin-top: 12px; }

/* Neues Logo (helle Schrift, Fassung für dunklen Grund): steht auf einem dunkelblauen Feld,
   damit es im hellen wie im dunklen Design in den Originalfarben erscheint. */
header .logo { box-sizing: content-box; height: 24px; padding: 8px 12px; background: #1d2d3e; border-radius: 8px; }
.footer-logo { box-sizing: content-box; height: 16px; width: auto; display: block; padding: 5px 9px; background: #1d2d3e; border-radius: 6px; }


/* Rücksprung ins SAPify Portal (alle Apps) — in jeder App oben in der Kopfzeile */
.btn-portal { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn-portal:hover { background: var(--surface-hover); border-color: var(--sap-blue); color: var(--sap-blue); }

/* Hausschrift Montserrat (Regular / Semibold / Bold) — selbst gehostet (SIL Open Font License),
   weil die Content-Security-Policy keine fremden Quellen zulässt. */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/montserrat-400.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("assets/fonts/montserrat-600.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/montserrat-700.woff2") format("woff2"); }
body, button, input, select, textarea { font-family: "Montserrat", "Segoe UI", Arial, sans-serif; }

/* ============================================================================
   Einheitliches Erscheinungsbild aller SAPify-Apps (Vorbild: SAPify Portal):
   Kopf- und Fusszeile dunkelblau (hell: #354a5f, dunkel: #1d2d3e), helles Logo
   direkt auf der Leiste, weisse Schrift. Aufklappmenüs behalten die normalen Farben.
   ============================================================================ */
:root { --kopf-bg: #354a5f; --kopf-fg: #ffffff; }
[data-theme="dark"] { --kopf-bg: #1d2d3e; }
header { background: var(--kopf-bg); color: var(--kopf-fg); border-bottom: none; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.header-inner { padding-top: 9px; padding-bottom: 9px; min-height: 52px; gap: 16px; }
header .logo { box-sizing: border-box; height: 28px; padding: 0; background: none; border-radius: 0; }
header .wordmark { color: #fff; font-size: 19px; }
header .header-text { border-left: 1px solid rgba(255,255,255,.28); padding-left: 16px; }
header h1 { color: #fff; font-size: 16px; }
header .subtitle { color: rgba(255,255,255,.72); opacity: 1; font-size: 12px; }
.header-user { color: #fff; }
header .btn-icon { color: #fff; }
header .btn-icon:hover { background: rgba(255,255,255,.14); }
header .btn-portal, header .header-user > .btn-secondary, header .header-user > button.btn { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.38); }
header .btn-portal:hover, header .header-user > .btn-secondary:hover, header .header-user > button.btn:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.6); color: #fff; }
footer.site-footer, .site-footer { background: var(--kopf-bg); color: rgba(255,255,255,.78); border-top: none; }
.site-footer .footer-inner { padding-top: 13px; padding-bottom: 13px; }
.footer-logo { box-sizing: border-box; height: 22px; padding: 0; background: none; border-radius: 0; }
.site-footer a { color: #8fd3f4; }

/* ============================================================================
   Handy (Hochformat, bis 640 px): Die Seite wird nie breiter als der Bildschirm.
   Kopfzeile zweizeilig, Reiter als wischbare Leiste, Ticketlisten als gestapelte Karten,
   übrige Tabellen scrollen in ihrem Rahmen. Ab 641 px gilt unverändert das Bisherige.
   ============================================================================ */
@media (max-width: 640px) {
  main { padding: 20px 0 32px; }
  h2 { font-size: 18px; overflow-wrap: break-word; }
  .panel, .comment, .confirm-banner, .note-box, td, dd { overflow-wrap: break-word; }

  /* Kopfzeile: oben Logo und Titel, darunter Portal-Link, Design, Name und Abmelden */
  .header-inner { gap: 8px 12px; min-height: 0; }
  header .logo { height: 22px; flex: 0 0 auto; }
  header .wordmark { font-size: 17px; }
  header .header-text { flex: 1 1 0; min-width: 0; padding-left: 12px; }
  header h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  header .subtitle { display: none; }
  .header-user { flex: 1 1 100%; margin-left: 0; gap: 8px; min-width: 0; }
  .header-user #who { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; }
  .header-user .btn-portal { margin-right: auto; }
  header .btn-portal, header .header-user > .btn-sm { padding: 7px 12px; }

  /* Reiter: eine Zeile, seitlich wischbar (statt vier umbrochener Zeilen) */
  .tabs-inner { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs-inner::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 0 0 auto; padding: 12px 12px; font-size: 13.5px; white-space: nowrap; }

  /* Bedienelemente: fingertauglich; 16 px Schrift verhindert das Hineinzoomen beim Antippen */
  input, select, textarea { font-size: 16px; }
  .btn-sm { padding: 8px 12px; }
  .btn-icon { padding: 8px 10px; }
  .view > .row { margin-bottom: 10px; }
  .view > .row > div { min-width: 0; }
  .view > .row > .spacer { flex: 1 1 100%; height: 0; }
  .filter-row > input, .filter-row > select, .w150, .w200, .w300 { width: 100%; }
  .panel { padding: 14px; }
  .grid { gap: 10px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .grid-3 input { padding-left: 9px; padding-right: 9px; }
  .narrow { max-width: none; }
  .tiles { gap: 10px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dd { margin-bottom: 8px; }

  /* Breite Tabellen scrollen in ihrem Rahmen, nicht die Seite */
  th, td { padding: 10px 12px; }
  .pad { padding: 14px; }
  .pad table { table-layout: fixed; }
  .pad th, .pad td { padding: 8px 6px; overflow-wrap: anywhere; }
  .chip { overflow-wrap: anywhere; }

  .sub { overflow-wrap: break-word; }
  .comment .meta { flex-wrap: wrap; }

  /* Dialoge, Meldungen, Fusszeile */
  .overlay { padding: 12px; }
  .modal { padding: 16px; }
  .modal .row.end .btn { flex: 1 1 auto; text-align: center; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .lightbox { padding: 12px; }
  footer .footer-inner { flex-wrap: wrap; gap: 6px 12px; }
}

/* ============================================================================
   SAPify Ticketing — eigene Bausteine
   ============================================================================ */
:root {
  --p1-bg: #bb0000; --p1-fg: #ffffff;
  --p2-bg: #e9730c; --p2-fg: #ffffff;
  --p3-bg: #f2d249; --p3-fg: #4a3b00;
  --p4-bg: #dfe6ee; --p4-fg: #354a5f;
  --warn-bg: #fff3d6; --warn-fg: #8a5a00;
  --info-bg: #e3f0fc; --info-fg: #0854a0;
  --intern-bg: #fff8e1; --intern-rand: #e0b100;
  --agent-bg: #eef5fd;
}
[data-theme="dark"] {
  --p3-bg: #8a7200; --p3-fg: #fff6cf;
  --p4-bg: #2f3b48; --p4-fg: #c9d6e3;
  --warn-bg: #3d3113; --warn-fg: #ffcf70;
  --info-bg: #17304a; --info-fg: #8fc4f7;
  --intern-bg: #33290c; --intern-rand: #b58f00;
  --agent-bg: #1c2a3a;
}
a { color: var(--sap-blue); }
:where([data-theme="dark"]) a { color: #6fb6f5; }   /* :where = ohne Gewicht, damit .btn, .tzeile usw. ihre Farbe behalten */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.klein { font-size: 12.5px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.leer { text-align: center; color: var(--text-muted); padding: 34px 16px; font-size: 13.5px; }
.kopfzeile { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 16px; }
.kopfzeile h2 { margin: 0; }
.kopfzeile .spacer { flex: 1; }
.zurueck { display: inline-block; margin-bottom: 10px; font-size: 13px; text-decoration: none; }
.zurueck:hover { text-decoration: underline; }

/* «Allgemeine Frage an SAPify (ohne Ticket)» – dezenter Link in die Inbox des Portals */
.frage-sapify { margin: 14px 0 0; font-size: 12.5px; color: var(--text-muted); }
.frage-sapify a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.frage-sapify a:hover { color: var(--text); }
.seite .frage-sapify { margin: 12px 2px 0; }
/* Mitteilungen (zentrale Inbox des Portals) */
.mitteilungen { position: relative; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.mitteilungen svg { width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mitteilungen .zahl { position: absolute; top: -2px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #e9730c; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }

/* Abzeichen: Priorität, Status, Typ */
.prio { display: inline-block; min-width: 30px; text-align: center; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; }
.prio.p1 { background: var(--p1-bg); color: var(--p1-fg); } .prio.p2 { background: var(--p2-bg); color: var(--p2-fg); }
.prio.p3 { background: var(--p3-bg); color: var(--p3-fg); } .prio.p4 { background: var(--p4-bg); color: var(--p4-fg); }
.status { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 10px; background: var(--na-bg); color: var(--na-fg); white-space: nowrap; }
.status.s-new, .status.s-assigned { background: var(--info-bg); color: var(--info-fg); }
.status.s-in_progress { background: rgba(10,110,209,.18); color: var(--sap-blue); }
[data-theme="dark"] .status.s-in_progress { color: #8fc4f7; }
.status.s-pending_customer, .status.s-pending_vendor { background: var(--warn-bg); color: var(--warn-fg); }
.status.s-resolved { background: var(--ok-bg); color: var(--ok-fg); }
.typ { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.marke { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 7px; border-radius: 4px; background: var(--nok-bg); color: var(--nok-fg); vertical-align: middle; }
.marke.gelb { background: var(--warn-bg); color: var(--warn-fg); }
.marke.blau { background: var(--info-bg); color: var(--info-fg); }

/* SLA */
.sla { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; color: var(--text-muted); }
.sla::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.sla.z-warnung::before { background: var(--high); } .sla.z-verletzt::before { background: var(--hot); }
.sla.z-pausiert::before { background: var(--text-muted); } .sla.z-entfaellt::before { background: var(--border); }
.sla.z-verletzt { color: var(--nok-fg); font-weight: 600; }
.sla-box { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; }
.sla-box .zeile { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.sla-box .zeile b { color: var(--sap-dark); }
.sla-box .bar { margin-top: 6px; }
.bar.z-warnung > span { background: var(--high); } .bar.z-verletzt > span { background: var(--hot); }
.bar.z-erfuellt > span { background: var(--ok); } .bar.z-pausiert > span { background: var(--text-muted); }

/* Ticketliste: am PC Zeilen mit Spalten, am Handy je Ticket eine Karte */
.tliste { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); overflow: hidden; }
.tzeile { display: grid; grid-template-columns: 138px minmax(0, 1fr) 190px 54px 200px 170px 112px; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13px; }
.tliste.kunde .tzeile { grid-template-columns: 138px minmax(0, 1fr) 220px 54px 130px; }
.tzeile:last-child { border-bottom: none; }
a.tzeile:hover { background: var(--surface-hover); }
.tzeile.kopf { background: var(--surface-hover); color: var(--sap-dark); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.tzeile .nr { font-weight: 700; color: var(--sap-blue); white-space: nowrap; }
[data-theme="dark"] .tzeile .nr { color: #6fb6f5; }
.tzeile .betreff { min-width: 0; }
.tzeile .betreff b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tzeile .betreff > span { display: block; color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tzeile .team { min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tzeile .team span { display: block; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.tzeile .zeit { color: var(--text-muted); font-size: 12px; white-space: nowrap; text-align: right; }
.queues { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.queue { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 16px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.queue:hover { border-color: var(--sap-blue); color: var(--sap-blue); }
.queue.aktiv { background: var(--sap-blue); border-color: var(--sap-blue); color: #fff; }
.filter { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.filter.kunde { grid-template-columns: minmax(180px, 2fr) minmax(140px, 1fr) minmax(140px, 1fr); max-width: 760px; }

/* Ticket-Detail */
.ticket { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.ticket-kopf { margin-bottom: 14px; }
.ticket-kopf .zeile1 { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.ticket-kopf .zeile1 .nr { font-weight: 700; color: var(--sap-dark); font-size: 14px; }
.ticket-kopf h2 { margin: 0; overflow-wrap: anywhere; }
.aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }
.hinweis { border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; background: var(--info-bg); color: var(--info-fg); }
.hinweis.gelb { background: var(--warn-bg); color: var(--warn-fg); }
.hinweis.gruen { background: var(--ok-bg); color: var(--ok-fg); }
.hinweis.rot { background: var(--nok-bg); color: var(--nok-fg); }
.hinweis .row { margin-top: 8px; }
.beschreibung { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.5; }
.angaben { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr); gap: 5px 12px; font-size: 13px; margin: 12px 0 0; }
.angaben dt { color: var(--text-muted); font-weight: 600; }
.angaben dd { margin: 0; overflow-wrap: anywhere; }
.seite .angaben { grid-template-columns: 118px minmax(0, 1fr); margin: 0; }
.seite .panel { padding: 14px; }
.seite h4 { margin-bottom: 10px; }
.seite select, .seite input { padding: 6px 8px; font-size: 13px; }
.seite .feldzeile { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 6px 12px; align-items: center; font-size: 13px; margin-bottom: 7px; }
.seite .feldzeile > span { color: var(--text-muted); font-weight: 600; }
.verweis { display: block; padding: 7px 0; font-size: 13px; text-decoration: none; color: var(--text); flex: 1; min-width: 0; }
.verweis b { color: var(--sap-blue); }
[data-theme="dark"] .verweis b { color: #6fb6f5; }
.verweis > span:not(.status) { display: block; color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verweis-zeile { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.verweis-zeile:last-child { border-bottom: none; }

/* Verlauf: öffentliche Antworten und interne Notizen klar getrennt */
.nachricht { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 11px 14px; margin-bottom: 10px; }
.nachricht.agent { background: var(--agent-bg); }
.nachricht.intern { background: var(--intern-bg); border-color: var(--intern-rand); border-left-width: 4px; }
.nachricht.system { background: var(--surface-hover); font-size: 12.5px; }
.nachricht .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.nachricht .meta b { color: var(--sap-dark); font-size: 13px; }
.nachricht .txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.5; }
.dateien { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dateien:empty { display: none; }
.datei { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); padding: 5px 10px; font-size: 12.5px; cursor: pointer; text-decoration: none; }
.datei:hover { border-color: var(--sap-blue); }
.datei .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datei .gr { color: var(--text-muted); white-space: nowrap; }
.datei .x { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 4px; }
.datei .x:hover { color: var(--hot); }
.datei.bild { padding: 0; overflow: hidden; }
.datei.bild img { display: block; width: 112px; height: 82px; object-fit: cover; }
.verfassen { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 12px 14px; }
.verfassen.intern { background: var(--intern-bg); border-color: var(--intern-rand); }
.umschalter { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.umschalter button { border: none; background: var(--surface); color: var(--text); padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.umschalter button + button { border-left: 1px solid var(--border); }
.umschalter button.aktiv { background: var(--sap-blue); color: #fff; }
.umschalter button.aktiv.intern { background: var(--intern-rand); color: #1a1a1a; }
.verfassen textarea { min-height: 110px; }
.verfassen .optionen { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.verfassen .optionen select { width: auto; max-width: 240px; padding: 6px 8px; font-size: 13px; }
.verfassen .senden { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 10px; }
.warnzeile { font-size: 12.5px; font-weight: 600; color: var(--warn-fg); margin-bottom: 8px; }

/* Neues Ticket (Kundenportal): Schritte, Kacheln, Vorschläge */
.schritte { display: flex; gap: 6px; margin-bottom: 18px; font-size: 12.5px; color: var(--text-muted); flex-wrap: wrap; }
.schritte span { padding: 4px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); white-space: nowrap; }
.schritte span.aktiv { background: var(--sap-blue); border-color: var(--sap-blue); color: #fff; font-weight: 600; }
.schritte span.fertig { color: var(--ok-fg); border-color: var(--ok-fg); }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 14px; }
.kacheln.gross { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); max-width: 860px; }
.kachel { text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; cursor: pointer; display: block; width: 100%; transition: border-color .15s, transform .15s; }
.kachel:hover, .kachel:focus-visible { border-color: var(--sap-blue); transform: translateY(-2px); outline: none; }
.kachel .icon { font-size: 28px; line-height: 1; margin-bottom: 10px; display: block; }
.kachel b { display: block; font-size: 15px; color: var(--sap-dark); margin-bottom: 4px; }
.kachel span.text { display: block; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.kacheln.gross .kachel { padding: 24px; }
.kacheln.gross .kachel b { font-size: 19px; }
.kacheln.gross .kachel .icon { font-size: 36px; }
.gruppe-titel { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 18px 0 8px; }
.erfassen { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.wahl { display: grid; gap: 8px; }
.wahl label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-weight: 500; font-size: 13.5px; cursor: pointer; }
.wahl label:hover { border-color: var(--sap-blue); }
.wahl input { width: auto; flex: 0 0 auto; }
.wahl label.gewaehlt { border-color: var(--sap-blue); box-shadow: 0 0 0 1px var(--sap-blue) inset; }
.vorschlag { display: block; padding: 9px 0; border: none; border-bottom: 1px solid var(--border); color: var(--text); cursor: pointer; background: none; width: 100%; text-align: left; font: inherit; }
.vorschlag:last-child { border-bottom: none; }
.vorschlag b { display: block; font-size: 13.5px; color: var(--sap-blue); }
[data-theme="dark"] .vorschlag b { color: #6fb6f5; }
.vorschlag span { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.artikel { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; }

/* Dashboard */
.tiles.vier { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile.t-warn .v { color: var(--warn-fg); }
.balken { display: grid; grid-template-columns: minmax(70px, 180px) minmax(0, 1fr) 36px; gap: 10px; align-items: center; font-size: 13px; margin-bottom: 8px; }
.balken .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.balken .bar { margin: 0; height: 12px; }
.balken .zahl { text-align: right; font-weight: 700; color: var(--sap-dark); }
.bar.p1 > span { background: var(--p1-bg); } .bar.p2 > span { background: var(--p2-bg); }
.bar.p3 > span { background: #d1a800; } .bar.p4 > span { background: #7d93a8; }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash .panel { margin: 0; min-width: 0; }
.dash .breit { grid-column: 1 / -1; }
.quote { font-size: 30px; font-weight: 700; color: var(--sap-dark); }
.quote.gut { color: var(--ok-fg); } .quote.schlecht { color: var(--nok-fg); }

/* Einstellungen */
.einst { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.einst-nav { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; }
.einst-nav button { text-align: left; border: none; background: none; color: var(--text); padding: 9px 12px; border-radius: 6px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.einst-nav button:hover { background: var(--surface-hover); }
.einst-nav button.aktiv { background: var(--sap-blue); color: #fff; font-weight: 600; }
.matrix { border-collapse: separate; border-spacing: 6px; width: auto; background: none; }
.matrix th, .matrix td { border: none; padding: 0; background: none; font-size: 12.5px; text-transform: none; letter-spacing: 0; vertical-align: middle; }
.matrix select { width: 74px; padding: 7px 8px; font-weight: 700; }
.zeiten input { width: 100%; min-width: 64px; padding: 7px 8px; }
.tagzeile { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.tagzeile input { padding: 7px 8px; }
.feld-eintrag { display: grid; grid-template-columns: minmax(0, 2fr) 130px minmax(0, 2fr) auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.listenzeile { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.listenzeile:last-child { border-bottom: none; }
.listenzeile .titel { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.listenzeile .unter { color: var(--text-muted); font-size: 12.5px; overflow-wrap: anywhere; }
.listenzeile.ein { padding-left: 22px; }
.inaktiv .titel { color: var(--text-muted); text-decoration: line-through; }
.mitglieder { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 6px 14px; }
.modal.breit { max-width: 860px; }
.modal .row.end { margin-top: 16px; }
.field .hint { margin-top: 4px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.field-row.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.konto-foto { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.auth-form a.btn { text-align: center; box-sizing: border-box; }

@media (max-width: 1180px) {
  .tzeile { grid-template-columns: 132px minmax(0, 1fr) 170px 50px 150px 104px; }
  .tzeile .c-team { display: none; }
  .ticket { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 980px) {
  .ticket, .erfassen, .einst { grid-template-columns: minmax(0, 1fr); }
  .tiles.vier { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash { grid-template-columns: minmax(0, 1fr); }
  .filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter > :first-child { grid-column: 1 / -1; }
  .einst-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .einst-nav::-webkit-scrollbar { display: none; }
  .einst-nav button { flex: 0 0 auto; }
  /* Ticketliste als Karten */
  .tzeile.kopf { display: none; }
  .tzeile, .tliste.kunde .tzeile { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 14px; }
  .tzeile .c-nr { grid-area: 1 / 1; }
  .tzeile .c-prio { grid-area: 1 / 2; text-align: right; }
  .tzeile .c-betreff { grid-area: 2 / 1 / 3 / 3; }
  .tzeile .betreff b { white-space: normal; }
  .tzeile .c-status { grid-area: 3 / 1; }
  .tzeile .c-zeit { grid-area: 3 / 2; }
  .tzeile .c-sla { grid-area: 4 / 1; }
  .tzeile .c-team { display: block; grid-area: 4 / 2; text-align: right; max-width: 46vw; }
  .tzeile .c-team span { display: none; }
}
@media (max-width: 640px) {
  .grid-2, .field-row, .field-row.drei { grid-template-columns: minmax(0, 1fr); }
  .filter, .filter.kunde { grid-template-columns: minmax(0, 1fr); }
  .queues { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .queues::-webkit-scrollbar { display: none; }
  .queue { flex: 0 0 auto; padding: 8px 14px; }
  .kopfzeile .btn { flex: 1 1 auto; text-align: center; }
  .aktionen .btn { flex: 1 1 auto; text-align: center; }
  .angaben, .seite .angaben { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .angaben dd { margin-bottom: 8px; }
  .seite .feldzeile { grid-template-columns: minmax(0, 1fr); gap: 3px; margin-bottom: 10px; }
  .seite select, .seite input { padding: 9px 11px; font-size: 16px; }
  .verfassen { padding: 12px; }
  .verfassen .optionen select { max-width: 100%; width: 100%; }
  .verfassen .senden .btn { flex: 1 1 auto; text-align: center; }
  .umschalter { display: flex; }
  .umschalter button { flex: 1 1 0; padding: 9px 8px; }
  .kacheln { gap: 10px; }
  .kachel, .kacheln.gross .kachel { padding: 14px; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 2px 10px; align-items: start; }
  .kachel .icon, .kacheln.gross .kachel .icon { font-size: 26px; grid-row: 1 / 3; margin: 0; }
  .kacheln.gross .kachel b { font-size: 16px; }
  .balken { grid-template-columns: minmax(60px, 110px) minmax(0, 1fr) 30px; }
  .feld-eintrag { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px; border: 1px solid var(--border); border-radius: 6px; }
  .feld-eintrag > :nth-child(3) { grid-column: 1 / -1; }
  .matrix select { width: 64px; }
  .tagzeile { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .listenzeile { grid-template-columns: minmax(0, 1fr); }
  .datei.bild img { width: 96px; height: 72px; }
  /* Eingabetabellen der Einstellungen: je Zeile eine Karte, Spaltenname über dem Feld */
  table.stapel thead { display: none; }
  table.stapel, table.stapel tbody { display: block; }
  table.stapel tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  table.stapel tr:last-child { border-bottom: none; }
  table.stapel td { display: block; border: none; padding: 4px 0; }
  table.stapel td[data-l]::before { content: attr(data-l); display: block; font-size: 11.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 3px; }
  .quote { font-size: 26px; }
}
