:root {
  --bg: #f5f4f0; --card: #fff; --ink: #1d2126; --muted: #6a6e75; --line: #e2e0da;
  --accent: #2f5d50; --accent-soft: #e3eee9; --side: #1d2126;
  --warn: #9a5b00; --warn-soft: #fbefd9; --err: #a12a2a; --err-soft: #f8e1e1;
  --ok: #276b3a; --ok-soft: #e1f2e5; --b2b: #3d4f8a; --b2b-soft: #e5e9f6;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 16px; }
h1 small { font-size: 15px; color: var(--muted); font-weight: 400; margin-left: 6px; }
h2 { font-size: 13px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
h2 small { text-transform: none; letter-spacing: 0; }
h3 { font-size: 15px; margin: 20px 0 6px; }
code { font-size: 13px; background: #f0eee9; padding: 1px 5px; border-radius: 4px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* Layout */
body.app { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #c9cdd2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px; }
.brand { color: #fff; font-weight: 700; font-size: 18px; padding: 0 10px 18px; }
.brand span { color: #9cc7b8; font-weight: 500; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.side nav a { color: #c9cdd2; padding: 7px 10px; border-radius: 6px; font-size: 14px; }
.side nav a.on, .side nav a:hover { color: #fff; background: #ffffff1a; text-decoration: none; }
.who { border-top: 1px solid #ffffff22; padding: 12px 10px 0; font-size: 13px; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.who small { color: #8f959c; }
.main-wrap { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.gsearch { flex: 1; max-width: 640px; }
.gsearch input { margin: 0; }
.ringing { background: var(--accent); color: #fff; padding: 7px 14px; border-radius: 8px; font-weight: 600; animation: pulse 1.2s infinite; }
.ringing a { color: #fff; text-decoration: underline; }
@keyframes pulse { 50% { opacity: .75; } }
.page { max-width: 1280px; margin: 0 auto; padding: 24px 28px 60px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.narrow { width: 100%; max-width: 400px; }
.accent { color: var(--accent); }
.head { margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.head h1, .head h2 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { margin: 0 0 8px; font-size: 14px; }
.right { float: right; }

/* Buttons & Formulare */
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 7px; padding: 8px 15px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.dli { width: 15px; height: 15px; vertical-align: -3px; margin-right: 6px; flex: none; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: var(--err); }
.small-btn { padding: 5px 11px; font-size: 13px; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
button.link.light { color: #fff; }
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 7px 10px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfccc5; border-radius: 6px; }
input[type=checkbox] { width: auto; display: inline; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 2px; margin: 4px 0 14px; }
legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
.form { max-width: 980px; }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-form input, .row-form select, .row-form textarea { width: auto; flex: 1; min-width: 120px; margin: 0; }
.row-form input[type=checkbox], .row-form input[type=radio] { flex: none; min-width: 0; }
.row-form.tight { gap: 4px; flex-wrap: nowrap; }
.row-form.tight input { min-width: 0; padding: 4px 6px; font-size: 13px; }
.inline-label { display: flex; align-items: center; gap: 6px; margin: 0; }
.inline-label select, .inline-label input { width: auto; margin: 0; }
input.short, select.short { max-width: 150px; flex: 0 1 150px; }
input.tiny { max-width: 80px; flex: 0 1 80px; }
input.micro { max-width: 52px; flex: 0 0 52px; }

.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; margin: 0; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 7px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.tabs a.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* Tabellen */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.card table { border: 0; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: #faf9f7; }
td { padding: 8px 12px; border-bottom: 1px solid #efede8; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.anon td, tr.done td { color: var(--muted); }
tr.done td:nth-child(2) { text-decoration: line-through; }
tr.prio td:first-child { box-shadow: inset 3px 0 0 var(--err); }
.num { text-align: right; white-space: nowrap; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.late { color: var(--err); font-weight: 600; }
.scroll { overflow-x: auto; }

/* Chips */
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: #eceae4; color: #4a4e55; font-weight: 600; vertical-align: middle; white-space: nowrap; }
.pill.b2b, .pill.k-b2b { background: var(--b2b-soft); color: var(--b2b); }
.pill.warn, .pill.k-konfi { background: var(--warn-soft); color: var(--warn); }
.pill.k-reklamation, .pill.err-pill { background: var(--err-soft); color: var(--err); }
.pill.k-anfrage, .pill.k-bestellstatus, .pill.new { background: var(--accent-soft); color: var(--accent); }
.pill.ok, .pill.s-gewonnen { background: var(--ok-soft); color: var(--ok); }
.notice { background: var(--warn-soft); color: #5e3b00; border-radius: 8px; padding: 10px 14px; }
.flash { border-radius: 8px; padding: 10px 14px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash.err { background: var(--err-soft); color: var(--err); }
.err { color: var(--err); }

/* Übersicht */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--ink); }
a.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile b { display: block; font-size: 26px; line-height: 1.2; }
.tile span { color: var(--muted); font-size: 13px; }
.tile.warn b { color: var(--warn); }
.tiles .tile.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 18px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid #efede8; }
.list li:last-child { border-bottom: 0; }
.list li.done { color: var(--muted); text-decoration: line-through; }
.check-btn { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #b9b6ae; background: #fff; color: transparent; cursor: pointer; font-size: 12px; line-height: 1; padding: 0; margin-right: 6px; }
.check-btn:hover, .check-btn.on { border-color: var(--ok); color: var(--ok); }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 120px 1fr 60px; align-items: center; gap: 10px; padding: 4px 0; }
.bars.wide li { grid-template-columns: 140px 1fr 190px; }
.bar { height: 10px; background: #efede8; border-radius: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bars em { font-style: normal; text-align: right; color: var(--muted); font-size: 13px; }

dl { display: grid; grid-template-columns: 125px 1fr; gap: 6px 10px; margin: 0; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; overflow-wrap: anywhere; }
a.call { font-weight: 600; }

.note-form { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.note-form textarea { margin: 0; flex: 1; min-width: 200px; }
.note-form select, .note-form input { width: auto; margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 130px 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px solid #efede8; }
.timeline > li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-size: 13px; }
.timeline .items { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.timeline li.note > div { border-left: 3px solid var(--warn); padding-left: 10px; }
.timeline li.mail > div { border-left: 3px solid var(--accent); padding-left: 10px; }
.timeline li.call > div { border-left: 3px solid var(--b2b); padding-left: 10px; }
.timeline .note { margin: 4px 0 0; white-space: pre-wrap; }
.clip { color: var(--muted); font-size: 13px; }
.items { padding-left: 18px; margin: 4px 0; }
.pager { display: flex; gap: 16px; justify-content: center; margin-top: 8px; font-size: 14px; }
.danger-zone { border-color: #ecd0d0; }

/* Ticket */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.thread { padding: 8px 20px; }
.msg { padding: 14px 0; border-bottom: 1px solid #efede8; }
.msg:last-of-type { border-bottom: 0; }
.msg header { margin-bottom: 4px; }
.msg.out { background: #f6faf8; margin: 0 -20px; padding: 14px 20px; }
.msg.comment { background: #fffaf0; margin: 0 -20px; padding: 12px 20px; }
.msg.system { color: var(--muted); font-size: 13px; padding: 6px 0; }
.msg.system .body { font-size: 13px; }
.body { white-space: pre-wrap; word-wrap: break-word; font: inherit; margin: 6px 0 0; max-height: 480px; overflow-y: auto; }

/* Vertrieb */
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; }
.col { background: #ebe9e3; border-radius: 10px; padding: 12px; min-height: 200px; }
.col.s-gewonnen { background: #e3efe6; }
.col.s-verloren { background: #efe6e6; }
.deal { background: var(--card); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); }
.deal summary { cursor: pointer; list-style: none; }
.deal .form { margin-top: 10px; }

/* Einstellungen */
.switch-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #efede8; flex-wrap: wrap; }
.switch-row > div { flex: 1; min-width: 240px; }
details.box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
details.box summary { cursor: pointer; }
details.box[open] summary { margin-bottom: 12px; }
code.copy { user-select: all; display: inline-block; padding: 6px 10px; overflow-wrap: anywhere; }

@media (max-width: 1000px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(5, 240px); }
}
@media (max-width: 760px) {
  body.app { display: block; }
  .side { position: static; height: auto; padding: 10px 12px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .who { border: 0; padding: 8px 10px 0; }
  .topbar { padding: 10px 16px; position: static; }
  .page { padding: 18px 16px 40px; }
  table { display: block; overflow-x: auto; }
  .timeline > li { grid-template-columns: 1fr; gap: 2px; }
  .grid2 { grid-template-columns: 1fr; }
}
.pos-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
code { font-feature-settings: "calt" 0; }

/* Ladeanzeige bei Uploads */
.spinner { display: inline-block; width: 1em; height: 1em; margin-right: .5em; vertical-align: -.15em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
form[aria-busy=true] button:disabled { opacity: 1; cursor: progress; }
.busy-bar { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 1000; margin-top: .6rem; padding: .55rem 1rem; border-radius: 999px; background: var(--ink, #1f2a37); color: #fff; font-size: .95rem; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.busy-note { margin: .6rem 0 0; color: var(--muted, #666); font-size: .9rem; }

/* Bereichswahl (z. B. Werkstatt: Aufträge / Reklamationen) – deutlich größer als Reiter und Filter */
.area-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 6px 0 18px; }
.area-switch a { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); }
.area-switch a strong { font-size: 18px; }
.area-switch a span { font-size: 13px; color: var(--muted); }
.area-switch a:hover { text-decoration: none; border-color: var(--muted); }
.area-switch a.on { border-color: var(--accent); box-shadow: inset 0 -4px 0 var(--accent); }
.area-switch a .badge { position: absolute; top: 12px; right: 14px; font-style: normal; min-width: 24px; padding: 2px 8px; border-radius: 999px; background: #c0392b; color: #fff; font-size: 13px; font-weight: 700; text-align: center; }

/* Beispiele unter Auswertungen */
.examples { margin-top: 14px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; font-size: 13px; }
.examples p { margin: 0 0 4px; }
.examples ul { margin: 0; padding-left: 18px; }
.examples li { margin: 2px 0; }

.assign-order { margin: 14px 0; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; }
.assign-order h3 { margin: 0 0 8px; font-size: 15px; }
.assign-order ul { list-style: none; margin: 0 0 10px; padding: 0; }
.assign-order li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.warn-link { color: #b5651d; font-weight: 600; }

.rekla-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.rekla-item:last-of-type { border-bottom: 0; }
.rekla-item form { margin-top: 6px; }

/* Einstellungen in Bereichen (Chris 30.11.2026: anwendungsfreundlich wie Shopify/Billbee) */
.set-search { margin: 0 0 14px; }
.set-search input { width: 100%; max-width: 560px; }
.set-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.set-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.set-nav a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-size: 14px; }
.set-nav a:hover { background: var(--soft, rgba(0,0,0,.04)); text-decoration: none; }
.set-nav a.on { background: var(--soft, rgba(0,0,0,.06)); font-weight: 600; }
.set-nav .ni { width: 18px; height: 18px; flex: none; }
.set-nav-cap { margin: 10px 10px 2px; font-size: 12px; color: var(--muted); }
.set-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.set-tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card, #fff); color: var(--ink); }
.set-tile:hover { border-color: var(--accent); text-decoration: none; }
.set-tile .ni { width: 22px; height: 22px; margin-bottom: 4px; }
.set-tile span { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) { .set-layout { grid-template-columns: 1fr; } .set-nav { position: static; flex-direction: row; flex-wrap: wrap; } .set-nav-cap { display: none; } }
.set-main [hidden], .set-main[hidden] { display: none !important; }

/* Antwort-Assistent (Chris 30.11.2026) */
.assist-body { white-space: pre-wrap; font: inherit; background: var(--soft, rgba(0,0,0,.03)); border-radius: 8px; padding: 12px; margin: 8px 0; }
.assist-green { border-left: 4px solid var(--ok, #2e7d32); }
.badge.ok { background: rgba(46,125,50,.12); color: var(--ok, #2e7d32); }
.assist .badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--soft, rgba(0,0,0,.06)); vertical-align: middle; }

.option-box{display:flex;gap:.6rem;align-items:flex-start;margin:.6rem 0;padding:.6rem .8rem;border:1.5px solid var(--accent,#2c6bd6);border-radius:8px;font-size:.95rem}
.option-box input{margin-top:.25rem}

/* Letzte Läufe (Chris 02.12.2026): kompakt, Datei-Chips mit Download-Symbol statt großer Knöpfe */
table.runs td { vertical-align: middle; }
table.runs .files { text-align: right; float: none; }  /* nicht .right: das floatet global */
.nowrap { white-space: nowrap; }
.run-name { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.run-state { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.btn.btn-xs { padding: 3px 10px; font-size: 12.5px; border-radius: 6px; line-height: 1.5; }
.file-chip { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-left: 6px; background: var(--card); font-size: 13px; vertical-align: middle; }
.file-chip a { display: inline-flex; align-items: center; padding: 4px 10px; color: var(--accent); font-weight: 600; text-decoration: none; }
.file-chip a.dl { padding: 4px 8px; border-left: 1px solid var(--line); color: var(--muted); }
.file-chip a:hover { background: var(--accent-soft); color: var(--accent); }
.file-chip a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Zurück-Pfeil auf Unterseiten (dezent) */
.back-arrow{display:inline-flex;align-items:center;gap:2px;margin:0 0 6px;font-size:13px;line-height:1;color:var(--muted,#6b7280);text-decoration:none;opacity:.8}
.back-arrow:hover{opacity:1;color:var(--ink,inherit)}
.back-arrow span{font-size:12px}
