/* Yomoko Ticketsystem – schlicht, modern. Farben ausschließlich über Tokens. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ink: #17212b;
  --ink-2: #3a4754;
  --muted: #677585;
  --border: #e1e6eb;
  --border-strong: #cbd3db;
  --accent: #0b7b76;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3f1;
  --accent-hover: #09645f;
  --focus: rgba(11, 123, 118, .35);
  --note-bg: #fff8e1;
  --note-border: #f1dfa3;
  --out-bg: #eef7f6;
  --out-border: #cde7e4;
  --danger: #c2372b;
  --danger-soft: #fdecea;
  --warn: #b26b00;
  --warn-soft: #fff4e0;
  --ok: #1f8a4c;
  --ok-soft: #e6f5ec;
  --info: #2c62c9;
  --info-soft: #e8effc;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar: 236px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419; --surface: #161d24; --surface-2: #1b232b; --ink: #e5eaef; --ink-2: #c3ccd5; --muted: #8b98a6;
    --border: #26313b; --border-strong: #34424f; --accent: #35b8ae; --accent-ink: #06201e; --accent-soft: #123330;
    --accent-hover: #4fd0c5; --focus: rgba(53, 184, 174, .4); --note-bg: #2a2412; --note-border: #4a3f1b;
    --out-bg: #12272a; --out-border: #1e3f41; --danger: #f07167; --danger-soft: #3a1c1a; --warn: #f0a93b;
    --warn-soft: #36270f; --ok: #4cc083; --ok-soft: #15301f; --info: #7aa5f5; --info-soft: #172640;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 8px 28px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1419; --surface: #161d24; --surface-2: #1b232b; --ink: #e5eaef; --ink-2: #c3ccd5; --muted: #8b98a6;
  --border: #26313b; --border-strong: #34424f; --accent: #35b8ae; --accent-ink: #06201e; --accent-soft: #123330;
  --accent-hover: #4fd0c5; --focus: rgba(53, 184, 174, .4); --note-bg: #2a2412; --note-border: #4a3f1b;
  --out-bg: #12272a; --out-border: #1e3f41; --danger: #f07167; --danger-soft: #3a1c1a; --warn: #f0a93b;
  --warn-soft: #36270f; --ok: #4cc083; --ok-soft: #15301f; --info: #7aa5f5; --info-soft: #172640;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 8px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; color: var(--ink); }
h1 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 620; }
h3 { font-size: 13px; font-weight: 620; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.icon { flex-shrink: 0; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Grundlayout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 680; font-size: 15px; color: var(--ink); }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 750; font-size: 14px; }
.nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 10px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a .count { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 0 7px; border-radius: 10px; }
.nav a .count.alert { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who a { color: var(--ink); font-weight: 560; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .search input { padding-left: 34px; background: var(--surface-2); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 24px 28px 48px; width: 100%; max-width: 1480px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 16px; }
.card + .card { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 560; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.inline { display: inline; }

label { font-weight: 560; font-size: 13px; color: var(--ink-2); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field .help { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=datetime-local], input[type=color], select, textarea {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; transition: border-color .12s, box-shadow .12s;
}
input[type=color] { padding: 3px; width: 48px; }
textarea { height: auto; min-height: 120px; padding: 10px 11px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
select { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select.sm, input.sm { height: 30px; font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; }
legend { font-weight: 620; padding: 0 6px; color: var(--ink); }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 580; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.plain::before { display: none; }
.status-new { background: var(--info-soft); color: var(--info); border-color: transparent; }
.status-open { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.status-in_progress { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.status-waiting_customer, .status-waiting_third { background: var(--surface-2); color: var(--muted); }
.status-resolved { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.status-closed { background: var(--surface-2); color: var(--muted); }
.status-closed::before { background: transparent; border: 1.5px solid currentColor; width: 5px; height: 5px; }
.prio-low { color: var(--muted); }
.prio-normal { color: var(--ink-2); }
.prio-high { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.prio-urgent { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 560; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border); gap: 5px; }
.tag i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.ticket-no { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: -.01em; }

.avatar { --h: 180; width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 650; flex-shrink: 0;
  background: hsl(var(--h) 45% 90%); color: hsl(var(--h) 45% 30%); }
:root[data-theme="dark"] .avatar { background: hsl(var(--h) 30% 24%); color: hsl(var(--h) 55% 82%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { background: hsl(var(--h) 30% 24%); color: hsl(var(--h) 55% 82%); } }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* Flash / Toasts */
.flashes { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-weight: 520; animation: flash-in .2s ease-out; }
.flash .icon { margin-top: 2px; }
.flash.success .icon { color: var(--ok); }
.flash.error { border-color: var(--danger); }
.flash.error .icon { color: var(--danger); }
.flash.info .icon { color: var(--info); }
.flash button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
@keyframes flash-in { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }
.alert-box { padding: 12px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--ink); border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start; }
.alert-box.error { background: var(--danger-soft); }
.alert-box.info { background: var(--info-soft); }
.alert-box .icon { margin-top: 2px; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 620; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .w-check { width: 36px; }
.table a.row-link { color: var(--ink); font-weight: 580; }
.table tr.unread a.row-link::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--info); margin-left: 7px; vertical-align: 1px; }

