/* Ticketsystem – Stylesheet */
:root {
  --ground: #F2F4F6;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --line: #E1E5EA;
  --line-soft: #ECEFF2;
  --input-line: #CBD2D9;
  --text: #14171A;
  --text-2: #3A4149;
  --muted: #5C6570;
  --accent: #0A6AA6;
  --accent-hover: #08537F;
  --accent-soft: #E4F2FB;
  --brand-dark: #131517;
  --brand-dark-2: #22262A;
  --brand-cyan: #58C8F8;
  --note: #FFF6D6;
  --note-line: #E9C96B;
  --note-text: #7A5300;
  --danger: #A1251B;
  --danger-soft: #FBE7E5;
  --ok: #1F6B35;
  --ok-soft: #E3F3E7;
  --on-accent: #FFFFFF;
  --tabs-bg: #E9ECEF;
  --row-hover: #F0F3F5;
  --chip-bg: #EEF1F4;
  --count-bg: #E9ECEF;
  --note-input: #FFFBEA;
  --waiting-fg: #8A4B00;
  --waiting-strong: #6B3A00;
  --st-neu-bg: #E6EEFB; --st-neu-fg: #1E4FAE;
  --st-bearb-bg: #FDF0DC; --st-bearb-fg: #8A4B00;
  --st-wartet-bg: #EFE8FB; --st-wartet-fg: #5B33A6;
  --st-zu-bg: #EDEDEB; --st-zu-fg: #4D4D52;
  --shadow-soft: 0 1px 2px rgba(0,0,0,.08);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { letter-spacing: -0.015em; line-height: 1.25; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Kopfzeile */
.topbar { background: var(--brand-dark); color: #FFFFFF; border-bottom: 1px solid #2D3237; }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.topbar.wide .topbar-inner { max-width: none; }
.brand { display: flex; align-items: center; gap: 10px; color: #FFFFFF; text-decoration: none; }
.brand:hover { color: #FFFFFF; }
.brand-gear { width: 30px; height: 30px; display: block; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.brand-name span { color: var(--brand-cyan); font-weight: 500; }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.mainnav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: #C3CAD1; font-weight: 500; }
.mainnav a:hover { background: var(--brand-dark-2); color: #FFFFFF; }
.mainnav a.active { background: var(--brand-dark-2); color: #FFFFFF; box-shadow: inset 0 -2px 0 var(--brand-cyan); }
.me { display: flex; align-items: center; gap: 10px; }
.me-text { text-align: right; line-height: 1.3; }
.me-name { font-weight: 500; font-size: 14px; }
.me-sub { font-size: 13px; color: #A9B2BB; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-dark-2); color: var(--brand-cyan);
  border: 1px solid #3A4046; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.logout { margin: 0; }
.logout button { background: none; border: 0; font: inherit; font-size: 13px; color: #A9B2BB; cursor: pointer; padding: 8px; min-height: 40px; }
.logout button:hover { color: #FFFFFF; text-decoration: underline; }

/* ---------- Grundlayout */
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }
.narrow { max-width: 720px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 600; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.card-pad { padding: 28px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; text-decoration: none; font-weight: 500; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* ---------- Meldungen */
.flash { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.warn { background: var(--st-bearb-bg); color: var(--st-bearb-fg); }

/* ---------- Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--input-line); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--ground); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-link { background: none; border: 0; color: var(--accent); padding: 0 4px; min-height: 36px; font: inherit; cursor: pointer; text-decoration: underline; }
.btn-danger { color: var(--danger); }
:focus-visible { outline: 3px solid #58C8F8; outline-offset: 2px; }

/* ---------- Formulare */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-weight: 500; font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=time], select, textarea {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--input-line); border-radius: var(--radius);
  font: inherit; background: var(--surface); color: inherit; width: 100%;
}
textarea { padding: 11px 14px; resize: vertical; line-height: 1.5; }
select { padding: 0 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.route-hint { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--input-line); border-radius: var(--radius); cursor: pointer; font-weight: 500; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); padding: 0 15px; }
.seg label:has(input:focus-visible) { outline: 3px solid #58C8F8; outline-offset: 2px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }

/* ---------- Status und Priorität */
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.st-neu { background: var(--st-neu-bg); color: var(--st-neu-fg); }
.st-bearb { background: var(--st-bearb-bg); color: var(--st-bearb-fg); }
.st-wartet { background: var(--st-wartet-bg); color: var(--st-wartet-fg); }
.st-geloest { background: var(--ok-soft); color: var(--ok); }
.st-zu { background: var(--st-zu-bg); color: var(--st-zu-fg); }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #A3A3A8; }
.prio.p2::before { background: #3B6FD8; }
.prio.p3::before { background: #D9771F; }
.prio.p4::before { background: #C2362A; }
.prio.p4 { color: var(--danger); font-weight: 600; }
.badge-new { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; }
.badge-private { font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); padding: 0 8px; border-radius: 999px; }

/* ---------- Tabs */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--tabs-bg); border-radius: 12px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 9px; text-decoration: none; color: var(--text-2); font-weight: 600; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }
.tab .count { color: var(--muted); font-weight: 500; }

/* ---------- Ticketliste (Kunde) */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.search { display: flex; gap: 8px; }
.search input { width: 240px; }
.list { overflow: hidden; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); color: inherit; }
.list-main { flex: 1 1 360px; min-width: 0; }
.list-top { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; color: var(--muted); }
.list-subject { font-weight: 600; font-size: 16px; }
.list-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.list-side { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.list-time { font-size: 13px; color: var(--muted); min-width: 80px; text-align: right; }

/* ---------- Ticket-Kopf */
.ticket-head { padding: 22px 28px; border-bottom: 1px solid var(--line-soft); }
.ticket-head h1, .ticket-head h2 { margin: 2px 0 14px; font-size: 22px; font-weight: 600; }
.ticket-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; font-size: 13px; color: var(--text-2); }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 16px; }
.control { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.control label, .control .label { font-size: 12px; color: var(--muted); }
.control select { min-height: 40px; width: auto; min-width: 150px; }
.control .btn { min-height: 40px; }

/* ---------- Verlauf */
.thread { padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; background: var(--surface-2); min-height: 160px; }
.event { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); text-align: center; }
.event::before, .event::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 80%; align-self: flex-start; }
.msg.right { align-self: flex-end; align-items: flex-end; }
.msg-head { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.msg-head strong { color: var(--text); font-weight: 600; }
.msg-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.msg-delete { display: inline; margin: 0 0 0 4px; }
.msg-delete button { border: 0; background: none; color: var(--muted); cursor: pointer; width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 6px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-delete button, .msg-delete button:focus-visible { opacity: 1; }
.msg-delete button:hover { color: var(--danger); background: var(--danger-soft); }
@media (hover: none) { .msg-delete button { opacity: .7; } }
.bubble { padding: 11px 15px; border-radius: 14px; border-top-left-radius: 4px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.right .bubble { background: var(--accent); border-color: var(--accent); color: var(--on-accent); border-top-left-radius: 14px; border-top-right-radius: 4px; }
.msg.right .bubble a { color: var(--on-accent); }
.msg.note .bubble { background: var(--note); border-color: var(--note-line); color: var(--text); }
.msg.note .bubble a { color: var(--accent); }
.note-label { font-size: 12px; font-weight: 600; color: var(--note-text); margin-bottom: 4px; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.msg.right .files { justify-content: flex-end; }
.att-img img { display: block; max-width: 280px; max-height: 220px; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; background: var(--surface); }
.att-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--text); font-size: 14px; }
.att-file:hover { background: var(--ground); color: var(--text); }
.att-file .small { color: var(--muted); }

/* ---------- Eingabe */
.composer { padding: 14px 20px 20px; border-top: 1px solid var(--line-soft); background: var(--surface); border-radius: 0 0 14px 14px; }
.composer.drag { outline: 2px dashed var(--accent); outline-offset: -6px; }
.composer-modes { display: inline-flex; gap: 4px; padding: 4px; background: var(--tabs-bg); border-radius: 10px; margin-bottom: 10px; }
.composer-modes label { min-height: 36px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 7px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.composer-modes input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.composer-modes label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }
.composer-modes label.note:has(input:checked) { background: var(--note); color: var(--note-text); }
.composer.is-note textarea { background: var(--note-input); border-color: var(--note-line); }
.composer-row { display: flex; align-items: flex-end; gap: 10px; }
.composer-row textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 240px; }
.attach { flex: none; width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid var(--input-line); display: grid; place-items: center; color: var(--text-2); cursor: pointer; }
.attach:hover { background: var(--ground); }
.attach input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.attach:has(input:focus-visible) { outline: 3px solid #58C8F8; outline-offset: 2px; }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.file-chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; background: var(--surface-2); }
.chip img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.chip button { border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); width: 28px; height: 28px; }
.composer-foot { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--muted); }
.composer-foot select { width: auto; min-height: 36px; font-size: 14px; }
.closed-note { padding: 16px 28px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 14px; }

/* ---------- Agent-Posteingang */
.inbox { display: flex; flex-wrap: wrap; align-items: stretch; min-height: calc(100vh - 56px); }
.inbox-nav { flex: 1 1 200px; max-width: 240px; padding: 20px 12px; background: var(--surface); border-right: 1px solid var(--line); }
.nav-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 12px 8px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 9px; text-decoration: none; color: var(--text); font-weight: 500; }
.nav-item:hover { background: var(--ground); color: var(--text); }
.nav-item.active { background: var(--accent-soft); font-weight: 600; }
.nav-count { font-size: 13px; min-width: 24px; text-align: center; padding: 1px 7px; border-radius: 999px; background: var(--count-bg); color: var(--text-2); }
.nav-item.active .nav-count { background: var(--accent); color: var(--on-accent); }
.nav-search { padding: 16px 4px 0; margin-top: 12px; border-top: 1px solid var(--line-soft); }
.nav-note { font-size: 13px; color: var(--muted); padding: 12px; }
.inbox-list { flex: 0 0 var(--list-w, clamp(460px, 40vw, 720px)); min-width: 0; background: var(--surface-2); container-type: inline-size; }
.inbox-list-head { padding: 20px 20px 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.inbox-list-head h1 { margin: 0; font-size: 20px; font-weight: 600; }
.inbox-row { display: block; padding: 14px 20px; border-top: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.inbox-row:hover { background: var(--row-hover); color: inherit; }
.inbox-row.active { background: var(--accent-soft); }
.inbox-row-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.inbox-row-subject { font-weight: 600; margin: 3px 0 8px; display: flex; gap: 8px; align-items: baseline; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; transform: translateY(-1px); }
.inbox-row-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.inbox-row-subject .badge-new { font-weight: 600; white-space: nowrap; }
.plant-tag { font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--chip-bg); color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plant-control { flex: 1 1 260px; }
.plant-control select { width: 100%; min-width: 220px; max-width: 520px; }
.last-reply { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.last-reply strong { font-weight: 600; color: var(--text-2); }
.last-reply.waiting { color: var(--waiting-fg); }
.last-reply.waiting strong { color: var(--waiting-strong); }
.lamp { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #F28C1B;
  box-shadow: 0 0 0 3px rgba(242, 140, 27, .22), 0 0 8px 2px rgba(242, 140, 27, .55); animation: lamp 2.4s ease-in-out infinite; }
@keyframes lamp { 50% { box-shadow: 0 0 0 3px rgba(242, 140, 27, .12), 0 0 3px 1px rgba(242, 140, 27, .3); } }
@media (prefers-reduced-motion: reduce) { .lamp { animation: none; } }
.inbox-detail { flex: 999 1 520px; min-width: 0; background: var(--surface); display: flex; flex-direction: column; }
.inbox-detail .thread { flex: 1; }
.inbox-detail .composer { border-radius: 0; }
.inbox-placeholder { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 40px; text-align: center; }

/* ---------- Hinweis-Toast */
.toast-area { position: fixed; top: 72px; right: 24px; z-index: 20; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast { background: var(--brand-dark); color: #FFFFFF; border-radius: 12px; padding: 14px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.18); display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.toast a { color: var(--brand-cyan); font-weight: 600; }
.toast button { flex: none; border: 0; background: none; color: #B8BDC2; font-size: 20px; line-height: 1; cursor: pointer; width: 28px; height: 28px; }

/* ---------- Anmeldung */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-brand-panel { flex: 1 1 420px; background: radial-gradient(120% 90% at 30% 20%, #23282D 0%, var(--brand-dark) 60%);
  color: #FFFFFF; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 18px;
  padding: 64px clamp(32px, 6vw, 96px); position: relative; overflow: hidden; }
.auth-gear { width: 96px; height: 96px; }
.auth-wordmark { width: 240px; height: auto; opacity: .95; }
.auth-claim { margin: 18px 0 0; font-size: 32px; }
.auth-claim .brand-name { font-size: 34px; }
.auth-sub { margin: 0; color: #A9B2BB; font-size: 16px; max-width: 34ch; }
.auth-lines { position: absolute; right: -40px; bottom: 48px; display: flex; flex-direction: column; gap: 10px; }
.auth-lines span { display: block; height: 4px; width: 220px; border-radius: 4px; background: var(--brand-cyan); opacity: .55; }
.auth-lines span:nth-child(2) { width: 160px; margin-left: 60px; opacity: .35; }
.auth-lines span:nth-child(3) { width: 110px; margin-left: 110px; opacity: .2; }
.auth-form { flex: 1 1 420px; display: grid; place-items: center; padding: 48px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { margin: 0 0 6px; font-size: 26px; font-weight: 650; }
.auth-brand-mobile { display: none; align-items: center; gap: 10px; margin-bottom: 28px; color: var(--text); }
.auth-brand-mobile .brand-name span { color: var(--accent); }
.brand-mark-dark { width: 36px; height: 36px; border-radius: 9px; background: var(--brand-dark); display: grid; place-items: center; }
@media (max-width: 860px) {
  .auth-brand-panel { display: none; }
  .auth-brand-mobile { display: flex; }
}
.qr { width: 200px; height: 200px; padding: 8px; background: #FFFFFF; border: 1px solid var(--line); border-radius: 12px; }
.qr svg { width: 100%; height: 100%; }
.secret { font-family: var(--mono); font-size: 16px; letter-spacing: .05em; background: var(--ground); padding: 10px 14px; border-radius: 8px; overflow-wrap: anywhere; }

/* ---------- Admin */
.admin-nav { margin-bottom: 24px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data input[type=text], table.data select, table.data input[type=number] { min-height: 38px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--count-bg); color: var(--text-2); }
.tag.off { background: var(--danger-soft); color: var(--danger); }
.section-title { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 500; font-size: 14px; margin-bottom: 6px; padding: 0; }

@media (max-width: 720px) {
  .wrap { padding: 20px 16px 48px; }
  .card-pad { padding: 20px; }
  .thread { padding: 16px; }
  .msg { max-width: 92%; }
  .ticket-head { padding: 18px 16px; }
  .composer { padding: 12px; }
  .search input { width: 100%; }
  .inbox-nav { max-width: none; }
  .inbox-list { flex: 1 1 100%; }
  .me-text { display: none; }
  .topbar-inner { gap: 8px 12px; padding: 10px 16px; }
  .me { margin-left: auto; }
  .mainnav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .mainnav a { white-space: nowrap; }
}

/* ---------- Berichte */
.report-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0 4px; border-top: 1px solid var(--line-soft); }
.report-count { font-size: 32px; font-weight: 700; color: var(--accent); margin-right: 6px; vertical-align: -3px; }
code { font-family: var(--mono); font-size: 13px; background: var(--ground); padding: 1px 5px; border-radius: 4px; }
table.data td.mono { white-space: nowrap; }
.odoo-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- Posteingang: Spalten scrollen unabhängig (ab Tablet-Breite) */
@media (min-width: 900px) {
  body.inbox-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body.inbox-page .topbar { flex: none; }
  body.inbox-page .inbox { flex: 1 1 auto; min-height: 0; flex-wrap: nowrap; }
  .inbox-page .inbox-nav,
  .inbox-page .inbox-list { overflow-y: auto; overscroll-behavior: contain; }
  .inbox-page .inbox-list-head { position: sticky; top: 0; z-index: 2; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
  .inbox-page .inbox-list-head + .inbox-row { border-top: 0; }
  .inbox-page .inbox-detail { min-height: 0; overflow: hidden; }
  .inbox-page .inbox-detail > .ticket-head { flex: none; max-height: 45%; overflow-y: auto; border-bottom: 1px solid var(--line-soft); }
  .inbox-page .inbox-detail > .flash, .inbox-page .inbox-detail > .flashes { flex: none; }
  .inbox-page .inbox-detail .thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .inbox-page .inbox-detail .composer { flex: none; }
  .inbox-page .inbox-placeholder { overflow-y: auto; }
}
.inbox-page .inbox-row { scroll-margin-top: 64px; }
.nav-search .btn { white-space: normal; text-align: center; line-height: 1.3; padding: 6px 10px; }

/* ---------- Ticket durch Agent anlegen */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.select-filter { margin-bottom: 2px; }
select.select-list { min-height: 0; height: auto; padding: 6px; }
select.select-list option { padding: 6px 8px; border-radius: 6px; }
select.select-list optgroup { font-weight: 600; color: var(--text-2); }
.nav-new { display: flex; width: 100%; margin: 0 0 16px; }

/* ---------- Posteingang: Ticketliste */
.inbox-resizer { flex: 0 0 7px; margin: 0 -3px; position: relative; z-index: 3; cursor: col-resize; touch-action: none; }
.inbox-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: var(--line); transition: background .15s, width .15s, left .15s; }
.inbox-resizer:hover::after, .inbox-resizer:focus-visible::after, .inbox-resizer.dragging::after { left: 2px; width: 3px; background: var(--accent); }
.inbox-resizer:focus-visible { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
.list-count { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--count-bg); border-radius: 999px; padding: 1px 9px; }
.inbox-row { position: relative; padding: 14px 20px 14px 22px; }
.inbox-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.inbox-row.is-waiting::before { background: #F28C1B; }
.inbox-row.active::before { background: var(--accent); }
.ir-top { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--muted); }
.ir-num { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.ir-company { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ir-time { white-space: nowrap; }
.ir-subject { display: flex; align-items: center; gap: 8px; margin: 3px 0 9px; font-weight: 600; font-size: 15px; line-height: 1.35; }
.ir-subject-text { min-width: 0; overflow-wrap: anywhere; }
.inbox-row.is-unread .ir-subject-text { color: var(--text); }
.ir-subject .badge-new { white-space: nowrap; }
.ir-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.chip-soft { font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--chip-bg); color: var(--text-2); white-space: nowrap; }
.ir-chips .plant-tag { max-width: 220px; }
.ir-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 11px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); }
.ir-facts > div { min-width: 0; }
.ir-facts dt { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 1px; }
.ir-facts dd { margin: 0; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ir-facts .ir-last { grid-column: 1 / -1; }
.ir-facts .ir-last.waiting dd { color: var(--waiting-fg); font-weight: 600; }
.ir-facts .who { font-weight: 400; color: var(--muted); }
.ir-facts .none { color: var(--muted); }
.ir-facts .ir-count { display: none; }
@container (min-width: 600px) {
  .ir-facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.7fr) auto; }
  .ir-facts .ir-last { grid-column: auto; }
  .ir-facts .ir-count { display: block; text-align: right; }
}
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.title-row h2 { flex: 1 1 320px; }
.pdf-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.pdf-actions .btn { font-weight: 500; }
.pdf-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.placeholder-title { font-size: 17px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
@media (max-width: 899px) {
  .inbox-resizer { display: none; }
  .inbox-list { flex: 1 1 100%; border-right: 0; }
}

/* ---------- Sprache und Erscheinungsbild */
.prefs { display: flex; align-items: center; gap: 6px; }
.pref-btn { min-width: 36px; height: 34px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid #2D3237;
  color: #C3CAD1; text-decoration: none; font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.pref-btn:hover { background: var(--brand-dark-2); color: #FFFFFF; }
.pref-btn svg { display: block; }
.i-sun { display: none !important; }
:root[data-theme="dark"] .i-sun { display: block !important; }
:root[data-theme="dark"] .i-moon { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .i-sun { display: block !important; }
  :root[data-theme="auto"] .i-moon { display: none !important; }
}
.auth-form { position: relative; }
.auth-prefs { position: absolute; top: 16px; right: 16px; }
.auth-prefs .pref-btn { border-color: var(--line); color: var(--text-2); }
.auth-prefs .pref-btn:hover { background: var(--ground); color: var(--text); }
.seg-compact { gap: 6px; }
.seg-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--input-line); border-radius: var(--radius); text-decoration: none; color: var(--text-2); font-weight: 500; }
.seg-link:hover { color: var(--text); background: var(--ground); }
.seg-link.on { border: 2px solid var(--accent); padding: 0 13px; background: var(--accent-soft); color: var(--text); }

/* ---------- Dunkles Erscheinungsbild */
:root[data-theme="dark"] {
  --ground: #0E1012; --surface: #171A1D; --surface-2: #1C2024; --line: #2B3137; --line-soft: #23282D; --input-line: #3A4148;
  --text: #E7EAED; --text-2: #C2C9D0; --muted: #8E98A2;
  --accent: #4CBDEF; --accent-hover: #7ACFF5; --accent-soft: #12303E; --on-accent: #06141B;
  --note: #332A12; --note-line: #6E5A1E; --note-text: #EBCB72; --note-input: #2A2410;
  --danger: #FF8E85; --danger-soft: #3A1D1B; --ok: #7ED79A; --ok-soft: #16301F;
  --tabs-bg: #111416; --row-hover: #20252A; --chip-bg: #252B31; --count-bg: #262C32;
  --waiting-fg: #F5B266; --waiting-strong: #FFC98A;
  --st-neu-bg: #1A2A46; --st-neu-fg: #A3C0F7; --st-bearb-bg: #3A2A12; --st-bearb-fg: #F4B970;
  --st-wartet-bg: #2B2244; --st-wartet-fg: #C6B2F6; --st-zu-bg: #2A2E33; --st-zu-fg: #B5BCC3;
  --shadow-soft: 0 1px 2px rgba(0,0,0,.5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --ground: #0E1012; --surface: #171A1D; --surface-2: #1C2024; --line: #2B3137; --line-soft: #23282D; --input-line: #3A4148;
    --text: #E7EAED; --text-2: #C2C9D0; --muted: #8E98A2;
    --accent: #4CBDEF; --accent-hover: #7ACFF5; --accent-soft: #12303E; --on-accent: #06141B;
    --note: #332A12; --note-line: #6E5A1E; --note-text: #EBCB72; --note-input: #2A2410;
    --danger: #FF8E85; --danger-soft: #3A1D1B; --ok: #7ED79A; --ok-soft: #16301F;
    --tabs-bg: #111416; --row-hover: #20252A; --chip-bg: #252B31; --count-bg: #262C32;
    --waiting-fg: #F5B266; --waiting-strong: #FFC98A;
    --st-neu-bg: #1A2A46; --st-neu-fg: #A3C0F7; --st-bearb-bg: #3A2A12; --st-bearb-fg: #F4B970;
    --st-wartet-bg: #2B2244; --st-wartet-fg: #C6B2F6; --st-zu-bg: #2A2E33; --st-zu-fg: #B5BCC3;
    --shadow-soft: 0 1px 2px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] .topbar { border-bottom-color: #22272C; }
:root[data-theme="dark"] .toast { background: #22272C; border: 1px solid #343B42; }
:root[data-theme="dark"] .prio.p4 { color: var(--danger); }
:root[data-theme="dark"] .auth-brand-panel { background: radial-gradient(120% 90% at 30% 20%, #1E2327 0%, #0B0D0E 60%); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .topbar { border-bottom-color: #22272C; }
  :root[data-theme="auto"] .toast { background: #22272C; border: 1px solid #343B42; }
  :root[data-theme="auto"] .auth-brand-panel { background: radial-gradient(120% 90% at 30% 20%, #1E2327 0%, #0B0D0E 60%); }
}

/* ---------- Kalender */
.wrap.wide { max-width: 1440px; }
:root { --k-inbetriebnahme: #2E7D32; --k-support: #0A6AA6; --k-wartung: #B26A00; --k-sonstiges: #6B5BB0; }
:root[data-theme="dark"] { --k-inbetriebnahme: #6CCF77; --k-support: #5CC0F2; --k-wartung: #F0A94A; --k-sonstiges: #B4A6F0; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] { --k-inbetriebnahme: #6CCF77; --k-support: #5CC0F2; --k-wartung: #F0A94A; --k-sonstiges: #B4A6F0; } }
.k-inbetriebnahme { --k: var(--k-inbetriebnahme); }
.k-support { --k: var(--k-support); }
.k-wartung { --k: var(--k-wartung); }
.k-sonstiges { --k: var(--k-sonstiges); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--k); flex: none; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.cal-toolbar { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.cal-toolbar h2 { margin: 0 8px; font-size: 18px; font-weight: 600; min-width: 150px; text-align: center; }
.cal-filter { margin-left: auto; }
.cal-filter select { min-width: 200px; }
.cal-grid { display: grid; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line-soft); }
.cal-day { min-height: 112px; padding: 6px 6px 8px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-row .cal-day:last-child { border-right: 0; }
.cal-day.weekend { background: var(--surface-2); }
.cal-day.other .cal-date { color: var(--muted); opacity: .6; }
.cal-date { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-date:hover { background: var(--accent-soft); color: var(--text); }
.cal-day.today .cal-date { background: var(--accent); color: var(--on-accent); }
.cal-chip { display: flex; gap: 4px; align-items: baseline; font-size: 12px; line-height: 1.3; padding: 2px 6px; border-radius: 5px; text-decoration: none; color: var(--text);
  background: color-mix(in srgb, var(--k) 14%, var(--surface)); border-left: 3px solid var(--k); min-width: 0; }
.cal-chip:hover { background: color-mix(in srgb, var(--k) 24%, var(--surface)); color: var(--text); }
.cal-chip .t { font-variant-numeric: tabular-nums; color: var(--text-2); flex: none; }
.cal-chip .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: 12px; color: var(--muted); padding-left: 6px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 16px; font-size: 13px; color: var(--text-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-upcoming { position: sticky; top: 16px; max-height: calc(100vh - 120px); overflow-y: auto; }
.up-row { display: grid; gap: 2px; padding: 12px 20px; border-top: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.up-row:hover { background: var(--row-hover); color: inherit; }
.up-kind { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--k); }
.up-plant { font-weight: 600; overflow-wrap: anywhere; }
.up-when { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.up-meta { font-size: 12.5px; color: var(--muted); }
.howto h3 { font-size: 14px; margin: 14px 0 4px; }
.howto h3:first-child { margin-top: 0; }
.howto p { margin: 0; color: var(--text-2); }
fieldset[disabled] { opacity: .8; }
@media (max-width: 1100px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-upcoming { position: static; max-height: none; }
}
@media (max-width: 700px) {
  .cal-month { display: none; }
}
.cal-chip.absence { background: repeating-linear-gradient(135deg, var(--chip-bg) 0 6px, var(--surface-2) 6px 12px);
  border-left-color: var(--muted); color: var(--text-2); cursor: default; }
.dot-absence { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, var(--chip-bg) 2px 4px); border: 1px solid var(--muted); }
.absence-row { cursor: default; }
.absence-row:hover { background: none; }
.absence-sync { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--line-soft); }

/* ---------- Kalender: Anfragen und gesperrte Tage */
.cal-chip.req { background: var(--surface); border: 1px dashed var(--k); border-left: 3px dashed var(--k); }
.cal-chip.req .n::after { content: " ?"; color: var(--muted); }
.dot-req { background: var(--surface); border: 1.5px dashed var(--text-2); }
.cal-day.blocked { background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, var(--chip-bg) 8px 16px); }
.cal-blocked { font-size: 11.5px; font-weight: 600; color: var(--muted); padding-left: 2px; }
.vstatus { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 0 6px; border-radius: 999px; margin-left: 4px; text-transform: uppercase; }
.vstatus.s-angefragt { background: var(--st-bearb-bg); color: var(--st-bearb-fg); }
.vstatus.s-abgelehnt { background: var(--danger-soft); color: var(--danger); }
.vbanner { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; }
.vbanner.s-angefragt { background: var(--st-bearb-bg); color: var(--st-bearb-fg); }
.vstatus.s-kurz { background: var(--danger-soft); color: var(--danger); }
.lead-note { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; line-height: 1.45; background: var(--accent-soft, var(--bg-soft)); border: 1px solid var(--line-soft); }
.lead-note.is-short { background: var(--st-bearb-bg); color: var(--st-bearb-fg); border-color: transparent; }
.lead-note strong { display: block; margin-bottom: 2px; }
.vbanner.s-bestaetigt { background: var(--ok-soft); color: var(--ok); }
.vbanner.s-abgelehnt { background: var(--danger-soft); color: var(--danger); }
.req-title { display: flex; align-items: center; gap: 8px; }
.req-row { background: color-mix(in srgb, var(--st-bearb-bg) 45%, transparent); }
.blocked-hint { padding: 8px 12px; border-radius: var(--radius); background: var(--chip-bg); }
.decide-card { border: 2px solid var(--accent-soft); }
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px;
  background: #F28C1B; color: #131517; font-size: 11px; font-weight: 700; vertical-align: 1px; }
[hidden] { display: none !important; }
.seg-multi label:has(input:checked) span::before { content: "✓ "; font-weight: 700; }
.up-support { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
