/* Support Center v2.0 – Light Theme (SalewskiBuch Design) */
/* Design an salewski.it angeglichen (Karl 09.09.2026, Theme sw-minimal/automation):
   DM Sans (selbst gehostet), Papier #f7f8f2, Tinte #152c28, Dunkelgrün #275b45 als Primärfarbe,
   Lime #d9ed99 als Akzent, Linien #dce2d8; heller Header statt dunkler Navbar. */
@font-face { font-family: 'DM Sans'; src: url('fonts/dmsans-variable.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
    --bg: #f7f8f2;
    --bg-card: #ffffff;
    --bg-hover: #f2f4ec;
    --bg-input: #ffffff;
    --text: #152c28;
    --text-muted: #52615b;
    --border: #dce2d8;
    --primary: #275b45;
    --primary-hover: #1d4634;
    --primary-light: #eef5d6;
    --lime: #d9ed99;
    --success: #2f7a55;
    --warning: #b7791f;
    --danger: #b4463b;
    --purple: #6d5aa8;
    --radius: 7px;
    --radius-card: 12px;
    --shadow: 0 1px 2px rgba(21,44,40,.04);
    --shadow-md: 0 10px 20px rgba(21,44,40,.06);
    --navbar-bg: rgba(247,248,242,.97);
    --navbar-text: #152c28;
    accent-color: #275b45;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 0.9375rem;
}

/* Navbar */
.navbar {
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(6px);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: none;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-muted);
    white-space: nowrap;
    text-decoration: none;
    gap: .75rem;
}
.nav-brand span { padding-left: .75rem; border-left: 1px solid var(--border); font-size: 1rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; }

.nav-logo {
    height: 30px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: .25rem;
    flex: 1;
    overflow: visible; /* kein Clipping des Dropdowns; Breite ist über die Breakpoints gesichert */
    align-items: center;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    padding: .4rem .6rem;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 550;
    white-space: nowrap;
    transition: all .15s;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--primary-light);
}

.nav-links a.active {
    color: var(--text);
    background: var(--lime);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    white-space: nowrap;
}

.user-badge {
    font-size: .8rem;
    padding: .25rem .6rem;
    border-radius: 20px;
    font-weight: 500;
}