/* Ticketliste */
.ticket-cell { display: flex; flex-direction: column; gap: 3px; min-width: 260px; }
.ticket-cell .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filters select { width: auto; min-width: 130px; }
.filters input[type=search] { width: 220px; }
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--border); }
.bulkbar select { width: auto; }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.overdue { color: var(--danger); font-weight: 600; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.stat:hover { border-color: var(--border-strong); text-decoration: none; color: var(--ink); }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 520; }
.stat .value { font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat.warn .value { color: var(--danger); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { display: block; color: var(--ink); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.ok { background: var(--ok); } .dot.err { background: var(--danger); } .dot.off { background: var(--border-strong); }

/* Ticket-Detail */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.ticket-title { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.ticket-title .row { gap: 8px; }
.ticket-title h1 { font-size: 21px; }
.subject-edit { display: none; gap: 8px; }
.ticket-title.editing h1 { display: none; }
.ticket-title.editing .subject-edit { display: flex; }
.timeline { display: flex; flex-direction: column; gap: 14px; }
.msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.msg.out { background: var(--out-bg); border-color: var(--out-border); }
.msg.note { background: var(--note-bg); border-color: var(--note-border); }
.msg-head { display: flex; gap: 10px; align-items: center; padding: 12px 16px 0; flex-wrap: wrap; }
.msg-head .who { font-weight: 620; }
.msg-head .addr { color: var(--muted); font-size: 12.5px; }
.msg-head .when { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.msg-kind { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.msg.note .msg-kind { background: var(--note-border); color: var(--ink); }
.msg.out .msg-kind { background: var(--out-border); color: var(--accent); }
.msg-recipients { padding: 4px 16px 0 54px; font-size: 12.5px; color: var(--muted); }
.msg-body { padding: 10px 16px 14px 54px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.msg-body.html { white-space: normal; }
.msg-body iframe { width: 100%; border: 0; min-height: 60px; display: block; background: transparent; }
.msg-quote { margin-top: 8px; }
.msg-quote summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border: 1px solid var(--border); border-radius: 10px; }
.msg-quote summary::-webkit-details-marker { display: none; }
.msg-quote .q { color: var(--muted); border-left: 3px solid var(--border-strong); padding-left: 10px; margin-top: 8px; }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px 54px; }
.attachment { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font-size: 12.5px; max-width: 280px; }
.attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment:hover { border-color: var(--border-strong); text-decoration: none; color: var(--ink); }
.msg-toggle { font-size: 12px; }
.send-failed { margin: 0 16px 14px 54px; }
.audit { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; padding: 0 16px; }
.audit::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); margin: 0 7px 0 8px; flex-shrink: 0; }
.audit b { color: var(--ink-2); font-weight: 580; }

.composer { margin-top: 18px; }
.composer .tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--border); }
.composer .tab { border: 0; background: none; padding: 9px 14px; font: inherit; font-weight: 580; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 7px; align-items: center; }
.composer .tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.composer .tab[data-tab=note].active { color: var(--warn); border-bottom-color: var(--warn); }
.composer .pane { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.composer .pane.note-pane textarea { background: var(--note-bg); border-color: var(--note-border); }
.recip { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; }
.recip label { color: var(--muted); font-weight: 520; }
.composer-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.composer-foot .grow { flex: 1; }
.file-input { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); font-weight: 520; font-size: 13px; }
.file-input input { display: none; }
.file-list { font-size: 12.5px; color: var(--muted); }

.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.props { display: flex; flex-direction: column; gap: 12px; }
.props .field label { font-size: 12px; color: var(--muted); font-weight: 560; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.presence { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: var(--radius); background: var(--info-soft); color: var(--info); font-weight: 560; font-size: 13px; margin-bottom: 14px; }
.presence.replying { background: var(--warn-soft); color: var(--warn); }

/* Template-Picker */
.picker { position: relative; }
.picker-menu { position: absolute; z-index: 30; left: 0; top: calc(100% + 4px); width: min(380px, 80vw); max-height: 340px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; }
.picker-menu input { margin-bottom: 6px; }
.picker-menu .opt { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 9px; border-radius: 5px; font: inherit; color: var(--ink); cursor: pointer; }
.picker-menu .opt small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-menu .opt:hover, .picker-menu .opt.hl { background: var(--accent-soft); }
.picker-menu .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 9px 3px; font-weight: 620; }

/* Reports */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding: 8px 0 0; border-bottom: 1px solid var(--border); }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; min-width: 2px; height: 100%; position: relative; }
.bars .b i { display: block; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 0; }
.bars .b i.r { background: var(--border-strong); border-radius: 0; }
.bars .b:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 3px 7px; border-radius: 4px; font-size: 11.5px; white-space: nowrap; z-index: 5; }
.bars-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); padding-top: 6px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.hbar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.hbar i { display: block; height: 100%; background: var(--accent); }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { justify-content: center; padding: 0 0 22px; font-size: 17px; }
.auth-card .card-body { padding: 26px; display: flex; flex-direction: column; gap: 14px; }

/* Responsiv */
@media (max-width: 1200px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar .spacer { display: none; }
  .topbar .btn.primary span { display: none; }
  .topbar .btn.primary { width: 34px; padding: 0; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 40px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .msg-body, .msg-recipients, .msg-attachments { padding-left: 16px; }
  .send-failed { margin-left: 16px; }
  .filters input[type=search], .filters select { width: 100%; }
}

/* Dialog */
dialog { padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(15, 20, 25, .45); }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { border-bottom: 1px solid var(--border); }
details.card:not([open]) > summary { border-bottom: 0; }
