/* ═══════════════════════════════════════════════════════
   Ticket System – Modernes Dunkelgrau-Design
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset ──────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: #0d1117;
  color: #c9d1d9;
  line-height: 1.6;
}
a { color: #58a6ff; text-decoration: none; }
a:hover { color: #79c0ff; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
svg { display: inline-block; vertical-align: middle; }

/* ── App Layout ─────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ═══════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════ */
.sidebar {
  width: 240px;
  background: #010409;
  border-right: 1px solid #21262d;
  position: fixed; top: 0; left: 0; height: 100vh;
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
}
.sidebar-brand {
  padding: 0 18px;
  height: 56px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #21262d;
}
.brand-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #1f6feb, #388bfd);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(31,111,235,.35);
}
.brand-mark svg { width: 15px; height: 15px; color: #fff; }
.brand-name { font-size: .95rem; font-weight: 700; color: #f0f6fc; letter-spacing: -.02em; }

.sidebar-nav { flex: 1; padding: 12px 10px; }
.nav-section {
  font-size: .62rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: #484f58;
  padding: 16px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #8b949e;
  font-size: .88rem; font-weight: 500;
  cursor: pointer; transition: all .15s;
  text-decoration: none; margin-bottom: 2px;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: #161b22; color: #e6edf3; text-decoration: none; }
.nav-item.active { background: #1c2d3e; color: #58a6ff; }
.nav-item.active svg { color: #388bfd; }

.sidebar-footer { padding: 16px 18px; border-top: 1px solid #21262d; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #1c2d3e; color: #58a6ff;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; flex-shrink: 0;
  border: 2px solid #1f3358;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: .85rem; font-weight: 600; color: #f0f6fc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .72rem; color: #6e7681; margin-top: 2px; }
.btn-logout {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: transparent;
  border: 1px solid #21262d; border-radius: 8px;
  color: #6e7681; font-size: .8rem; cursor: pointer; transition: all .15s;
}
.btn-logout svg { width: 14px; height: 14px; }
.btn-logout:hover { background: #161b22; color: #8b949e; border-color: #30363d; }

/* ═══════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════ */
.main-content { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: #161b22;
  border-bottom: 1px solid #21262d;
  padding: 0 28px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1rem; font-weight: 700; color: #f0f6fc; letter-spacing: -.01em; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.page-content { padding: 28px 32px; flex: 1; max-width: 1400px; }

/* ═══════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════ */
.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #21262d;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: .92rem; font-weight: 700; color: #f0f6fc; }
.card-body { padding: 20px; }

/* ═══════════════════════════════════════════════════════
   STATS GRID
   ═══════════════════════════════════════════════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #161b22; border: 1px solid #30363d;
  border-radius: 12px; padding: 18px 20px;
  cursor: pointer; transition: all .18s;
  display: flex; align-items: center; gap: 16px;
}
.stat-card:hover { border-color: #444c56; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.stat-icon-wrap {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon-wrap svg { width: 20px; height: 20px; }
.stat-icon-offen    { background: rgba(56,139,253,.15); color: #58a6ff; }
.stat-icon-progress { background: rgba(227,179,65,.15);  color: #e3b341; }
.stat-icon-wait     { background: rgba(240,136,62,.15);  color: #f0883e; }
.stat-icon-closed   { background: rgba(72,79,88,.25);    color: #8b949e; }
.stat-info { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: .74rem; color: #6e7681; font-weight: 500; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: #f0f6fc; line-height: 1; }
.stat-card.stat-offen          { border-top: 3px solid #388bfd; }
.stat-card.stat-in-bearbeitung { border-top: 3px solid #e3b341; }
.stat-card.stat-warten         { border-top: 3px solid #f0883e; }
.stat-card.stat-geschlossen    { border-top: 3px solid #484f58; }

/* ── Dashboard Filter-Bar ───────────────────────────── */
.dash-filter-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.dash-filter-select {
  padding: 7px 12px; background: #161b22; border: 1px solid #30363d;
  border-radius: 8px; color: #c9d1d9; font-size: .82rem; outline: none;
  cursor: pointer; transition: border-color .15s;
}
.dash-filter-select:focus { border-color: #388bfd; }
.dash-filter-select option { background: #161b22; }

/* ── Customer Banner ─────────────────────────────────── */
.customer-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; margin-bottom: 14px;
  background: rgba(56,139,253,.1); border: 1px solid rgba(56,139,253,.25);
  border-radius: 10px; font-size: .85rem; color: #58a6ff;
}
.customer-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Ticket List Card ────────────────────────────────── */
.ticket-list-card {
  background: #161b22; border: 1px solid #30363d; border-radius: 12px; overflow: hidden;
}
.ticket-list-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid #21262d;
  display: flex; align-items: center;
}
.ticket-list-count { font-size: .82rem; font-weight: 600; color: #6e7681; }

/* ── Ticket Table ────────────────────────────────────── */
.ticket-table { width: 100%; border-collapse: collapse; }
.ticket-table thead th {
  padding: 10px 16px; text-align: left;
  font-size: .72rem; font-weight: 600; color: #6e7681;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid #21262d; background: #161b22;
}
.ticket-table tbody tr {
  border-bottom: 1px solid #21262d; cursor: pointer;
  transition: background .12s;
}
.ticket-table tbody tr:last-child { border-bottom: none; }
.ticket-table tbody tr:hover { background: #1c2128; }
.ticket-table tbody tr:nth-child(even) { background: transparent; }
.ticket-table tbody tr:nth-child(even):hover { background: #1c2128; }
.ticket-table td { padding: 13px 16px; vertical-align: middle; }
.ticket-priority-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
td.td-number, .td-number {
  font-family: 'SF Mono','Fira Code',monospace;
  font-size: .77rem; color: #8b949e; font-weight: 500;
}
.td-subject-cell { max-width: 0; }
.td-subject-main {
  font-size: .88rem; font-weight: 600; color: #e6edf3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.td-subject-sub {
  display: flex; align-items: center; gap: 8px;
  font-size: .76rem; color: #6e7681; margin-top: 3px;
}
.td-cat-tag {
  padding: 1px 8px; background: rgba(163,113,247,.1);
  color: #d2a8ff; border-radius: 20px; font-size: .7rem;
  white-space: nowrap;
}
.ticket-assignee-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: #21262d; border: 1px solid #30363d;
  font-size: .6rem; font-weight: 700; color: #8b949e;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════════════════════ */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar input[type="text"],
.filter-bar select {
  padding: 9px 13px;
  background: #0d1117; border: 1px solid #30363d;
  border-radius: 8px; color: #e6edf3; font-size: .85rem;
  outline: none; transition: all .15s;
}
.filter-bar input[type="text"]:focus,
.filter-bar select:focus { border-color: #388bfd; box-shadow: 0 0 0 3px rgba(56,139,253,.15); }
.filter-bar select option { background: #161b22; color: #c9d1d9; }
.search-wrap { position: relative; flex: 1; min-width: 220px; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #484f58; pointer-events: none; }
.search-wrap input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: .85rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap input::placeholder { color: #484f58; }
.search-wrap input:focus { border-color: #388bfd; box-shadow: 0 0 0 3px rgba(56,139,253,.12); }
.filter-separator { width: 1px; height: 28px; background: #21262d; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #0d1117;
  padding: 12px 16px;
  text-align: left; font-size: .72rem; font-weight: 700;
  color: #8b949e; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 2px solid #21262d; white-space: nowrap;
}
tbody tr { border-bottom: 1px solid #161b22; transition: background .12s; cursor: pointer; }
tbody tr:nth-child(even) { background: rgba(22,27,34,.5); }
tbody tr:hover { background: #1c2128; }
tbody tr:last-child { border-bottom: none; }
td {
  padding: 14px 16px; font-size: .87rem; color: #c9d1d9;
  vertical-align: middle;
}
td.td-subject {
  font-weight: 600; color: #f0f6fc;
  max-width: 500px;
}
td.td-subject .td-sub {
  font-weight: 400; font-size: .76rem; color: #6e7681;
  margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 420px;
}
td.td-number {
  font-family: 'SF Mono','Fira Code',monospace;
  font-size: .77rem; color: #8b949e; font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: .74rem; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-offen           { background: rgba(56,139,253,.15);  color: #58a6ff;  border-color: rgba(56,139,253,.3); }
.badge-in-bearbeitung  { background: rgba(227,179,65,.15);  color: #e3b341;  border-color: rgba(227,179,65,.3); }
.badge-warten          { background: rgba(240,136,62,.15);  color: #f0883e;  border-color: rgba(240,136,62,.3); }
.badge-geschlossen     { background: rgba(72,79,88,.3);     color: #8b949e;  border-color: rgba(72,79,88,.45); }
.priority-hoch         { background: rgba(248,81,73,.15);   color: #ff7b72;  border-color: rgba(248,81,73,.3); }
.priority-mittel       { background: rgba(227,179,65,.15);  color: #e3b341;  border-color: rgba(227,179,65,.3); }
.priority-niedrig      { background: rgba(63,185,80,.15);   color: #56d364;  border-color: rgba(63,185,80,.3); }
.badge-category        { background: rgba(163,113,247,.12); color: #d2a8ff;  border-color: rgba(163,113,247,.25); }
.badge-ai              { background: rgba(56,139,253,.12);  color: #79c0ff;  border-color: rgba(56,139,253,.25); font-size: .68rem; }
.badge-manual          { background: rgba(72,79,88,.2);     color: #8b949e;  border-color: rgba(72,79,88,.35); font-size: .68rem; }

/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px;
  font-size: .85rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
  text-decoration: none; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:hover { text-decoration: none; }
.btn-primary  { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.btn-primary:hover { background: #388bfd; border-color: #388bfd; }
.btn-secondary { background: #21262d; color: #c9d1d9; border-color: #30363d; }
.btn-secondary:hover { background: #30363d; color: #f0f6fc; border-color: #484f58; }
.btn-success { background: #196c2e; color: #56d364; border-color: #196c2e; }
.btn-success:hover { background: #1a7f37; }
.btn-danger  { background: #da3633; color: #fff; border-color: #da3633; }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning { background: #9e6a03; color: #e3b341; border-color: #9e6a03; }
.btn-outline { background: transparent; border-color: #30363d; color: #c9d1d9; }
.btn-outline:hover { background: #21262d; color: #f0f6fc; border-color: #484f58; }
.btn-ghost   { background: transparent; border-color: transparent; color: #8b949e; }
.btn-ghost:hover { background: #21262d; color: #f0f6fc; }
.btn-sm { padding: 7px 14px; font-size: .82rem; }
.btn-sm svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn-danger-soft { background: transparent; border-color: rgba(248,81,73,.4); color: #f85149; }
.btn-danger-soft:hover { background: rgba(248,81,73,.15); border-color: #f85149; color: #ff7b72; }
.btn-ai-suggest { background: rgba(56,139,253,.1); border-color: rgba(56,139,253,.35); color: #58a6ff; }
.btn-ai-suggest:hover { background: rgba(56,139,253,.2); border-color: #388bfd; color: #79c0ff; }
.btn-ai-suggest:disabled { opacity: .6; }

/* ═══════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: #c9d1d9; margin-bottom: 7px; }
.form-hint  { font-size: .74rem; color: #6e7681; margin-top: 6px; line-height: 1.4; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: #0d1117; border: 1px solid #30363d;
  border-radius: 8px; color: #f0f6fc; outline: none;
  transition: all .15s; font-size: .88rem;
}
.form-control:focus { border-color: #388bfd; box-shadow: 0 0 0 3px rgba(56,139,253,.15); }
.form-control::placeholder { color: #484f58; }
textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.6; }
select.form-control { cursor: pointer; }
select.form-control option { background: #161b22; color: #c9d1d9; }

/* ═══════════════════════════════════════════════════════
   DEPARTMENT TAGS
   ═══════════════════════════════════════════════════════ */
.dept-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dept-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; background: rgba(56,139,253,.1);
  color: #58a6ff; border: 1px solid rgba(56,139,253,.2);
  border-radius: 20px; font-size: .76rem; font-weight: 500;
}
.dept-tag button { background: none; border: none; cursor: pointer; color: #58a6ff; padding: 0; display: flex; }
.dept-tag button svg { width: 11px; height: 11px; }
.dept-checkboxes { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.dept-checkbox-label { display: flex; align-items: center; gap: 6px; font-size: .84rem; cursor: pointer; color: #c9d1d9; }
.dept-checkbox-label input { cursor: pointer; accent-color: #388bfd; width: 16px; height: 16px; }
.dept-add-row { display: flex; gap: 8px; margin-bottom: 12px; }
.dept-add-row input {
  flex: 1; padding: 8px 12px; background: #0d1117;
  border: 1px solid #30363d; border-radius: 8px;
  color: #f0f6fc; font-size: .84rem; outline: none; font-family: inherit;
}
.dept-add-row input:focus { border-color: #388bfd; }

/* ═══════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════ */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1a2744 0%, #0d1117 65%);
}
.login-card {
  background: #161b22; border: 1px solid #30363d;
  border-radius: 16px; padding: 44px;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 60px rgba(0,0,0,.7);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #1f6feb, #388bfd);
  border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px; box-shadow: 0 0 28px rgba(31,111,235,.4);
}
.login-icon svg { width: 24px; height: 24px; color: #fff; }
.login-logo h1 { font-size: 1.25rem; font-weight: 700; color: #f0f6fc; }
.login-logo p  { font-size: .85rem; color: #8b949e; margin-top: 6px; }
.login-error {
  background: rgba(248,81,73,.1); color: #ff7b72;
  border: 1px solid rgba(248,81,73,.25);
  padding: 11px 14px; border-radius: 8px;
  font-size: .84rem; margin-bottom: 16px; display: none;
}

/* ═══════════════════════════════════════════════════════
   TICKET DETAIL
   ═══════════════════════════════════════════════════════ */
.ticket-layout { display: grid; grid-template-columns: 1fr 310px; gap: 24px; align-items: start; }
.ticket-header-card {
  background: #161b22; border: 1px solid #30363d;
  border-radius: 12px; padding: 28px; margin-bottom: 24px;
}
.ticket-number {
  font-family: 'SF Mono','Fira Code',monospace;
  font-size: .76rem; color: #8b949e; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.ticket-subject { font-size: 1.4rem; font-weight: 800; color: #f0f6fc; margin-bottom: 14px; line-height: 1.35; }
.ticket-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ═══════════════════════════════════════════════════════
   CONVERSATION
   ═══════════════════════════════════════════════════════ */
.conversation {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 24px;
  background: transparent; border: none;
  border-radius: 0; padding: 0 0 8px;
}

/* ── Nachrichten-Gruppen-Abstand ── */
.msg-group { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.msg-group:last-child { margin-bottom: 0; }

/* ── Zeitstempel-Trennlinie ── */
.msg-date-sep {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0; color: #484f58; font-size: .72rem;
}
.msg-date-sep::before, .msg-date-sep::after {
  content: ''; flex: 1; height: 1px; background: #21262d;
}

/* ── System-Notizen ── */
.msg-system-row {
  display: flex; justify-content: center; margin: 8px 0;
}
.msg-system-chip {
  background: #161b22; border: 1px dashed #30363d;
  border-radius: 20px; padding: 5px 14px;
  font-size: .74rem; color: #6e7681; font-style: italic;
  max-width: 80%; text-align: center; line-height: 1.5;
}

/* ── Nachrichten-Zeile ── */
.msg-row { display: flex; gap: 10px; align-items: flex-end; }
.msg-row.right { flex-direction: row-reverse; }

/* ── Avatar ── */
.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; flex-shrink: 0; margin-bottom: 2px;
}
.msg-row.customer .msg-avatar { background: #161b22; color: #8b949e; border: 1px solid #30363d; }
.msg-row.agent    .msg-avatar { background: #1a3823; color: #56d364; border: 1px solid #196c2e; }
.msg-row.ai       .msg-avatar { background: #2d1b69; color: #b88dff; border: 1px solid #4a2d9e; }

/* ── Bubble-Container ── */
.msg-content { display: flex; flex-direction: column; max-width: 70%; gap: 3px; }
.msg-row.right .msg-content { align-items: flex-end; }

/* ── Sender-Label ── */
.msg-sender {
  font-size: .72rem; font-weight: 600; color: #6e7681;
  padding: 0 4px;
}

/* ── Bubble ── */
.msg-bubble {
  padding: 12px 16px; font-size: .875rem;
  line-height: 1.65; word-break: break-word; white-space: pre-wrap;
  border-radius: 16px; display: inline-block;
}
.msg-row.customer .msg-bubble {
  background: #161b22; border: 1px solid #30363d; color: #c9d1d9;
  border-bottom-left-radius: 4px;
}
.msg-row.agent .msg-bubble {
  background: #1c2d3e; color: #c9e0ff; border: 1px solid #254b7a;
  border-bottom-right-radius: 4px;
}
.msg-row.ai .msg-bubble {
  background: #1e1535; color: #d4b8ff; border: 1px solid #4a2d9e;
  border-bottom-right-radius: 4px;
}

/* ── KI-Chip in der Bubble ── */
.msg-ai-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #3d1f8a; color: #c9b8ff; border-radius: 10px;
  font-size: .68rem; font-weight: 700; padding: 2px 8px;
  margin-bottom: 6px; letter-spacing: .02em;
}

/* ── Zeitstempel unter Bubble ── */
.msg-time {
  font-size: .7rem; color: #484f58; padding: 0 4px;
}

/* ═══════════════════════════════════════════════════════
   REPLY BOX
   ═══════════════════════════════════════════════════════ */
.reply-card {
  background: #161b22; border: 1px solid #30363d;
  border-radius: 12px; overflow: hidden;
}
.reply-card textarea {
  width: 100%; padding: 16px 20px; border: none; outline: none;
  resize: vertical; min-height: 110px;
  font-size: .9rem; color: #f0f6fc;
  background: #161b22; font-family: inherit; line-height: 1.6;
  border-bottom: 1px solid #21262d;
}
.reply-card textarea::placeholder { color: #484f58; }
.reply-file-preview {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 20px 10px; background: #161b22;
}
.reply-file-chip {
  display: flex; align-items: center; gap: 6px;
  background: #21262d; border: 1px solid #30363d;
  border-radius: 8px; padding: 4px 8px; font-size: .75rem; color: #c9d1d9;
}
.reply-file-chip img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.reply-file-chip button {
  background: none; border: none; color: #8b949e; cursor: pointer; padding: 0; line-height: 1;
}
.reply-file-chip button svg { width: 12px; height: 12px; }
.reply-file-chip button:hover { color: #ff7b72; }
.reply-actions {
  padding: 12px 20px; display: flex; gap: 10px;
  align-items: center; flex-wrap: wrap; background: #0d1117;
}
/* Chat-Bilder – separate Blöcke unter dem Text */
.msg-imgs {
  display: flex; flex-direction: column; gap: 4px;
  max-width: 280px;
}
.msg-row.right .msg-imgs { align-items: flex-end; }
.msg-img-wrap { display: block; line-height: 0; }
.msg-img {
  max-width: 260px; max-height: 220px;
  width: auto; height: auto;
  border-radius: 12px; object-fit: cover;
  border: 1px solid #30363d; cursor: zoom-in;
  transition: opacity .15s; display: block;
}
.msg-img:hover { opacity: .88; }

/* Anhänge-Sidebar */
.attachment-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px; text-decoration: none;
  transition: background .12s; color: inherit;
}
.attachment-row:hover { background: #21262d; text-decoration: none; }
.attachment-thumb {
  width: 40px; height: 40px; object-fit: cover;
  border-radius: 6px; border: 1px solid #30363d; flex-shrink: 0;
}
.attachment-info { flex: 1; min-width: 0; }
.attachment-name {
  font-size: .78rem; font-weight: 500; color: #c9d1d9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attachment-meta { font-size: .7rem; color: #6e7681; margin-top: 1px; }

/* ═══════════════════════════════════════════════════════
   INFO SIDEBAR
   ═══════════════════════════════════════════════════════ */
.info-sidebar { display: flex; flex-direction: column; gap: 18px; }
.info-section-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: #484f58; padding: 0 0 8px;
  border-bottom: 1px solid #21262d; margin-bottom: 4px;
}
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; font-size: .86rem; gap: 12px;
}
.info-row + .info-row { border-top: 1px solid #21262d; }
.info-key { color: #8b949e; font-weight: 500; white-space: nowrap; }
.info-value { color: #f0f6fc; font-weight: 600; text-align: right; }
.info-select {
  background: #0d1117; border: 1px solid #30363d;
  border-radius: 8px; padding: 6px 10px;
  font-size: .82rem; color: #f0f6fc; outline: none; cursor: pointer; font-family: inherit;
  transition: border-color .15s;
}
.info-select:focus { border-color: #388bfd; }
.info-select option { background: #161b22; color: #c9d1d9; }

/* AI / Info Boxes */
.ai-box {
  background: rgba(56,139,253,.06); border: 1px solid rgba(56,139,253,.18);
  border-radius: 10px; padding: 16px 18px;
  font-size: .86rem; color: #8b949e; line-height: 1.65;
}
.ai-box-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .7rem; font-weight: 700; color: #58a6ff;
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px;
}
.ai-box-label svg { width: 12px; height: 12px; }
.missing-info-box {
  background: rgba(227,179,65,.06); border: 1px solid rgba(227,179,65,.2);
  border-radius: 10px; padding: 16px 18px;
  font-size: .86rem; color: #c9a227; line-height: 1.65;
}
.missing-info-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .7rem; font-weight: 700; color: #e3b341;
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px;
}
.missing-info-label svg { width: 12px; height: 12px; }
.ai-activity-box {
  background: rgba(163,113,247,.05); border: 1px solid rgba(163,113,247,.15);
  border-radius: 10px; padding: 16px 18px;
}
.ai-activity-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .7rem; font-weight: 700; color: #d2a8ff;
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 12px;
}
.ai-activity-label svg { width: 12px; height: 12px; }
.ai-activity-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .84rem; padding: 8px 0; color: #8b949e;
}
.ai-activity-row + .ai-activity-row { border-top: 1px solid rgba(163,113,247,.08); }
.ai-activity-row span:last-child { color: #e6edf3; font-weight: 600; }

/* ═══════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid #21262d; margin-bottom: 24px; }
.tab-btn {
  padding: 10px 20px; border: none; background: none;
  color: #8b949e; font-size: .88rem; font-weight: 600;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s;
  display: flex; align-items: center; gap: 7px; font-family: inherit;
  border-radius: 8px 8px 0 0;
}
.tab-btn svg { width: 15px; height: 15px; }
.tab-btn:hover { color: #c9d1d9; background: rgba(56,139,253,.05); }
.tab-btn.active { color: #58a6ff; border-bottom-color: #388bfd; background: rgba(56,139,253,.08); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Role Badges */
.role-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: .73rem; font-weight: 600; border: 1px solid transparent;
}
.role-super_admin { background: rgba(163,113,247,.15); color: #d2a8ff; border-color: rgba(163,113,247,.25); }
.role-admin       { background: rgba(248,81,73,.12);    color: #ff7b72; border-color: rgba(248,81,73,.25); }
.role-support     { background: rgba(56,139,253,.12);   color: #58a6ff; border-color: rgba(56,139,253,.25); }
.role-reader      { background: rgba(72,79,88,.3);      color: #8b949e; border-color: rgba(72,79,88,.45); }

/* ═══════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(1,4,9,.8);
  display: none; align-items: center; justify-content: center; z-index: 200;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: #161b22; border: 1px solid #30363d;
  border-radius: 16px; width: 100%; max-width: 500px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.8);
}
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid #21262d;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #161b22; z-index: 1;
  border-radius: 16px 16px 0 0;
}
.modal-header span { font-weight: 700; font-size: .95rem; color: #f0f6fc; }
.modal-close {
  background: none; border: none; cursor: pointer; color: #6e7681;
  padding: 6px; border-radius: 6px; display: flex; transition: all .15s;
}
.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { background: #21262d; color: #c9d1d9; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #21262d;
  display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0; background: #161b22;
  border-radius: 0 0 16px 16px;
}

/* ═══════════════════════════════════════════════════════
   NOTIFICATION BELL
   ═══════════════════════════════════════════════════════ */
.notif-bell-wrapper { position: relative; }
.notif-bell-btn {
  position: relative; background: none; border: none;
  padding: 8px; border-radius: 8px; color: #8b949e;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.notif-bell-btn:hover { background: #21262d; color: #f0f6fc; }
.notif-bell-btn svg { width: 18px; height: 18px; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: #f85149; color: #fff;
  font-size: .62rem; font-weight: 700;
  min-width: 17px; height: 17px;
  border-radius: 9px; padding: 0 4px;
  display: none; align-items: center; justify-content: center;
  border: 2px solid #161b22; line-height: 1;
}
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 360px; max-height: 440px;
  background: #161b22; border: 1px solid #30363d;
  border-radius: 14px; box-shadow: 0 20px 56px rgba(0,0,0,.8);
  overflow: hidden; z-index: 999; display: flex; flex-direction: column;
  animation: dropIn .18s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.notif-push-prompt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: #0d2137; border-bottom: 1px solid #1f3358;
  font-size: .76rem; color: #58a6ff;
}
.notif-push-prompt span { flex: 1; }
.notif-push-prompt button {
  background: #1f6feb; color: #fff; border: none; border-radius: 5px;
  padding: 3px 10px; font-size: .75rem; cursor: pointer; font-weight: 600;
}
.notif-push-prompt button:hover { background: #388bfd; }
.notif-panel-header {
  padding: 14px 18px; border-bottom: 1px solid #21262d;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .88rem; font-weight: 700; color: #f0f6fc;
  background: #1c2128; flex-shrink: 0;
}
.notif-mark-read {
  background: none; border: none; cursor: pointer;
  font-size: .76rem; color: #58a6ff; font-family: inherit; padding: 2px 8px;
  border-radius: 6px; transition: background .12s;
}
.notif-mark-read:hover { background: rgba(56,139,253,.12); }
.notif-panel-body { overflow-y: auto; }
.notif-empty { padding: 36px 18px; text-align: center; color: #6e7681; font-size: .86rem; }
.notif-item {
  display: flex; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid #21262d;
  cursor: pointer; transition: background .12s; align-items: flex-start;
}
.notif-item:hover { background: #1c2128; }
.notif-item:last-child { border-bottom: none; }
.notif-unread { background: rgba(31,111,235,.06); }
.notif-item-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.notif-assigned   { background: rgba(56,139,253,.12); color: #58a6ff; }
.notif-reply      { background: rgba(63,185,80,.12);  color: #56d364; }
.notif-new_ticket { background: rgba(227,179,65,.12); color: #e3b341; }
.notif-item-icon svg { width: 15px; height: 15px; }
.notif-item-content { flex: 1; min-width: 0; }
.notif-item-title { font-size: .85rem; font-weight: 600; color: #f0f6fc; margin-bottom: 3px; }
.notif-item-body  { font-size: .8rem; color: #8b949e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-time  { font-size: .73rem; color: #6e7681; margin-top: 4px; }
.notif-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: #388bfd; flex-shrink: 0; margin-top: 6px; }

/* ═══════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; top: 16px; right: 20px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  z-index: 9999; pointer-events: none;
}
.toast {
  padding: 12px 18px; border-radius: 10px;
  font-size: .85rem; font-weight: 500;
  display: flex; align-items: flex-start; gap: 10px;
  animation: toastSlideDown .2s cubic-bezier(.2,.8,.4,1); max-width: 400px;
  border: 1px solid transparent;
  box-shadow: 0 8px 28px rgba(0,0,0,.7);
  pointer-events: auto;
}
.toast svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }
.toast-success { background: #0f2a1a; color: #56d364; border-color: rgba(63,185,80,.3); }
.toast-error   { background: #2a0e0e; color: #ff7b72; border-color: rgba(248,81,73,.3); }
.toast-info    { background: #0d1d35; color: #58a6ff; border-color: rgba(56,139,253,.3); }
.toast-body { display: flex; flex-direction: column; gap: 2px; }
.toast-title { font-weight: 600; font-size: .85rem; }
.toast-sub   { font-size: .78rem; opacity: .8; line-height: 1.4; white-space: pre-line; }
.toast-clickable { cursor: pointer; }
.toast-clickable:hover { filter: brightness(1.15); }
.toast-fade-out { opacity: 0; transform: translateY(-8px); transition: all .25s ease; }
@keyframes toastSlideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════
   EMPTY / LOADING
   ═══════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; display: block; color: #30363d; }
.empty-state p { font-size: .88rem; color: #6e7681; }
.loading-row td { text-align: center; padding: 36px; color: #484f58; }
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2.5px solid #21262d; border-top-color: #388bfd;
  border-radius: 50%; animation: spin .5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════ */
.pagination { display: flex; gap: 5px; justify-content: center; padding: 16px; }
.page-btn {
  padding: 6px 12px; border: 1px solid #30363d; border-radius: 8px;
  background: #161b22; font-size: .8rem; cursor: pointer;
  color: #8b949e; transition: all .15s; font-family: inherit; font-weight: 500;
}
.page-btn:hover { background: #21262d; color: #f0f6fc; }
.page-btn.active { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.page-btn:disabled { opacity: .3; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════
   VIEW TOGGLE
   ═══════════════════════════════════════════════════════ */
.view-toggle { display: flex; gap: 3px; background: #0d1117; border: 1px solid #30363d; border-radius: 10px; padding: 4px; }
.view-btn {
  padding: 6px 14px; border: none; border-radius: 7px;
  font-size: .8rem; font-weight: 600; cursor: pointer;
  color: #8b949e; background: transparent; font-family: inherit; transition: all .15s;
  display: flex; align-items: center; gap: 6px;
}
.view-btn svg { width: 13px; height: 13px; }
.view-btn.active { background: #1c2d3e; color: #58a6ff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.view-btn:hover:not(.active) { color: #c9d1d9; background: rgba(255,255,255,.03); }

/* ═══════════════════════════════════════════════════════
   LIVE DOT
   ═══════════════════════════════════════════════════════ */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #56d364;
  display: inline-block; margin-left: 8px;
  box-shadow: 0 0 8px rgba(86,211,100,.5);
  animation: pulse 2s ease-in-out infinite;
}
.live-dot.disconnected { background: #6e7681; box-shadow: none; animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* ═══════════════════════════════════════════════════════
   AI PROVIDER TOGGLE
   ═══════════════════════════════════════════════════════ */
.provider-toggle {
  display: flex; gap: 0; border: 1px solid #30363d; border-radius: 10px;
  overflow: hidden; margin-bottom: 20px;
}
.provider-btn {
  flex: 1; padding: 12px 16px; border: none; background: #0d1117;
  font-size: .86rem; font-weight: 600; cursor: pointer; font-family: inherit;
  color: #6e7681; transition: all .15s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.provider-btn svg { width: 16px; height: 16px; }
.provider-btn:first-child { border-right: 1px solid #30363d; }
.provider-btn.active { background: #1c2d3e; color: #58a6ff; }
.provider-btn:hover:not(.active) { background: #161b22; color: #c9d1d9; }

/* ═══════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════ */
.text-muted   { color: #6e7681; }
.text-sm      { font-size: .8rem; }
.fw-600       { font-weight: 600; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-2        { gap: 10px; }
.mt-2         { margin-top: 10px; }
.mt-3         { margin-top: 16px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: #8b949e; font-size: .85rem; font-weight: 500; transition: all .15s;
  padding: 6px 10px; border-radius: 7px;
}
.back-link svg { width: 15px; height: 15px; }
.back-link:hover { background: #21262d; color: #f0f6fc; text-decoration: none; }
.ticket-closed-banner {
  text-align: center; padding: 20px; color: #8b949e; font-size: .86rem;
  background: #161b22; border: 1px solid #30363d; border-radius: 12px;
}
.ticket-closed-banner svg { display: block; margin: 0 auto 8px; width: 22px; height: 22px; color: #484f58; }

/* ═══════════════════════════════════════════════════════
   TICKET DETAIL PAGE – Conversation-First Layout
   ═══════════════════════════════════════════════════════ */
.ticket-detail-page.main-content {
  min-height: auto;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.ticket-detail-page > .topbar {
  flex-shrink: 0;
}
.topbar-subject {
  font-size: .88rem;
  font-weight: 600;
  color: #f0f6fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.topbar-divider {
  width: 1px;
  height: 20px;
  background: #30363d;
  flex-shrink: 0;
}

/* ── KI-Zusammenfassung (immer sichtbar) ────────────── */
.summary-bar {
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  padding: 12px 28px;
  background: #0d1117;
  border-bottom: 1px solid #21262d;
}
.summary-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 11px 14px;
  min-width: 0;
}
.summary-block-warn {
  flex: 0 0 auto;
  width: 260px;
  border-color: rgba(227,179,65,.3);
  background: rgba(227,179,65,.05);
}
.summary-block-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #58a6ff;
}
.summary-block-warn .summary-block-label { color: #e3b341; }
.summary-block-label svg { width: 13px; height: 13px; flex-shrink: 0; }
.summary-block-text {
  font-size: .82rem;
  color: #8b949e;
  line-height: 1.6;
}

/* ── Kontext-Leiste ─────────────────────────────────── */
.context-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 28px;
  height: 40px;
  background: #0d1117;
  border-bottom: 1px solid #21262d;
  font-size: .82rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ctx-field {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  white-space: nowrap;
}
.ctx-label {
  font-size: .72rem;
  font-weight: 600;
  color: #484f58;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ctx-select {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: .82rem;
  color: #e6edf3;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.ctx-select:hover { background: #161b22; border-color: #30363d; }
.ctx-select:focus { background: #161b22; border-color: #388bfd; }
.ctx-select option { background: #161b22; color: #c9d1d9; }
.ctx-sep {
  width: 1px;
  height: 18px;
  background: #21262d;
  flex-shrink: 0;
}
.ctx-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 16px;
}
.ctx-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .76rem;
  color: #6e7681;
  white-space: nowrap;
}
.ctx-meta svg { color: #484f58; }

/* ── Chat-Bereich (volle Breite) ────────────────────── */
.ticket-chat-area {
  flex: 1;
  display: flex;
  display: -webkit-flex;
  flex-direction: column;
  -webkit-flex-direction: column;
  overflow: hidden;
  padding: 24px 32px;
  min-height: 0;
}
.ticket-chat-area > .conversation {
  flex: 1;
  -webkit-flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  margin-bottom: 0;
  max-width: 900px;
  width: 100%;
  align-self: center;
}
.ticket-chat-area > .reply-card,
.ticket-chat-area > .ticket-closed-banner,
.ticket-chat-area > .text-muted {
  flex-shrink: 0;
  -webkit-flex-shrink: 0;
  margin-top: 16px;
  max-width: 900px;
  width: 100%;
  align-self: center;
}

/* ── Drawer (Slide-in Details) ──────────────────────── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(1,4,9,.5);
  z-index: 149;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.drawer-overlay.open { display: block; }
.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: #0d1117;
  border-left: 1px solid #21262d;
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 30px rgba(0,0,0,.4);
}
.detail-drawer.open {
  transform: translateX(0);
}
.drawer-header {
  flex-shrink: 0;
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #21262d;
  background: #161b22;
}
.drawer-header > span {
  font-size: .9rem;
  font-weight: 700;
  color: #f0f6fc;
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-header > span svg { width: 16px; height: 16px; color: #6e7681; }
.drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #6e7681;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  transition: all .15s;
}
.drawer-close svg { width: 16px; height: 16px; }
.drawer-close:hover { background: #21262d; color: #c9d1d9; }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px;
}

/* ── Drawer-Sections ────────────────────────────────── */
.ip-section {
  padding: 16px 0;
  border-bottom: 1px solid #21262d;
}
.ip-section:last-child { border-bottom: none; }
.ip-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #484f58;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ip-section-title svg { width: 13px; height: 13px; }
.ip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: .84rem;
  gap: 10px;
}
.ip-key { color: #6e7681; font-weight: 500; font-size: .8rem; white-space: nowrap; }
.ip-val { color: #e6edf3; font-weight: 500; text-align: right; font-size: .84rem; min-width: 0; }
.ip-val a { font-size: .82rem; }
.ip-select {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: .82rem;
  color: #f0f6fc;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s;
}
.ip-select:focus { border-color: #388bfd; }
.ip-select option { background: #161b22; color: #c9d1d9; }
.ip-ai-text {
  font-size: .84rem;
  color: #8b949e;
  line-height: 1.6;
  margin-top: 4px;
}
.ip-missing-text {
  font-size: .84rem;
  color: #c9a227;
  line-height: 1.6;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════
   TEMPLATE PICKER DROPDOWN
   ═══════════════════════════════════════════════════════ */
.tpl-picker-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  max-width: 300px;
  max-height: 280px;
  overflow-y: auto;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 200;
}
.tpl-picker-dropdown.open { display: block; }
.tpl-dd-cat {
  padding: 8px 14px 4px;
  font-size: .7rem;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tpl-dd-item {
  padding: 8px 14px;
  font-size: .83rem;
  color: #e6edf3;
  cursor: pointer;
  transition: background .12s;
}
.tpl-dd-item:hover { background: #21262d; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .context-bar { padding: 0 16px; }
  .ctx-right { display: none; }
  .ticket-chat-area { padding: 16px; }
}
@media (max-width: 960px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .dash-filter-bar { gap: 6px; }
}
@media (max-width: 700px) {
  .sidebar { width: 0; border: none; overflow: hidden; }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .notif-panel { width: 300px; right: -40px; }
  .topbar { padding: 0 16px; }
  .detail-drawer { width: 100%; }
  .context-bar { padding: 0 12px; height: auto; min-height: 40px; flex-wrap: wrap; gap: 4px; padding-top: 6px; padding-bottom: 6px; }
  .ctx-field { padding: 0 8px; }
  .ticket-chat-area { padding: 12px; }
}
