/* ACONA Kundenportal
   Corporate Design nach acona-softwares.de: Poppins, Navy #1C244B, ACONA-Blau #009FE3.
   Navy trägt die Shell (Leiste), weiße Flächen liegen ohne Rahmen und Schatten auf getöntem Grund.
   Blau steht für Auswahl und Aktion, Bernstein ausschließlich für "Sie sind am Zug".
   Radien: Buttons rund (wie auf der Website), Flächen und Felder 8px, Status 4px. */

@font-face { font-family: "Poppins"; src: url("../fonts/poppins-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
    color-scheme: light;

    --navy: #1c244b;
    --navy-raised: #262f5e;
    --rail-text: #aeb6d0;
    --rail-dim: #8f99ba;

    --ground: #eef2f6;
    --panel: #ffffff;
    --panel-2: #f6f8fb;
    --line: #e6ebf1;
    --control: #cfd7e2;
    --control-hover: #a9b4c4;

    --text: #2b3044;
    --muted: #5b6472;
    --soft: #687284;

    --brand: #009fe3;
    --brand-tint: #e7f5fc;
    --brand-light: #6ccdf5;
    --brand-ink: #0072a8;
    --action: #007ab3;
    --action-hover: #00669a;

    --mine: #d98e04;
    --mine-tint: #fff6e5;
    --mine-ink: #8a5300;
    --done: #23874e;
    --hold: #8792a6;

    --danger: #b42318;
    --danger-tint: #fdeeec;
    --success-tint: #e8f5ee;

    --s-open: #006fa8;     --s-open-bg: #e7f5fc;
    --s-progress: #3b4bc8; --s-progress-bg: #eef0ff;
    --s-waiting: #8a5300;  --s-waiting-bg: #fff1d6;
    --s-hold: #4b5565;     --s-hold-bg: #e9edf2;
    --s-done: #1e7a45;     --s-done-bg: #e3f4ea;
    --s-closed: #5b6472;   --s-closed-bg: #edf0f4;

    --font: "Poppins", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    --r: 8px;
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --rail-width: 256px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    scrollbar-color: #c3ccd8 transparent;
    accent-color: var(--action);
}

body {
    margin: 0;
    background: var(--ground);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(0, 159, 227, 0.22); color: var(--navy); }

h1, h2, h3 { margin: 0; color: var(--navy); font-weight: 600; line-height: 1.3; text-wrap: balance; }
h1 { font-size: 1.75rem; letter-spacing: -0.015em; }
h2 { font-size: 1.0625rem; }
h3 { font-size: 0.875rem; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 600; }

a { color: var(--brand-ink); text-underline-offset: 0.2em; }
a:hover { color: var(--action-hover); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.optional { margin-left: 6px; color: var(--soft); font-size: 0.8125rem; font-weight: 400; }

.icon { width: 18px; height: 18px; flex: none; }
.icon--sm { width: 15px; height: 15px; }
.icon--xs { width: 13px; height: 13px; }

.skip-link { position: absolute; left: 16px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: var(--r); background: var(--navy); color: #fff; }
.skip-link:focus { top: 12px; color: #fff; }

/* Shell: Navy-Leiste links, Inhalt zentriert */

.shell { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: 100vh; }

.rail {
    position: sticky; top: 0;
    height: 100vh;
    display: flex; flex-direction: column;
    padding: 24px 16px 18px;
    background: var(--navy);
    color: var(--rail-text);
    overflow-y: auto;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.rail ::selection { background: rgba(108, 205, 245, 0.35); color: #fff; }
.rail :focus-visible { outline-color: var(--brand-light); }
.rail__head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 22px; }
.rail__logo img { display: block; width: 128px; height: auto; }
.rail__close { display: none; }

.rail__org { display: flex; flex-direction: column; margin: 0 8px 18px; line-height: 1.35; }
.rail__org-name { color: #fff; font-weight: 600; font-size: 0.875rem; overflow-wrap: anywhere; }
.rail__org-meta { color: var(--rail-dim); font-size: 0.75rem; }

.rail__new {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; margin-bottom: 18px;
    border-radius: 999px;
    background: var(--brand); color: var(--navy);
    font-weight: 600; text-decoration: none;
    transition: background-color 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.rail__new:hover, .rail__new[aria-current="page"] { background: #33b2ea; color: var(--navy); }
.rail__new:active { transform: scale(0.97); }

.rail__nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rail__nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px;
    border-radius: var(--r);
    color: var(--rail-text); text-decoration: none;
    font-weight: 500;
    transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.rail__icon { color: var(--rail-dim); }
.rail__label { flex: 1; }
.rail__nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.rail__nav a[aria-current="page"] { background: rgba(0, 159, 227, 0.18); color: #fff; font-weight: 600; }
.rail__nav a[aria-current="page"] .rail__icon { color: var(--brand-light); }
.rail__count {
    min-width: 22px; padding: 0 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12); color: #fff;
    font-size: 0.75rem; font-weight: 600; line-height: 20px; text-align: center;
    font-variant-numeric: tabular-nums;
}
.rail__count--alert { background: #f2b544; color: var(--navy); }

.rail__foot { margin-top: auto; padding-top: 24px; }
.rail__help { margin: 0 8px 16px; font-size: 0.75rem; line-height: 1.5; color: var(--rail-dim); }
.rail__help a { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-light); font-weight: 500; text-decoration: none; }
.rail__help a:hover { color: #fff; text-decoration: underline; }
.rail__person {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 8px;
    border-radius: var(--r);
    background: var(--navy-raised);
}
.rail__avatar { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 0.6875rem; font-weight: 600; }
.rail__person-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.rail__person-name { color: #fff; font-weight: 600; font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__person-mail { color: var(--rail-dim); font-size: 0.6875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__logout { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--r); background: transparent; color: var(--rail-text); cursor: pointer; }
.rail__logout:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.rail__legal { display: flex; gap: 14px; margin: 12px 8px 0; font-size: 0.6875rem; }
.rail__legal a { color: var(--rail-dim); text-decoration: none; }
.rail__legal a:hover { color: #fff; text-decoration: underline; }

.rail-backdrop, .topbar { display: none; }

.main { min-width: 0; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 40px 56px; }
.container--narrow { max-width: 860px; }
.flashes { padding-bottom: 0; }
.flashes + .container { padding-top: 16px; }

/* Seitenkopf */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head--plain { margin-bottom: 22px; }
.page-head__sub { margin: 6px 0 0; color: var(--muted); max-width: 64ch; }
.back { display: inline-flex; align-items: center; gap: 4px; margin: -6px 0 12px -4px; padding: 4px; color: var(--muted); font-size: 0.8125rem; text-decoration: none; border-radius: var(--r); }
.back:hover { color: var(--navy); }
.link-quiet { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-ink); font-size: 0.8125rem; font-weight: 500; text-decoration: none; }
.link-quiet:hover { text-decoration: underline; }

/* Buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 18px;
    border: 1px solid var(--action); border-radius: 999px;
    background: var(--action); color: #fff;
    font: inherit; font-weight: 500; line-height: 1;
    text-decoration: none; white-space: nowrap;
    cursor: pointer;
    transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.btn .icon { width: 17px; height: 17px; }
.btn:hover { background: var(--action-hover); border-color: var(--action-hover); color: #fff; }
.btn:active { transform: scale(0.97); }
.btn[aria-disabled="true"] { opacity: 0.65; cursor: progress; transform: none; }
.btn--secondary { background: var(--panel); color: var(--navy); border-color: var(--control); }
.btn--secondary:hover { background: var(--panel-2); color: var(--navy); border-color: var(--control-hover); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--panel-2); border-color: transparent; color: var(--navy); }
.btn--small { min-height: 32px; padding: 0 14px; font-size: 0.8125rem; }
.btn--block { width: 100%; }

/* Meldungen */

.notice { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 12px 14px; border-radius: var(--r); background: var(--panel); }
.notice .icon { margin-top: 1px; }
.notice--error { background: var(--danger-tint); color: #7a1a12; }
.notice--success { background: var(--success-tint); color: #14532d; }
.notice--mine { background: var(--mine-tint); color: #6b4300; }
.form__foot .field__hint { margin: 0 auto 0 0; align-self: center; }

/* Flächen */

.panel { background: var(--panel); border-radius: var(--r); }

/* Status */

.status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.status--open { color: var(--s-open); background: var(--s-open-bg); }
.status--progress { color: var(--s-progress); background: var(--s-progress-bg); }
.status--waiting { color: var(--s-waiting); background: var(--s-waiting-bg); }
.status--hold { color: var(--s-hold); background: var(--s-hold-bg); }
.status--done { color: var(--s-done); background: var(--s-done-bg); }
.status--closed { color: var(--s-closed); background: var(--s-closed-bg); }

/* Am-Zug-Anzeige: links die Gegenseite, rechts "Sie" */

.turn { display: inline-flex; align-items: center; gap: 10px; vertical-align: middle; }
.turn__track { position: relative; display: block; width: 34px; height: 6px; border-radius: 3px; background: #dbe2eb; }
.turn__dot {
    position: absolute; top: 50%;
    width: 12px; height: 12px; border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 2px var(--panel);
}
.turn--theirs .turn__dot { left: 3px; background: var(--brand); }
.turn--mine .turn__dot { left: calc(100% - 3px); background: var(--mine); }
.turn--hold .turn__dot { left: 50%; background: var(--hold); }
.turn--done .turn__track { background: var(--done); }
.turn--done .turn__dot { display: none; }
.turn--large .turn__track { width: 96px; height: 8px; border-radius: 4px; }
.turn--large .turn__dot { width: 18px; height: 18px; box-shadow: 0 0 0 3px var(--panel); }
.turn--large.turn--theirs .turn__dot { left: 4px; }
.turn--large.turn--mine .turn__dot { left: calc(100% - 4px); }
.turn__end { color: var(--soft); font-size: 0.75rem; font-weight: 600; }
.turn--theirs .turn__end--other { color: var(--brand-ink); }
.turn--mine .turn__end--me { color: var(--mine-ink); }
.turn--done .turn__end { color: var(--s-done); }

/* Übersicht */

.group { margin-bottom: 32px; }
.group__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.group__head h2 { font-size: 1rem; display: flex; align-items: baseline; gap: 8px; }
.group__count { color: var(--soft); font-size: 0.875rem; font-weight: 500; }
.group--focus .group__count { padding: 0 8px; border-radius: 999px; background: var(--s-waiting-bg); color: var(--mine-ink); font-weight: 600; font-size: 0.8125rem; }
.group__empty { margin: 0; color: var(--soft); }

.rows { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.rows > li + li { border-top: 1px solid var(--line); }
.row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto 104px;
    grid-template-areas: "turn main meta time";
    align-items: center; gap: 4px 16px;
    padding: 14px 18px;
    color: var(--text); text-decoration: none;
    transition: background-color 150ms var(--ease-out);
}
.row:hover { background: var(--panel-2); color: var(--text); }
.row--mine { background: #fffbf2; }
.row--mine:hover { background: var(--mine-tint); }
.row > .turn { grid-area: turn; }
.row__main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }
.row__subject { color: var(--navy); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__excerpt { color: var(--muted); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__author { color: var(--text); font-weight: 500; }
.row__meta { grid-area: meta; display: flex; gap: 12px; color: var(--soft); font-size: 0.75rem; white-space: nowrap; }
.row__time { grid-area: time; color: var(--soft); font-size: 0.75rem; text-align: right; white-space: nowrap; }

.first-run { padding: 32px; max-width: 720px; }
.first-run h2 { font-size: 1.25rem; margin-bottom: 8px; }
.first-run p { color: var(--muted); max-width: 60ch; margin-bottom: 20px; }

/* Ticketliste */

.list-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 16px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs__item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 14px 10px 12px;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500;
}
.tabs__item:hover { color: var(--navy); }
.tabs__item[aria-current="page"] { color: var(--navy); border-bottom-color: var(--brand); font-weight: 600; }
.tabs__count { padding: 0 7px; border-radius: 999px; background: var(--ground); color: var(--soft); font-size: 0.6875rem; font-weight: 600; line-height: 19px; }
.tabs__item[aria-current="page"] .tabs__count { background: var(--brand-tint); color: var(--brand-ink); }

.search { position: relative; flex: 0 1 300px; margin: 8px 0; }
.search__icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--soft); pointer-events: none; }
.search__input {
    width: 100%; height: 38px; padding: 0 14px 0 38px;
    border: 1px solid transparent; border-radius: 999px;
    background: var(--ground); color: var(--text);
    font: inherit; caret-color: var(--brand);
    transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.search__input:hover { border-color: var(--control); }
.search__input:focus { outline: none; background: var(--panel); border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 159, 227, 0.16); }
.search__input::placeholder { color: var(--soft); }

.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 16px; background: var(--panel-2); color: var(--soft); font-size: 0.75rem; font-weight: 500; text-align: left; white-space: nowrap; }
.table td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { position: relative; transition: background-color 150ms var(--ease-out); }
.table tbody tr:hover { background: var(--panel-2); }
.table tbody tr.is-mine { background: #fffbf2; }
.table tbody tr.is-mine:hover { background: var(--mine-tint); }
.table tbody tr:has(.t-subject:focus-visible) { outline: 2px solid var(--brand); outline-offset: -2px; }
.t-turn { width: 1%; padding-right: 4px !important; }
.t-ticket { min-width: 260px; }
.t-subject { display: block; color: var(--navy); font-weight: 600; text-decoration: none; }
.t-subject::after { content: ""; position: absolute; inset: 0; }
.t-subject:focus-visible { outline: none; }
.t-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--soft); font-size: 0.75rem; }
.t-status { width: 1%; white-space: nowrap; }
.t-last { width: 1%; white-space: nowrap; font-size: 0.8125rem; }
.t-last__who { display: block; color: var(--text); font-weight: 500; }
.t-last time { color: var(--soft); font-size: 0.75rem; }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--soft); font-size: 0.75rem; }
.table-foot__nav { display: flex; gap: 8px; }

.empty { padding: 44px 24px; text-align: center; }
.empty h2 { font-size: 1rem; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 48ch; margin: 0 auto 18px; }
.empty p:last-child { margin-bottom: 0; }

/* Skeleton beim Nachladen der Liste */

.skeleton { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, #e9eef4 25%, #f4f7fa 45%, #e9eef4 65%); background-size: 300% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.skeleton--turn { width: 34px; height: 6px; }
.skeleton--pill { width: 88px; height: 20px; border-radius: 4px; }
.skeleton-stack { display: flex; flex-direction: column; gap: 8px; }
.w-30 { width: 30%; } .w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; } .w-75 { width: 75%; }
.w-px50 { width: 50px; } .w-px70 { width: 70px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Ticketansicht */

.ticket-head { margin-bottom: 18px; }
.ticket-head h1 { font-size: 1.625rem; max-width: 40ch; }
.ticket-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 10px 0 0; color: var(--muted); font-size: 0.8125rem; }
.ticket-no { display: inline-flex; align-items: center; gap: 2px; color: var(--navy); font-weight: 600; }
.copy { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--r); background: transparent; color: var(--soft); cursor: pointer; transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out); }
.copy:hover { background: var(--panel); color: var(--navy); }
.copy.is-copied { color: var(--done); }

.next {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 24px;
    margin-bottom: 28px; padding: 18px 22px;
    border-radius: var(--r);
    background: var(--panel);
}
.next--mine { background: var(--mine-tint); }
.next--mine .turn__track { background: #f1dfbd; }
.next--mine .turn__dot { box-shadow: 0 0 0 3px var(--mine-tint); }
.next__text h2 { font-size: 1rem; margin-bottom: 2px; }
.next__text p { color: var(--muted); }
.next__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.ticket-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: "conversation info";
    gap: 28px; align-items: start;
}
.conversation { grid-area: conversation; min-width: 0; }
.ticket-info { grid-area: info; position: sticky; top: 24px; }

.conversation__title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; font-size: 1rem; }
.conversation__title .num { color: var(--soft); font-size: 0.8125rem; font-weight: 500; }

.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; }
.msg--own { justify-content: flex-end; }
.msg__card { width: min(100%, 680px); padding: 14px 18px 16px; border-radius: var(--r); background: var(--panel); }
.msg--other .msg__card { margin-right: 48px; }
.msg--own .msg__card { margin-left: 48px; }
.msg--acona .msg__card { background: var(--brand-tint); }
.msg__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.msg__author { display: flex; align-items: center; gap: 8px; color: var(--navy); font-weight: 600; font-size: 0.8125rem; }
.msg__org { padding: 0 6px; border-radius: 4px; background: var(--panel); color: var(--brand-ink); font-size: 0.6875rem; font-weight: 600; line-height: 18px; }
.msg__time { margin-left: auto; color: var(--soft); font-size: 0.75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg__body { font-size: 0.9375rem; line-height: 1.65; overflow-wrap: anywhere; }
.msg__body p { margin-bottom: 0.7em; max-width: 72ch; }
.msg__files { display: grid; gap: 6px; margin-top: 12px; }
.msg--acona .file { background: rgba(255, 255, 255, 0.7); }

.event { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 8px; color: var(--soft); font-size: 0.75rem; text-align: center; }
.event strong { color: var(--muted); }

.older details > summary {
    display: flex; justify-content: center; padding: 8px;
    color: var(--brand-ink); font-size: 0.8125rem; font-weight: 500;
    list-style: none; cursor: pointer; border-radius: var(--r);
}
.older summary::-webkit-details-marker { display: none; }
.older summary:hover { background: var(--panel); }
.older details[open] > summary { display: none; }
.older details > .thread { margin-top: 0; }

.avatar { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #e3e8f0; color: var(--navy); font-size: 0.6875rem; font-weight: 600; }
.avatar--s { width: 26px; height: 26px; font-size: 0.625rem; }
.avatar--acona { background: var(--panel); }
.avatar--acona img { display: block; width: 100%; height: 100%; }

.composer { margin-top: 20px; border-radius: var(--r); background: var(--panel); transition: box-shadow 150ms var(--ease-out); }
.composer:focus-within { box-shadow: 0 0 0 2px var(--brand); }
.composer__label { display: block; padding: 14px 18px 0; color: var(--navy); font-weight: 600; font-size: 0.875rem; }
.composer .notice { margin: 10px 18px 0; }
.composer__input {
    display: block; width: 100%; min-height: 120px; padding: 8px 18px 14px;
    border: 0; resize: vertical; background: transparent; color: var(--text);
    font: inherit; font-size: 0.9375rem; line-height: 1.6; caret-color: var(--brand);
}
.composer__input:focus { outline: none; }
.composer__input::placeholder { color: var(--soft); }
.composer__files { display: grid; gap: 6px; padding: 0 18px 12px; }
.composer__bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 10px 12px 10px 10px; background: var(--panel-2); border-radius: 0 0 var(--r) var(--r); }
.composer__attach { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; color: var(--brand-ink); font-weight: 500; cursor: pointer; transition: background-color 150ms var(--ease-out); }
.composer__attach:hover { background: var(--brand-tint); }
.composer__attach:has(:focus-visible) { outline: 2px solid var(--brand); }
.composer__hint { flex: 1; color: var(--soft); font-size: 0.75rem; }

.info { border-radius: var(--r); background: var(--panel); }
.info__summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; color: var(--navy); font-weight: 600; list-style: none; cursor: pointer; }
.info__summary::-webkit-details-marker { display: none; }
.info__hint { flex: 1; color: var(--soft); font-size: 0.75rem; font-weight: 400; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info[open] .info__hint { visibility: hidden; }
.info__chevron { color: var(--soft); transition: transform 200ms var(--ease-out); }
.info[open] .info__chevron { transform: rotate(90deg); }
.info__body { padding: 0 18px 18px; }
.facts { margin: 0; }
.facts > div { padding: 8px 0; border-top: 1px solid var(--line); }
.facts > div:first-child { border-top: 0; padding-top: 0; }
.facts dt { color: var(--soft); font-size: 0.75rem; }
.facts dd { margin: 1px 0 0; color: var(--navy); font-weight: 500; overflow-wrap: anywhere; }
.info__title { margin: 18px 0 8px; font-size: 0.8125rem; }
.info__none { color: var(--soft); font-size: 0.8125rem; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.people li { display: flex; align-items: center; gap: 10px; font-size: 0.8125rem; color: var(--navy); }
.people__role { margin-left: auto; color: var(--soft); font-size: 0.75rem; text-align: right; }

.files { display: grid; gap: 6px; }
.files--chosen { margin-top: 12px; }
.file { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 10px; border-radius: var(--r); background: var(--panel-2); color: var(--text); text-decoration: none; transition: background-color 150ms var(--ease-out); }
a.file:hover { background: #e9eff6; color: var(--text); }
.file__icon { color: var(--brand-ink); width: 16px; height: 16px; }
.file__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy); font-size: 0.8125rem; font-weight: 500; }
.file__size { color: var(--soft); font-size: 0.75rem; white-space: nowrap; }

/* Formulare */

.form { margin-bottom: 20px; }
.form__section { margin: 0; padding: 22px 24px; border: 0; min-width: 0; }
.form__section + .form__section { border-top: 1px solid var(--line); }
.form__title { float: left; width: 100%; padding: 0; margin: 0 0 14px; color: var(--navy); font-size: 1rem; font-weight: 600; }
.form__title + * { clear: both; }
.form__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; background: var(--panel-2); border-radius: 0 0 var(--r) var(--r); }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .label { display: block; margin-bottom: 6px; color: var(--navy); font-size: 0.8125rem; font-weight: 600; }
.field__hint { margin: -2px 0 8px; color: var(--muted); font-size: 0.8125rem; }
.field__hint--below { margin: 6px 0 0; }
.field__error { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--danger); font-size: 0.8125rem; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-row .field { margin: 0; }
.billing-fields .field-row { margin-bottom: 16px; }
.billing-fields .field-row:last-child { margin-bottom: 0; }
.admin-grid__side .billing-fields .field-row { grid-template-columns: minmax(0, 1fr); }
.billing-summary { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 20px; }
.billing-summary dt { color: var(--muted); }
.billing-summary dd { margin: 0; }

.input, .select, .textarea {
    display: block; width: 100%;
    min-height: 42px; padding: 9px 12px;
    border: 1px solid var(--control); border-radius: var(--r);
    background: var(--panel); color: var(--text);
    font: inherit; caret-color: var(--brand);
    transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
.textarea { resize: vertical; line-height: 1.6; }
.select {
    appearance: none; padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23687284' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 13px center;
}
.select:disabled { background-color: var(--panel-2); color: var(--soft); }
.input:hover, .select:hover:not(:disabled), .textarea:hover { border-color: var(--control-hover); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 159, 227, 0.16); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
::placeholder { color: var(--soft); opacity: 1; }

.category-selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.category-selects .field { margin: 0; }

.dropzone {
    position: relative;
    display: grid; justify-items: center; gap: 2px;
    padding: 22px 20px;
    border: 1px solid var(--control); border-radius: var(--r);
    background: var(--panel-2);
    text-align: center; cursor: pointer;
    transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--brand); background: var(--brand-tint); }
.dropzone:has(:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.dropzone.is-invalid { border-color: var(--danger); }
.dropzone__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone__icon { width: 24px; height: 24px; margin-bottom: 6px; color: var(--brand-ink); }
.dropzone__link { color: var(--brand-ink); font-weight: 600; }
.dropzone__hint { color: var(--soft); font-size: 0.75rem; }

/* Anmeldeseiten */

.auth { min-height: 100vh; display: grid; place-items: center; align-content: center; padding: 40px 16px; }
.auth__box { width: 100%; max-width: 400px; }
.auth__logo { display: block; width: 150px; margin: 0 0 32px; }
.auth__logo img { display: block; width: 100%; height: auto; }
.auth h1 { margin-bottom: 8px; font-size: 1.625rem; }
.auth__lead { color: var(--muted); margin-bottom: 24px; }
.form--panel { padding: 24px; border-radius: var(--r); background: var(--panel); }
.form--panel .btn { width: 100%; }
.auth__foot { margin-top: 20px; color: var(--muted); font-size: 0.8125rem; }
.field > .auth__row { display: flex; justify-content: space-between; align-items: baseline; }
.auth__row a { font-size: 0.8125rem; font-weight: 500; }
.auth__legal { display: flex; gap: 18px; justify-content: center; margin: 36px 0 0; font-size: 0.75rem; }
.auth__legal a { color: var(--soft); text-decoration: none; }
.auth__legal a:hover { color: var(--navy); text-decoration: underline; }

/* Fehlerseiten */

.error-page { max-width: 52ch; padding: 32px 0; }
.error-page__code { margin: 0 0 6px; color: var(--soft); font-size: 0.8125rem; }
.error-page h1 { margin-bottom: 10px; }
.error-page p { color: var(--muted); margin-bottom: 22px; }
.auth .error-page { padding: 0; }

/* Mittlere Breiten: Details wandern über den Verlauf und lassen sich einklappen */

@media (max-width: 1100px) {
    .ticket-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "info" "conversation"; gap: 20px; }
    .ticket-info { position: static; }
    .info__body { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 28px; }
    .info__body > .facts { grid-row: span 3; }
    .info__title { margin-top: 0; }
    .row { grid-template-columns: 44px minmax(0, 1fr) 96px; grid-template-areas: "turn main time" "turn meta meta"; }
    .row__meta { font-size: 0.75rem; }
}

/* Handy und kleines Tablet: Leiste wird zum Menü */

@media (max-width: 960px) {
    .topbar {
        position: sticky; top: 0; z-index: 30;
        display: flex; align-items: center; gap: 8px;
        padding: 10px 12px 10px 16px;
        background: var(--navy);
    }
    .topbar__logo { margin-right: auto; }
    .topbar__logo img { display: block; width: 108px; height: auto; }
    .topbar__new { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--brand); color: var(--navy); font-weight: 600; font-size: 0.8125rem; text-decoration: none; }
    .topbar__menu { display: none; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: #fff; cursor: pointer; }
    .js .topbar__menu { display: grid; }

    .shell { grid-template-columns: minmax(0, 1fr); }
    .rail { position: static; height: auto; }
    .js .rail {
        position: fixed; inset: 0 auto 0 0; z-index: 50;
        width: min(300px, 86vw); height: 100%;
        transform: translateX(-100%);
        transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1), visibility 260ms;
        visibility: hidden;
    }
    .js body.menu-open .rail { transform: none; visibility: visible; }
    .js .rail__close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: #fff; cursor: pointer; }
    .js body.menu-open .rail-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(28, 36, 75, 0.45); }

    .container { padding: 22px 16px 40px; }
    h1, .ticket-head h1 { font-size: 1.375rem; }
    .page-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 22px; }
    .page-head > .btn { display: none; }

    .next { grid-template-columns: minmax(0, 1fr); padding: 16px; }
    .next__actions { justify-content: stretch; }
    .next__actions > .btn, .next__actions > form { flex: 1 1 100%; }
    .next__actions form .btn { width: 100%; }

    .msg--other .msg__card { margin-right: 16px; }
    .msg--own .msg__card { margin-left: 16px; }
    .msg__card { padding: 12px 14px 14px; }
    .composer__hint { display: none; }
    .composer__bar .btn { margin-left: auto; }

    .list-bar { padding: 0 8px; }
    .search { flex: 1 1 100%; margin: 0 4px 10px; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; }
    .table tbody tr {
        display: grid; grid-template-columns: 40px minmax(0, 1fr) auto;
        grid-template-areas: "turn ticket ticket" "turn status last";
        gap: 6px 10px; padding: 12px 14px; border-top: 1px solid var(--line);
    }
    .table td { padding: 0; border: 0; width: auto; }
    .table .t-turn { grid-area: turn; align-self: start; padding-top: 7px !important; }
    .table .t-ticket { grid-area: ticket; min-width: 0; }
    .table .t-status { grid-area: status; }
    .table .t-last { grid-area: last; text-align: right; }
    .t-last__who { display: inline; }
    .t-last time::before { content: ", "; }

    .row { grid-template-columns: 40px minmax(0, 1fr); grid-template-areas: "turn main" "turn meta"; align-items: start; padding: 12px 14px; }
    .row > .turn { margin-top: 7px; }
    .row__subject, .row__excerpt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .row__meta { justify-self: start; }
    .row__time { grid-area: meta; justify-self: end; }

    .msg__head { flex-wrap: wrap; row-gap: 2px; }
    .msg__author { white-space: nowrap; }

    .category-selects, .field-row { grid-template-columns: minmax(0, 1fr); }
    .form__section { padding: 18px 16px; }
    .form__foot { padding: 12px 16px; }
}

/* Admin-Bereich: gleiche Tokens, zusätzliche Bausteine */

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.filter-bar .search { margin: 0; }
.select--compact { min-height: 38px; width: auto; max-width: 220px; padding-top: 7px; padding-bottom: 7px; border-radius: 999px; background-color: var(--ground); border-color: transparent; font-size: 0.8125rem; }
.select--compact:hover:not(:disabled) { border-color: var(--control); }

.t-sub { display: block; color: var(--soft); font-size: 0.75rem; }
.t-customer, .t-assignee { white-space: nowrap; font-size: 0.8125rem; }
.t-num { width: 1%; text-align: right; white-space: nowrap; }
.table th.t-num { text-align: right; }
.table tbody tr.is-muted td, .is-muted { opacity: 0.6; }

.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { background: #8f1c13; border-color: #8f1c13; color: #fff; }

.check, .field > label.check { display: flex; margin: 0; font-weight: 400; align-items: flex-start; gap: 10px; font-size: 0.8125rem; color: var(--text); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; }
.field--spaced { margin-top: 16px; }
.input--code { text-transform: uppercase; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.admin-grid__side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 24px; }
.admin-grid__side .form { margin: 0; }
.admin-section { margin-bottom: 32px; }
.empty--compact { padding: 28px 20px; }

.add-row { border-top: 1px solid var(--line); }
.add-row > summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px; color: var(--brand-ink); font-weight: 500; list-style: none; cursor: pointer; }
.add-row > summary::-webkit-details-marker { display: none; }
.add-row > summary:hover { background: var(--panel-2); }
.add-row[open] > summary { display: none; }
.add-row__form { padding: 16px; display: grid; gap: 12px; }
form.add-row__form { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.add-row__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.ticket-grid--admin { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "conversation info"; }
.ticket-side { grid-area: info; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 24px; }
.side-panel { padding: 16px 18px; }
.side-panel__title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; color: var(--navy); font-size: 0.875rem; font-weight: 600; }
.side-panel__title--spaced { margin-top: 18px; }
.side-panel--fold > summary { margin: 0; list-style: none; cursor: pointer; }
.side-panel--fold > summary::-webkit-details-marker { display: none; }
.side-panel--fold[open] > summary { margin-bottom: 12px; }
.side-panel--fold[open] .info__chevron { transform: rotate(90deg); }
.side-panel--danger .side-panel__title { color: var(--danger); }
.side-panel .field { margin-bottom: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .select { flex: 1; min-width: 0; }
.stack-selects { display: grid; gap: 0; }
.stack-selects .field { margin-bottom: 10px; }

.segmented { display: inline-flex; gap: 2px; margin: 12px 16px 0; padding: 3px; border: 0; border-radius: 999px; background: var(--ground); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out); }
.segmented input:checked + span { background: var(--panel); color: var(--navy); font-weight: 600; box-shadow: 0 1px 2px rgba(28, 36, 75, 0.12); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.composer--note { background: #eef1f6; }
.composer--note .composer__bar { background: #e4e9f0; }
.composer--note [data-reply-only] { display: none; }
.composer--note .segmented { background: #dfe5ee; }

.msg--note .msg__card { background: #e9edf3; }
.msg__note-icon { color: var(--s-hold); }
.msg__org--note { background: #d9e0ea; color: #3a4560; }
.event--internal { color: var(--s-hold); }

.tree { list-style: none; margin: 0; padding: 6px 0; }
.tree__item { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 16px; }
.tree__item + .tree__item { border-top: 1px solid var(--line); }
.tree__item--l2 { padding-left: 40px; }
.tree__item--l3 { padding-left: 64px; }
.tree__item--l1 .tree__input { font-weight: 600; color: var(--navy); }
.tree__name { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.tree__input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--text); font: inherit; }
.tree__input:hover { border-color: var(--control); }
.tree__input:focus { outline: none; border-color: var(--brand); background: var(--panel); }
.tree__save { visibility: hidden; }
.tree__name:focus-within .tree__save { visibility: visible; }
.tree__count { color: var(--soft); font-size: 0.75rem; white-space: nowrap; min-width: 64px; text-align: right; }
.tree__add > summary { list-style: none; }
.tree__add > summary::-webkit-details-marker { display: none; }
.tree__add[open] { flex-basis: 100%; }
.tree__add-form { display: flex; gap: 8px; padding: 8px 0 6px; }
.tree__item:has(.tree__add[open]) { flex-wrap: wrap; }

.tree-group + .tree-group { border-top: 1px solid var(--line); }
.tree-group__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; list-style: none; cursor: pointer; }
.tree-group__head::-webkit-details-marker { display: none; }
.tree-group__head:hover { background: var(--panel-2); }
.tree-group__name { flex: 1; color: var(--navy); font-weight: 600; }
.tree-group[open] .info__chevron { transform: rotate(90deg); }
.tree-group .tree { padding: 0 0 8px; border-top: 1px solid var(--line); }
.search--wide { flex-basis: 340px; }

@media (max-width: 1100px) {
    .admin-grid, .ticket-grid--admin { grid-template-columns: minmax(0, 1fr); grid-template-areas: "conversation" "info"; }
    .admin-grid__side, .ticket-side { position: static; }
    .t-assignee { display: none; }
}
@media (max-width: 960px) {
    .filter-bar .search { flex: 1 1 100%; }
    .select--compact { flex: 1; max-width: none; }
    .table .t-customer { grid-area: last; text-align: right; }
    .table .t-num { display: none; }
    form.add-row__form { grid-template-columns: minmax(0, 1fr); }
    .tree__item--l2 { padding-left: 28px; }
    .tree__item--l3 { padding-left: 40px; }
    .tree__count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
    .rail, .topbar, .composer, .next__actions, .back { display: none !important; }
    .shell { display: block; }
    body { background: #fff; }
}
.rail__section { margin-top: 14px !important; padding-top: 14px !important; border-top: 1px solid rgba(255, 255, 255, 0.08); }