.user-badge.admin { background: var(--primary); color: #fff; }
.user-badge.customer { background: var(--primary-light); color: var(--primary-hover); border: 1px solid var(--lime); }

.logout-btn {
    color: #fff;
    background: var(--primary);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 600;
    padding: .35rem .75rem;
    border-radius: var(--radius);
}

.logout-btn:hover { background: var(--primary-hover); }

/* Navigation mit Linien-Icons und Gruppen (Karl 09.09.2026: Menüpunkte sollen sich unterscheiden) */
.nav-links a { display: inline-flex; align-items: center; gap: .45rem; }
.nav-links a.nav-logout-mobile { display: none; }
.nav-ico { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav-links a.active .nav-ico, .nav-links a:hover .nav-ico { opacity: 1; }
.nav-sep { width: 1px; height: 22px; background: var(--line, var(--border)); margin: 0 .35rem; align-self: center; flex: 0 0 auto; }
.nav-links a.nav-cta { background: var(--green, var(--primary)); color: #fff; border: 1px solid var(--green, var(--primary)); padding-left: .7rem; padding-right: .85rem; }
.nav-links a.nav-cta:hover { background: var(--green-dark, var(--primary-hover)); color: #fff; }
.nav-links a.nav-cta.active { background: var(--green-dark, var(--primary-hover)); color: #fff; }
.nav-links a.nav-cta .nav-ico { opacity: 1; stroke-width: 2.2; }
@media (max-width: 950px) {
    .nav-sep { width: auto; height: 0; margin: .35rem 0; border-top: 1px solid var(--line, var(--border)); }
    .nav-links a .nav-ico { width: 19px; height: 19px; }
    .nav-links a.nav-cta { margin: .5rem 1rem; border-radius: 7px; justify-content: center; }
}

/* Container — 1600 statt 1200 (Karl 23.09.2026: grosser Buero-Monitor, Ticketliste lief mit
   1261 px ueber die 1152 px Innenbreite und musste seitwaerts gescrollt werden). */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
}

h1 { font-size: 1.5rem; margin-bottom: 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin-bottom: .75rem; letter-spacing: -.01em; }
h1, h2, h3, h4 { color: var(--text); }

/* Welcome box */
.welcome-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.welcome-box h2 { color: var(--primary); margin-bottom: .5rem; }
.welcome-box > p { color: var(--text-muted); margin-bottom: 1.5rem; }

.welcome-steps {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.welcome-step {
    flex: 1;
    display: flex;
    gap: .75rem;
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.step-nr {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.welcome-step p {
    font-size: .85rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

/* Due Date */
.due-date-wrap { display: flex; align-items: center; gap: .25rem; }
.due-date-label { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.due-date-input { max-width: 140px; font-size: .8rem; padding: .3rem .4rem; }
.due-date-input::-webkit-calendar-picker-indicator { cursor: pointer; }
.due-date-clear { background: none; border: none; color: var(--text-muted); font-size: 1rem; cursor: pointer; padding: 0 .2rem; }
.due-date-clear:hover { color: var(--danger); }
.badge-due { background: var(--primary-light); color: var(--primary-hover); border: 1px solid var(--lime); }

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 1rem;
}
.search-row {
    display: flex;
    gap: .75rem;
    align-items: center;
}
.search-toggle {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
}
.search-toggle input { cursor: pointer; }
.search-input {
    flex: 1;
    padding: .7rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .95rem;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(69,130,180,.15); }
.search-input::placeholder { color: var(--text-muted); }
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: .25rem;
    max-height: 400px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .6rem 1rem;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    gap: .75rem;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }
.search-result-main { display: flex; align-items: center; gap: .5rem; min-width: 0; flex: 1; }
.search-result-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-meta { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.search-empty { padding: .75rem 1rem; color: var(--text-muted); font-size: .9rem; }

/* Stats */
/* Kompakte Kacheln (Karl 14.09.2026: "so viele Kacheln, dass es in zwei Zeilen ist … nimmt zu viel
   Platz ein"): Zahl und Beschriftung nebeneinander in einer ~44 px hohen Kachel, Zeile bricht nur
   um, wenn es wirklich nicht passt (7 Kacheln stehen ab ~900 px in einer Reihe). */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: .4rem .5rem .4rem .6rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 44px;
    box-sizing: border-box;
    text-align: left;
    white-space: nowrap;
    border-left: 4px solid;
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
}

a.stat-card, a.stat-card:hover, a.stat-card:visited, a.stat-card * { text-decoration: none !important; color: inherit; cursor: pointer; }
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.stat-open { border-color: var(--danger); }
.stat-card.stat-progress { border-color: var(--warning); }
.stat-card.stat-waiting { border-color: var(--purple); }
.stat-card.stat-closed { border-color: var(--success); }
.stat-card.stat-proposal { border-color: var(--primary); }
.stat-card.stat-dates { border-color: #d97706; }
.stat-card.stat-dates.stat-overdue { border-color: #dc2626; }
.stat-card.stat-dates.stat-overdue .stat-number { color: #b91c1c; }
.stat-card .stat-sub { display: inline-block; margin-left: .3rem; padding: .05rem .4rem; border-radius: 999px; background: #fee2e2; color: #b91c1c; font-size: .72rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
/* Terminliste hinter der Kachel "Termine" (12.09.2026) — gleiche Optik wie Posteingang */
.due-panel { margin-top: -1rem; margin-bottom: 2rem; }
.due-panel .section-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.due-empty { color: var(--text-muted); margin: 0; }
/* Kacheln per Griff umsortieren (12.09.2026) */
.stat-card { position: relative; }
/* Griff seit 14.09. im Fluss am rechten Rand der kompakten Kachel (nicht mehr absolut in der Ecke) */
.drag-grip { order: 9; margin-left: 0; margin-right: -.25rem; width: 18px; height: 22px; padding: 0; border: 0; background: transparent; color: var(--text-muted); cursor: grab; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; touch-action: none; opacity: .55; flex: 0 0 auto; }
.stat-card:hover .drag-grip { opacity: 1; }
.drag-grip:hover { background: var(--bg); color: var(--primary); }
.drag-grip:active { cursor: grabbing; }
.drag-floating { position: fixed !important; z-index: 300; margin: 0; pointer-events: none; box-shadow: 0 12px 32px rgba(0,0,0,.18); opacity: .96; transform: rotate(.6deg); box-sizing: border-box; }
.drag-placeholder { border: 2px dashed var(--primary); border-radius: var(--radius-card); background: var(--bg); opacity: .5; box-sizing: border-box; }
body.dash-dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }

/* Filter-Zustand der Kacheln (2026-08-14): Klick filtert die Ticketliste */
.filter-reset {
    font-size: .8rem;
    font-weight: 400;
    color: var(--primary);
    text-decoration: none;
    margin-left: .6rem;
    white-space: nowrap;
}
.filter-reset::before { content: '\00d7'; margin-right: .25rem; }
.filter-reset:hover { text-decoration: underline; }
.stat-card.stat-active { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--primary), var(--shadow-md); }
.stat-card.stat-active .stat-number { color: var(--text); }

.iss-field { display: flex; gap: .4rem; align-items: center; }
.stat-number { font-size: 1.2rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; line-height: 1; }
.stat-label { font-size: .66rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; line-height: 1.1; }

/* Section */
.section { margin-bottom: 2rem; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: .5rem;
}

.section-header h1, .section-header h2 { margin: 0; }

/* Gruppierung der Tickets nach zustaendigem Mitarbeiter */
.assignee-group { margin-bottom: 2.75rem; }
.assignee-group:first-child { margin-top: .5rem; }
.assignee-group-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--border);
}
.assignee-group-name { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.assignee-group-empty {
    padding: .75rem 1rem;
    color: var(--text-muted);
    font-size: .85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* "Am Zug" — wer gerade handeln muss */
.badge-nextaction { font-weight: 600; }
.badge-nextaction.na-team { background: var(--primary); color: #fff; }
.badge-nextaction.na-kunde { background: #fff4e5; color: #b45309; border: 1px solid #fcd34d; }

/* Ticket list */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .875rem 1rem;
    background: var(--bg-card);
    text-decoration: none;
    color: var(--text);
    transition: background .15s;
    gap: 1rem;
}

.ticket-row:hover { background: var(--primary-light); }
.ticket-row.ticket-closed { opacity: .6; }

.ticket-main {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    flex: 1;
}

.ticket-nr {
    font-family: 'Roboto Mono', 'SF Mono', 'Fira Code', monospace;
    font-size: .8rem;
    color: var(--primary);
    white-space: nowrap;
    font-weight: 600;
    background: var(--primary-light);
    padding: .1rem .4rem;
    border-radius: 4px;
}

.ticket-subject {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

.ticket-time {
    font-size: .8rem;
    color: var(--text-muted);
    min-width: 70px;
    text-align: right;
}

/* Badges */
.badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
}

.badge-lg { font-size: .85rem; padding: .25rem .75rem; }
.badge-customer { background: #64748b; }
.badge-assignee { background: var(--primary-light); color: var(--primary-hover); border: 1px solid var(--lime); }
.badge-msgs { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); font-size: .75rem; }
.badge-admin { background: var(--primary); }
.badge-internal { background: var(--warning); color: #000; }

/* Filters */
.filters { margin-bottom: 1rem; }

.filter-form {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.filter-input, .filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: .5rem .75rem;
    border-radius: 0.375rem;
    font-size: .875rem;
}

.filter-input { flex: 1; min-width: 150px; }
.filter-select { min-width: 130px; }
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(39,91,69,.15); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background .18s, transform .18s;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-secondary:hover { background: #0f201c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #276848; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #963a31; }
.btn-todo { background: #0d9488; color: #fff; }
.btn-todo:hover { background: #0f766e; }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }

/* Inbox / Posteingang */
.inbox-section { margin-bottom: 1.5rem; }
.inbox-section h2 { display: flex; align-items: center; gap: .5rem; }
.inbox-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 600; }
.nav-inbox-link { position: relative; }
.inbox-list { display: flex; flex-direction: column; gap: .5rem; }
.inbox-card { background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--warning); border-radius: var(--radius); padding: 1rem; display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; box-shadow: var(--shadow); }
.inbox-info { flex: 1; min-width: 0; }
.inbox-from { font-size: .9rem; margin-bottom: .25rem; }
.inbox-email { color: var(--text-muted); font-size: .8rem; }
.inbox-direct { display: inline-block; padding: 1px 7px; border-radius: 10px; background: #fef3c7; color: #92400e; font-size: .72rem; font-weight: 600; vertical-align: middle; }
/* Herkunft „Ordner Ticket“ (2026-08-18): von Karl selbst eingelegt, Kunde noch offen */
.inbox-karlmail { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--primary-light); color: var(--primary-hover); font-size: .72rem; font-weight: 600; vertical-align: middle; }
.ticket-time-sum { color: var(--text-muted); font-size: .85rem; white-space: nowrap; align-self: center; }
.todo-done-hint { display: inline-block; padding: 3px 8px; border-radius: 6px; background: #fef3c7; color: #92400e; font-size: .78rem; font-weight: 600; align-self: center; }
.stats-table { min-width: 0; }
.timer-paused-badge { background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 600; }
.ticket-dates { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; width: 100%; }
.ticket-date { display: inline-flex; align-items: center; gap: .35rem; padding: 2px 8px; border-radius: 6px; font-size: .78rem; }
.ticket-date a { text-decoration: none; font-weight: 700; color: inherit; opacity: .7; }
.ticket-date a:hover { opacity: 1; }
.ticket-date.date-open { background: #e0ecf9; color: #1d4ed8; }
.ticket-date.date-overdue { background: #fee2e2; color: #b91c1c; }
.ticket-date.date-done { background: #e5e7eb; color: #6b7280; text-decoration: line-through; }
.ticket-date.date-done a { text-decoration: none; }
.stats-table td a { color: var(--primary); }
.inbox-subject { font-weight: 600; margin-bottom: .25rem; }
.inbox-preview { color: var(--text-muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 600px; }
.inbox-time { color: var(--text-muted); font-size: .8rem; margin-top: .25rem; }
.inbox-actions { display: flex; flex-direction: column; gap: .5rem; flex-shrink: 0; }
.modal-actions { display: flex; gap: .5rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); flex-wrap: nowrap; }
.modal-actions .btn { padding: .5rem .9rem; white-space: nowrap; }
.inbox-search-results { max-height: 300px; overflow-y: auto; margin-top: .5rem; }
.inbox-search-item { padding: .75rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .25rem; cursor: pointer; }
.inbox-search-item:hover { background: var(--bg-hover); }
.inbox-search-hint { color: var(--text-muted); font-size: .85rem; padding: .5rem 0; }
.form-hint { color: var(--success); font-size: .8rem; margin-top: .25rem; }
.modal-wide { max-width: 780px; width: 95%; }
.inbox-preview-header { margin-bottom: 1rem; }
.inbox-preview-header h3 { margin-bottom: .5rem; word-break: break-word; }
.inbox-preview-meta { color: var(--text-muted); font-size: .85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem; }
.inbox-preview-date { white-space: nowrap; }
.inbox-preview-body { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; margin: 1rem 0; max-height: 400px; overflow-y: auto; }
.inbox-preview-iframe { width: 100%; min-height: 200px; max-height: 380px; border: none; background: #fff; border-radius: var(--radius); }
.inbox-preview-text { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: .9rem; padding: 1rem; margin: 0; color: var(--text); }
.inbox-preview-attachments { display: none; margin: .75rem 0; }
.inbox-att-label { font-size: .8rem; color: var(--text-muted); margin-bottom: .5rem; font-weight: 600; }
.inbox-att-item { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .75rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); font-size: .85rem; color: var(--text); text-decoration: none; margin: 0 .25rem .25rem 0; }
.inbox-att-item:hover { background: var(--primary-light); }
.inbox-att-item small { color: var(--text-muted); }
.inbox-att-thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Priority toggle (customer) */
.priority-toggle {
    display: flex;
    gap: .5rem;
}

.priority-option input { display: none; }

.priority-btn {
    display: inline-block;
    padding: .5rem 1.25rem;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    cursor: pointer;
    font-size: .9rem;
    transition: all .15s;
    color: var(--text-muted);
}

.priority-option input:checked + .priority-btn {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.priority-option input:checked + .priority-btn.priority-urgent {
    border-color: var(--danger);
    color: var(--danger);
    background: #fee2e2;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: .35rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: .6rem .75rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: inherit;
}

.form-group textarea { resize: vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(69,130,180,.15);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .875rem;
    cursor: pointer;
    color: var(--warning);
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}

.dropzone-sm { padding: 1rem; }
.dropzone-sm .dropzone-content { gap: .25rem; }
.dropzone-sm .dropzone-content p { font-size: .85rem; }

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone:hover, .dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone.drag-over {
    border-style: solid;
    background: rgba(69,130,180,.12);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    color: var(--text-muted);
    pointer-events: none;
}

.dropzone-content p { margin: 0; font-size: .9rem; }
.dropzone-content small { font-size: .8rem; opacity: .7; }
.dropzone-browse { color: var(--primary); text-decoration: underline; }

/* File preview (after drop) */
.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .5rem;
}

.file-preview:empty { display: none; }

.file-preview-item {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .65rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .8rem;
}

.file-preview-item img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
}

.file-preview-item .remove-file {
    cursor: pointer;
    color: var(--text-muted);
    margin-left: .25rem;
    font-size: 1rem;
    line-height: 1;
}

.file-preview-item .remove-file:hover { color: var(--danger); }

/* Ticket detail */
.ticket-header { margin-bottom: 1.25rem; }

/* Titelzeile: links Titel + Kenndaten, rechts die Werkzeuge (Zeit, Stoppuhr, Aufgabe) */
.ticket-titlebar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: .75rem 1rem;
}

.ticket-title h1 { margin-bottom: .25rem; }
/* Titelblock nimmt die Restbreite, die Werkzeuge bleiben oben rechts; Art/Projekt in eigener Zeile
   unter den Kenndaten (12.09.2026), damit die Kenndaten-Zeile nicht die Werkzeuge nach unten schiebt */
.ticket-title { flex: 1 1 auto; min-width: 0; }   /* kein fester flex-basis: mobil (column) wuerde er zur Mindesthoehe */
/* Admin-Kopf (12.09.2026, Karl): Zeile 1 "Zurück" + Werkzeuge rechts, Zeile 2 Titel + Art/Projekt rechtsbündig */
.ticket-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.ticket-h1row { display: flex; align-items: center; justify-content: space-between; gap: .35rem 1.25rem; flex-wrap: wrap; margin-bottom: .25rem; }
.ticket-h1row h1 { margin-bottom: 0; min-width: 0; flex: 1 1 auto; }
.ticket-classify { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; margin-left: auto; font-size: .85rem; color: var(--text-muted); }
.ticket-h1row.editing .ticket-classify { display: none; }   /* Eingabefeld fuer den Titel bekommt die volle Breite */
/* Titel nachträglich ändern (Admin): Überschrift ist anklickbar, Eingabefeld erscheint an Ort und Stelle */
.ticket-title h1.subject-editable { cursor: text; border-radius: var(--radius); padding: 0 .25rem; margin-left: -.25rem; }
.ticket-title h1.subject-editable:hover,
.ticket-title h1.subject-editable:focus-visible { background: var(--bg-hover); outline: 1px dashed var(--border); }
.subject-edit { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex: 1 1 100%; }
.subject-edit-input { flex: 1 1 320px; min-width: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em;
    padding: .3rem .5rem; border: 1px solid var(--primary); border-radius: var(--radius); background: var(--bg-input); color: var(--text); }

.ticket-tools {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

/* Die Ticket-Eigenschaften stehen als eigene Karte in einem festen Raster —
   vorher lagen sie mit den Werkzeug-Knoepfen in einer Flex-Reihe und brachen
   je nach Fensterbreite unterschiedlich um (Karl 09.09.2026: "durcheinander"). */
.ticket-props {
    display: block;
    margin-top: .75rem;
    padding: .65rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.ticket-props .field-group { min-width: 0; }
/* Zeile 1 als eigenes Raster (19.10.2026, Karl: die Felder nahmen nicht die volle Breite des Kastens ein).
   Vorher war .ticket-props selbst das Raster und Zeile 2 spannte alle Spalten (1 / -1), dadurch blieb bei
   1440 px eine neunte, leere Spalte stehen: auto-fit klappt leere Spalten nur zu, wenn kein Element sie belegt. */
.ticket-props .ticket-props-row1 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));   /* 7 Felder in Zeile 1 auch bei 1100 px (12.09.2026) */
    gap: .5rem .9rem;
}
/* Projekt braucht Platz fuer Auswahl + "+ Neu" */
.ticket-props .field-group-wide { grid-column: span 2; }
/* Datumsfelder als eigene, volle Zeile (Karl 11.09.2026) */
/* Datumsfelder (12.09.2026, Karl): rechtsbuendig in Zeile 2 hinter ISS-Nummer + Verknuepft mit,
   keine eigene Zeile mehr. Ab Spalte 4 (ISS = 1, Verknuepft = 2-3), innen als Flex nach rechts. */
.ticket-props .ticket-props-row2 { margin-top: .5rem; display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem .9rem; min-width: 0; }
.ticket-props .ticket-props-row2 > .field-group { flex: 0 0 auto; }
.ticket-props .ticket-props-row2 > .field-group-wide { flex: 1 1 160px; min-width: 0; }   /* Verknuepft mit: Restbreite fuer die Chips; Basis 160 (vorher 260), damit bei 1024 px neben "Vor Ort" die Datumsfelder in der Zeile bleiben (14.09.) */
.ticket-props .ticket-props-dates { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem .9rem; flex: 0 0 auto; }
.ticket-props .ticket-props-dates .field-group { flex: 0 0 auto; }
.ticket-props .filter-select { min-width: 0; }
.ticket-props .filter-select,
.ticket-props input[type="text"],
.ticket-props input[type="date"] { width: 100%; min-width: 0; }
.ticket-props .project-picker,
.ticket-props .iss-field { display: flex; gap: .35rem; align-items: center; min-width: 0; }
.ticket-props .project-picker .filter-select,
.ticket-props .iss-field input { flex: 1 1 auto; }
.ticket-props .project-picker .btn,
.ticket-props .iss-field .btn { flex: 0 0 auto; }

.ticket-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
/* Erstellt-Kennzeichen (Karl 19.10.2026: "wann Daniela das Ticket erstellt hat, geht unter, das muss ich zu sehr
   suchen"): Datum fett im eigenen Chip in normaler Textfarbe statt grauem Nebensatz, Alter dahinter in Grau. */
.ticket-erstellt { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); font-size: .85rem; white-space: nowrap; }
.ticket-erstellt strong { font-weight: 700; }
.ticket-erstellt .ticket-erstellt-alt { color: var(--text-muted); }

/* Kundenansicht: Status-/Prioritaets-Abzeichen rechts neben dem Titel */
.ticket-actions {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-left: auto;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: .85rem;
    display: inline-block;
    margin-bottom: .5rem;
}

.back-link:hover { color: var(--primary); }

/* Messages */
.messages {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: 2rem;
}

.message {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    border-left: 3px solid var(--border);
    position: relative;
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    box-shadow: var(--shadow);
}

.msg-footer {
    margin-top: .5rem;
    padding-top: .4rem;
    border-top: 1px solid var(--border);
}
.msg-edit-link {
    font-size: .8rem;
    color: var(--text-muted);
    text-decoration: none;
}
.msg-edit-link:hover { color: var(--primary); }

.msg-edit-panel {
    margin-top: .5rem;
    padding: .6rem .8rem;
    background: var(--bg);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.msg-edit-toggle {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: var(--text);
    cursor: pointer;
}
.msg-edit-toggle input { cursor: pointer; }

.message-admin { border-left-color: var(--primary); }
.message-customer { border-left-color: var(--success); }
.message-internal { border-left-color: var(--warning); background: #fef3c7; }

.message-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
    font-size: .85rem;
}

.message-time { color: var(--text-muted); margin-left: auto; }

.message-body {
    font-size: .9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-attachments {
    margin-top: .75rem;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.attachment {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .8rem;
    color: var(--primary);
    text-decoration: none;
}

.attachment:hover { background: var(--primary-light); }

/* Image preview in messages */
.attachment-image {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    max-width: 320px;
}

.image-preview-link {
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: border-color .15s;
}

.image-preview-link:hover { border-color: var(--primary); }

.image-preview-link img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 240px;
    object-fit: cover;
}

.attachment-name {
    font-size: .75rem;
    color: var(--text-muted);
}

/* Reply form */
.reply-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
/* Ticket description (first message) */
.ticket-description { background: var(--bg-card); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem; border-left: 4px solid var(--primary); border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: var(--shadow); }
.ticket-description::before { content: 'Beschreibung'; display: block; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); margin-bottom: .5rem; }
.ticket-description-body { font-size: .95rem; line-height: 1.7; color: var(--text); }

.reply-form-compact { padding: .75rem 1rem; margin-bottom: 1rem; }
.reply-form-compact textarea { min-height: unset; }
.reply-form-bottom { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.reply-form-left { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* Alle Sendewege in EINER Gruppe: die Sonderwege dezent, "Antworten" als
   einzige eingefaerbte Hauptaktion ganz rechts. */
.reply-send { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-left: auto; }
.reply-send-label { font-size: .75rem; color: var(--text-muted); margin-right: .1rem; }
.reply-send-sep { width: 1px; align-self: stretch; min-height: 1.6rem; background: var(--border); margin: 0 .35rem; }
.btn-alt { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.btn-alt:hover { background: var(--primary-light); border-color: var(--lime); color: var(--text); }
.dropzone-inline { border: none; padding: 0; position: relative; cursor: pointer; display: inline-flex; }
.dropzone-inline input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone-inline .dropzone-label { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--text-muted); cursor: pointer; }
.dropzone-inline .dropzone-label:hover { color: var(--primary); }
textarea.drag-over { border-color: var(--primary); background: var(--primary-light); }

/* Assignee dialog after reply */
.assignee-dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; padding: 1rem; box-sizing: border-box; z-index: 1000; }
.assignee-dialog { background: var(--bg-card); border-radius: var(--radius); padding: 1.25rem; min-width: 280px; max-width: 360px; box-shadow: var(--shadow-md); }
.assignee-dialog p { margin: 0 0 .5rem; font-weight: 600; }
.assignee-dialog .assignee-current { font-weight: 400; font-size: .85rem; color: var(--text-muted); margin-bottom: .75rem; }
.assignee-dialog select { width: 100%; margin-bottom: .75rem; }
.assignee-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.badge-waiting { background: #8b5cf6; color: #fff; }
.due-date-options { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .75rem; }
.due-date-option { display: flex; align-items: center; gap: .4rem; cursor: pointer; padding: .3rem .5rem; border-radius: var(--radius); font-size: .9rem; }
.due-date-option:hover { background: var(--primary-light); }
.due-date-option input { margin: 0; }

.reply-form h3 { margin-bottom: 1rem; font-size: 1rem; }

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.card h3 { margin-bottom: .5rem; }
.card-meta { font-size: .85rem; color: var(--text-muted); margin-bottom: .75rem; }
.card-meta span { display: block; }
.card-stats { display: flex; gap: 1rem; font-size: .85rem; }
.card-stat-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.card-stat-link:hover { text-decoration: underline; }

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.data-table th, .data-table td {
    padding: .625rem .75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
}

.data-table th { background: #f9fafb; color: var(--text-muted); font-weight: 600; font-size: .8125rem; text-transform: uppercase; border-bottom: 2px solid var(--border); }
.data-table tr:hover td { background: var(--primary-light); }
.data-table tr:last-child td { border-bottom: none; }
.row-inactive { opacity: .5; }
/* Dropdown „Verwaltung" im Header + Aktionsmenü in Tabellen (Karl 09.09.2026) */
.nav-dd { position: relative; display: inline-flex; align-items: center; }
.nav-dd-btn { display: inline-flex; align-items: center; gap: .45rem; background: none; border: 0; cursor: pointer; font: inherit; font-size: .875rem; font-weight: 550; color: var(--text); padding: .4rem .6rem; border-radius: var(--radius); transition: all .15s; white-space: nowrap; }
.nav-dd-btn:hover, .nav-dd.open .nav-dd-btn { background: var(--primary-light); }
.nav-dd.active .nav-dd-btn { background: var(--lime); }
.nav-chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .7; transition: transform .15s; }
.nav-dd.open .nav-chev { transform: rotate(180deg); }
.nav-dd-menu { display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 210px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 30px rgba(21,44,40,.12); padding: .35rem; flex-direction: column; gap: 2px; z-index: 120; }
.nav-dd.open .nav-dd-menu { display: flex; }
.nav-dd-menu a { padding: .55rem .75rem; border-radius: 8px; }
.act-menu { position: relative; display: inline-flex; }
.act-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 30px; padding: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; color: var(--text); }
.act-menu-btn:hover, .act-menu.open .act-menu-btn { background: var(--primary-light); border-color: var(--lime); }
.act-menu-btn svg { width: 18px; height: 18px; fill: currentColor; }
.act-menu-list { display: none; position: fixed; min-width: 190px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 30px rgba(21,44,40,.14); padding: .35rem; flex-direction: column; gap: 2px; z-index: 130; }
.act-menu.open .act-menu-list { display: flex; }
.act-menu-list button { display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: .55rem .75rem; font: inherit; font-size: .875rem; font-weight: 500; color: var(--text); cursor: pointer; }
.act-menu-list button:hover { background: var(--primary-light); }
.act-menu-list button.act-danger { color: var(--danger); }
.act-menu-list button.act-danger:hover { background: #fbeae8; }
.user-actions { display: flex; gap: .35rem; flex-wrap: nowrap; align-items: center; white-space: nowrap; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,.15);
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-header h2 { margin: 0; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.field-group { display: flex; flex-direction: column; gap: .2rem; }
.field-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.status-select { border: 2px solid var(--border); border-radius: 6px; padding: .35rem .5rem; }
.status-select option { background: var(--bg-card); color: var(--text); font-weight: 400; }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay .modal-content { max-width: 550px; }
.modal-overlay .modal-header h3 { margin: 0; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Alerts */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 1rem; }

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2.25rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(21,44,40,.06);
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    height: 34px;
    width: auto;
    margin-bottom: 1rem;
}
.login-eyebrow { display: flex; align-items: center; justify-content: center; gap: .5rem; font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: .25rem; }
.login-eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }

/* Rich Text Editor */
.editor-toolbar {
    display: flex;
    gap: 2px;
    padding: 4px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    flex-wrap: wrap;
}
.editor-toolbar button {
    background: none;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: .8rem;
    color: var(--text);
    line-height: 1.2;
}
.editor-toolbar button:hover { background: var(--bg-hover); border-color: var(--border); }
.toolbar-sep { width: 1px; background: var(--border); margin: 2px 4px; }
.reply-editor {
    min-height: 60px;
    max-height: 300px;
    overflow-y: auto;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--bg-input);
    font-size: .9rem;
    line-height: 1.5;
    outline: none;
}
.reply-editor:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(39,91,69,.15); }
.reply-editor:empty:before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}
.reply-editor ul, .reply-editor ol { margin: .25rem 0; padding-left: 1.5rem; }
.reply-editor li { margin-bottom: .1rem; }
/* Absatzabstand wie in der Mail (mailLayout: 12px), damit der Editor zeigt, was rausgeht (Karl 19.10.2026) */
.reply-editor p, .message-body p, .ticket-description-body p { margin: 0 0 .75rem; }
.reply-editor p:last-child, .message-body p:last-child, .ticket-description-body p:last-child { margin-bottom: 0; }
.message-body ul, .message-body ol { margin: .25rem 0; padding-left: 1.5rem; }
.message-body li { margin-bottom: .1rem; }
.ticket-description-body ul, .ticket-description-body ol { margin: .25rem 0; padding-left: 1.5rem; }
.ticket-description-body li { margin-bottom: .1rem; }

.login-header h1 { font-size: 1.5rem; margin: .5rem 0 .25rem; }
.login-header p { color: var(--text-muted); font-size: .9rem; }

/* Utility */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

/* Timer */
.timer-section {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.timer-running {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.timer-subtask {
    font-size: .8rem; color: var(--text-muted); max-width: 240px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.timer-subtask:empty { display: none; }

.timer-display {
    font-family: 'Roboto Mono', 'SF Mono', 'Fira Code', monospace;
    font-size: .9rem;
    font-weight: 600;
    color: var(--success);
    min-width: 70px;
}

/* Stoppuhr des geoeffneten Tickets in der Kopfzeile, links neben dem Namen (Karl 12.09.2026) */
.nav-user .timer-section { gap: .4rem; }
.nav-user .timer-running { gap: .4rem; }
.nav-user .timer-subtask { max-width: 160px; }   /* Navbar ist hell — Standardfarben passen */
.nav-timer {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: .75rem;
    color: var(--primary-hover);
    padding: .2rem .5rem;
    background: var(--lime);
    border-radius: 20px;
    animation: timer-pulse 2s ease-in-out infinite;
}

/* Uhr fuehrt zum Ticket, der Knopf daneben stoppt von JEDER Seite aus — vorher ging
   Stoppen nur auf der Ticket-Detailseite (Vorfall vergessener Timer, 20.08.2026). */
.nav-timer > a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.nav-timer > a:hover { text-decoration: underline; }
/* Ticketnummer in der kleinen Uhr (23.09.2026) — welche Uhr ist das? */
.nav-timer-nr { font-weight: 700; margin-right: .35rem; }
/* Beschriftung der grossen Uhr des geoeffneten Tickets (23.09.2026) */
.timer-ticket { font-size: .75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
/* Gemessen 23.09.: mit zwei laufenden Uhren sprengen die Zusaetze die Kopfzeile bis 1440px
   (navRight 1471 bei 1400px) — darunter ausblenden, die Nummer bleibt im Tooltip der Uhr. */
@media (max-width: 1500px) {
    .nav-timer-nr, .timer-ticket { display: none; }
}
.nav-timer-stop {
    border: 0;
    background: var(--primary);
    color: #fff;
    font-size: .6rem;
    line-height: 1;
    padding: .25rem .4rem;
    border-radius: 20px;
    cursor: pointer;
}
.nav-timer-stop:hover { background: var(--primary-hover); }
.nav-timer-stop:disabled { opacity: .5; cursor: default; }

@keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

/* lexoffice suggestions */
.lexoffice-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.lexoffice-chip {
    transition: all .15s;
}

.lexoffice-chip.chip-active {
    background: var(--primary) !important;
    color: #fff !important;
}

/* Burger button - hidden on desktop.
   2026-08-14: Balken waren var(--text) (fast schwarz) auf der dunklen Navbar —
   praktisch unsichtbar. Jetzt weiss, dicker und mit 44px-Tippflaeche. */
.burger {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    padding: .45rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 44px;
    min-height: 40px;
    transition: background .15s;
}

.burger:hover, .burger.active { background: var(--primary-light); }

.burger span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--text);
    border-radius: 2px;
    transition: all .2s;
}

.burger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }

.nav-logout-mobile { display: none; }

/* Mobile — Breakpoint 950px, damit auch iPhone quer (844–932px) erfasst wird */
/* Zwischenstufe: unter 1300px Wortmarke und Namens-Badge einsparen, damit die Icon-Navigation
   bis ~1000px in eine Zeile passt (gemessen 09.09.2026: 1224px voll, 994px reduziert). */
@media (max-width: 1300px) {
    .nav-brand span, .user-badge { display: none; }
}
/* 1001–1100 px: Menuepunkte nur als Icon, sonst schiebt die laufende Stoppuhr "Abmelden" aus dem Bild
   (gemessen 12.09.2026: 1024 px laufend = 11 px Ueberlauf). Der Posteingang-Zaehler bleibt. */
/* Nur 1001-1100 px (15.10.2026): vorher galt die Regel auch im Burger-Menue, dort fehlten alle Beschriftungen */
@media (min-width: 1001px) and (max-width: 1100px) {
    .nav-links > a > span:not(.inbox-badge), .nav-dd-btn > span { display: none; }
}
@media (max-width: 1000px) {
    /* Burger rechts aussen (Karl 14.08.: „soll rechts sein") */
    .burger { display: flex; order: 5; margin-left: auto; }

    .navbar {
        padding: 0 .75rem;
        gap: .5rem;
    }

    .nav-brand span { display: none; }

    /* Menue haengt als eigenes Panel UNTER der Navbar (absolut positioniert),
       statt sich per flex-wrap in die 56px hohe Navbar zu quetschen — das hat
       den Burger nach unten ins Seiteninnere geschoben und das Panel quer
       ueber den Inhalt gelegt (Karl 14.08.: „Menü passt nicht"). */
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: auto;
        flex-direction: column;
        padding: 0;
        gap: 0;
        background: var(--bg);
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 24px rgba(21,44,40,.08);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .nav-links.open { display: flex; }

    .nav-links a {
        padding: .9rem 1rem;
        font-size: .95rem;
        border-radius: 0;
        color: var(--text);
        border-bottom: 1px solid var(--border);
    }

    .nav-links a:last-child { border-bottom: none; }

    /* Aktive Seite: vorher var(--bg-hover) = fast weiss hinter weisser
       Schrift -> unlesbar. Jetzt dunkelblau mit Akzentbalken. */
    .nav-links a.active {
        background: var(--lime);
        color: var(--text);
        box-shadow: inset 3px 0 0 var(--primary);
    }

    .nav-links a.nav-logout-mobile, .nav-logout-mobile {
        display: flex;
        color: var(--danger) !important;
        font-weight: 600;
        border-top: 1px solid var(--border);
        margin-top: 0;
    }

    /* Der Benutzer-Block verschwindet mobil — die laufende Stoppuhr aber NICHT: sonst
       waere sie samt Stopp-Knopf genau auf dem Geraet unerreichbar, mit dem Karl abends
       nachsieht (20.08.2026). Sie rueckt vor den Burger, der Name bleibt ausgeblendet. */
    .nav-user { display: none; }
    .nav-user.has-timer {
        display: inline-flex;
        margin-left: auto;
        margin-right: .5rem;
    }
    .nav-user.has-timer .user-badge,
    .nav-user.has-timer .logout-btn { display: none; }
    .nav-user.has-ticket-timer { display: inline-flex; margin-left: auto; margin-right: .5rem; }
    .nav-user.has-ticket-timer .user-badge,
    .nav-user.has-ticket-timer .logout-btn,
    .nav-user.has-ticket-timer .timer-subtask { display: none; }

    /* Fingerfreundlicher Stopp-Knopf (Touch-Ziel), Uhr etwas groesser */
    .nav-timer { font-size: .8rem; padding: .25rem .35rem .25rem .6rem; }
    .nav-timer-stop { min-width: 32px; min-height: 32px; font-size: .7rem; }
    .nav-timer-nr, .timer-ticket { display: none; }   /* mobil zu breit; Nummer bleibt im Tooltip */

    .nav-links { align-items: stretch; }
    /* Dropdown im Panel flach ausrollen: Gruppentitel + eingerückte Einträge */
    .nav-dd { display: block; }
    .nav-dd-btn { pointer-events: none; width: 100%; padding: .8rem 1rem .3rem; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); background: none !important; }
    .nav-dd .nav-chev { display: none; }
    .nav-dd-menu { display: flex; position: static; border: 0; box-shadow: none; padding: 0 0 .25rem .75rem; background: transparent; min-width: 0; }
    .nav-sep { width: auto; height: 0; margin: 0; border-top: 1px solid var(--border); }
    .nav-links a.nav-cta { margin: .6rem 1rem; border-radius: 7px; justify-content: center; border-bottom: 0; }
}
@media (max-width: 950px) {
    /* Burger rechts aussen (Karl 14.08.: „soll rechts sein") */
    .burger { display: flex; order: 5; margin-left: auto; }

    .navbar {
        padding: 0 .75rem;
        gap: .5rem;
    }

    .nav-brand span { display: none; }

    /* Menue haengt als eigenes Panel UNTER der Navbar (absolut positioniert),
       statt sich per flex-wrap in die 56px hohe Navbar zu quetschen — das hat
       den Burger nach unten ins Seiteninnere geschoben und das Panel quer
       ueber den Inhalt gelegt (Karl 14.08.: „Menü passt nicht"). */
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: auto;
        flex-direction: column;
        padding: 0;
        gap: 0;
        background: var(--bg);
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 24px rgba(21,44,40,.08);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .nav-links.open { display: flex; }

    .nav-links a {
        padding: .9rem 1rem;
        font-size: .95rem;
        border-radius: 0;
        color: var(--text);
        border-bottom: 1px solid var(--border);
    }

    .nav-links a:last-child { border-bottom: none; }

    /* Aktive Seite: vorher var(--bg-hover) = fast weiss hinter weisser
       Schrift -> unlesbar. Jetzt dunkelblau mit Akzentbalken. */
    .nav-links a.active {
        background: var(--lime);
        color: var(--text);
        box-shadow: inset 3px 0 0 var(--primary);
    }

    .nav-links a.nav-logout-mobile, .nav-logout-mobile {
        display: flex;
        color: var(--danger) !important;
        font-weight: 600;
        border-top: 1px solid var(--border);
        margin-top: 0;
    }

    /* Der Benutzer-Block verschwindet mobil — die laufende Stoppuhr aber NICHT: sonst
       waere sie samt Stopp-Knopf genau auf dem Geraet unerreichbar, mit dem Karl abends
       nachsieht (20.08.2026). Sie rueckt vor den Burger, der Name bleibt ausgeblendet. */
    .nav-user { display: none; }
    .nav-user.has-timer {
        display: inline-flex;
        margin-left: auto;
        margin-right: .5rem;
    }
    .nav-user.has-timer .user-badge,
    .nav-user.has-timer .logout-btn { display: none; }
    .nav-user.has-ticket-timer { display: inline-flex; margin-left: auto; margin-right: .5rem; }
    .nav-user.has-ticket-timer .user-badge,
    .nav-user.has-ticket-timer .logout-btn,
    .nav-user.has-ticket-timer .timer-subtask { display: none; }

    /* Fingerfreundlicher Stopp-Knopf (Touch-Ziel), Uhr etwas groesser */
    .nav-timer { font-size: .8rem; padding: .25rem .35rem .25rem .6rem; }
    .nav-timer-stop { min-width: 32px; min-height: 32px; font-size: .7rem; }
    .nav-timer-nr, .timer-ticket { display: none; }   /* mobil zu breit; Nummer bleibt im Tooltip */

    .container { padding: .75rem; }

    .stats-grid { gap: .4rem; }
    .stat-card { padding: .35rem .55rem .35rem .6rem; min-height: 40px; }
    .stat-number { font-size: 1.1rem; }

    .ticket-row { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .ticket-meta { flex-wrap: wrap; }

    .ticket-titlebar { flex-direction: column; gap: .5rem; }

    /* Ticket fields as 2-column grid on mobile */
    .ticket-props { padding: .7rem .75rem; }
    .ticket-props .ticket-props-row1 {
        grid-template-columns: 1fr 1fr;
        gap: .5rem;
    }
    .ticket-props .field-group-wide { grid-column: span 2; }
    .ticket-props .field-group select,
    .ticket-props .field-group input { width: 100%; font-size: .8rem; }
    /* Felder mit Personennamen ("Daniela Klomann (VATTER)") brauchen die volle
       Breite, sonst schneidet das Auswahlfeld den Namen ab (Karl 2026-09-10). */
    .ticket-props .field-group.fg-name { grid-column: span 2; }
    .ticket-props .ticket-props-dates { margin-left: 0; width: 100%; justify-content: flex-start; }
    .ticket-tools {
        margin-left: 0;
        justify-content: flex-start;
        flex-wrap: wrap; /* Zeitsumme + Stoppuhr + Aufgaben-Knopf passen sonst nicht in schmale Viewports */
    }
    .ticket-time-sum { white-space: normal; }
    .reply-send { margin-left: 0; width: 100%; }
    .reply-send .btn[type="submit"], .reply-send button[type="submit"] { margin-left: auto; }
    .reply-send-sep { display: none; }

    .filter-form { flex-direction: column; }
    .filter-input, .filter-select { width: 100%; }

    .welcome-steps { flex-direction: column; }
    .attachment-image { max-width: 100%; }

    /* Section header */
    .section-header { flex-direction: column; align-items: flex-start; }

    /* Data table responsive — Tabelle selbst horizontal scrollbar, statt die Seite zu sprengen
       (z. B. Benutzer-Übersicht lief auf dem iPhone über den rechten Rand). */
    .data-table { font-size: .8rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table th, .data-table td { padding: .5rem .4rem; }
    html, body { overflow-x: hidden; overflow-x: clip; }

    /* Modal */
    .modal-content { width: 95%; padding: 1rem; }
    .modal-overlay .modal-content { max-width: none; }
    .form-row { flex-direction: column; gap: .5rem; }

    /* Reply form */
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }
    .form-actions .filter-select { width: 100%; }
    .form-actions .checkbox-label { width: 100%; }

    /* Ticket info */
    .ticket-info { flex-direction: column; align-items: flex-start; gap: .25rem; }
    .ticket-erstellt { display: inline-block; white-space: normal; line-height: 1.35; }

    /* Message edit panel */
    .msg-edit-panel { flex-direction: column; gap: .5rem; }
    .msg-footer { margin-top: .35rem; }

    /* Ticket list */
    .ticket-nr { font-size: .75rem; }
    .ticket-subject { font-size: .85rem; }
    .badge { font-size: .7rem; padding: .15rem .4rem; }

    /* Search */
    .search-results { left: 0; right: 0; max-height: 60vh; }

    /* Ticket title */
    .ticket-title h1 { font-size: 1.1rem; word-break: break-word; }
    .ticket-info { font-size: .75rem; }

    /* Dropzone smaller on mobile */
    .dropzone-sm .dropzone-content p { font-size: .8rem; }

    /* Reply form textarea */
    .reply-form textarea { font-size: .9rem; }

    /* Dashboard inbox */
    .inbox-item { flex-direction: column; }

    /* Customer view badges */
    .badge-lg { font-size: .75rem; padding: .3rem .6rem; }

    /* Inbox mobile */
    .inbox-card { flex-direction: column; }
    .inbox-actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
    .inbox-actions .btn { flex: 1; text-align: center; }
    .inbox-preview { white-space: normal; max-width: 100%; }

}

@media (max-width: 480px) {
    .stats-grid { gap: .35rem; }
    .stat-card { padding: .3rem .5rem .3rem .55rem; min-height: 38px; }
    .stat-number { font-size: 1.05rem; }
    .stat-label { font-size: .64rem; letter-spacing: .06em; }

    .editor-toolbar .btn-ai { font-size: 11px; padding: 3px 8px; }

    h1 { font-size: 1.25rem; }

    .message { padding: .75rem; }
    .message-body { font-size: .85rem; }
}

/* KI-Assistent */
.toolbar-grow { flex: 1 1 auto; }
.editor-toolbar .btn-ai {
    background: #f0f4ff;
    color: #3b5998;
    border: 1px solid #c5d4f0;
    font-size: 12px;
    padding: 3px 9px;
}
.editor-toolbar .btn-ai:hover:not(:disabled) { background: #e0e8ff; border-color: #a8bce8; }
.editor-toolbar .btn-ai:disabled { opacity: .45; cursor: not-allowed; }

.btn-ai {
    background: #f0f4ff;
    color: #3b5998;
    border: 1px solid #c5d4f0;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all .15s;
}
.btn-ai:hover:not(:disabled) {
    background: #dbe4f8;
    border-color: #3b5998;
}
.btn-ai:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Ticket-Tabelle (2026-08-12): Spalten mit Überschriften statt Badge-Reihen.
   Alte .ticket-row/.ticket-list-Styles bleiben für die Dashboard-Suche erhalten. */
.table-scroll { overflow-x: auto; border-radius: var(--radius); }
.ticket-table { min-width: 820px; }
.ticket-table .ticket-tr { cursor: pointer; }
.ticket-table td { vertical-align: middle; white-space: nowrap; }
.ticket-table .tt-subject { font-weight: 500; white-space: normal; min-width: 220px; max-width: 420px; }
.ticket-table .tt-nr a { text-decoration: none; }
.ticket-table .tt-msgs { font-size: .75rem; color: var(--text-muted); margin-left: .4rem; white-space: nowrap; }
.ticket-table .tt-time { color: var(--text-muted); font-size: .8rem; }
/* Alter seit Erstellung (2026-08-14): Ampel — bis 7 Tage unauffaellig,
   bis 30 Tage orange, darueber rot, damit Liegenbleiber sofort auffallen. */
.ticket-table .tt-age { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.ticket-table .tt-age.age-fresh { color: var(--text-muted); }
.ticket-table .tt-age.age-mid { color: var(--warning); }
.ticket-table .tt-age.age-old { color: var(--danger); }
.ticket-table .tt-age.age-none { color: var(--text-muted); }
.ticket-table .tt-empty { color: var(--text-muted); }
.ticket-table tr.ticket-closed td { opacity: .6; }
.assignee-group .table-scroll { margin-top: .25rem; }

/* Festes Spaltenraster (Karl 08.10.2026): alle Ticket-Tabellen einer Seite teilen dieselben Prozentbreiten,
   damit "Alter" unter "Alter" steht. Nur ab 951 px (darunter Kartenansicht). Betreff bekommt den Rest. */
@media (min-width: 951px) {
    .ticket-table.tt-fixed { table-layout: fixed; }
    .ticket-table.tt-fixed .col-nr { width: 10%; }
    .ticket-table.tt-fixed .col-age { width: 6%; }
    .ticket-table.tt-fixed .col-status { width: 16%; }
    .ticket-table.tt-fixed .col-amzug { width: 14%; }
    .ticket-table.tt-fixed .col-prio { width: 7%; }
    .ticket-table.tt-fixed .col-kunde { width: 8%; }
    .ticket-table.tt-fixed .col-bearb { width: 9%; }
    .ticket-table.tt-fixed .col-time { width: 10%; }
    .ticket-table.tt-fixed .tt-subject { min-width: 0; max-width: none; }
    .ticket-table.tt-fixed td { overflow-wrap: anywhere; }
    .ticket-table.tt-fixed .badge-nextaction { white-space: normal; }
}
/* 951-1340 px: Prozentbreiten wuerden die Ticketnummer abschneiden, deshalb feste Pixel fuer die schmalen
   Spalten; Betreff nimmt den Rest (kein Seitwaertsscrollen, Karl 10.09.2026 bleibt erhalten). */
@media (min-width: 951px) and (max-width: 1340px) {
    .ticket-table.tt-fixed .col-nr { width: 112px; }
    .ticket-table.tt-fixed .col-age { width: 62px; }
    .ticket-table.tt-fixed .col-status { width: 160px; }
    .ticket-table.tt-fixed .col-amzug { width: 140px; }
    .ticket-table.tt-fixed .col-prio { width: 78px; }
    .ticket-table.tt-fixed .col-kunde { width: 82px; }
    .ticket-table.tt-fixed .col-bearb { width: 100px; }
    .ticket-table.tt-fixed .col-time { width: 112px; }
}

/* „Ich bin am Zug": meine Tickets, wo ich als Nächstes handeln muss (offen/in Bearbeitung).
   Blaue Akzentleiste links + zarter Tint, damit sie in meiner Gruppe sofort auffallen.
   Desktop = Tabellenzeile, Mobil = Karte (Parallel-Feature ≤950px). */
/* Favoriten-Stern (Karl 15.09.2026): gold = Favorit. Setzen auf der Ticketseite (Stern vor dem Titel);
   in den Listen steht nur der goldene Stern am Betreff (Klick entfernt ihn), sonst kein Zeichen/Platz. */
.fav-star { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; line-height: 1; color: #c9ced6; font-size: 1.05rem; font-family: inherit; flex: 0 0 auto; }
.fav-star:hover, .fav-star:focus-visible { color: #e0a800; }
.fav-star.on { color: #e0a800; }
.fav-star:disabled { opacity: .5; cursor: wait; }
.assignee-group.assignee-group-fav { margin-bottom: 1.5rem; }
/* Entwurf liegt bereit (Karl 29.09.2026): Block unter den Favoriten + Kennzeichen am Betreff */
.assignee-group.assignee-group-entwurf { margin-bottom: 1.5rem; }
.tt-entwurf {
    margin-left: .4rem; font-size: .75rem;
    padding: .05rem .4rem; border-radius: 10px;
    background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
    /* bewusst umbrechbar: "Entwurf Umsetzungs-Agent 29.09." am Stueck (nowrap) trieb die Tabelle
       bei 1024 px um 41 px in die Breite (gemessen 29.09.2026). inline-block: das Kennzeichen
       rutscht als Ganzes in die naechste Zeile, statt mitten im Text zu zerreissen. */
    display: inline-block; max-width: 100%; white-space: normal;
}
.assignee-group-fav .assignee-group-name .fav-star { cursor: default; font-size: 1.1rem; }
.ticket-h1main { display: flex; align-items: baseline; gap: .45rem; flex: 1 1 auto; min-width: 0; }
.ticket-h1main .fav-star { font-size: 1.4rem; }
.ticket-h1row.editing .ticket-h1main { flex-basis: 100%; }
.ticket-h1row.editing .fav-star { display: none; }
.ticket-table .fav-star-list { margin-left: .15rem; font-size: 1rem; vertical-align: -1px; }
.ticket-table .fav-star-list:not(.on) { display: none; }
.ticket-table tr.ticket-myturn td { background: #eaf3fb; }
.ticket-table tr.ticket-myturn td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.ticket-table tr.ticket-myturn:hover td { background: #dcebf8; }

/* 951-1340 px: lieber kompakter setzen als die Tabelle seitwaerts scrollen lassen
   -- sonst rutscht "Aktualisiert" aus dem Bild (Karl 2026-09-10). Obergrenze 23.09. von 1200 auf 1340,
   weil die volle Tabelle inzwischen 1261 px braucht (Container bei 1340 px Fenster = 1292 px). */
@media (min-width: 951px) and (max-width: 1340px) {
    .ticket-table { font-size: .85rem; }
    .ticket-table th, .ticket-table td { padding: .5rem .4rem; }
    .ticket-table .tt-subject { min-width: 150px; max-width: 320px; }
    .ticket-table .badge { font-size: .7rem; padding: .2rem .45rem; }
    .ticket-table .tt-time { font-size: .75rem; }
}

/* Letzte Stufe vor der Kartenansicht (951-1000 px) */
@media (min-width: 951px) and (max-width: 1000px) {
    .ticket-table { font-size: .8rem; }
    .ticket-table .tt-subject { min-width: 100px; max-width: 260px; }
    .ticket-table th, .ticket-table td { padding: .45rem .3rem; }
    /* laengere Namen im "Am Zug"-Kennzeichen duerfen hier umbrechen */
    .ticket-table .badge-nextaction { white-space: normal; }
}

@media (max-width: 950px) {
    /* Ticket-Tabelle mobil als Karten (2026-08-14, Karl-Feedback: Dashboard
       musste auf dem iPhone seitwärts gescrollt werden). Kein Seitwärts-Scrollen
       mehr — jede Zeile wird eine Karte, die Spaltenüberschriften wandern als
       Label vor die Werte (data-label), damit die 2026-08-12 gewünschte
       Beschriftung erhalten bleibt. */
    .table-scroll { overflow-x: visible; }
    .ticket-table {
        display: block;
        min-width: 0;
        width: 100%;
        overflow-x: visible;
        border: none;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        font-size: .85rem;
    }
    .ticket-table thead { display: none; }
    .ticket-table tbody { display: block; }
    .ticket-table tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        padding: .6rem .75rem;
        margin-bottom: .5rem;
    }
    .ticket-table tr:hover td { background: transparent; }
    /* „Ich bin am Zug" als Karte: Akzentleiste links + Tint direkt auf der Karte */
    .ticket-table tr.ticket-myturn { border-left: 3px solid var(--primary); background: #eaf3fb; }
    .ticket-table tr.ticket-myturn td { background: transparent; }
    .ticket-table td {
        display: block;
        width: auto;
        min-width: 0;
        border-bottom: none;
        padding: .1rem 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .ticket-table .tt-subject {
        min-width: 0;
        max-width: none;
        font-weight: 600;
        font-size: .95rem;
        padding-bottom: .35rem;
    }
    .ticket-table td[data-label] {
        display: flex;
        align-items: baseline;
        gap: .5rem;
    }
    .ticket-table td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 5.5rem;
        color: var(--text-muted);
        font-size: .72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .02em;
    }
    /* Lange Namen (waiting_for/Bearbeiter, bis 100 Zeichen) müssen umbrechen —
       sonst würde das nowrap-Badge im Flex-Row abgeschnitten (Codex-Befund). */
    .ticket-table td[data-label] > * { min-width: 0; }
    .ticket-table td[data-label] .badge { white-space: normal; overflow-wrap: anywhere; }
    .ticket-table .tt-msgs { margin-left: .3rem; white-space: normal; }
}

/* Benutzerliste mobil als Karten (Karl 2026-09-10: "auf dem Smartphone muss es
   passen") -- dieselbe Machart wie die Ticket-Tabelle, sonst waeren Rolle, Status
   und die Aktionen nur per Seitwaerts-Scrollen erreichbar. */
@media (max-width: 950px) {
    .user-table { display: block; width: 100%; overflow-x: visible; border: none;
        background: transparent; box-shadow: none; font-size: .85rem; }
    .user-table thead { display: none; }
    .user-table tbody { display: block; }
    .user-table tr { display: block; background: var(--bg-card); border: 1px solid var(--border);
        border-radius: var(--radius); box-shadow: var(--shadow); padding: .6rem .75rem; margin-bottom: .5rem; }
    .user-table td { display: flex; align-items: baseline; gap: .5rem; width: auto;
        border-bottom: none; padding: .1rem 0; white-space: normal; overflow-wrap: anywhere; }
    .user-table td::before { content: attr(data-label); flex: 0 0 6.5rem; color: var(--text-muted);
        font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
    .user-table td > * { min-width: 0; }
    .user-table .ut-name { font-weight: 600; font-size: .95rem; }
    .user-table .user-actions { padding-top: .45rem; }
}

/* Wiedervorlagen-Block im Dashboard (2026-08-17, 2. Anlauf): flexible Zeilen-Liste
   statt Tabelle — scrollt nie seitlich, der Betreff bekommt die volle Restbreite */
.due-list { display: flex; flex-direction: column; gap: 8px; }
.due-item { display: flex; align-items: center; gap: 14px; background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 10px; padding: 10px 14px; }
.due-item.due-overdue { border-left-color: #dc2626; }
.due-when { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 118px; }
.due-date { font-weight: 600; white-space: nowrap; }
.due-main { flex: 1; min-width: 0; }
.due-title { display: block; color: var(--text); text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-title:hover { color: var(--primary); }
.due-meta { color: var(--text-muted); font-size: .85rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.due-badge-over { background: #fee2e2; color: #b91c1c; }
.badge.due-badge-soon { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.due-done { flex: none; }
@media (max-width: 950px) {
  .due-item { flex-wrap: wrap; gap: 8px; }
  /* Datum+Badge als erste Zeile, Titel/Meta auf voller Breite darunter — sonst
     quetscht flex den Titel neben due-when in eine schmale Spalte */
  .due-when { flex-direction: row; align-items: center; min-width: 0; width: 100%; }
  .due-main { flex: 1 1 100%; }
  .due-title, .due-meta { white-space: normal; overflow-wrap: anywhere; }
  .due-done { margin-left: auto; }
}

/* ==========================================================================
   Unteraufgaben im Ticket (2026-08-18, Karl-Wunsch)
   Punkte mit eigener Chronik. Der Kunde sieht Liste + Fortschritt, aber nur
   die freigegebenen Eintraege.
   ========================================================================== */
.subtasks {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.subtasks-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.subtasks-title { font-size: 1rem; font-weight: 600; }
.subtasks-count {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text-muted);
}
.subtasks-count.all-done { color: var(--success); }
.subtasks-bar {
    flex: 1 1 120px;
    min-width: 80px;
    max-width: 320px;
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.subtasks-bar > span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width .3s;
}
.subtasks-tools { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.subtasks-hint {
    margin-top: .6rem;
    padding: .4rem .6rem;
    background: #ecfdf5;
    border-left: 3px solid var(--success);
    border-radius: 4px;
    font-size: .85rem;
    color: #065f46;
}
.subtasks-none { color: var(--text-muted); font-size: .875rem; }
.subtasks-open { margin-left: auto; }
/* Nach dem Klick auf „Punkte anlegen" verschwindet der Knopf; rechts stehen dann nur die Werkzeuge (12.09.2026, live geprueft) */
.subtasks:not(.subtasks-leer) .subtasks-open { display: none; }
/* Ohne Punkte schrumpft der Kasten auf eine Zeile — Werkzeuge und Eingabe
   erscheinen erst auf Klick (sonst drei Zeilen Leerlauf ueber dem Antwortfeld). */
.subtasks-leer { padding: .6rem 1.25rem; }
.subtasks-leer .subtasks-tools,
.subtasks-leer .subtask-add { display: none; }

.subtask-list { list-style: none; margin: .75rem 0 0; }
.subtask { border-top: 1px solid var(--border); }
.subtask:first-child { border-top: none; }
.subtask-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem 0;
}
.subtask-check { width: 17px; height: 17px; cursor: pointer; flex: none; accent-color: var(--primary); }
.subtask-mark {
    width: 17px; height: 17px; flex: none;
    border: 1px solid var(--border); border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem; line-height: 1; color: transparent;
}
.subtask-mark-done { background: var(--success); border-color: var(--success); color: #fff; }
.subtask-expand {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: .8rem;
    padding: .25rem; line-height: 1; flex: none;
}
.subtask-label { flex: 1 1 auto; min-width: 0; cursor: pointer; }
.subtask-name { font-weight: 600; overflow-wrap: anywhere; }
/* Noch nicht freigegebene Punkte leicht hervorheben (Karl 18.09.2026): der gleichnamige
   Plan-Schritt steht auf Ausblick, angefragt oder Rueckfrage. Nur fuer Admins gerendert. */
.subtask-offen { background: #fdf8ec; box-shadow: inset 3px 0 0 var(--warning); }
.subtask-offen > .subtask-row { padding-left: .55rem; }
.subtask-offen .subtask-name { color: #7a5713; }
.subtask-offen.subtask-done { background: #fbfaf6; }
/* Zusatz steht unter der Bezeichnung, Zeilenumbruecke bleiben erhalten (12.09.2026) */
.subtask-detail { display: block; color: var(--text-muted); font-size: .875rem; overflow-wrap: anywhere; white-space: pre-line; }
.subtask-done .subtask-name { text-decoration: line-through; color: var(--text-muted); }
.subtask-notecount { color: var(--text-muted); font-size: .8rem; white-space: nowrap; flex: none; }
.subtask-when { color: var(--success); font-size: .8rem; white-space: nowrap; flex: none; }
/* Stundenschaetzung je Punkt (12.09.2026): schmales Feld rechts neben der Bezeichnung */
.subtask-hours {
    width: 4.4rem; flex: none; text-align: right;
    font-size: .8rem; font-family: inherit; font-variant-numeric: tabular-nums;
    padding: .15rem .4rem; border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-input); color: var(--text);
}
.subtask-hours::placeholder { color: var(--text-muted); opacity: .6; }
.subtask-hours:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(39,91,69,.15); }
.subtask-done .subtask-hours { opacity: .5; }
.subtasks-sum { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
/* Gebuchte Zeit je Punkt (Schaetzguete, 22.09.2026): gleiche Optik wie im Aufwandsplan */
.subtasks-ist { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.subtasks-ohne { font-size: .8rem; color: var(--text-muted); margin: .45rem 0 0; }
.subtask-ist { flex: none; }
.subtask-ist .est-used-bar { width: 5rem; }
.subtask-done .subtask-ist { opacity: .55; }
.subtask-actions { display: flex; gap: .35rem; flex: none; }
.subtask-actions a {
    color: var(--text-muted); text-decoration: none;
    padding: 0 .2rem; font-size: .9rem; line-height: 1.4;
}
.subtask-actions a:hover { color: var(--primary); }
.subtask-actions a.disabled { opacity: .25; pointer-events: none; }
/* Stoppuhr je Unteraufgabe (12.09.2026): ▶ startet, laufender Punkt gruen mit ■ */
.subtask-actions a.subtask-timer { color: var(--success); font-size: .8rem; }
.subtask-timing .subtask-name { color: var(--success); }
.subtask-timing .subtask-actions a.subtask-timer { color: var(--danger); }
.subtask-timing .subtask-name::after {
    content: 'Stoppuhr läuft'; font-size: .7rem; font-weight: 500; margin-left: .5rem;
    padding: .05rem .4rem; border-radius: 10px; background: var(--lime); color: var(--primary-hover);
    vertical-align: middle; white-space: nowrap;
}

.subtask-edit { display: flex; gap: .35rem; flex: 1 1 100%; flex-wrap: wrap; align-items: flex-end; }
.subtask-edit input, .subtask-edit textarea {
    padding: .3rem .5rem; border: 1px solid var(--border);
    border-radius: 4px; font-size: .875rem; font-family: inherit;
}
.subtask-edit-title { flex: 1 1 100%; }
.subtask-edit-detail { flex: 1 1 200px; resize: none; overflow: hidden; }

/* Chronik eines Punktes */
.subtask-notes {
    padding: .25rem 0 .75rem 2.1rem;
    border-left: 2px solid var(--primary-light);
    margin-left: .5rem;
}
.subtask-note-empty { color: var(--text-muted); font-size: .85rem; margin-bottom: .5rem; }
.subtask-note {
    background: var(--bg-hover);
    border-radius: 4px;
    padding: .4rem .6rem;
    margin-bottom: .4rem;
}
.subtask-note-internal { background: #fffbeb; }
.subtask-note-meta {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    font-size: .78rem; color: var(--text-muted); margin-bottom: .15rem;
}
.subtask-note-body { font-size: .9rem; overflow-wrap: anywhere; }
.subtask-note-del { color: var(--text-muted); text-decoration: none; margin-left: auto; }
.subtask-note-del:hover { color: var(--danger); }
.badge-shared { background: var(--success); color: #fff; }

.subtask-note-form { margin-top: .4rem; }
.subtask-note-form textarea {
    width: 100%; padding: .45rem .6rem;
    border: 1px solid var(--border); border-radius: 4px;
    font-family: inherit; font-size: .9rem; resize: vertical;
}
.subtask-note-form-bottom {
    display: flex; align-items: center; gap: .75rem;
    flex-wrap: wrap; margin-top: .35rem;
}
.subtask-note-form-bottom .btn { margin-left: auto; }

.subtask-add {
    display: flex; gap: .4rem; flex-wrap: wrap;
    margin-top: .75rem; padding-top: .75rem;
    border-top: 1px solid var(--border);
}
.subtask-add input, .subtask-add textarea {
    padding: .4rem .6rem; border: 1px solid var(--border);
    border-radius: 4px; font-size: .875rem; font-family: inherit;
}
/* Zwei Zeilen: Bezeichnung + Std, darunter der mehrzeilige Zusatz + Knopf (12.09.2026) */
.subtask-add-row { display: flex; gap: .4rem; flex: 1 1 100%; flex-wrap: wrap; align-items: flex-end; }
.subtask-add-title { flex: 1 1 180px; min-width: 0; }
.subtask-add-detail { flex: 1 1 100%; min-width: 0; resize: none; overflow: hidden; } /* line-height normal = exakt Input-Hoehe (Chromium gemessen 12.09.) */
.subtask-add-hours  { flex: 0 0 5rem; width: 5rem; text-align: right; }

/* Vorschlagsdialog */
.subtask-suggest-source { color: var(--text-muted); font-size: .875rem; margin-bottom: .5rem; }
.subtask-suggest-wait { color: var(--text-muted); font-size: .9rem; }
.subtask-suggest-list { max-height: 45vh; overflow-y: auto; }
.subtask-suggest-row {
    display: flex; align-items: flex-start; gap: .5rem;
    padding: .35rem .25rem; border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.subtask-suggest-row:last-child { border-bottom: none; }
.subtask-suggest-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.subtask-suggest-detail { color: var(--text-muted); margin-left: .4rem; }

/* Fortschritts-Badge in den Ticketlisten */
.tt-subtasks {
    margin-left: .4rem; font-size: .78rem;
    color: var(--text-muted); white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tt-subtasks.tt-subtasks-done { color: var(--success); }

@media (max-width: 950px) {
    .subtasks { padding: .75rem .85rem; }
    .subtasks-tools { margin-left: 0; width: 100%; }
    .subtasks-tools .btn { flex: 1 1 auto; }
    /* Haekchen, Pfeil und Bezeichnung bleiben zusammen in der ersten Zeile;
       Zaehler/Datum/Bedienknoepfe rutschen bei Bedarf in die zweite (950px-Regel). */
    .subtask-row { flex-wrap: wrap; }
    .subtask-label { flex: 1 1 120px; }
    .subtask-hours { order: 3; }
    .subtask-ist { order: 3; }
    .subtask-ist .est-used { flex-direction: row; align-items: center; gap: .45rem; }
    .subtask-ist .est-used-bar { width: 3.5rem; }
    .subtask-notecount, .subtask-when { order: 4; }
    .subtask-actions { order: 5; margin-left: auto; }
    .subtask-actions a { padding: .2rem .35rem; font-size: 1rem; }
    .subtask-notes { padding-left: 1rem; margin-left: .25rem; }
    .subtask-note-form-bottom .btn { margin-left: 0; width: 100%; }
}

/* === Terminbestaetigung (2026-08-20) === */
.appt-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid #6366f1;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .9rem 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.appt-head { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.appt-when { font-size: 1.05rem; font-weight: 600; }
.appt-state { font-size: .85rem; color: var(--text-muted); }
.appt-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.appt-field { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: .6rem; }
.appt-field input, .appt-field textarea { width: 100%; margin-top: .2rem; }
.appt-hint { font-size: .8rem; color: var(--text-muted); margin: 0 0 .75rem; font-weight: 400 !important; }

/* --- Terminwahl aus Karls Kalender (2026-09-15): gruen-petrol, gebucht = kraeftiger --- */
.booking-box { border-left-color: #0d9488; }
.booking-box-booked { border-left-color: #16a34a; background: #f0fdf4; }
.booking-box .appt-state a { color: var(--primary); }

/* --- Aufwandsschaetzung zur Freigabe (2026-09-08) ---
   Nutzt den Terminkasten mit eigener Farbkante. Muss VOR .appt-box-overdue
   stehen, damit eine abgelaufene Frist weiterhin rot markiert wird. */
.est-box { border-left-color: #0ea5e9; }
/* Der Kopf traegt hier den ganzen Plan (Schrittliste, Summen) — als Flex-Kind ohne
   flex-grow blieb er so breit wie sein Inhalt und der weisse Kasten wirkte halb leer
   (Karl 23.09.2026, nach der Container-Verbreiterung auf 1600 px). */
.est-box > .appt-head { flex: 1 1 100%; }
/* Erledigt-Kasten (14.09.2026) — gruen wie das Status-Badge */
.closed-box { border-left-color: #22c55e; background: #f0fdf4; }
.search-all-hint { font-size: .85rem; color: var(--text-muted); margin: -.25rem 0 .75rem; }
.closed-box .appt-when { color: #166534; }
.closed-box .appt-state { color: #166534; opacity: .85; }

/* --- Aufwandsplan: Schritte im Ticket (2026-09-08) --- */
.est-title-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.est-title-row .est-edit-btn { margin-left: auto; }
.est-steps { list-style: none; margin: .6rem 0 .4rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.est-step {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .5rem .7rem; border-radius: 8px;
    background: var(--bg-hover); border-left: 3px solid transparent;
}
.est-step-dran { border-left-color: #0ea5e9; }
.est-step-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.est-step-title { font-weight: 600; }
.est-step-badge { font-size: .7rem; font-weight: 700; color: #fff; padding: .1rem .45rem; border-radius: 10px; white-space: nowrap; }
.est-step-desc { flex: 1 1 100%; font-size: .85rem; color: var(--text-muted); }
.est-step-hours { font-weight: 600; white-space: nowrap; }
.est-sums { font-weight: 600 !important; }
/* Verbrauch je Schritt aus der Stoppuhr (15.09.2026, nur Karl) */
.est-step-right { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex: 0 0 auto; }
.est-used { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.est-used-bar { display: block; width: 7.5rem; height: 4px; border-radius: 2px; background: var(--border, #e5e7eb); overflow: hidden; }
.est-used-bar > span { display: block; height: 100%; background: #0ea5e9; }
.est-used-over { color: #b91c1c; font-weight: 600; }
.est-used-over .est-used-bar > span { background: #dc2626; }
/* Gesamtbalken fuers ganze Ticket: oben im Kasten unter der Ueberschrift, Balken in voller
   Breite (Karl 24.09.2026: "so wie rechts bei den Schritten, nur fuers ganze Ticket") */
.est-verbrauch { display: flex; flex-direction: column; gap: .35rem; margin: .5rem 0 .25rem; font-size: .9rem; }
.est-verbrauch-kopf { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 1rem; row-gap: .15rem; }
.est-verbrauch .est-used { flex-direction: row; align-items: baseline; font-size: .95rem; font-weight: 600; color: var(--text); white-space: normal; }
.est-verbrauch .est-used-over { color: #b91c1c; }
.est-verbrauch > .est-used-bar { width: 100%; height: 8px; border-radius: 4px; }
.est-verbrauch-over > .est-used-bar > span { background: #dc2626; }
.est-verbrauch-rest, .est-verbrauch-ohne { color: var(--text-muted); }
@media (max-width: 600px) {
    /* schmal: Stunden + Verbrauch als eigene Zeile unter dem Schritt, sonst bleibt fuer die Beschreibung kaum Platz */
    .est-step:has(.est-used) { flex-wrap: wrap; }
    .est-step:has(.est-used) .est-step-right { flex: 1 1 100%; flex-direction: row; justify-content: space-between; align-items: center; }
    .est-step-right .est-used { flex-direction: row; align-items: center; gap: .5rem; }
    .est-step-right .est-used-bar { width: 4.5rem; }
}
/* Rueckfrage des Kunden zur Aufwandsschaetzung (14.09.2026): Wortlaut oben beim Plan */
.est-rueckfrage { margin-top: .6rem; padding: .6rem .8rem; border-radius: 8px; background: #fffbeb; border: 1px solid #fde68a; }
.est-rueckfrage-head { font-size: .85rem; color: #92400e; }
.est-rueckfrage-text { margin: .45rem 0 .6rem; padding: .1rem 0 .1rem .7rem; border-left: 3px solid #d97706; font-size: .95rem; color: var(--text); white-space: normal; }
.est-rueckfrage .appt-actions { margin-top: .2rem; }
/* Selbstfreigabe im Portal (14.09.2026): Haken je offenem Schritt, Knopf unter dem Plan */
.est-pick { width: 18px; height: 18px; margin: .15rem 0 0; flex: 0 0 auto; accent-color: #22c55e; cursor: pointer; }
.est-plan-actions { align-items: center; margin-top: .6rem; }
.est-plan-actions .appt-state { flex: 1 1 auto; }
.est-send-btn { padding: .1rem .5rem !important; font-size: .72rem !important; }

/* Dialog: eine Zeile je Schritt */
/* Dialog passt auf den Bildschirm (Karl 12.09.2026, MacBook): scrollt innen, groessere Felder */
.est-dialog { max-width: 760px; width: 100%; max-height: calc(100vh - 2rem); overflow-y: auto; box-sizing: border-box; }
.est-dialog .est-row-title, .est-dialog .est-row-hours, .est-dialog .est-row-desc, .est-dialog .appt-field input, .est-dialog .appt-field select { font-size: .95rem; padding: .5rem .65rem; }
.est-row { border: 1px solid var(--border); border-radius: 8px; padding: .7rem .8rem; margin-bottom: .7rem; }
/* Uebersicht vor dem Direktversand der Freigabe (Karl 12.09.2026: "sehr gut lesbar") */
.est-summary { max-width: 860px; width: 100%; font-size: 1.05rem; max-height: calc(100vh - 2rem); overflow-y: auto; box-sizing: border-box; padding: 1.5rem; }
.est-summary .est-summary-title { font-size: 1.35rem; margin-bottom: 1rem; }
.est-summary .est-summary-row { display: flex; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--border); font-weight: 400; }
.est-summary .est-summary-row strong { min-width: 0; overflow-wrap: anywhere; }
.est-summary .est-summary-row span, .est-summary .est-summary-block > span, .est-summary .est-summary-sum span { color: var(--text-muted); flex: 0 0 9rem; }
.est-summary .est-summary-block { padding: .7rem 0; border-bottom: 1px solid var(--border); }
.est-summary .est-summary-block > span { display: block; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem; }
.est-summary .est-summary-block p { font-weight: 400; line-height: 1.5; margin: 0; }
.est-summary .est-summary-steps { list-style: none; margin: 0; padding: 0; }
.est-summary .est-summary-steps li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .4rem 0; font-weight: 400; }
/* Stunden bilden eine eigene Spalte und brechen nie um (Karl 18.09.2026: "ca. 4" stand ueber "Std") */
.est-summary .est-summary-steps li > span { min-width: 0; }
.est-summary .est-summary-steps li > strong, .est-summary .est-summary-sum > strong { flex: 0 0 6.5rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.est-summary .est-summary-sum { display: flex; justify-content: space-between; padding-top: .5rem; margin-top: .3rem; border-top: 2px solid var(--primary); font-size: 1.1rem; }
.est-summary .est-summary-hint { font-weight: 400; font-size: .95rem; color: var(--text-muted); margin: .8rem 0 0; line-height: 1.5; }
.est-summary .assignee-dialog-actions { margin-top: 1.1rem; }
.est-summary .assignee-dialog-actions .btn { font-size: 1rem; padding: .6rem 1.2rem; }
/* Schmales Display: Bezeichnung ueber den Wert statt zwei enge Spalten (390 px geprueft) */
@media (max-width: 520px) {
    .est-summary { padding: 1.1rem; font-size: 1rem; }
    .est-summary .est-summary-row { flex-direction: column; gap: .1rem; }
    .est-summary .est-summary-row span { flex: none; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
    .est-summary .est-summary-steps li > strong, .est-summary .est-summary-sum > strong { flex: 0 0 5.5rem; }
}
.est-row-locked { opacity: .7; }
.est-row-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.est-row-nr { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.est-row-title { flex: 1 1 160px; min-width: 0; }
.est-row-hours { width: 7.5rem; flex: 0 0 auto; text-align: right; }
.est-row-checkwrap { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.est-row-state { font-size: .78rem; color: var(--success, #22c55e); font-weight: 600; white-space: nowrap; }
.est-row-del { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 0 .2rem; }
.est-row-del:hover { color: var(--danger, #ef4444); }
.est-row-desc { margin-top: .4rem; width: 100%; box-sizing: border-box; font: inherit; resize: vertical; }
@media (max-width: 600px) {
    .est-row-title { flex: 1 1 100%; }
    .est-title-row .est-edit-btn { margin-left: 0; }
}
.est-box-hint { border-left-color: var(--warning, #f59e0b); }

/* === Benoetigte Hardware: Anschaffungs-Freigabe (2026-09-21) ===
   Bernstein statt des Himmelblaus der Aufwandsfreigabe — der Kasten muss sich auf
   einen Blick von der Stundenfreigabe unterscheiden (Karl 21.09.2026). */
.pur-box { border-left-color: #b45309; }
/* --- Rückfrage mit Auswahl (2026-09-25): Petrol, beantwortet = gedämpft --- */
.frage-box { border-left-color: #0f766e; }
.frage-box > .appt-head { flex: 1 1 100%; }
.frage-box-beantwortet { border-left-color: #94a3b8; }
.frage-text { margin: .4rem 0 .2rem; font-size: .92rem; }
.frage-form { display: flex; flex-direction: column; gap: .3rem; margin-top: .3rem; }
.frage-q { border: 1px solid var(--border); border-radius: 8px; margin: .35rem 0; padding: .5rem .8rem .7rem; min-width: 0; }
.frage-q legend { font-weight: 600; padding: 0 .3rem; overflow-wrap: anywhere; }
.frage-nr { color: #0f766e; }
.frage-hinweis { font-weight: 400; font-size: .8rem; color: var(--text-muted); }
.frage-opt { display: flex; gap: .5rem; align-items: flex-start; margin: .35rem 0; cursor: pointer; overflow-wrap: anywhere; }
.frage-opt input { margin-top: .25rem; flex: 0 0 auto; }
.frage-bst { font-weight: 600; color: #0f766e; }
.frage-anders { width: 100%; box-sizing: border-box; margin-top: .2rem; }
.frage-liste { margin: .5rem 0 .3rem; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .4rem; }
.frage-titel { font-weight: 600; overflow-wrap: anywhere; }
.frage-opt-ansicht { font-size: .9rem; color: var(--text-muted); overflow-wrap: anywhere; }
.frage-gewaehlt { color: var(--text); font-weight: 600; }
/* Karl klickt Antworten einer offenen Rückfrage selbst an (2026-10-02) */
.frage-admin .frage-klick { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .2rem .4rem; margin: 0 0 0 -.4rem; border-radius: 6px; font: inherit; font-size: .9rem; line-height: 1.4; color: var(--text-muted); cursor: pointer; overflow-wrap: anywhere; }
.frage-admin .frage-klick:hover, .frage-admin .frage-klick:focus-visible { background: rgba(15, 118, 110, .09); color: var(--text); }
.frage-admin .frage-klick.frage-gewaehlt { color: var(--text); font-weight: 600; }
.frage-admin[data-laeuft="1"] { opacity: .6; pointer-events: none; }
.frage-vorab-eingabe { display: none; gap: .5rem; align-items: flex-start; margin: .2rem 0 .35rem; }
.frage-vorab-eingabe.offen { display: flex; }
.frage-vorab-eingabe textarea { flex: 1 1 auto; min-width: 0; box-sizing: border-box; }
.frage-vorab-hinweis a { margin-left: .5rem; font-weight: 400; }
/* Noch offene Frage nach dem Absenden (2026-09-28): roter Rand, Hinweis oben im Formular */
.frage-q { scroll-margin-top: 80px; }
.frage-q.frage-fehlt { border: 2px solid #dc2626; background: rgba(220, 38, 38, .04); }
.frage-q.frage-fehlt legend { color: #b91c1c; }
.frage-meldung { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: .5rem .7rem; border-radius: 8px; margin: .3rem 0; font-size: .9rem; }
.frage-anmerkung { font-style: normal; }
.pur-items { list-style: none; margin: .6rem 0 .4rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.pur-item {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .5rem .7rem; border-radius: 8px;
    background: var(--bg-hover); border-left: 3px solid transparent;
}
.pur-item-dran { border-left-color: #b45309; }
.pur-item-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.pur-item-title { font-weight: 600; overflow-wrap: anywhere; }
.pur-item-badge { font-size: .7rem; font-weight: 700; color: #fff; padding: .1rem .45rem; border-radius: 10px; white-space: nowrap; }
.pur-item-desc { flex: 1 1 100%; font-size: .85rem; color: var(--text-muted); }
.pur-item-link { flex: 1 1 100%; font-size: .85rem; overflow-wrap: anywhere; }
.pur-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; flex: 0 0 auto; }
.pur-item-calc { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.pur-item-sum { font-weight: 600; white-space: nowrap; }
.pur-hinweis { font-size: .8rem !important; opacity: .85; }
/* Begleittext im Kasten (21.09.2026): beim Kunden der Text der versendeten Anfrage,
   bei Karl ohne offene Anfrage sein Entwurf mit dezentem Vermerk */
.pur-text { margin: .5rem 0 .2rem; font-size: .9rem; color: var(--text); white-space: normal; }
.pur-text-entwurf { color: var(--text-muted); font-style: italic; }
.pur-text-vermerk {
    display: inline-block; margin-right: .4rem; font-style: normal;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: #92400e; background: #fffbeb; border: 1px solid #fde68a;
    padding: .05rem .35rem; border-radius: 10px; vertical-align: .05rem;
}
/* Dialog: Menge und Preis in der Kopfzeile, Link und Beschreibung darunter.
   Jedes Feld traegt seine Beschriftung (Platzhalter verschwinden beim Tippen). */
.pur-dialog .est-row-head { align-items: flex-end; }
.pur-feld { display: flex; flex-direction: column; gap: .15rem; font-size: .7rem; color: var(--text-muted); }
.pur-feld > input, .pur-feld > textarea { width: 100%; box-sizing: border-box; }
.pur-feld-title { flex: 1 1 180px; min-width: 0; }
.pur-feld-qty { flex: 0 0 5rem; }
.pur-feld-price { flex: 0 0 11rem; }
.pur-feld-breit { margin-top: .45rem; }
.pur-dialog .pur-row-qty, .pur-dialog .pur-row-price { text-align: right; }
.pur-dialog .est-row-desc { margin-top: 0; }
.pur-dialog .pur-row-foot { margin-top: .35rem; font-size: .78rem; color: var(--text-muted); text-align: right; }
.pur-dialog .pur-total { margin: .6rem 0 0; font-weight: 600; color: var(--text); }
/* Karl 21.09.2026: "viel zu klein, zu schmal, sieht gequetscht aus" — der Hardware-Dialog
   bekommt deutlich mehr Breite und Luft als der Stunden-Dialog (760 px): lange Bezeichnungen,
   Links und ein mehrzeiliger Begleittext muessen ohne Scrollen im Feld lesbar sein. */
.pur-dialog { max-width: 1080px; padding: 1.6rem 1.9rem 1.4rem; }
.pur-dialog > p:first-child { font-size: 1.25rem; margin-bottom: .6rem; }
.pur-dialog .appt-hint { font-size: .9rem; line-height: 1.5; margin-bottom: 1rem; }
.pur-dialog .appt-field { display: block; margin-bottom: 1rem; font-size: .85rem; }
.pur-dialog .appt-field input, .pur-dialog .appt-field select, .pur-dialog .appt-field textarea { margin-top: .3rem; width: 100%; box-sizing: border-box; }
.pur-dialog #purNote { min-height: 12rem; line-height: 1.5; padding: .7rem .8rem; }
.pur-dialog .est-row { padding: 1rem 1.15rem; margin-bottom: 1rem; }
.pur-dialog .est-row-head { gap: .9rem; flex-wrap: wrap; }
.pur-dialog .pur-feld { font-size: .8rem; gap: .3rem; }
.pur-dialog .pur-feld-title { flex: 1 1 360px; }
.pur-dialog .pur-feld-qty { flex: 0 0 6.5rem; }
.pur-dialog .pur-feld-price { flex: 0 0 12.5rem; }
.pur-dialog .pur-feld-breit { margin-top: .75rem; }
.pur-dialog .pur-row-desc { min-height: 4.2rem; line-height: 1.45; }
.pur-dialog .pur-row-foot { margin-top: .6rem; font-size: .9rem; }
.pur-dialog .pur-total { font-size: 1.05rem; margin: .9rem 0 1.2rem; }
.pur-dialog .assignee-dialog-actions { margin-top: 1.2rem; gap: .7rem; }
.pur-dialog .assignee-dialog-actions .btn { padding: .55rem 1.1rem; font-size: .95rem; }
@media (max-width: 700px) {
    .pur-dialog { padding: 1.1rem 1rem; }
    .pur-dialog #purNote { min-height: 9rem; }
}
/* Ohne font: inherit kaeme der Begleittext im Browser-Standard (Monospace) daher */
.pur-dialog textarea { font: inherit; font-size: .95rem; resize: vertical; }
@media (max-width: 700px) {
    .pur-feld-title { flex: 1 1 100%; }
    .pur-feld-price { flex: 1 1 auto; }
}
@media (max-width: 600px) {
    /* schmal: Menge x Preis und Zeilensumme als eigene Zeile unter der Position,
       sonst bleibt fuer die Bezeichnung kaum Platz (kein Querscrollen bis 390 px) */
    .pur-item { flex-wrap: wrap; }
    .pur-item-right { flex: 1 1 100%; flex-direction: row; justify-content: space-between; align-items: baseline; }
}
.stat-card.stat-estimate { border-color: #0ea5e9; }
.stat-card.stat-queued { border-color: #64748b; }
.stat-card.stat-onsite { border-color: #0e7490; }   /* Vor Ort (14.09.2026), Petrol wie das Kennzeichen */
.card-approval {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: .45rem;
}
.approval-label { display: block; font-size: .8rem; color: var(--text-muted); }

/* --- Mitarbeiter je Kunde auf der Kundenseite (2026-09-12) --- */
.card-team { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.card-team-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .45rem; }
.card-team-head .approval-label { margin: 0; }
.team-empty { font-size: .85rem; color: var(--text-muted); margin: 0; }
.team-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.team-item { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-top: 1px solid var(--border); }
.team-item:first-child { border-top: 0; }
.team-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.team-name { font-size: .9rem; font-weight: 500; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.team-name .badge { font-size: .65rem; padding: .1rem .45rem; }
.team-mail { font-size: .78rem; color: var(--text-muted); overflow-wrap: anywhere; }
.team-inactive .team-main { opacity: .55; }
.badge-off { background: #8a948f; }

/* Segment-Schalter (zwei bis drei sich ausschließende Möglichkeiten statt Dropdown) */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-card); }
.seg button { background: transparent; border: 0; padding: .5rem .9rem; font: inherit; font-size: .875rem; font-weight: 500; color: var(--text); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--primary-light); }
.seg button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.seg-hint { font-size: .8rem; color: var(--text-muted); margin-top: .4rem; }
@media (max-width: 600px) {
    .seg { display: flex; }
    .seg button { flex: 1; }
}
.approval-label select { width: 100%; margin-top: .2rem; }
.approval-check { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text-muted); }
@media (max-width: 600px) {
    .appt-box { flex-direction: column; align-items: stretch; }
    .appt-actions .btn { flex: 1; }
}
.appt-box-overdue { border-left-color: var(--danger); }
.appt-box-overdue .appt-state { color: var(--danger); }

/* --- Kundenprojekte (2026-09-02) --- */
/* Projekt-Kennzeichen am Betreff in den Ticketlisten */
.tt-project {
    margin-left: .4rem; font-size: .75rem;
    padding: .05rem .4rem; border-radius: 10px;
    background: var(--bg-hover); color: var(--text-muted);
    white-space: nowrap;
}
/* Auswahlfeld + „+ Neu"-Knopf als eine Einheit */
.project-picker { display: flex; gap: .35rem; align-items: center; }
.project-picker select { flex: 1; min-width: 0; }
.project-picker .btn { flex: none; white-space: nowrap; }
/* Art des Tickets (2026-09-11): Fehler vs. Erweiterung.
   Kleines Kennzeichen in der Ticketliste, Badge im Ticketkopf, farbiger Punkt an
   der Gruppen-Ueberschrift — ueberall dieselben zwei Farben. */
.tt-art {
    margin-left: .4rem; font-size: .75rem;
    padding: .05rem .4rem; border-radius: 10px;
    color: #fff; white-space: nowrap; text-decoration: none;
}
a.tt-art:hover { filter: brightness(1.1); }
.tt-art-bug         { background: #dc2626; }
.tt-art-feature     { background: #2563eb; }
/* 2026-09-12: drei weitere Arten aus Karls Aufgabenliste mit dem Kunden */
.tt-art-setup       { background: #7c3aed; }
.tt-art-hardware    { background: #b45309; }
.tt-art-procurement { background: #0f766e; }
/* Externe Nr. / Betroffene Person / Freigabe noetig — Kennzeichen am Betreff (2026-09-12) */
.tt-ref { margin-left: .4rem; font-size: .75rem; padding: .05rem .4rem; border-radius: 10px; background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; white-space: nowrap; }
.tt-person { margin-left: .4rem; font-size: .75rem; color: var(--text-muted); }
.tt-approval { margin-left: .4rem; font-size: .75rem; padding: .05rem .4rem; border-radius: 10px; background: #fef3c7; color: #92400e; border: 1px solid #fde68a; white-space: nowrap; }
/* Schalter "Freigabe noetig" in der Feldleiste: so hoch wie die Nachbarn */
.approval-toggle { display: inline-flex; align-items: center; gap: .45rem; height: 36px; box-sizing: border-box; padding: 0 .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); cursor: pointer; font-size: .9rem; user-select: none; }
.approval-toggle.on { background: #fef3c7; border-color: #fde68a; color: #92400e; font-weight: 600; }
.approval-toggle { width: 100%; justify-content: flex-start; }
/* "ja, freigegeben" nie umbrechen (Karl 24.09.2026): Rasterspalte ist ~130 px, der Text brauchte ~150 px.
   Etwas kleinere Schrift + engere Abstaende, und der Kasten darf ein paar Pixel in die Spaltenluecke
   (14 px) ragen — gemessen bei 1100/1280/1512 px: Text bleibt im Kasten, Abstand zum Nachbarfeld >= 9 px. */
.ticket-props .approval-toggle { white-space: nowrap; font-size: .85rem; gap: .35rem; padding: 0 .45rem; width: max-content; min-width: 100%; align-self: flex-start; position: relative; z-index: 1; }
.approval-toggle input { margin: 0; flex: 0 0 16px; width: 16px !important; height: 16px; }
/* Vor Ort (2026-09-14): eigene Farbe (Petrol), damit es nicht wie "Freigabe noetig" (Gelb) aussieht */
.approval-toggle.onsite-toggle.on { background: #cffafe; border-color: #a5f3fc; color: #155e75; }
.tt-onsite { margin-left: .4rem; font-size: .75rem; padding: .05rem .4rem; border-radius: 10px; background: #cffafe; color: #155e75; border: 1px solid #a5f3fc; white-space: nowrap; font-weight: 600; }
.ticket-props .fg-onsite { flex: 0 0 auto; }
.ticket-props .fg-onsite .approval-toggle { width: auto; min-width: 84px; }
.filter-form .filter-onsite { width: auto; height: 36px; }
/* Internes Ticket (Karl 01.10.2026): Kennzeichen am Betreff und Schalter in Grau-Violett, unterscheidbar von
   Entwurf/Freigabe (Gelb) und Vor Ort (Petrol). Nur Admins sehen es. */
.tt-intern { margin-left: .4rem; font-size: .75rem; padding: .05rem .4rem; border-radius: 10px; background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; white-space: nowrap; font-weight: 600; }
/* Claude autonom (Karl 13.10.2026): Ticketkopf und Benutzerliste, nur fuer Admins */
.tt-autonom { margin-left: .4rem; font-size: .75rem; padding: .05rem .4rem; border-radius: 10px; background: #fbeee8; color: #9a3b1c; border: 1px solid #f2cdbd; white-space: nowrap; font-weight: 600; }
.approval-toggle.intern-toggle.on, .approval-toggle.filter-intern.on { background: #ede9fe; border-color: #ddd6fe; color: #5b21b6; }
.ticket-props .fg-intern { flex: 0 0 auto; }
.ticket-props .fg-intern .approval-toggle { width: auto; min-width: 84px; }
.ticket-form .intern-toggle { width: auto; height: auto; min-height: 36px; padding: .35rem .6rem; white-space: normal; }
.ticket-form.ist-intern #contactUserField { display: none !important; }
/* Aktivitaet (14.09.2026): Kunden-Chips + Protokoll als Zeilenliste (kein Seitwaerts-Scrollen) */
.act-customers { display: flex; flex-wrap: wrap; gap: .5rem; }
.act-customer { display: flex; flex-direction: column; gap: 2px; min-width: 180px; flex: 1 1 200px; max-width: 320px; padding: .55rem .8rem; background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 10px; text-decoration: none; color: var(--text); }
.act-customer:hover { box-shadow: var(--shadow-md); }
.act-customer.act-never { border-left-color: #d1d5db; color: var(--text-muted); }
.act-cname { font-weight: 600; }
.act-cwhen { font-size: .85rem; }
.act-cmeta { font-size: .78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-list { display: flex; flex-direction: column; gap: 4px; }
.act-item { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .8rem; padding: .45rem .8rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; }
.act-when { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: .82rem; min-width: 84px; }
.act-who { flex: 0 0 auto; font-weight: 600; }
.act-cust { font-weight: 400; color: var(--text-muted); font-size: .82rem; }
.act-what { flex: 0 0 auto; }
.act-detail { color: var(--text-muted); }
.act-ticket { flex: 1 1 200px; min-width: 0; text-decoration: none; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-ticket:hover { color: var(--primary); }
.act-subject { color: var(--text-muted); }
.act-ip { flex: 0 0 auto; margin-left: auto; font-size: .75rem; color: #9ca3af; font-variant-numeric: tabular-nums; }
.act-item.act-login, .act-item.act-login_token { border-left: 3px solid var(--success); }
.act-item.act-reply, .act-item.act-ticket_create { border-left: 3px solid var(--primary); }
@media (max-width: 950px) { .act-ip { display: none; } .act-customer { max-width: none; } }
/* Verknuepfte Tickets (2026-09-12) */
/* Verknuepfte Tickets: seit 12.09.2026 als Feld im Eigenschaften-Kasten neben der ISS-Nummer */
.relation-field { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-width: 0; }
.relation-dot { width: .55rem; height: .55rem; border-radius: 50%; flex: none; }
.ticket-relation { display: inline-flex; align-items: center; gap: .35rem; padding: 2px 8px; border-radius: 6px; font-size: .78rem; background: var(--bg-hover); border: 1px solid var(--border); max-width: 100%; height: 30px; box-sizing: border-box; }
.ticket-relation a { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-relation .relation-x { font-weight: 700; opacity: .6; } .ticket-relation .relation-x:hover { opacity: 1; }
.ticket-relation.relation-closed { opacity: .65; }
.relation-add { display: inline-flex; gap: .35rem; align-items: center; min-width: 0; }
.relation-add .filter-input { width: 120px; min-width: 0; }
.ticket-props .relation-add .filter-input, .ticket-props .relation-add .btn-sm { height: 36px; box-sizing: border-box; }
.badge-art { color: #fff; text-decoration: none; }
.badge-art:hover { filter: brightness(1.1); }
.badge-art-bug     { background: #dc2626; }
.badge-art-feature { background: #2563eb; }
.badge-art-setup       { background: #7c3aed; }
.badge-art-hardware    { background: #b45309; }
.badge-art-procurement { background: #0f766e; }
/* Ueberschrift einer Art-Gruppe in der Ticketliste (nur bei Projektfilter) */
.ticket-group {
    display: flex; align-items: center; gap: .5rem;
    font-size: 1rem; margin: 1.4rem 0 .5rem;
}
.ticket-group::before {
    content: ''; width: .6rem; height: .6rem; border-radius: 50%;
    background: var(--art-farbe, var(--text-muted)); flex: none;   /* Farbe je Art aus der Tabelle (12.09.2026) */
}

/* Projekt-Kennzeichen im Ticketkopf (verlinkt auf die Ticketliste des Projekts) */
.badge-project { background: #7c3aed; color: #fff; text-decoration: none; }
.badge-project:hover { filter: brightness(1.1); }
/* Projektwahl im Ticketkopf unter dem Titel — Kundensicht seit 09/2026, Admin seit 12.09.2026
   (Karl: Position im Eigenschaften-Kasten "gefaellt mir nicht", soll neben/unter den Titel) */
.ticket-project-pick { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.ticket-project-pick select { min-width: 150px; }
.ticket-project-admin .filter-select, .ticket-project-admin .btn-sm { height: 32px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
.ticket-project-admin .btn-sm { display: inline-flex; align-items: center; }
/* Art-Auswahl farbig wie das Kennzeichen (Karl: Farbe traegt Bedeutung ueberall gleich) */
.ticket-project-admin .art-select { color: #fff; font-weight: 600; min-width: 130px; }
.ticket-project-admin .art-select.art-leer { color: var(--text); font-weight: 400; }
.ticket-project-admin .art-select option { color: var(--text); background: var(--bg-card); font-weight: 400; }

@media (max-width: 950px) {
    .ticket-project-pick { width: 100%; }
    .ticket-project-pick select { flex: 1; }
}

/* Projekte-Tabelle mobil als Karten statt seitlich scrollend
   (gleiches Muster wie die Ticket-Tabelle) */
@media (max-width: 950px) {
    .project-table, .project-table tbody, .project-table tr { display: block; width: 100%; }
    .project-table thead { display: none; }
    .project-table tr {
        border: 1px solid var(--border); border-radius: 10px;
        margin-bottom: 10px; padding: .6rem .75rem; background: var(--bg-card);
    }
    .project-table td {
        display: flex; align-items: baseline; gap: .5rem;
        border: none; padding: .2rem 0;
    }
    .project-table td::before {
        content: attr(data-label);
        flex: 0 0 6.5rem;
        color: var(--text-muted); font-size: .72rem; font-weight: 600;
        text-transform: uppercase; letter-spacing: .02em;
    }
    .project-table td > * { min-width: 0; }
    .project-table td[data-label="Aktionen"] { flex-wrap: wrap; gap: .35rem; padding-top: .5rem; }
}

/* Antwort-Entwurf (2026-09-11): gelber Hinweis ueber dem Editor, nur Admins */
.draft-hinweis { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: .5rem; }
.draft-hinweis .btn { white-space: nowrap; }
/* Begleittext an den Freigeber: geht NICHT mit "Antworten" raus (22.09.2026) */
.draft-hinweis-freigabe { background: #e0ecf9; color: #1e3a8a; border-color: #bfdbfe; }
/* Wer bekommt diese Antwort? Steht direkt unter dem Editor (Karl 22.09.2026) */
.reply-empf { font-size: .82rem; color: var(--text-muted); margin: .1rem 0 .5rem; }
/* Mail-Vorschau "Genau diese Mail geht raus" — breit und luftig wie die Uebersicht */
.mailvorschau { width: 100%; max-width: 900px; max-height: calc(100vh - 2rem); box-sizing: border-box;
    padding: 1.5rem; display: flex; flex-direction: column; gap: .75rem; }
.mailvorschau .est-summary-title { font-size: 1.35rem; margin: 0; }
.mailvorschau-kopf { font-size: .9rem; font-weight: 400; color: var(--text-muted); margin: .35rem 0 0; line-height: 1.5; overflow-wrap: anywhere; }
.mailvorschau-rahmen { flex: 1 1 auto; min-height: 320px; height: min(60vh, 620px); width: 100%;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.mailvorschau .assignee-dialog-actions { align-items: center; margin: 0; }
.mailvorschau .appt-hint { font-weight: 400; }
@media (max-width: 520px) { .mailvorschau { padding: 1.1rem; } .mailvorschau-rahmen { height: 56vh; min-height: 240px; } }

/* "Fertig bis" + "Nachhaken" (2026-09-11) */
.badge-fertig { background: #e0ecf9; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-fertig-soon { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge-fertig-over { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.badge-fertig-done { background: #e5e7eb; color: #6b7280; border-color: #e5e7eb; }
.tt-due { white-space: nowrap; }
.due-kind { font-weight: 600; }
.due-kind-deadline { color: #1d4ed8; }
.due-kind-followup { color: #92400e; }
.dialog-hint { font-size: .85rem; color: var(--text-muted); margin: .25rem 0 .75rem; }
.dialog-label { display: block; font-size: .8rem; font-weight: 600; margin: .5rem 0 .2rem; }
.ticket-actions .due-date-wrap { margin-left: .5rem; }

/* Beobachter (2026-09-11): Chips + kleines Plus in EINER Zeile, Hoehe wie die Nachbarfelder */
.fg-watchers { flex-wrap: wrap; }
.watcher-row { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.watcher-chips { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
/* Chip mit dem Box-Modell der Auswahlfelder (.filter-select: 8/12 px Innenabstand, 14 px, 1 px Rand, 6 px Radius) —
   keine feste Hoehe, damit er in jedem Browser genau so hoch ist wie die Nachbarn (Chrome 36 px, WebKit 47 px) */
.watcher-chip { display: inline-flex; align-items: center; gap: .35rem; box-sizing: border-box; padding: 0 12px; font-size: 14px; line-height: normal; background: #e0ecf9; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 6px; }
/* In der Eigenschaften-Leiste bekommen ALLE Felder dieselbe feste Hoehe — nur so ist der Chip in jedem
   Browser/OS exakt so hoch wie die Auswahlfelder (Schriftmetriken unterscheiden sich sonst um 1-2 px). */
.ticket-props .filter-select, .ticket-props .filter-input, .ticket-props .due-date-input, .ticket-props .watcher-chip, .ticket-props .btn-sm { height: 36px; box-sizing: border-box; }
.ticket-props .field-group > .btn-alt { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-props .watcher-plus { width: 28px; height: 28px; }
.watcher-chip a { color: inherit; text-decoration: none; font-weight: 700; font-size: 14px; line-height: normal; opacity: .7; }
.watcher-chip a:hover { opacity: 1; }
.watcher-plus { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); font-weight: 700; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0; }
.watcher-plus:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.watcher-select { margin-top: .3rem; }

/* ── Statistik (Neuaufbau 2026-09-12) ─────────────────────────────────────────
   Kacheln, Karten mit Linie statt Schatten, Inline-SVG-Saeulen, waagerechte Balken.
   Diagrammfarben #6d5bd0 (neu) / #2e8b5e (erledigt): Paletten-Pruefer bestanden. */
.st-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: .25rem 0 1.25rem; }
.st-head h1 { margin: .1rem 0 .3rem; }
.st-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); font-weight: 600; }
.st-eyebrow::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-right: .45rem; vertical-align: 1px; }
.st-lead { margin: 0; color: var(--text-muted); font-size: .92rem; max-width: 60ch; }
.st-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.st-kpi { display: block; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1rem 1.1rem .95rem; text-decoration: none; color: inherit; min-height: 112px; }
a.st-kpi:hover { border-color: var(--primary); background: #fbfcf7; }
.st-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); font-weight: 600; }
.st-kpi-value { font-size: 2rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: .35rem 0 .3rem; color: var(--text); }
.st-kpi-unit { font-size: 1rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.st-kpi-sub { font-size: .82rem; color: var(--text-muted); }
.st-row { display: grid; gap: 1.1rem; margin-bottom: 1.1rem; align-items: start; }
.st-row-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.st-row-1-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.st-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.1rem 1.25rem 1.2rem; margin-bottom: 1.1rem; min-width: 0; }
.st-row .st-card { margin-bottom: 0; }
.st-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.st-card-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.st-card-sub { margin: .2rem 0 0; font-size: .82rem; color: var(--text-muted); }
.st-card-tools { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.st-legend { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text-muted); }
.st-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.st-toggle { font: inherit; font-size: .8rem; font-weight: 600; color: var(--primary); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .3rem .65rem; cursor: pointer; }
.st-toggle:hover { background: var(--primary-light); border-color: var(--primary); }
/* Saeulendiagramm */
.st-chart-wrap { position: relative; }
.st-chart { display: block; width: 100%; height: auto; overflow: visible; }
.st-grid { stroke: var(--border); stroke-width: 1; }
.st-axis { stroke: #c9d1c6; stroke-width: 1; }
.st-tick { font-size: 11px; fill: var(--text-muted); font-family: inherit; }
.st-year { fill: #8a9a92; font-size: 10px; }
.st-val { font-size: 11px; font-weight: 600; fill: var(--text); font-family: inherit; }
.st-col { transition: opacity .12s; }
.st-col-dim { opacity: .35; }
.st-hit { cursor: default; outline: none; }
.st-hit:focus-visible { stroke: var(--primary); stroke-width: 1.5; fill: rgba(39,91,69,.05); }
.st-tip { position: absolute; transform: translateY(-100%); background: #152c28; color: #fff; border-radius: 8px; padding: .5rem .7rem; font-size: .8rem; pointer-events: none; box-shadow: 0 8px 20px rgba(21,44,40,.18); white-space: nowrap; z-index: 5; }
.st-tip-title { font-weight: 600; margin-bottom: .3rem; }
.st-tip-row { display: flex; align-items: center; gap: .45rem; line-height: 1.5; }
.st-tip-row i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.st-tip-row strong { font-variant-numeric: tabular-nums; min-width: 1.6em; }
.st-tip-row span { color: rgba(255,255,255,.7); }
.st-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.st-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; padding: .35rem .5rem; border-bottom: 1px solid var(--border); }
.st-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--bg-hover); }
.st-table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Aufteilung offene Tickets */
.st-breakdown h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); font-weight: 600; margin: .9rem 0 .4rem; }
.st-breakdown h3:first-child { margin-top: 0; }
.st-brow { display: grid; grid-template-columns: 110px minmax(0, 1fr) 2.2em; align-items: center; gap: .6rem; padding: .22rem 0; text-decoration: none; color: inherit; font-size: .85rem; }
a.st-brow:hover .st-brow-label { color: var(--primary); }
.st-brow-label { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-brow-num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Waagerechte Balken */
.st-bar { position: relative; display: block; height: 10px; border-radius: 5px; background: var(--bg-hover); overflow: hidden; min-width: 40px; }
.st-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.st-bar-part { box-shadow: 2px 0 0 #fff; }
/* Zeilenlisten mit Balken */
.st-rows { display: flex; flex-direction: column; gap: .15rem; }
.st-row-item { display: grid; grid-template-columns: minmax(140px, 1.2fr) minmax(0, 2fr) minmax(150px, 1fr) minmax(130px, .9fr); align-items: center; gap: .9rem; padding: .5rem .4rem; border-radius: var(--radius); text-decoration: none; color: inherit; font-size: .9rem; }
.st-row-item-3 { grid-template-columns: minmax(140px, 1.2fr) minmax(0, 2fr) minmax(150px, 1.4fr); }
.st-row-item-rank { grid-template-columns: minmax(200px, 2fr) minmax(0, 1.6fr) 5.5em 8.5em; }
a.st-row-item:hover { background: var(--bg-hover); }
.st-row-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-nr { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: .8rem; font-weight: 600; color: var(--primary); background: var(--primary-light); border-radius: 4px; padding: .05rem .35rem; margin-right: .3rem; }
.st-row-nums { font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-dim { color: var(--text-muted); font-weight: 400; }
.st-row-meta { color: var(--text-muted); font-size: .82rem; text-align: right; white-space: nowrap; }
.st-status { justify-self: end; }
.st-empty { color: var(--text-muted); font-size: .88rem; margin: 0; }
@media (max-width: 1100px) {
    .st-row-2-1, .st-row-1-1 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    /* Das Saeulendiagramm skaliert auf Handybreite unter Lesbarkeit -> Tabelle statt Diagramm */
    .st-chart-wrap { display: none !important; }
    .st-table-wrap { display: block !important; }
    .st-toggle { display: none; }
}
@media (max-width: 950px) {
    .st-kpi-value { font-size: 1.7rem; }
    .st-row-item, .st-row-item-3, .st-row-item-rank { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: .25rem; }
    .st-row-item .st-bar { grid-column: 1 / -1; order: 3; }
    .st-row-item .st-row-nums, .st-row-item .st-row-meta, .st-row-item .st-status { text-align: right; justify-self: end; }
    .st-brow { grid-template-columns: 96px minmax(0, 1fr) 2.2em; }
}

/* Aktivitaet im Ticket (Karl 18.09.2026): Dialog #ticketActivityModal, nur Admin */
.modal-overlay .modal-content.tact-modal { max-width: 640px; }
.tact-h { margin: 0 0 .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.tact-viewers { display: flex; flex-direction: column; gap: 4px; }
.tact-viewer { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .8rem; padding: .5rem .8rem; background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid var(--success); border-radius: 8px; }
.tact-viewer.tact-stale { border-left-color: #f59e0b; }
.tact-viewer.tact-nie { border-left-color: #d1d5db; color: var(--text-muted); }
.tact-name { font-weight: 600; flex: 1 1 200px; min-width: 0; }
.tact-badge { font-weight: 400; font-size: .72rem; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 .45rem; white-space: nowrap; }
.tact-when { font-size: .9rem; font-variant-numeric: tabular-nums; }
.tact-meta { flex: 1 1 100%; font-size: .8rem; color: var(--text-muted); }
.tact-never, .tact-hint, .tact-leer { font-size: .82rem; color: var(--text-muted); margin: .5rem 0 0; }
.tact-leer { font-size: .9rem; }
.tact-protohead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.25rem 0 .5rem; }
.tact-protohead .tact-h { margin: 0; }
.tact-team-toggle { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text-muted); cursor: pointer; user-select: none; }
.tact-team-toggle input { margin: 0; width: 16px; height: 16px; }
.tact-list .tact-team { display: none; }
.tact-list.tact-show-team .tact-team { display: flex; }
.tact-list.tact-show-team .tact-leer-kunde { display: none; }

/* ── Schaetzgüte (22.09.2026) ─────────────────────────────────────────────────
   Baut auf den Statistik-Klassen auf (st-head/st-kpis/st-card/st-table). Eigene
   Teile: Faktor-Balken mit Mitte bei 1,0 und die Zeilenraster der Vergleiche.
   Datenfarben #2e8b5e / #b45309 / #6d5bd0 — Paletten-Pruefung bestanden. */
.sg-faktoren { display: flex; flex-direction: column; gap: .1rem; }
/* Die Karte ist nur ein Drittel breit — Name oben, Balken/Wert daneben, Hinweis darunter.
   Feste Spalten fuer Ebene und Hinweis hatten den Namen auf 0 gequetscht. */
.sg-frow { display: grid; grid-template-columns: minmax(0, 1fr) 4.6rem 3.4em; align-items: center; column-gap: .55rem; row-gap: .15rem; padding: .4rem .2rem; font-size: .85rem; border-radius: var(--radius); border-top: 1px solid var(--border); }
.sg-frow:first-child { border-top: none; }
.sg-row-kopf { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; }
.sg-frow-duenn { opacity: .6; }
.sg-ftext { grid-column: 1; min-width: 0; }
.sg-febene { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; }
.sg-fname { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-frow .sg-fbar { grid-column: 2; }
.sg-fwert { grid-column: 3; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.sg-fmeta { grid-column: 1 / -1; font-size: .78rem; text-align: left; }
.sg-badge { display: inline-block; color: #fff; font-size: .7rem; font-weight: 600; letter-spacing: .03em; border-radius: 999px; padding: .08rem .5rem; }
.sg-hinweis { margin: .8rem 0 0; font-size: .8rem; color: var(--text-muted); }
/* Faktor-Balken: Mitte = 1,0 (Strich), nach links unter, nach rechts ueber der Schaetzung */
.sg-fbar { position: relative; display: block; height: 10px; border-radius: 5px; background: var(--bg-hover); overflow: hidden; min-width: 48px; }
.sg-fbar-fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.sg-fbar-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: #a9b5ad; }
/* Balken Ist gegen Soll */
.sg-bar { position: relative; display: block; height: 10px; border-radius: 5px; background: var(--bg-hover); overflow: hidden; min-width: 48px; }
.sg-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
/* Zeilenlisten */
.sg-rows { display: flex; flex-direction: column; gap: .1rem; }
.sg-row { display: grid; grid-template-columns: 7.5em minmax(0, 1.5fr) 7.5em 5em 5.5em minmax(150px, 11em); align-items: center; gap: .7rem; padding: .45rem .3rem; border-radius: var(--radius); text-decoration: none; color: inherit; font-size: .88rem; }
a.sg-row:hover { background: var(--bg-hover); }
.sg-row-lauf { grid-template-columns: 7.5em minmax(0, 1fr) minmax(0, 1.2fr) 11em 4em; }
.sg-row-ohne { grid-template-columns: 7.5em minmax(0, 1fr) 6em; }
.sg-punkt { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-sub { display: block; font-weight: 400; font-size: .78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.sg-art { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sg-warn { color: #b45309; font-weight: 600; }
.sg-faktor { display: flex; align-items: center; gap: .5rem; font-variant-numeric: tabular-nums; }
.sg-faktor strong { min-width: 2.6em; text-align: right; }
.sg-gross { margin: 0 0 .8rem; font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.sg-gross .st-dim { font-size: .85rem; font-weight: 400; }
@media (max-width: 950px) {
    /* Zwei Spalten statt sechs: Nummer + Punkt oben, Zahlen darunter rechts (950px-Regel) */
    .sg-row, .sg-row-lauf, .sg-row-ohne { grid-template-columns: 7.5em minmax(0, 1fr); row-gap: .2rem; gap: .5rem; padding: .55rem .3rem; }
    .sg-row .sg-punkt { grid-column: 2; }
    .sg-row .sg-art, .sg-row .sg-num { grid-column: 2; text-align: right; }
    .sg-row .sg-bar, .sg-row .sg-faktor { grid-column: 1 / -1; }
    .sg-row-kopf { display: none; }
    .sg-frow { grid-template-columns: minmax(0, 1fr) 3.4em; }
    .sg-frow .sg-fbar { grid-column: 1 / -1; }
}

/* Interner Bearbeitungsstand (Karl 27.09.2026) — nur fuer Karl sichtbar, nie im Kundenportal.
   In der Ticketliste steht das Kennzeichen UNTER dem Status-Badge in derselben Spalte und ist
   in der Breite begrenzt: eine eigene Spalte haette die Tabelle ueber 1152 px getrieben
   (Regel 10.09.2026: kein Seitwaerts-Scrollen). Farbe kommt je Stand aus --stand-farbe. */
.tt-stand { display: block; margin-top: .25rem; max-width: 11rem; font-size: .72rem; line-height: 1.25;
    padding: .1rem .4rem; border-radius: 8px; white-space: normal; overflow-wrap: anywhere;
    color: var(--stand-farbe, #6b7280); background: color-mix(in srgb, var(--stand-farbe, #6b7280) 12%, #fff);
    border: 1px solid color-mix(in srgb, var(--stand-farbe, #6b7280) 35%, #fff); font-weight: 600; }
/* Im Ticketkopf steht er in einer Zeile mit den anderen Kennzeichen */
.tt-stand-kopf { display: inline-block; margin-top: 0; margin-left: .4rem; max-width: 28rem; font-size: .78rem; }
/* Zeile unter den Dashboard-Kacheln: nur die Staende, bei denen etwas haengt */
.stand-zeile { display: flex; flex-wrap: wrap; gap: .5rem; margin: -.4rem 0 1rem; }
.stand-chip { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; text-decoration: none; font-weight: 600;
    color: var(--stand-farbe, #6b7280); background: color-mix(in srgb, var(--stand-farbe, #6b7280) 12%, #fff);
    border: 1px solid color-mix(in srgb, var(--stand-farbe, #6b7280) 35%, #fff); }
.stand-chip:hover { box-shadow: var(--shadow-md); }

/* Dialog "Uebergabe" am Status-Feld (Karl 29.09.2026): passt auch bei 430 px */
.ueb-dialog { width: 100%; max-width: 360px; box-sizing: border-box; }
.ueb-dialog .ueb-dialog-label { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: .35rem; font-weight: 400; }
.ueb-dialog textarea { display: block; width: 100%; box-sizing: border-box; min-height: 6rem; resize: vertical;
    margin-bottom: .75rem; padding: .5rem; font: inherit; font-size: .9rem; border: 1px solid var(--border);
    border-radius: var(--radius); background: var(--bg-card); color: inherit; }
.ueb-dialog .ueb-dialog-haken { display: flex; align-items: flex-start; gap: .5rem; font-size: .9rem; font-weight: 400;
    margin: 0 0 .25rem; cursor: pointer; }
.ueb-dialog .ueb-dialog-haken input { margin-top: .2rem; flex: 0 0 auto; }
.ueb-dialog .ueb-dialog-hilfe { font-size: .8rem; color: var(--text-muted); margin: 0 0 .75rem 1.6rem; }
.ueb-dialog .ueb-dialog-fehler { font-size: .85rem; color: var(--danger); background: #fef2f2; border: 1px solid #fecaca;
    border-radius: var(--radius); padding: .5rem .6rem; margin: 0 0 .75rem; overflow-wrap: anywhere; }

/* Bilder mit Bildunterschrift (Entwurfsbilder, Karl 29.09.2026): volle Spaltenbreite, nie breiter
   als die Spalte (kein Querscroll, auch bei 430 px), nicht beschnitten — Screenshots muessen
   ganz lesbar sein. Klick oeffnet das Bild gross im neuen Tab. */
.message-attachments .bild-titel { flex: 1 1 100%; }
.bild-titel { margin: 0; max-width: 100%; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.bild-titel-link { display: block; max-width: 100%; align-self: flex-start; border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; transition: border-color .15s; background: #fff; }
.bild-titel-link:hover { border-color: var(--primary); }
.bild-titel-link img { display: block; max-width: 100%; height: auto; }
.bild-titel figcaption { font-size: .85rem; color: var(--text-muted); line-height: 1.4; overflow-wrap: anywhere; }
.entwurf-bilder { margin: 0 0 .75rem; padding: .75rem; border: 1px solid #fde68a; background: #fffbeb;
    border-radius: var(--radius); display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.entwurf-bilder-kopf { font-size: .85rem; color: #92400e; overflow-wrap: anywhere; }
.entwurf-bild { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; min-width: 0; max-width: 100%; }
.entwurf-bild .bild-titel { width: 100%; }

/* ---- Eine Seite "Tickets" (Karl 29.09.2026): Dashboard, Tickets und Meine Tickets zusammengefasst ---- */
.seite-kopf { margin-top: .25rem; margin-bottom: 1.25rem; }
/* Filterleiste: eine Leiste, bricht um, laeuft nie ueber; Zeilenabstand >= 16 px */
.ticket-filterleiste { margin: 0 0 1.5rem; }
.ticket-filterleiste .filter-form { row-gap: 1rem; column-gap: .5rem; align-items: center; }
.ticket-filterleiste .filter-select { min-width: 0; max-width: 16rem; height: 36px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
.ticket-filterleiste .filter-suche { position: relative; flex: 1 1 22rem; min-width: 0; margin: 0; display: flex; align-items: center; gap: .6rem; }
.ticket-filterleiste .filter-suche .filter-input { flex: 1 1 auto; min-width: 0; height: 36px; box-sizing: border-box; }
/* Live-Treffer der Suche: breiter als das Suchfeld, damit der Betreff lesbar bleibt, und der
   Betreff darf umbrechen (Abnahme 29.09.2026: im schmalen Feld blieb nur "Etiketten…" uebrig) */
@media (min-width: 951px) {
    .ticket-filterleiste .filter-suche .search-results { right: auto; width: min(46rem, calc(100vw - 4rem)); }
}
.ticket-filterleiste .filter-suche .search-result-subject { white-space: normal; overflow: visible; }
.ticket-filterleiste .filter-aufheben { height: 36px; display: inline-flex; align-items: center; white-space: nowrap; }
/* Gesetzte Filter erkennbar */
.filter-input.filter-aktiv, .filter-select.filter-aktiv { border-color: var(--primary); background: var(--primary-light, #eef5ef); font-weight: 600; }
.stand-chip.stand-chip-aktiv { box-shadow: 0 0 0 2px var(--stand-farbe, #6b7280); }
.liste-anzahl { font-weight: 400; color: var(--text-muted); font-size: .95rem; }
@media (max-width: 950px) {
    .ticket-filterleiste .filter-select { max-width: none; }
    .ticket-filterleiste .filter-suche { flex-basis: auto; width: 100%; }
    .ticket-filterleiste .filter-aufheben { align-self: flex-start; }
}
/* Kacheln bleiben bei 951-1100 px in EINER Reihe (Karl 29.09.2026, Fenster um 1024-1100 px): etwas
   engere Schrift, kleinere Innenabstaende, "überfällig" als kompaktes Kennzeichen. Gemessen: vorher
   1022 px Bedarf bei 976 px Platz (7 Kacheln mit "1 überfällig"). */
@media (min-width: 951px) and (max-width: 1100px) {
    .stats-grid { gap: .3rem; }
    .stat-card { padding: .4rem .35rem .4rem .5rem; gap: .3rem; }
    .stat-label { letter-spacing: .02em; }
    .stat-card .stat-sub { margin-left: .2rem; padding: .05rem .3rem; font-size: .66rem; }
}
/* Terminliste direkt unter der Zeile der Bearbeitungsstaende: kein negativer Abstand */
.stand-zeile + .due-panel { margin-top: .5rem; }
.stand-zeile { margin-bottom: 1.25rem; }

/* Konflikt beim Senden: neuerer Entwurf im Ticket (Codex Runde 3, 29.09.2026) */
.entwurf-konflikt { margin: 0 0 .75rem; padding: .75rem; border: 1px solid #fde68a; background: #fef3c7; color: #92400e;
    border-radius: var(--radius); font-size: .9rem; overflow-wrap: anywhere; }
.entwurf-konflikt p { margin: 0 0 .6rem; }
.entwurf-konflikt-knoepfe { display: flex; flex-wrap: wrap; gap: .5rem; }
.entwurf-konflikt-knoepfe .btn { white-space: normal; text-align: left; }
.entwurf-eigener-text { margin: 0 0 .75rem; padding: .75rem; border: 1px dashed var(--border); background: var(--bg-card);
    border-radius: var(--radius); display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; min-width: 0; }
.entwurf-eigener-kopf { font-size: .85rem; color: var(--text-muted); }
.entwurf-eigener-inhalt { font-size: .9rem; line-height: 1.6; overflow-wrap: anywhere; max-width: 100%; user-select: text; }
/* Lange Namen im "Am Zug"-Kennzeichen ("Daniela Klomann (VATTER)") duerfen bis 1100 px umbrechen:
   mit echten Daten war die Tabelle bei 1024 px sonst 5-10 px breiter als der Container (29.09.2026) */
@media (min-width: 951px) and (max-width: 1100px) {
    .ticket-table .badge-nextaction { white-space: normal; }
}

/* "Am Zug": ungesendeter Kundenentwurf (Karl 29.09.2026, Ticket 811) */
.am-zug-entwurf { display: inline-block; margin-top: .25rem; font-size: .75rem; font-weight: 600; line-height: 1.3;
    padding: .1rem .45rem; border-radius: 8px; color: #92400e; background: #fef3c7; border: 1px solid #fde68a;
    white-space: normal; overflow-wrap: anywhere; max-width: 100%; }

/* Senden-Dialog im Antwortformular: Status und Nächste Aktion vor dem Senden (Karl 30.09.2026, Ticket 811) */
.antwort-dialog { width: 100%; max-width: 380px; box-sizing: border-box; }
.antwort-dialog-block { border-top: 1px solid var(--border); padding-top: .6rem; margin-top: .6rem; }
.antwort-dialog-kopf { font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.antwort-dialog-akt { font-size: .85rem; color: var(--text-muted); margin-bottom: .45rem; overflow-wrap: anywhere; }
.antwort-dialog-label { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: .2rem; }
.antwort-dialog select { width: 100%; max-width: 100%; margin-bottom: .35rem; }
.antwort-dialog-hinweis { font-size: .8rem; color: var(--text-muted); margin-bottom: .35rem; }
.antwort-dialog .assignee-dialog-actions { margin-top: .9rem; }

/* Abschluss prüfen (Karl 07.10.2026): erledigte Tickets mit Freigabe oben im Dashboard, bis Karl
   sie abhakt. Optik der Bloecke assignee-group, je Ticket eine Zeile mit Knoepfen rechts. */
.abschluss-section { margin-bottom: 0; }
.assignee-group.assignee-group-abschluss { margin-bottom: 1.5rem; }
.abschluss-liste { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg-card); overflow: hidden; margin-top: .25rem; }
.abschluss-zeile { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-left: 4px solid var(--warning); }
.abschluss-zeile + .abschluss-zeile { border-top: 1px solid var(--border); }
.abschluss-info { flex: 1 1 auto; min-width: 0; }
.abschluss-kopf { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; }
.abschluss-nr { font-weight: 700; white-space: nowrap; color: var(--primary); }
.abschluss-betreff { font-weight: 600; overflow-wrap: anywhere; }
.abschluss-meta { font-size: .82rem; color: var(--text-muted); margin-top: .15rem; overflow-wrap: anywhere; }
.abschluss-zahlen { display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .88rem; margin-top: .3rem; }
.abschluss-zahlen > span { overflow-wrap: anywhere; }
.abschluss-rest { font-weight: 700; }
.abschluss-rest.offen { color: var(--danger); }
.abschluss-warnung { font-size: .82rem; color: var(--danger); margin-top: .25rem; overflow-wrap: anywhere; }
.abschluss-knoepfe { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; flex: 0 0 auto; max-width: 45%; }
@media (max-width: 700px) {
    .abschluss-zeile { flex-direction: column; align-items: stretch; }
    .abschluss-knoepfe { max-width: none; justify-content: flex-start; }
}
.abschluss-hinweis { margin-top: .4rem; font-size: .88rem; }
/* Abschluss-Kasten auf der Ticketseite (Karl 16.10.2026): dieselbe Zeile wie im Dashboard, im Terminkasten-Rahmen */
.appt-box.abschluss-box { display: block; border-left-color: var(--warning); }
.abschluss-box .abschluss-liste { border: 0; border-radius: 0; background: transparent; margin-top: .35rem; }
.abschluss-box .abschluss-zeile { padding: 0; border-left: 0; }
/* Eigenes Zeit-Projekt: Zahlen aus der Zeiterfassung, Haken fuer den Mehraufwand */
.abschluss-zeit { font-size: .88rem; margin-top: .4rem; overflow-wrap: anywhere; }
.abschluss-zeit > div + div { margin-top: .15rem; }
.abschluss-zeit-mehr-feld { display: flex; align-items: center; gap: .45rem; margin-top: .4rem; font-weight: 600; cursor: pointer; }
.abschluss-zeit-mehr-feld input { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; }
.abschluss-knoepfe .abschluss-zeit-los { width: 16rem; max-width: 100%; white-space: normal; text-align: center; justify-content: center; }
/* Stundenwahl (Karl 15.10.2026): Feld "Abzurechnende Stunden", darunter live Schlussrechnung/Gutschrift */
.abschluss-wahl { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: flex-end; margin-top: .55rem; }
.abschluss-wahl-feld { display: flex; flex-direction: column; gap: .2rem; font-size: .82rem; color: var(--text-muted); }
.abschluss-wahl-feld .abschluss-std { width: 7.5rem; padding: .3rem .5rem; font-size: .95rem; }
.abschluss-wahl-text { flex: 1 1 16rem; min-width: 0; font-size: .85rem; overflow-wrap: anywhere; }
.abschluss-ergebnis { font-weight: 700; margin-top: .15rem; }
.abschluss-ergebnis-rechnung { color: var(--primary); }
.abschluss-ergebnis-gutschrift { color: var(--warning); }
.abschluss-ergebnis-keine { color: var(--text-muted); }
.abschluss-ergebnis-fehler { color: var(--danger); }
.abschluss-knoepfe .abschluss-los { width: 13rem; }
.abschluss-wahl-schnell { display: flex; flex-direction: column; gap: .15rem; align-self: flex-end; padding-bottom: .1rem; }
.abschluss-setzen { background: none; border: 0; padding: 0; font: inherit; font-size: .8rem; color: var(--primary); text-decoration: underline; cursor: pointer; text-align: left; white-space: nowrap; }
.abschluss-setzen:hover { color: var(--text); }
@media (max-width: 700px) { .abschluss-knoepfe .abschluss-los, .abschluss-knoepfe .abschluss-zeit-los { width: 100%; } }

/* =====================================================================================================
   iPhone/PWA (15.10.2026, docs/archiv/support-mobil-optimierung-2026-10-15.md, Befunde H1-N8).
   Alles hier greift nur unter 951 px oder ueber env(safe-area-*) (am Desktop 0) -- der Desktop bleibt
   unveraendert. Zwischenstufe 601-950 px (iPhone Duo innen, quer gehaltene Handys): Karten zweispaltig.
   ===================================================================================================== */

/* H7 Safe-Area: Kopfleiste unter Statusleiste/Dynamic Island, Raender quer an der Notch */
.navbar { padding-top: env(safe-area-inset-top, 0px); height: calc(64px + env(safe-area-inset-top, 0px)); }
@media (max-width: 1000px) {
    .navbar { padding-left: max(.75rem, env(safe-area-inset-left, 0px)); padding-right: max(.75rem, env(safe-area-inset-right, 0px)); }
    .nav-links { max-height: calc(100vh - 64px - env(safe-area-inset-top, 0px)); max-height: calc(100dvh - 64px - env(safe-area-inset-top, 0px));
                 padding-bottom: env(safe-area-inset-bottom, 0px); }
}
#pushMenuEintrag[hidden] { display: none !important; }

@media (max-width: 950px) {
    .container { padding-left: max(.75rem, env(safe-area-inset-left, 0px)); padding-right: max(.75rem, env(safe-area-inset-right, 0px));
                 padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
    .assignee-dialog-overlay { padding: max(1rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px))
                                        max(1rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px)); }

    /* H2: ab 16 px zoomt iOS beim Antippen nicht mehr in die Seite (Zoomen bleibt erlaubt) */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
    select, textarea, [contenteditable="true"],
    .ticket-props .field-group select, .ticket-props .field-group input,
    .filter-input, .filter-select, .status-select, .due-date-input, .subtask-hours, .reply-editor,
    .abschluss-wahl-feld .abschluss-std { font-size: 16px !important; }

    /* M3: keine Ziehgriffe auf dem Handy (Antippen und Ziehen gerieten durcheinander), Kacheln 44 px */
    .drag-grip { display: none !important; }
    .stat-card { min-height: 44px; }

    /* M2: Filter hinter einem Knopf, gesetzte Filter als Chips (app.js filterLeisteMobil) */
    .ticket-filterleiste .filter-form { flex-direction: row; flex-wrap: wrap; align-items: center; row-gap: .6rem; }
    .ticket-filterleiste .filter-suche { flex: 1 1 100%; width: 100%; }
    .ticket-filterleiste .filter-suche .filter-input { height: 44px; }
    .ticket-filterleiste .filter-mobil-knopf { display: inline-flex; min-height: 44px; min-width: 6.5rem; justify-content: center; flex: 0 0 auto; }
    .ticket-filterleiste .filter-form:not(.filter-offen) > select,
    .ticket-filterleiste .filter-form:not(.filter-offen) > .filter-onsite { display: none; }
    .ticket-filterleiste .filter-form.filter-offen > select { width: 100%; height: 44px; }
    .ticket-filterleiste .filter-form > .filter-onsite { height: 44px; }
    .filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; width: 100%; }
    .filter-chips:empty { display: none; }
    .filter-chip { display: inline-flex; align-items: center; min-height: 32px; padding: .2rem .7rem; border-radius: 16px;
                   background: var(--primary-light); border: 1px solid var(--lime); color: var(--text); font-size: .85rem; font-weight: 600;
                   cursor: pointer; font-family: inherit; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ticket-filterleiste .filter-form.filter-offen .filter-chips { display: none; }
    .ticket-filterleiste .filter-aufheben { min-height: 44px; }
    /* N1: Haken "Geschlossene" mit 44-px-Trefferflaeche */
    .ticket-filterleiste .search-toggle { min-height: 44px; padding: 0 .25rem; }
    .search-toggle input { width: 20px; height: 20px; }

    /* M4: Ticketkarte verdichten. Zeile 1 Nr. + Alter, Zeile 2 Betreff, Zeile 3 Status/Am Zug/Prio als
       Chips, Kunde und "Aktualisiert" klein. Gilt fuer die Ticketlisten (tt-fixed). */
    .ticket-table.tt-fixed tr { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .4rem; padding: .55rem .7rem; }
    .ticket-table.tt-fixed td { padding: 0; }
    .ticket-table.tt-fixed td[data-label]::before { content: none; }
    .ticket-table.tt-fixed td[data-label] { display: inline-flex; flex: 0 0 auto; gap: .3rem; }
    .ticket-table.tt-fixed .tt-nr { order: 1; flex: 1 1 auto; }
    .ticket-table.tt-fixed .tt-age { order: 2; font-size: .78rem; }
    .ticket-table.tt-fixed .tt-subject { order: 3; flex: 1 1 100%; padding-bottom: .1rem; }
    .ticket-table.tt-fixed td[data-label="Status"] { display: contents; }
    .ticket-table.tt-fixed td[data-label="Status"] > .badge { order: 4; }
    .ticket-table.tt-fixed td[data-label="Am Zug"] { order: 5; }
    .ticket-table.tt-fixed td[data-label="Priorität"] { order: 6; }
    .ticket-table.tt-fixed td[data-label="Kunde"], .ticket-table.tt-fixed td[data-label="Bearbeiter"] { order: 7; font-size: .8rem; color: var(--text-muted); }
    .ticket-table.tt-fixed .tt-time { order: 8; margin-left: auto; font-size: .75rem; color: var(--text-muted); }
    .ticket-table.tt-fixed td[data-label="Status"] > .tt-stand { order: 9; flex: 1 1 100%; display: -webkit-box; -webkit-box-orient: vertical;
                                                                  -webkit-line-clamp: 2; overflow: hidden; white-space: normal; max-width: 100%; }
    .ticket-table.tt-fixed .badge, .ticket-table.tt-fixed td[data-label] .badge { white-space: nowrap; overflow-wrap: normal; font-size: .72rem; padding: .15rem .45rem; }
    .ticket-table.tt-fixed .badge-nextaction { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
    /* N2: Ticketnummer und Favoriten-Stern mit groesserer Trefferflaeche */
    .ticket-table.tt-fixed .ticket-nr { display: inline-block; padding: .2rem .45rem; font-size: .8rem; }
    .ticket-table .fav-star-list.on { padding: .55rem .5rem; margin: -.55rem -.2rem; }

    /* M5: Abschluss pruefen. Link als Knopf, Hauptknopf rechtsbuendig mit fester Breite und 44 px */
    .abschluss-auswertung { margin-left: auto; min-height: 36px; }
    .abschluss-knoepfe { justify-content: flex-end; }
    .abschluss-knoepfe .abschluss-los, .abschluss-knoepfe .btn { width: 13rem; max-width: 100%; min-height: 44px; justify-content: center; }
    .abschluss-knoepfe .abschluss-zeit-los { width: 16rem; }
    .abschluss-zeit-mehr-feld { min-height: 44px; }
    .abschluss-setzen { padding: .5rem 0; }

    /* M6: Freigaben "Je Ticket" als Karten statt Tabelle mit Querscroll */
    .st-table.fg-table, .st-table.fg-table tbody, .st-table.fg-table tfoot { display: block; width: 100%; }
    .st-table.fg-table thead { display: none; }
    .st-table.fg-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: .15rem .9rem; padding: .6rem .75rem; margin-bottom: .5rem;
                            border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
    .st-table.fg-table td { display: flex; justify-content: space-between; gap: .5rem; padding: .1rem 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
    .st-table.fg-table td.fg-ticket { grid-column: 1 / -1; display: block; font-weight: 600; }
    .st-table.fg-table td[data-label="Projekt"], .st-table.fg-table td[data-label="Status"] { grid-column: 1 / -1; display: block; }
    .st-table.fg-table td[data-label]::before { content: attr(data-label); color: var(--text-muted); font-size: .72rem; font-weight: 600;
                                                text-transform: uppercase; letter-spacing: .02em; }
    .st-table.fg-table td[data-label="Projekt"]::before, .st-table.fg-table td[data-label="Status"]::before { content: attr(data-label) ": "; }
    .st-table.fg-table .fg-betreff { max-width: none; }
    .st-table-wrap { overflow-x: visible; }

    /* M7: Aktivitaet - lange Dateinamen brechen um statt ueber die Karte zu laufen */
    .act-what, .act-detail { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }

    /* M8: Kunde - "Als erledigt markieren" als Nebenknopf am Ende des Kopfs, Status/Prioritaet als Kennzeichen */
    .ticket-actions { margin-left: 0; width: 100%; gap: .5rem; }
    .ticket-actions > .badge-lg { border-radius: 4px; padding: .15rem .5rem; font-size: .75rem; box-shadow: none; cursor: default; }
    .ticket-actions .ticket-erledigt-knopf { order: 99; margin-left: auto; background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
                                             min-height: 44px; width: 13rem; max-width: 100%; justify-content: center; }
    .ticket-actions .due-date-wrap { flex: 1 1 100%; }

    /* M9: Unteraufgaben - Aktionen hinter "…", 44-px-Trefferflaechen fuer Haken, Pfeil und Std */
    .subtask-row { flex-wrap: wrap; row-gap: .2rem; }
    .subtask-check { width: 22px; height: 22px; margin: 11px; }
    .subtask-expand { min-width: 36px; min-height: 44px; }
    .subtask-hours { min-height: 40px; width: 4.6rem; }
    .subtask-mehr { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--border);
                    border-radius: var(--radius); background: var(--bg-card); color: var(--text); font-size: 1.1rem; font-family: inherit; cursor: pointer; }
    .subtask-row > .subtask-mehr { order: 20; }
    .subtask-row > .subtask-actions { order: 21; }
    .subtask .subtask-actions { display: none; }
    .subtask.subtask-aktionen-offen .subtask-actions { display: flex; flex: 1 1 100%; justify-content: flex-end; gap: .4rem; padding: .2rem 0 .3rem; }
    .subtask.subtask-aktionen-offen .subtask-actions a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
                    border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); font-size: 1rem; }
    .subtask.subtask-aktionen-offen .subtask-actions a[onclick^="subtaskDelete"] { margin-left: 1rem; color: var(--danger); }

    /* M10: Dialoge passen immer ins Bild, Knopfreihe bleibt sichtbar */
    .assignee-dialog { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; }
    .assignee-dialog .assignee-dialog-actions { position: sticky; bottom: -1.25rem; background: var(--bg-card); padding: .6rem 0 .2rem; margin-bottom: -.2rem; }
    .assignee-dialog-actions .btn { min-height: 44px; min-width: 7rem; justify-content: center; }
    .modal-content { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto; }

    /* H6: Editor waechst mit dem Text, Entwurfsbilder als Vorschaureihe (gross nach Antippen) */
    .reply-editor { max-height: none; min-height: 120px; }
    .entwurf-bilder { flex-direction: row; flex-wrap: wrap; gap: .5rem; }
    .entwurf-bilder-kopf { flex: 1 1 100%; }
    .entwurf-bild { position: relative; width: 96px; flex: 0 0 96px; gap: 0; }
    .entwurf-bild .bild-titel-link { width: 96px; height: 96px; }
    .entwurf-bild .bild-titel-link img { width: 96px; height: 96px; object-fit: cover; }
    .entwurf-bild figcaption { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .72rem; }
    .entwurf-bild .entwurf-bild-weg { position: absolute; top: -6px; right: -6px; width: 36px; height: 36px; padding: 0; border-radius: 50%;
                                      font-size: 0; justify-content: center; box-shadow: 0 0 0 4px rgba(0,0,0,0); }
    .entwurf-bild .entwurf-bild-weg::before { content: "\00d7"; font-size: 1.25rem; line-height: 1; }
    .entwurf-bild .entwurf-bild-weg::after { content: ""; position: absolute; inset: -4px; }

    /* N3: Neues Ticket - "Fertig bis" wie die anderen Felder, Haken auf der Textlinie */
    .form-group .due-date-input, input[type="date"].due-date-input { max-width: none !important; width: 100%; min-height: 44px; }
    .ticket-props .due-date-input { width: 100%; }
    .approval-toggle, .form-group label.approval-toggle { display: inline-flex; align-items: center; min-height: 44px; }
    .form-group label.approval-toggle { display: flex; }
    .approval-toggle input { margin: 0; align-self: center; }

    /* N4: "×" an Datumsfeldern mit Abstand und 44-px-Flaeche */
    .due-date-wrap { gap: .4rem; }
    .due-date-clear { min-width: 44px; min-height: 44px; font-size: 1.2rem; border-radius: var(--radius); }

    /* N5: Stopp-Knopf der laufenden Uhr und Logo mit 44 px */
    .nav-timer-stop { min-width: 44px; min-height: 44px; font-size: .8rem; }
    .nav-brand { min-height: 44px; min-width: 44px; padding: 7px 7px 7px 0; }
    .burger { min-width: 44px; min-height: 44px; }

    .btn { min-height: 40px; }
    .btn-sm { min-height: 36px; }
}
.filter-mobil-knopf, .subtask-mehr { display: none; }
@media (max-width: 950px) { .filter-mobil-knopf { display: inline-flex; } .subtask-mehr { display: inline-flex; } }

/* Zwischenstufe 601-950 px (iPhone Duo innen, Handy quer): keine gestreckte Handy-Spalte */
@media (min-width: 601px) and (max-width: 950px) {
    .ticket-table.tt-fixed tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .ticket-table.tt-fixed tr { margin-bottom: 0; align-content: flex-start; }
    .st-table.fg-table tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .st-table.fg-table tbody tr { margin-bottom: 0; }
    .user-table tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .user-table tr { margin-bottom: 0; }
    .ticket-filterleiste .filter-form.filter-offen > select { width: calc(50% - .3rem); }
}

/* Zurueck in der installierten App (Karl 15.10.2026): Kopfleiste links, 44 px; im Browser unsichtbar.
   In der App ersetzt er das "← Zurück" im Ticket, damit es nur ein Zurueck gibt. */
.nav-zurueck { display: none; }
html.pwa-standalone .nav-zurueck { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -.4rem;
    border-radius: var(--radius); color: var(--text); flex: 0 0 auto; }
html.pwa-standalone .nav-zurueck:active { background: var(--bg-hover); }
html.pwa-standalone .back-link { display: none; }
/* Neu laden in der installierten App (Karl 16.10.2026): rechts vor dem Burger, 44 px; im Browser unsichtbar. */
.nav-neuladen { display: none; }
html.pwa-standalone .nav-neuladen { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    margin-left: auto; border: 0; background: none; border-radius: var(--radius); color: var(--text); flex: 0 0 auto; cursor: pointer; padding: 0; }
html.pwa-standalone .nav-neuladen:active { background: var(--bg-hover); }
html.pwa-standalone .nav-neuladen.laedt svg { animation: nav-neuladen-dreh .8s linear infinite; }
html.pwa-standalone .nav-user.has-timer ~ .nav-neuladen, html.pwa-standalone .nav-user.has-ticket-timer ~ .nav-neuladen { margin-left: 0; }
html.pwa-standalone .nav-neuladen ~ .burger { margin-left: 0; }   /* sonst teilen sich beide auto-Raender den Platz, Knopf landet mittig */
@keyframes nav-neuladen-dreh { to { transform: rotate(360deg); } }
@media (display-mode: standalone) {
    .nav-neuladen { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
        margin-left: auto; border: 0; background: none; border-radius: var(--radius); color: var(--text); flex: 0 0 auto; cursor: pointer; padding: 0; }
    .nav-zurueck { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -.4rem;
        border-radius: var(--radius); color: var(--text); flex: 0 0 auto; }
    .back-link { display: none; }
}

/* Push-Dialog */
.push-dialog { max-width: 380px; }
.push-schalter { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-weight: 600; cursor: pointer; }
.push-schalter input { width: 22px; height: 22px; accent-color: var(--primary); }
.push-hinweis { font-size: .85rem; color: var(--text-muted); margin: .25rem 0 .5rem; }
.push-status { font-size: .85rem; min-height: 1.2em; margin-bottom: .5rem; overflow-wrap: anywhere; }
.push-status.fehler { color: var(--danger); }

/* ---- Ticket-Detail auf dem Handy (Schalter MOBIL_TICKET_NEU -> body.mt-neu), nur bis 950 px ---- */
.mt-felder-knopf, .mt-kasten-kopf, .mt-schwebend, .mt-ganz-knopf, .mt-verlauf-leiste { display: none; }
@media (max-width: 950px) {
    /* H3: Status, Prioritaet und Naechste Aktion in einer Zeile, Rest hinter "Weitere Felder" */
    /* Seit 19.10.2026 ist Zeile 1 (.ticket-props-row1) das Raster, nicht mehr .ticket-props selbst */
    .mt-neu .ticket-props { padding: .55rem .6rem; margin-bottom: 0; }
    .mt-neu .ticket-props .ticket-props-row1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .35rem .5rem; }
    .mt-neu .ticket-props .field-group.fg-name { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .1rem .6rem; }
    .mt-neu .ticket-props .field-group.fg-name > * { grid-column: 2; }
    .mt-neu .ticket-props .field-group.fg-name > .field-label { grid-column: 1; grid-row: 1; margin: 0; }
    .mt-neu .ticket-props .field-label { font-size: .66rem; }
    .mt-neu .ticket-props .ticket-props-row1 > .field-group:nth-child(-n+3) select { height: 40px; padding-left: .4rem; padding-right: 1.2rem; text-overflow: ellipsis; }
    .mt-neu.mt-felder-zu .ticket-props > :not(.ticket-props-row1),
    .mt-neu.mt-felder-zu .ticket-props .ticket-props-row1 > :not(.field-group),
    .mt-neu.mt-felder-zu .ticket-props .ticket-props-row1 > .field-group:nth-child(n+4),
    .mt-neu.mt-felder-zu .ticket-classify,
    .mt-neu.mt-felder-zu .ticket-dates { display: none !important; }
    .mt-neu .ticket-props .ticket-props-row1 > .field-group:nth-child(-n+2) { grid-column: auto; }
    .mt-neu .ticket-props .ticket-props-row1 > :not(.field-group), .mt-neu .ticket-props .ticket-props-row1 > .field-group:nth-child(n+4) { grid-column: 1 / -1; }
    .mt-neu.mt-felder-zu .ticket-header { margin-bottom: .5rem; }
    .mt-neu .mt-felder-knopf { display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 44px; margin: .4rem 0 .6rem; padding: .4rem .75rem;
        border: 1px dashed var(--border); border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; text-align: left; }
    .mt-neu .mt-felder-titel { font-weight: 600; flex: 0 0 auto; }
    .mt-neu .mt-felder-info { color: var(--text-muted); font-size: .8rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mt-neu .mt-felder-titel::after { content: " ▾"; color: var(--text-muted); }
    .mt-neu:not(.mt-felder-zu) .mt-felder-titel::after { content: " ▴"; }
    /* Kopf kompakter: Werkzeuge in eine Zeile, Kenndaten nebeneinander */
    .mt-neu .ticket-titlebar { gap: .25rem; }
    .mt-neu .ticket-info { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
    .mt-neu .ticket-tools { gap: .4rem; }

    /* H4: Kaesten als Kopfzeile mit Kennzahl */
    .mt-neu .mt-kasten-kopf { display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 48px; margin: 0 0 .5rem; padding: .5rem .75rem;
        border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg-card); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
    .mt-neu .mt-kasten-kopf.offen { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; }
    .mt-neu .mt-kasten-titel { font-weight: 700; flex: 0 0 auto; max-width: 65%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mt-neu .mt-kasten-zahl { color: var(--text-muted); font-size: .85rem; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mt-neu .mt-kasten-pfeil { flex: 0 0 auto; color: var(--text-muted); transition: transform .15s; }
    .mt-neu .mt-kasten-kopf.offen .mt-kasten-pfeil { transform: rotate(90deg); }
    .mt-neu .mt-kasten-kopf.offen + * { border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 0; }
    .mt-neu .mt-zu { display: none !important; }

    /* H5: lange Nachrichten gekuerzt, interne Notizen ausblendbar */
    .mt-neu .mt-gekuerzt .message-body { max-height: 18.5em; overflow: hidden; position: relative;
        -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent); mask-image: linear-gradient(to bottom, #000 75%, transparent); }
    .mt-neu .mt-ganz-knopf { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem; margin: .35rem 0 0;
        border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); color: var(--primary); font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; }
    .mt-neu .mt-verlauf-leiste { display: flex; justify-content: flex-end; margin: .75rem 0 .5rem; }
    .mt-neu .mt-intern-filter { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; font-size: .88rem; color: var(--text-muted); cursor: pointer; }
    .mt-neu .mt-intern-filter input { width: 20px; height: 20px; accent-color: var(--primary); }
    .mt-neu .messages.mt-ohne-intern .message-internal { display: none; }

    /* Schwebend: "Antworten" und "Nach oben" unten rechts ueber dem Home-Indikator */
    .mt-neu .mt-schwebend { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; position: fixed; z-index: 90;
        right: max(1rem, env(safe-area-inset-right, 0px)); bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
    .mt-neu .mt-schwebend > button { pointer-events: auto; box-shadow: var(--shadow-md); border: 1px solid var(--border); font: inherit; cursor: pointer; }
    .mt-neu .mt-hoch { display: none; width: 44px; height: 44px; border-radius: 50%; background: var(--bg-card); color: var(--text); align-items: center; justify-content: center; }
    .mt-neu .mt-schwebend.mt-hoch-an .mt-hoch { display: inline-flex; }
    .mt-neu .mt-antworten { min-height: 48px; padding: 0 1.2rem; border-radius: 24px; background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
    .mt-neu .mt-schwebend.mt-antworten-aus .mt-antworten { display: none; }
}
/* Duo innen / Handy quer (601-950): Feldleiste kompakt in einer Zeile mit mehr Feldern */
@media (min-width: 601px) and (max-width: 950px) {
    .mt-neu .ticket-props { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1.5fr); }
    .mt-neu .ticket-props > .field-group.fg-name { grid-column: auto; display: block; }
}

/* N6 Dunkle Ansicht (15.10.2026): nur bis 950 px (Handy, Duo, Tablet hochkant), damit sich am Desktop nichts
   aendert. Farben ueber die Variablen; hell eingefaerbte Hinweiskaesten bekommen dunkle Toene. */
@media (prefers-color-scheme: dark) and (max-width: 950px) {
    :root {
        color-scheme: dark;
        --bg: #111a17;
        --bg-card: #18241f;
        --bg-hover: #1f2e28;
        --bg-input: #142019;
        --text: #e6ece8;
        --text-muted: #a3b2ab;
        --border: #2c3d36;
        --primary: #7fc4a0;
        --primary-hover: #9bd5b5;
        --primary-light: #1f3a2d;
        --lime: #3d5a2a;
        --success: #5fb98a;
        --warning: #e0a446;
        --danger: #f08378;
        --purple: #a99be0;
        --shadow: 0 1px 2px rgba(0,0,0,.4);
        --shadow-md: 0 10px 20px rgba(0,0,0,.45);
        --navbar-bg: rgba(17,26,23,.96);
        --navbar-text: #e6ece8;
        accent-color: #7fc4a0;
    }
    body { background: var(--bg); color: var(--text); }
    .btn-primary, .mt-neu .mt-antworten { color: #0e1714; }
    .btn-secondary { background: #2c3d36; border-color: #2c3d36; color: var(--text); }
    .btn-secondary:hover { background: #36493f; }
    input, select, textarea { background-color: var(--bg-input); color: var(--text); border-color: var(--border); }
    .nav-links.open, .nav-dd-menu { background: var(--bg-card); }
    .nav-links a.active { background: var(--primary-light); color: var(--text); }
    .nav-logo, .bild-titel-link img, .image-preview-link img { filter: none; }
    /* hell eingefaerbte Kaesten und Kennzeichen */
    .tt-entwurf, .entwurf-konflikt, .approval-toggle.on, .entwurf-bilder { background: #3a2f12; border-color: #5c4a1a; color: #f5d78a; }
    .entwurf-bilder-kopf { color: #f5d78a; }
    .approval-toggle.onsite-toggle.on { background: #0f3a42; border-color: #19606c; color: #9fe3ef; }
    .ticket-table tr.ticket-myturn, .ticket-table tr.ticket-myturn td { background: #16283a; }
    .ticket-table tr.ticket-myturn:hover td { background: #1b3147; }
    .subtask-offen { background: #2a2414; }
    .subtask-offen .subtask-name { color: #f0cf86; }
    .subtask-offen.subtask-done { background: transparent; }
    .badge.due-badge-over { background: #4a1d1d; color: #ffb4ab; }
    .message-internal { background: #2d2614; }
    .fg-table tr.fg-ueber td { background: #3a1c1c; }
    .fg-table tr.fg-schluss td { background: #33290f; }
    .reply-editor { background: var(--bg-input); color: var(--text); }
    .filter-input.filter-aktiv, .filter-select.filter-aktiv { background: var(--primary-light); }
    .mt-neu .mt-felder-knopf { color: var(--text); }
    /* helle Panels (Codex 15.10.2026): dunkler Grund, Text hell; Kontrast >= 4,5 nachgemessen */
    .subtask-note-internal, .est-rueckfrage { background: #2d2614; border-color: #4f4320; }
    .est-rueckfrage-head { color: #f5d78a; }
    .est-rueckfrage-text { color: var(--text); border-left-color: #e0a446; }
    .closed-box { background: #15291e; }
    .closed-box .appt-when, .closed-box .appt-state { color: #9fdcb6; }
    .data-table th { background: var(--bg-hover); color: var(--text-muted); }
    html .fg-table tr.fg-ueber td { background: #3a1c1c; }
    html .fg-table tr.fg-schluss td { background: #33290f; }
    .fg-table a, .closed-box a { color: var(--primary); }
    .est-used-over, .est-verbrauch .est-used-over { color: #f6a49b; }
    .sg-warn { color: #f0b768; }
    .stand-chip, .tt-stand { color: color-mix(in srgb, var(--stand-farbe, #6b7280) 40%, #ffffff);
        background: color-mix(in srgb, var(--stand-farbe, #6b7280) 22%, var(--bg-card));
        border-color: color-mix(in srgb, var(--stand-farbe, #6b7280) 50%, var(--bg-card)); }
    /* gefuellte Flaechen in Markengruen: dunkles Gruen mit weisser Schrift wie am Tag */
    .badge-nextaction.na-team, .badge-admin, .btn-success, .subtask-mark-done { background: #275b45; border-color: #275b45; color: #fff; }
    .btn-success:hover { background: #2f6b52; }
    .inbox-badge { background: #b4463b; color: #fff; }
    .badge[style*="var(--success"], .badge[style*="var(--primary)"] { background: #275b45 !important; color: #fff; }
    strong[style*="#b45309"], .sg-num[style*="#b45309"] { color: #f0b768 !important; }
    strong[style*="#2e8b5e"], .sg-num[style*="#2e8b5e"] { color: #7fd1a5 !important; }
}
/* Vorschau-Bild nur fuer das Handy (<picture>): am Desktop wie vorher nur das <img> */
.bild-titel-link picture { display: contents; }
@media (min-width: 951px) { .filter-chips { display: none; } }

/* ---- Aufgeraeumter Dashboard-Kopf (Karl 15.10.2026: Variante A + Desktop, Schalter in config.php).
   Serverseitig ein Block .dk-kopf-zeile: Titel, "+ Neu", Zaehler, Staende. Aus = alter Kopf, nichts aendert sich. ---- */
.dk-filter-zahl { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 10px; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700; }
.dk-kopf-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; margin: .25rem 0 1rem; }
.dk-kopf-zeile > h1 { margin: 0; }
.dk-kopf-zeile > .stats-grid, .dk-kopf-zeile > .stand-zeile { margin: 0; }
@media (max-width: 950px) {
    .dk-neu .dk-kopf-zeile { gap: .35rem .5rem; margin-bottom: .5rem; }
    .dk-neu .dk-kopf-zeile > h1 { flex: 1 1 auto; font-size: 1.45rem; }
    .dk-neu .dk-neu-knopf { flex: 0 0 auto; min-height: 44px; min-width: 5.5rem; justify-content: center; font-size: .95rem; }
    .dk-neu .dk-kopf-zeile > .stats-grid, .dk-neu .dk-kopf-zeile > .stand-zeile { flex: 1 1 100%; }
    /* Zaehler als Raster: Zahl gross, Bezeichnung klein darunter, Farbe als schmaler Rand */
    .dk-neu .stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; }
    .dk-neu .stat-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: .15rem;
        min-height: 54px; padding: .35rem .4rem .35rem .5rem; border-left-width: 3px; white-space: normal; min-width: 0; }
    .dk-neu .stat-card:hover, .dk-neu .stat-card.stat-active { transform: none; }
    .dk-neu .stat-number { font-size: 1.25rem; }
    .dk-neu .stat-label { font-size: .68rem; letter-spacing: .02em; color: var(--text-muted); line-height: 1.15; overflow-wrap: normal; word-break: normal; -webkit-hyphens: auto; hyphens: auto; }
    .dk-neu .stat-card .stat-sub { margin: 0; padding: 0 .3rem; font-size: .66rem; }
    .dk-neu .stat-card.stat-null { opacity: .5; box-shadow: none; }
    /* Variante A: Staende als zweite Kachelgruppe im selben Raster */
    .dk-a .stand-zeile { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; }
    .dk-a .stand-chip { display: flex; flex-direction: column-reverse; align-items: flex-start; justify-content: center; gap: .15rem; min-height: 54px;
        padding: .35rem .4rem .35rem .5rem; border-radius: var(--radius-card); border-left: 3px solid var(--stand-farbe, #6b7280); min-width: 0; }
    .dk-a .stand-chip strong { font-size: 1.25rem; line-height: 1; color: var(--text); }
    .dk-a .stand-chip .sc-text { font-size: .68rem; line-height: 1.15; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; -webkit-hyphens: auto; hyphens: auto; }
    .dk-a .stand-chip .sc-dp { display: none; }
    /* Variante B: Staende als schmale Zeile */
    .dk-b .stand-zeile { display: flex; flex-wrap: wrap; gap: .35rem; }
    .dk-b .stand-chip { display: inline-flex; align-items: center; gap: .3rem; min-height: 44px; padding: .15rem .7rem; font-size: .82rem; }
    .dk-b .stand-chip .sc-dp { display: none; }
    .dk-b .stand-chip strong { order: -1; }
    /* Suche und Filter-Knopf in einer Zeile, "Geschlossene" im Panel */
    .dk-neu .ticket-filterleiste { margin-bottom: 1rem; }
    .dk-neu .ticket-filterleiste .filter-form { flex-wrap: wrap; column-gap: .5rem; }
    .dk-neu .ticket-filterleiste .filter-suche { flex: 1 1 0; width: auto; min-width: 0; }
    .dk-neu .ticket-filterleiste .filter-mobil-knopf { min-width: 44px; min-height: 44px; padding: 0 .7rem; gap: .35rem; }
    .dk-neu .dk-filter-text { display: none; }
    .dk-neu .ticket-filterleiste .filter-form:not(.filter-offen) > .dk-haken-panel { display: none; }
    .dk-neu .ticket-filterleiste .filter-form > .dk-haken-panel { flex: 1 1 100%; order: 50; }
    .dk-neu .filter-chips { order: 40; }
}
/* Duo innen hochkant (bis 799 px): 4 Spalten wie auf dem Telefon; ab 800 px (Duo innen quer) alle in einer Zeile */
@media (min-width: 601px) and (max-width: 950px) { .dk-neu .stat-label, .dk-a .stand-chip .sc-text { -webkit-hyphens: manual; hyphens: manual; } }
@media (min-width: 800px) and (max-width: 950px) {
    .dk-neu .stats-grid, .dk-a .stand-zeile { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
/* Desktop: eine Kopfzeile Titel, Zaehler, Staende. "+ Neues Ticket" steht schon in der Navigation. */
@media (min-width: 951px) {
    .dk-desktop .dk-kopf-zeile > h1 { font-size: 1.6rem; margin-right: .5rem; }
    .dk-desktop .dk-neu-knopf { display: none; }
    .dk-desktop .stat-card.stat-null { opacity: .55; }
    .dk-desktop .ticket-filterleiste { margin-bottom: 1.25rem; }
    .dk-desktop .ticket-filterleiste .filter-form { flex-wrap: wrap; }
    .dk-desktop .ticket-filterleiste .filter-suche { flex: 1 1 20rem; min-width: 20rem; }
    .dk-desktop .ticket-filterleiste .filter-form > select { flex: 0 1 11rem; min-width: 8rem; max-width: 14rem; }
}
@media (min-width: 951px) { .dk-neu:not(.dk-desktop) .dk-neu-knopf { min-height: 36px; } }

/* Seite "Mitteilungen" (15.10.2026): je Ereignis eine Zeile, Schalter immer an derselben Stelle rechts, Zustand farbig */
.push-seite { max-width: 46rem; }
.push-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: .75rem 1rem; margin-bottom: 1rem; }
.push-block h2 { font-size: 1.05rem; margin: .1rem 0 .4rem; }
.push-zeile { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-top: 1px solid var(--border); }
.push-block h2 + .push-zeile, .push-block h2 + * > .push-zeile:first-child { border-top: 0; }
.push-zeile-text { display: flex; flex-direction: column; min-width: 0; }
.push-zeile-label { font-weight: 600; overflow-wrap: anywhere; }
.push-zeile-hinweis { font-size: .8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.push-zeile-haupt .push-zeile-label { font-weight: 700; }
.push-zeile-unter { padding-left: 1rem; }
.push-gruppe-aus .push-zeile-unter { opacity: .5; }
.push-toggle { flex: 0 0 5.5rem; width: 5.5rem !important; min-width: 5.5rem; justify-content: center; min-height: 40px; }
.push-toggle.on { background: #dcfce7; border-color: #86efac; color: #166534; font-weight: 700; }
.push-knoepfe { display: flex; justify-content: flex-end; margin-top: .25rem; }
.push-knoepfe .btn { min-width: 13rem; justify-content: center; }
.push-geraete { font-size: .82rem; color: var(--text-muted); margin: .5rem 0 0; overflow-wrap: anywhere; }
.push-seite > .push-hinweis { margin: 0 0 1rem; font-size: .88rem; color: var(--text-muted); }
@media (max-width: 950px) {
    .push-block { padding: .6rem .75rem; }
    .push-toggle { min-height: 44px; }
    .push-knoepfe .btn { width: 100%; min-height: 44px; }
}
@media (prefers-color-scheme: dark) and (max-width: 950px) {
    .push-toggle.on { background: #14532d; border-color: #166534; color: #bbf7d0; }
}

/* Guthaben aus erledigtem Ticket fuer Folgetickets (Karl 15.10.2026): Zeile = Text links, Knopf rechts mit
   fester Breite (Karl 13.10.: Knopfreihen feste Breite, rechtsbuendig); am Telefon Knopf unter dem Text. */
.guthaben-wahl { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(39, 91, 69, .15); }
.guthaben-wahl:first-of-type { border-top: 0; }
.guthaben-wahl-text { flex: 1 1 auto; min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.guthaben-wahl-klein { font-size: 13px; color: #52615b; }
.guthaben-wahl .guthaben-knopf { flex: 0 0 auto; width: 160px; min-height: 40px; }
@media (max-width: 600px) {
    .guthaben-wahl { flex-direction: column; align-items: stretch; }
    .guthaben-wahl .guthaben-knopf { width: 160px; align-self: flex-end; min-height: 44px; }
}
@media (prefers-color-scheme: dark) {
    .guthaben-kasten { background: #1f2a1c !important; border-color: #3d5a2a !important; color: #e5ecdf; }
    .guthaben-wahl-klein, .guthaben-meldung { color: #b6c2b0 !important; }
}
.guthaben-kasten a { color: var(--primary, #275b45); }
.guthaben-wahl .guthaben-knopf { justify-content: center; text-align: center; }
@media (prefers-color-scheme: dark) { .guthaben-kasten a { color: #bfe3a0; } }

/* Abschluss-Popup (Karl 16.10.2026): Knopf „Auftrag abschließen …“ rechtsbündig mit fester Breite, das Popup kommt aus der Zeiterfassung */
.abschluss-knoepfe .abschluss-los { width: 15rem; max-width: 100%; justify-content: center; text-align: center; }
@media (max-width: 950px) { .abschluss-knoepfe .abschluss-los { width: 15rem; } }
@media (max-width: 700px) { .abschluss-knoepfe .abschluss-los { width: 100%; } }
.abschluss-zeile.abschluss-erledigt { border-left-color: var(--success, #2e7d32); }
.abschluss-erledigt-text { color: var(--success, #2e7d32); font-weight: 600; }

/* Live-Anzeige der Agenten (Karl 19.10.2026): Kasten unter der Beschreibung, nur Admins. Farben ueber die
   Variablen, damit die dunkle Ansicht bis 950 px von selbst passt. */
.agent-live { background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid var(--text-muted); border-radius: var(--radius); box-shadow: var(--shadow); padding: .85rem 1.1rem; margin-bottom: 1rem; }
.agent-live[hidden], .agent-live [hidden] { display: none !important; }
.agent-live.agent-live-aktiv { border-left-color: var(--primary); }
.agent-live.agent-live-still { border-left-color: var(--warning); }
.agent-live-kopf { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.agent-live-punkt { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
.agent-live-aktiv .agent-live-punkt { background: var(--success); animation: agent-live-puls 1.6s ease-in-out infinite; }
.agent-live-still .agent-live-punkt { background: var(--warning); }
@keyframes agent-live-puls { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .agent-live-aktiv .agent-live-punkt { animation: none; } }
.agent-live-ueber { flex: 1 1 14rem; min-width: 0; }
.agent-live-titel { font-weight: 600; color: var(--text); line-height: 1.35; }
.agent-live-info { font-size: .82rem; color: var(--text-muted); line-height: 1.4; overflow-wrap: anywhere; }
.agent-live-steuer { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-left: auto; }
.agent-live-wahl { max-width: 17rem; }
.agent-live-umschalten { width: 10.5rem; justify-content: center; text-align: center; }
.agent-live-zeilen { list-style: none; margin: .7rem 0 0; padding: .5rem .65rem; max-height: 18rem; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); font-size: .84rem; line-height: 1.45; }
.agent-live-zeilen li { display: flex; gap: .65rem; padding: .12rem 0; }
.agent-live-zeilen time { flex: 0 0 4.4em; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.agent-live-zeilen span { min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.agent-live-fuss { margin-top: .4rem; font-size: .78rem; color: var(--text-muted); }
@media (max-width: 950px) {
    .agent-live-wahl { font-size: 16px; }
}
@media (max-width: 600px) {
    .agent-live { padding: .75rem .8rem; }
    .agent-live-steuer { width: 100%; margin-left: 0; }
    .agent-live-wahl { flex: 1 1 auto; max-width: none; min-height: 44px; }
    .agent-live-umschalten { min-height: 44px; flex: 0 0 auto; }
    .agent-live-zeilen { max-height: 22rem; font-size: .82rem; }
    .agent-live-zeilen li { gap: .5rem; padding: .2rem 0; }
    .agent-live-zeilen time { flex-basis: 4.6em; font-size: .74rem; padding-top: .1rem; }
}

/* Bildvorschau (Lightbox) fuer Bildanhaenge, Karl 19.10.2026 */
html.lb-offen, html.lb-offen body { overflow: hidden; }
.lb-overlay[hidden], .lb-overlay [hidden] { display: none !important; }
.lb-overlay {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; flex-direction: column;
    background: rgba(10, 14, 12, .96);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    color: #f2f5f3;
    padding: calc(env(safe-area-inset-top, 0px) + 3.5rem) calc(env(safe-area-inset-right, 0px) + 1rem)
             calc(env(safe-area-inset-bottom, 0px) + .75rem) calc(env(safe-area-inset-left, 0px) + 1rem);
    box-sizing: border-box;
    overscroll-behavior: contain;
    -webkit-tap-highlight-color: transparent;
}
.lb-buehne {
    position: relative; flex: 1 1 auto; min-height: 0;
    display: flex; align-items: center; justify-content: center;
}
.lb-bild {
    display: block; max-width: 100%; max-height: 100%;
    width: auto; height: auto; object-fit: contain;
    border-radius: 4px; box-shadow: 0 8px 32px rgba(0,0,0,.5);
    background: #fff;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.lb-knopf {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; padding: 0; margin: 0;
    border: none; border-radius: 50%;
    background: rgba(255,255,255,.14); color: #fff;
    cursor: pointer; transition: background .15s;
}
.lb-knopf:hover:not(:disabled) { background: rgba(255,255,255,.26); }
.lb-knopf:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb-knopf:disabled { opacity: .25; cursor: default; }
.lb-zu {
    position: absolute; z-index: 2;
    top: calc(env(safe-area-inset-top, 0px) + .5rem);
    right: calc(env(safe-area-inset-right, 0px) + .75rem);
}
.lb-pfeil { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.lb-zurueck { left: 0; }
.lb-weiter { right: 0; }
.lb-laedt {
    position: absolute; top: 50%; left: 50%;
    width: 36px; height: 36px; margin: -18px 0 0 -18px;
    border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%;
    animation: lb-dreh .8s linear infinite;
    display: none; pointer-events: none;
}
.lb-ist-laden .lb-laedt { display: block; }
@keyframes lb-dreh { to { transform: rotate(360deg); } }
.lb-fuss {
    flex: 0 0 auto;
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
    gap: .35rem 1.25rem;
    padding-top: .75rem; text-align: center; font-size: .9rem;
}
.lb-name { font-weight: 600; overflow-wrap: anywhere; }
.lb-zahl { color: rgba(242,245,243,.75); }
.lb-zahl:empty { display: none; }
.lb-links { display: inline-flex; gap: 1rem; }
.lb-links a { color: #fff; text-decoration: underline; text-underline-offset: 3px; padding: .4rem 0; }
@media (min-width: 951px) {
    .lb-overlay { padding-left: calc(env(safe-area-inset-left, 0px) + 4.5rem); padding-right: calc(env(safe-area-inset-right, 0px) + 4.5rem); }
    .lb-zurueck { left: -3.75rem; }
    .lb-weiter { right: -3.75rem; }
}
@media (max-width: 950px) {
    .lb-pfeil { background: rgba(0,0,0,.35); color: rgba(255,255,255,.9); }
    .lb-zurueck { left: -.25rem; }
    .lb-weiter { right: -.25rem; }
}
@media (prefers-reduced-motion: reduce) { .lb-laedt { animation-duration: 2s; } }

/* Offline (Karl 21.10.2026, assets/offline.js): Hinweis oben, Zaehler in der Kopfleiste, vorgemerkte Aktionen im Ticket */
.ow-banner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
    margin: 0 0 1rem; padding: .7rem 1rem; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--primary-light); color: var(--text); font-size: .9375rem; }
.ow-banner-offline { background: #fef3c7; border-color: #f2d68a; color: #5c3d06; }
.ow-banner-text { flex: 1 1 16rem; }
.ow-chip { flex: 0 0 auto; margin-left: auto; border: 0; border-radius: 999px; padding: .3rem .75rem; min-height: 32px;
    background: #fef3c7; color: #5c3d06; font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ow-chip-fehler { background: #fee2e2; color: #991b1b; }
.ow-chip ~ .nav-neuladen, .ow-chip ~ .burger { margin-left: .25rem; }
.ow-liste { margin: 0 0 1rem; padding: .85rem 1rem; border-radius: var(--radius-card); border: 1px solid #f2d68a;
    background: var(--bg-card); box-shadow: var(--shadow); }
.ow-liste-titel { font-size: 1rem; margin: 0 0 .5rem; }
.ow-eintrag { padding: .6rem 0; border-top: 1px solid var(--border); }
.ow-eintrag:first-of-type { border-top: 0; padding-top: 0; }
.ow-eintrag-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .5rem; }
.ow-zeit { color: var(--text-muted); font-size: .8125rem; }
.ow-zustand { color: var(--text-muted); font-size: .875rem; margin: .15rem 0 .4rem; }
.ow-eintrag-fehler .ow-zustand { color: var(--danger); font-weight: 600; }
.ow-text { display: block; width: 100%; resize: vertical; font: inherit; font-size: .875rem; padding: .45rem .6rem;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-hover); color: var(--text); margin-bottom: .45rem; }
.ow-knoepfe { display: flex; flex-wrap: wrap; gap: .4rem; }
.ow-antwort-hinweis { margin: 0 0 .5rem; padding: .45rem .7rem; border-radius: var(--radius); background: #fef3c7; color: #5c3d06; font-size: .875rem; }
@media (max-width: 950px) {
    .ow-text { font-size: 16px; }   /* iOS zoomt sonst beim Antippen */
    .ow-knoepfe .btn { min-height: 44px; }
}
@media (max-width: 600px) {
    .ow-chip { padding: .25rem .6rem; font-size: .75rem; }
}
@media (prefers-color-scheme: dark) and (max-width: 950px) {
    .ow-banner-offline, .ow-chip, .ow-antwort-hinweis { background: #3a2f12; color: #f6dfa0; border-color: #5c4a1a; }
    .ow-chip-fehler { background: #47201c; color: #f5b5ad; }
    .ow-liste { border-color: #5c4a1a; }
}
.ow-eintrag-kopf a { color: var(--primary); font-weight: 600; }
