/* ============================================================
   Team-Dashboard · pages.css
   Seitenspezifische Gestaltung. Kommt nach components.css und darf
   dessen Bausteine ergänzen, aber nicht grundsätzlich umdefinieren.
   ============================================================ */

/* ---------------------------------------------- Board */

.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; align-items: start; }
@media (max-width: 1180px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .board { grid-template-columns: 1fr; } }

.column {
  background: var(--column-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem;
  min-height: 16rem;
}
.column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.2rem 0.4rem 0.7rem;
}
.column .kw { font-weight: 660; font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; letter-spacing: -0.01em; }
.column .kw::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.column .kw-tag { font-weight: 560; font-size: 0.74rem; color: var(--text-3); letter-spacing: 0; }
.col-offen .kw::before { background: var(--st-offen); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-offen) 22%, transparent); }
.col-in_bearbeitung .kw::before { background: var(--st-in_bearbeitung); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-in_bearbeitung) 22%, transparent); }
.col-warten .kw::before { background: var(--st-warten); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-warten) 22%, transparent); }
.col-geschlossen .kw::before { background: var(--st-geschlossen); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-geschlossen) 22%, transparent); }

.column .count, .tpl-card summary .count {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 640;
  padding: 0.07rem 0.58rem;
  color: var(--text-2);
}

.cards { min-height: 8rem; display: flex; flex-direction: column; gap: 0.55rem; }
.cards.dropzone {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-md);
  background: var(--accent-ring);
}
.empty-hint {
  color: var(--text-3);
  font-size: 0.84rem;
  text-align: center;
  padding: 2rem 0;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

.todo-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.72rem 0.82rem;
  cursor: grab;
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  animation: rise 0.25s ease both;
}
.todo-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); border-color: var(--border-strong); }
.todo-card.dragging { opacity: 0.92; transform: rotate(2.5deg) scale(1.03); box-shadow: var(--shadow-3); cursor: grabbing; }
.todo-card h3 { margin: 0.35rem 0 0.15rem; font-size: 0.94rem; }
/* Vorschau auf zwei Zeilen kürzen – der volle Text steht im Detailbereich */
.todo-card > .desc {
  font-size: 0.84rem;
  color: var(--text-2);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.todo-card.status-geschlossen h3 { text-decoration: line-through; color: var(--text-2); }

/* Statusstreifen links: die Karte sagt schon aus der Entfernung, wo sie steht.
   Vorher lag hier die Priorität – die steht jetzt als Chip in der Kopfzeile,
   weil der Status beim Überfliegen eines Boards die wichtigere Information ist. */
.todo-card { border-left: 3px solid var(--stripe, var(--border-strong)); }
.todo-card.status-offen { --stripe: var(--st-offen); }
.todo-card.status-in_bearbeitung { --stripe: var(--st-in_bearbeitung); }
.todo-card.status-warten { --stripe: var(--st-warten); }
.todo-card.status-geschlossen { --stripe: var(--st-geschlossen); }
/* Hohe Priorität übersteuert den Streifen – Dringendes gewinnt */
.todo-card.prio-hoch:not(.status-geschlossen) { --stripe: var(--danger); }
.todo-card.status-geschlossen { opacity: 0.82; }
.todo-card.status-geschlossen:hover { opacity: 1; }

.todo-top { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.todo-top .card-menu { margin-left: auto; }
.board.readonly .todo-card { cursor: default; }

.todo-top { display: flex; justify-content: flex-end; align-items: center; gap: 0.4rem; min-height: 1.15rem; }
.todo-top .prio { margin-right: auto; }
.todo-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 0.6rem; gap: 0.4rem; }
.assign-form select { font-size: 0.79rem; padding: 0.22rem 1.6rem 0.22rem 0.45rem; width: auto; max-width: 100%; border-radius: 8px; background-size: 0.85rem; }
.done-note { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--green-fg); }

.card-menu { position: relative; }
.card-menu summary {
  cursor: pointer;
  list-style: none;
  width: 1.6rem;
  height: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}
.card-menu summary::-webkit-details-marker { display: none; }
.card-menu summary:hover { background: var(--accent-soft); color: var(--accent); }
.menu-body {
  position: absolute;
  right: 0;
  top: 1.8rem;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  width: 10rem;
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  animation: pop 0.14s ease;
}
.menu-body form { display: flex; flex-direction: column; gap: 0.45rem; }

/* ---------------------------------------------- Aufgaben-Detail (aufgeklappte Karte) */

.todo-detail { margin-top: 0.55rem; border-top: 1px solid var(--border); cursor: default; }
.todo-detail > summary {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  cursor: pointer;
  padding: 0.45rem 0 0.1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  transition: color 0.15s;
}
.todo-detail > summary::-webkit-details-marker { display: none; }
.todo-detail > summary:hover { color: var(--accent); }
.todo-detail > summary > svg:first-child { transition: transform 0.18s; }
.todo-detail[open] > summary > svg:first-child { transform: rotate(90deg); }

.detail-count {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  margin-left: auto;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.06rem 0.44rem;
  font-size: 0.7rem;
  font-weight: 650;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.55rem 0 0.2rem;
  animation: rise 0.18s ease both;
}
.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.45rem 0.7rem;
  margin: 0;
}
.detail-meta div { min-width: 0; }
.detail-meta dt {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.detail-meta dd { margin: 0.06rem 0 0; font-size: 0.82rem; overflow-wrap: anywhere; }
.detail-desc { margin: 0; font-size: 0.85rem; color: var(--text-2); white-space: pre-wrap; }

.detail-edit { display: flex; flex-direction: column; gap: 0.42rem; }
.detail-edit-row { display: flex; align-items: center; gap: 0.42rem; }
.detail-edit-row select { flex: 1; min-width: 0; }

.detail-section h4 {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.32rem; }
.history li {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  padding: 0.04rem 0 0.04rem 0.55rem;
  border-left: 2px solid var(--border-strong);
  font-size: 0.8rem;
}
.history .ev-created { border-left-color: var(--accent); }
.history .ev-status { border-left-color: var(--blue-dot); }
.history .ev-assign { border-left-color: var(--amber-dot); }
.history .ev-claim { border-left-color: var(--green-dot); }
.no-history { margin: 0; }

.claim-form .btn { gap: 0.28rem; }

/* ---------------------------------------------- Backlog (geschlossene Fälle) */

.backlog-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.bl-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 14rem; }
.bl-search svg { position: absolute; left: 0.62rem; color: var(--text-3); pointer-events: none; }
.bl-search input { width: 100%; padding-left: 2.1rem; }
.backlog-filter select { width: auto; min-width: 9.5rem; }

.bl-week {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin: 1.4rem 0 0.5rem;
  font-size: 0.96rem;
}
.bl-group { padding: 0.25rem 1.15rem; }

.bl-item { border-bottom: 1px solid var(--border); }
.bl-item:last-child { border-bottom: none; }
.bl-item > summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  list-style: none;
  cursor: pointer;
  padding: 0.62rem 0;
  transition: color 0.15s;
}
.bl-item > summary::-webkit-details-marker { display: none; }
.bl-item > summary:hover .bl-title { color: var(--accent); }
.bl-item > summary > svg:first-child { flex-shrink: 0; color: var(--text-3); transition: transform 0.18s; }
.bl-item[open] > summary > svg:first-child { transform: rotate(90deg); }
.bl-item > summary .prio { flex-shrink: 0; }
.bl-item > summary .detail-count { margin-left: 0; flex-shrink: 0; }

.bl-title {
  flex: 1;
  min-width: 0;
  font-weight: 570;
  font-size: 0.91rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}
.bl-who, .bl-when { flex-shrink: 0; white-space: nowrap; }
.bl-item .detail-body { padding-bottom: 0.75rem; }

.bl-reopen { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }

@media (max-width: 760px) {
  .bl-who { display: none; }
  .bl-title { white-space: normal; }
}

/* ---------------------------------------------- Listenkarten (Meetings, Projekte) */

.meeting-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.meeting-card {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-bottom: 0;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  animation: rise 0.25s ease both;
}
.meeting-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.meeting-link { flex: 1; text-decoration: none; color: inherit; display: block; min-width: 0; }
.meeting-link strong { transition: color 0.15s; }
.meeting-link:hover strong { color: var(--accent); }
.meeting-actions { display: flex; align-items: center; gap: 0.45rem; flex-shrink: 0; }

.date-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 3.15rem;
  height: 3.45rem;
  border-radius: var(--radius-md);
  background: var(--accent-grad);
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 12px 22px -12px color-mix(in srgb, var(--accent) 55%, transparent);
}
.date-block .d { font-size: 1.14rem; font-weight: 700; line-height: 1.15; }
.date-block .m { font-size: 0.64rem; letter-spacing: 0.11em; text-transform: uppercase; opacity: 0.88; }
.date-block.big { width: 3.95rem; height: 4.35rem; border-radius: 15px; }
.date-block.big .d { font-size: 1.48rem; }
.project-block { color: #fff; }

.empty-state { text-align: center; padding: 2.8rem 1rem; border-style: dashed; box-shadow: none; background: transparent; }
.empty-state .empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 550;
  margin-bottom: 0.75rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

/* ---------------------------------------------- Protokoll */

.protocol-head { display: flex; gap: 1.1rem; align-items: flex-start; }
.protocol-title { flex: 1; min-width: 0; }
.protocol-title h1 { margin-bottom: 0.3rem; }
.protocol-actions { display: flex; flex-direction: column; gap: 0.45rem; flex-shrink: 0; }
.participant-chips { margin-top: 0.55rem; }
.meta-editor { animation: rise 0.2s ease; }

.agenda-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }
.agenda-head h2 { margin-bottom: 0.55rem; }
.agenda-progress { font-weight: 560; }
.doc-count { color: var(--accent); font-weight: 700; }

.agenda-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.75rem 0.85rem; }
.agenda-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  max-width: 15rem;
  padding: 0.22rem 0.62rem 0.22rem 0.26rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.79rem;
  font-weight: 530;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.agenda-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.agenda-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}
.agenda-chip.filled { background: var(--green-bg); border-color: color-mix(in srgb, var(--green-fg) 28%, transparent); color: var(--green-fg); }
.agenda-chip.filled .agenda-num { background: color-mix(in srgb, var(--green-fg) 22%, transparent); color: var(--green-fg); }

.top-list { display: flex; flex-direction: column; gap: 0.6rem; }
.top-item {
  animation: rise 0.25s ease both;
  margin-bottom: 0;
  border-left: 3px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.top-item.filled { border-left-color: var(--green-dot); }
.top-item.flash-target { box-shadow: 0 0 0 3px var(--accent-ring); }

.top-head { display: flex; align-items: center; gap: 0.7rem; }
.top-head h3 { flex: 1; font-size: 0.99rem; min-width: 0; }
.top-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  flex-shrink: 0;
}
.top-item.filled .top-badge { background: var(--green-bg); color: var(--green-fg); }
.top-tools { display: flex; align-items: center; gap: 0.1rem; flex-shrink: 0; }

.top-notes { white-space: pre-wrap; margin: 0.5rem 0 0.3rem; font-size: 0.93rem; }
.decision {
  display: flex;
  align-items: baseline;
  gap: 0.42rem;
  background: var(--green-bg);
  border-left: 3px solid var(--green-dot);
  color: var(--green-fg);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  margin: 0.5rem 0 0.35rem;
  font-size: 0.92rem;
}

.top-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.top-form textarea, .top-form input[name="topic"] { grid-column: 1 / -1; }
@media (max-width: 700px) { .top-form { grid-template-columns: 1fr; } }

.top-rename { display: none; }
.top-item.editing .top-rename { display: flex; gap: 0.4rem; flex: 1; align-items: center; }
.top-item.editing .top-topic, .top-item.editing .js-edit { display: none; }

.top-live { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; margin-left: 2.35rem; }
@media (max-width: 640px) { .top-live { margin-left: 0; } }
.top-live-notes { resize: vertical; min-height: 3rem; line-height: 1.55; background: var(--surface-2); }
.top-live input { background: var(--surface-2); font-size: 0.88rem; }
.top-live [data-field]:focus { background: var(--surface); }
.top-live .saved { border-color: var(--green-dot); background: var(--green-bg); }
.top-live .save-failed { border-color: var(--danger); background: var(--red-bg); }

.top-extra { display: none; grid-template-columns: 1.5fr 1fr; gap: 0.5rem; }
.top-item.show-extra .top-extra { display: grid; }
.top-item.show-extra .js-extra { display: none; }
@media (max-width: 700px) { .top-extra { grid-template-columns: 1fr; } }
.mini-field { margin: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.mini-field > span { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.73rem; font-weight: 620; color: var(--text-2); }
.js-extra { align-self: flex-start; }

.add-top { border-style: dashed; box-shadow: none; background: transparent; }
.add-top-form { display: grid; grid-template-columns: 1.3fr 1.5fr auto; gap: 0.5rem; }
@media (max-width: 700px) { .add-top-form { grid-template-columns: 1fr; } }

.finalize-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.9rem; flex-wrap: wrap; }

/* ---------------------------------------------- Konto */

.account-info { display: flex; align-items: center; gap: 1rem; }
.account-form { max-width: 26rem; display: grid; gap: 0.6rem; margin-top: 0.6rem; }
.account-form label { margin-bottom: 0; }
.account-form button { justify-self: start; }
.danger-zone { border-color: var(--red-border); }
.danger-zone h2 { color: var(--danger); }

/* ---------------------------------------------- Benutzerverwaltung */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  border-left: 3px solid var(--accent);
}
.notice p { margin: 0.15rem 0 0; }
.notice-warn { border-left-color: var(--amber-dot); background: var(--amber-bg); }
.notice-warn strong { color: var(--amber-fg); }

.user-form {
  display: grid;
  gap: 0.65rem;
  max-width: 30rem;
  margin-top: 0.7rem;
}
.user-form label { margin-bottom: 0; display: grid; gap: 0.2rem; }
.user-form button { justify-self: start; }
.check-inline {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
}
.check-inline input { width: auto; }

.user-table td { vertical-align: middle; }
.user-table .row-actions { display: flex; gap: 0.35rem; justify-content: flex-end; align-items: center; }
.row-inactive { opacity: 0.55; }
.row-inactive strong { text-decoration: line-through; }

/* Das Verwaltungsmenü braucht mehr Platz als das schmale Kartenmenü */
.user-menu-body { width: 17rem; gap: 0.55rem; }
.user-menu-body hr { border: 0; border-top: 1px solid var(--border); margin: 0.1rem 0; width: 100%; }
.user-menu-body form { width: 100%; }
.user-menu-body .btn { width: 100%; justify-content: center; }
.stack-form { display: grid; gap: 0.4rem; }
.tiny-label {
  display: grid;
  gap: 0.15rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  margin-bottom: 0;
}
.tiny-label input { font-size: 0.85rem; padding: 0.35rem 0.5rem; }

.inline-h2 { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 1.05rem; margin: 0; }
.audit-table code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface-3);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

/* ---------------------------------------------- Projekte & Checklisten */

.manage-section { margin-top: 1.8rem; }
.manage-body { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.6rem; }

.tpl-add { display: flex; gap: 0.45rem; }
.tpl-add input { flex: 1; }
.mtpl-add { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 0.45rem; }
@media (max-width: 700px) { .mtpl-add { grid-template-columns: 1fr; } }
.mtpl-notes { display: block; margin-top: 0.05rem; }

.tpl-card { margin-bottom: 0; background: var(--surface-2); }
.tpl-card summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-weight: 620;
  list-style: none;
  transition: color 0.15s;
}
.tpl-card summary::-webkit-details-marker { display: none; }
.tpl-card summary:hover .tpl-name { color: var(--accent); }
.tpl-card summary .count { margin-left: auto; }
.tpl-chev { display: inline-flex; color: var(--text-3); transition: transform 0.18s; }
.tpl-card[open] .tpl-chev { transform: rotate(90deg); }
.tpl-card[open] summary { margin-bottom: 0.7rem; }
.tpl-body { display: flex; flex-direction: column; gap: 0.55rem; }
.tpl-foot { display: flex; justify-content: flex-end; }

.tpl-items { margin: 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: 0.32rem; }
.tpl-items li { font-size: 0.92rem; }
.tpl-items li::marker { color: var(--accent); font-size: 0.82rem; font-weight: 650; }
.tpl-text { margin-right: 0.3rem; }
.tpl-item-actions { display: inline-flex; gap: 0.12rem; vertical-align: middle; }
.tpl-item-actions form { display: inline; }

.req-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.26rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.03rem 0.52rem;
  font-size: 0.72rem;
  font-weight: 560;
  margin-left: 0.35rem;
  white-space: nowrap;
}

.progress { height: 0.45rem; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 0.5rem; max-width: 26rem; }
.progress.big { height: 0.68rem; flex: 1; max-width: none; margin-top: 0; }
.progress-fill { height: 100%; background: var(--accent-grad); border-radius: 999px; transition: width 0.45s cubic-bezier(0.22, 0.8, 0.35, 1); }
.progress-row { display: flex; align-items: center; gap: 0.9rem; }
.progress-label { white-space: nowrap; font-weight: 560; }

.cl-list { list-style: none; margin: 0 0 0.7rem; padding: 0; display: flex; flex-direction: column; }
.cl-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.cl-item:hover { background: var(--surface-2); }
.cl-item:last-child { border-bottom: none; }
.cl-row { display: flex; align-items: center; gap: 0.6rem; }
.cl-row label { display: flex; align-items: center; gap: 0.68rem; flex: 1; margin: 0; cursor: pointer; color: var(--text); font-size: 0.95rem; font-weight: 480; }
.cl-item input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); cursor: pointer; }
.cl-item.done .cl-text { text-decoration: line-through; color: var(--text-2); }
.cl-meta { white-space: nowrap; }

.cl-fields { display: flex; flex-wrap: wrap; gap: 0.5rem 0.7rem; margin: 0.4rem 0 0.15rem 1.85rem; }
.cl-field { margin: 0; display: flex; flex-direction: column; gap: 0.17rem; min-width: 13rem; }
.cl-field-label { font-size: 0.74rem; font-weight: 620; color: var(--text-2); }
.req-star { color: var(--danger); }
.cl-field input { font-size: 0.86rem; padding: 0.34rem 0.58rem; border-radius: 9px; }
.cl-field input.empty { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber-fg) 32%, transparent); }
.cl-field input.missing { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); background: var(--red-bg); }
.cl-field input.saved { border-color: var(--green-dot); background: var(--green-bg); }

.cl-error {
  margin: 0.35rem 0 0.1rem 1.85rem;
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--red-fg);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: 9px;
  padding: 0.34rem 0.65rem;
  animation: rise 0.18s ease;
}

.cl-comments { margin-left: 1.85rem; }
.cl-comments summary {
  display: inline-flex;
  align-items: center;
  gap: 0.33rem;
  cursor: pointer;
  color: var(--text-3);
  font-size: 0.79rem;
  font-weight: 550;
  list-style: none;
  transition: color 0.15s;
}
.cl-comments summary::-webkit-details-marker { display: none; }
.cl-comments summary:hover { color: var(--accent); }
.comment-list { margin-top: 0.45rem; }
.comment { padding: 0.42rem 0; border-top: 1px dashed var(--border); font-size: 0.88rem; }
.comment-head { display: flex; align-items: center; gap: 0.5rem; }
.comment p { margin: 0.14rem 0 0; white-space: pre-wrap; }
.comment-add { display: flex; gap: 0.45rem; margin-top: 0.5rem; max-width: 30rem; }
.comment-add input { font-size: 0.88rem; }

/* ---------------------------------------------- Assistent */

.row-actions { display: flex; align-items: center; gap: 0.4rem; justify-content: flex-end; }

.chat-layout {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 0.9rem;
  align-items: stretch;
  height: calc(100vh - 12rem);
  min-height: 26rem;
}
@media (max-width: 920px) {
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-sidebar { max-height: 14rem; }
  .chat-main { height: 70vh; }
}

.chat-sidebar { margin-bottom: 0; overflow-y: auto; padding: 0.6rem; }
.chat-list { display: flex; flex-direction: column; gap: 0.2rem; }
.chat-item {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s, color 0.15s;
}
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: var(--accent-soft); color: var(--accent); }
.chat-item-title {
  display: block;
  font-size: 0.86rem;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-meta { display: block; }

.chat-main {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-head strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  scroll-behavior: smooth;
}

.msg { display: flex; gap: 0.7rem; align-items: flex-start; animation: rise 0.2s ease both; }
.msg-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 650;
}
.msg-user .msg-avatar { background: var(--surface-3); color: var(--text-2); }
.msg-assistant .msg-avatar { background: var(--accent-grad); color: #fff; box-shadow: 0 5px 12px -5px color-mix(in srgb, var(--accent) 55%, transparent); }
.msg-body { min-width: 0; flex: 1; font-size: 0.94rem; line-height: 1.65; padding-top: 0.15rem; }
.msg-user .msg-body { color: var(--text-2); }
.msg-body > *:first-child { margin-top: 0; }
.msg-body p { margin: 0 0 0.6rem; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body h4 { font-size: 0.95rem; font-weight: 660; margin: 0.9rem 0 0.35rem; }
.msg-body ul, .msg-body ol { margin: 0 0 0.6rem; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.2rem; }
.msg-body li::marker { color: var(--accent); }
.msg-body code {
  background: var(--surface-3);
  border-radius: 6px;
  padding: 0.08rem 0.35rem;
  font-size: 0.86em;
  font-family: var(--font-mono);
}
.msg-body pre.code {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  overflow-x: auto;
  margin: 0 0 0.6rem;
}
.msg-body pre.code code { background: none; padding: 0; font-size: 0.84rem; line-height: 1.55; }

.msg-body.typing::after {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 1rem;
  background: var(--accent);
  border-radius: 2px;
  vertical-align: text-bottom;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.chat-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red-fg);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
}

.chat-empty { margin: auto; text-align: center; padding: 2rem 1.5rem; max-width: 30rem; }
.chat-empty .empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 0.7rem;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-composer textarea {
  resize: none;
  max-height: 200px;
  line-height: 1.5;
  border-radius: var(--radius-md);
}
.chat-composer .btn { padding: 0.55rem 0.75rem; flex-shrink: 0; }

/* ---------------------------------------------- Spielmodus: Haustier & Service Points */

/* Belohnung, die beim Schließen aus der Karte aufsteigt */
.sp-pop {
  position: absolute;
  right: 0.6rem;
  bottom: 2.2rem;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  pointer-events: none;
  animation: float-up 3s ease-out both;
}
.sp-pop span {
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-2);
}
.sp-points { background: var(--accent); color: #fff; }
.sp-xp { background: var(--green-bg); color: var(--green-fg); }
.sp-extra { background: var(--amber-bg); color: var(--amber-fg); }

.level-up {
  position: fixed;
  left: 50%;
  top: 18%;
  z-index: 200;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.1rem 2.2rem;
  box-shadow: var(--shadow-3);
  animation: pop 0.25s ease both;
}
.lvl-emoji { font-size: 2.2rem; }
.lvl-title { font-size: 1.25rem; font-weight: 750; color: var(--accent); }
.lvl-text { color: var(--text-2); font-size: 0.88rem; }

.confetti {
  position: fixed;
  top: -2rem;
  z-index: 199;
  font-size: 1.3rem;
  pointer-events: none;
  animation: confetti-fall 3s linear both;
}

/* Anlegen */
.pet-intro { display: flex; align-items: center; gap: 1.4rem; }
.pet-intro h1 { margin: 0 0 0.3rem; }
.pet-intro p { margin: 0; }
.pet-intro-egg { font-size: 3.4rem; line-height: 1; animation: wobble 2.6s ease-in-out infinite; }
.pet-create h2 { font-size: 0.95rem; margin: 0 0 0.6rem; }
.pet-create h2 + * { margin-bottom: 1.2rem; }
.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.2rem, 1fr));
  gap: 0.55rem;
}
.species-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.7rem 0.3rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.species-option:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.species-option input { position: absolute; opacity: 0; pointer-events: none; }
.species-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.species-face { font-size: 1.9rem; line-height: 1; }
.species-name { font-size: 0.78rem; color: var(--text-2); }
.pet-name-row { display: flex; gap: 0.55rem; flex-wrap: wrap; }
.pet-name-row input { flex: 1; min-width: 14rem; }

/* Steckbrief */
.pet-hero { display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; }
.pet-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 15rem;
  height: 15rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, var(--accent-soft), var(--surface-2) 72%);
  border: 1px solid var(--border);
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
  overflow: hidden;
}
.pet-avatar.grabbing { cursor: grabbing; }
.pet-avatar canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.pet-fallback { display: grid; place-items: center; }
.pet-avatar.ready .pet-fallback { display: none; }
.pet-hint {
  position: absolute;
  bottom: 0.35rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.pet-avatar.ready:hover .pet-hint { opacity: 1; }
.pet-3d-note {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  background: var(--amber-bg);
  color: var(--amber-fg);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.66rem;
  font-weight: 650;
  white-space: nowrap;
}
.pet-avatar.no-webgl .pet-3d-note { display: block; }
.pet-face { font-size: 3.6rem; line-height: 1; transition: transform 0.2s; }
.stage-ei .pet-face { font-size: 3rem; animation: wobble 2.6s ease-in-out infinite; }
.stage-baby .pet-face { font-size: 3rem; }
.stage-jung .pet-face { font-size: 3.6rem; }
.stage-gross .pet-face { font-size: 4.2rem; }
.stage-krone .pet-face, .stage-mythisch .pet-face { font-size: 4.6rem; }
.stage-krone .pet-avatar, .stage-mythisch .pet-avatar { border-color: var(--amber-dot); }
.stage-mythisch .pet-avatar {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
  animation: glow 2.4s ease-in-out infinite;
}
.pet-crown { position: absolute; top: 0.35rem; font-size: 1.5rem; }
.pet-aura { position: absolute; right: 0.6rem; top: 1.2rem; font-size: 1.2rem; animation: wobble 1.8s ease-in-out infinite; }
.pet-mood {
  position: absolute;
  right: 0.2rem;
  bottom: 0.5rem;
  font-size: 1.4rem;
  background: var(--surface);
  border-radius: 50%;
  padding: 0.1rem;
  box-shadow: var(--shadow-1);
}
.pet-avatar.bounce { animation: bounce 0.6s ease; }
.pet-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%);
  z-index: 20;
  width: max-content;
  max-width: 15rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  text-align: center;
  box-shadow: var(--shadow-2);
  animation: pop 0.18s ease both;
}

.pet-info { flex: 1; min-width: 16rem; }
.pet-name-line { display: flex; align-items: center; gap: 0.5rem; }
.pet-name-line h1 { margin: 0; }
.pet-rename { position: relative; }
.pet-rename summary { list-style: none; cursor: pointer; color: var(--text-3); padding: 0.2rem; }
.pet-rename summary::-webkit-details-marker { display: none; }
.pet-rename summary:hover { color: var(--accent); }
.pet-rename form {
  position: absolute;
  left: 0;
  top: 1.8rem;
  z-index: 25;
  display: flex;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.6rem;
  box-shadow: var(--shadow-3);
}
.pet-sub { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; margin: 0.3rem 0 0.9rem; }
.rank-badge {
  background: var(--accent-grad);
  color: #fff;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 680;
}
.xp-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.level-chip {
  background: var(--surface-3);
  border-radius: 8px;
  padding: 0.16rem 0.5rem;
  font-weight: 750;
  font-size: 0.85rem;
}
.xp-bar {
  flex: 1;
  min-width: 9rem;
  height: 0.7rem;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.xp-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent-grad);
  transition: width 0.4s ease;
}
.pet-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.75rem; }
.boost-chip { border-color: var(--amber-dot); color: var(--amber-fg); background: var(--amber-bg); }
.streak-chip { border-color: var(--red-border); color: var(--red-fg); background: var(--red-bg); }
.pet-mood-text { margin: 0.55rem 0 0; }

.pet-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.tile-value { font-size: 1.55rem; font-weight: 720; line-height: 1.1; }
.tile-label { font-size: 0.75rem; color: var(--text-3); }

.pet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.pet-col { min-width: 0; }
.pet-col .card h2 { display: flex; align-items: center; gap: 0.4rem; font-size: 1rem; margin-top: 0; }

/* Futterladen */
.shop-grid { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.8rem; }
.shop-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 0.6rem 0.75rem;
  transition: border-color 0.15s, transform 0.15s;
}
.shop-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.shop-item.locked { opacity: 0.55; }
.shop-item.locked:hover { border-color: var(--border); transform: none; }
.shop-emoji { font-size: 1.9rem; line-height: 1; flex-shrink: 0; }
.shop-text { display: flex; flex-direction: column; gap: 0.1rem; flex: 1; min-width: 0; }
.shop-effects { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.25rem; }
.effect {
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 650;
}
.effect.xp { background: var(--green-bg); color: var(--green-fg); }
.effect.boost { background: var(--amber-bg); color: var(--amber-fg); }
.effect.team { background: var(--blue-bg); color: var(--blue-fg); }

/* Kleiderschrank */
.slot-block { margin-top: 1rem; }
.slot-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.slot-head span { text-transform: none; letter-spacing: 0; }
.acc-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.5rem;
}
.acc {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.18rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 0.65rem 0.5rem 0.55rem;
  transition: border-color 0.15s, transform 0.15s;
}
.acc:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.acc.is-worn {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-ring);
}
.acc.is-locked { opacity: 0.5; filter: grayscale(0.8); }
.acc.is-locked:hover { transform: none; border-color: var(--border); }
.acc-emoji { font-size: 1.7rem; line-height: 1.1; }
.acc-name { font-size: 0.8rem; font-weight: 680; }
.acc-note { line-height: 1.25; margin-bottom: 0.25rem; }
.acc form { margin-top: auto; }
.acc-lock {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  margin-top: auto;
  font-size: 0.7rem;
  color: var(--text-3);
}

/* Erfolge */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.55rem; margin-top: 0.8rem; }
.ach {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.5rem;
  background: var(--surface-2);
}
.ach.todo { opacity: 0.42; filter: grayscale(1); }
.ach.done { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.ach-emoji { font-size: 1.6rem; line-height: 1; }
.ach-title { font-size: 0.8rem; font-weight: 680; }
.ach-text { line-height: 1.25; }

/* Rangliste */
.rank-table td { vertical-align: middle; }
.rank-face { font-size: 1.4rem; }
.rank-table tr.me { background: var(--accent-soft); }
.rank-table tr.me strong { color: var(--accent); }

/* Verlauf */
.pet-log { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; }
.pet-log li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.42rem 0 0.42rem 0.6rem;
  border-top: 1px dashed var(--border);
  border-left: 2px solid transparent;
  font-size: 0.85rem;
}
.pet-log li:first-child { border-top: none; }
.pet-log .pl-task { border-left-color: var(--green-dot); }
.pet-log .pl-feed { border-left-color: var(--amber-dot); }
.pet-log .pl-level { border-left-color: var(--accent); }
.pet-log .pl-team { border-left-color: var(--blue-dot); }
/* Kauf und Umbenennung standen bisher ohne Farbstreifen da */
.pet-log .pl-item { border-left-color: var(--accent-2); }
.pet-log .pl-rename { border-left-color: var(--text-3); }
.pet-log .pl-text { min-width: 0; overflow-wrap: anywhere; }
.pl-meta { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.delta { border-radius: 999px; padding: 0.02rem 0.4rem; font-size: 0.72rem; font-weight: 680; }
.delta.plus { background: var(--green-bg); color: var(--green-fg); }
.delta.minus { background: var(--red-bg); color: var(--red-fg); }

/* Adminpanel */
.admin-setting { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap; }
.admin-setting-head { display: flex; align-items: flex-start; gap: 0.9rem; flex: 1; min-width: 18rem; }
.admin-setting-head h2 { margin: 0 0 0.25rem; font-size: 1rem; }
.admin-setting-head p { margin: 0; }
.admin-setting-icon { font-size: 2rem; line-height: 1; }

@media (max-width: 900px) {
  .pet-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------- ITIL-Nachschlagewerk */

.itil {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1rem;
  align-items: start;
  --itil-h: clamp(460px, 70vh, 780px);
}
.itil .card { margin-bottom: 0; }

/* Bühne */
.itil-stage { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.itil-tools {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.itil-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.itil-seg__btn {
  font: inherit; font-size: 0.82rem; cursor: pointer;
  padding: 0.34rem 0.75rem; border: 0; background: none; color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.itil-seg__btn + .itil-seg__btn { border-left: 1px solid var(--border-strong); }
.itil-seg__btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.itil-seg__btn:hover:not([aria-pressed="true"]) { background: var(--surface-3); color: var(--text); }
.itil-tools__spacer { margin-left: auto; }
.itil-zoom {
  font: inherit; font-size: 0.8rem; cursor: pointer;
  min-width: 1.9rem; height: 1.9rem; padding: 0 0.5rem;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2);
}
.itil-zoom:hover { border-color: var(--accent); color: var(--accent); }

.itil-canvas { height: var(--itil-h); overflow: auto; cursor: grab; background: var(--column-bg); }
.itil-canvas.is-panning { cursor: grabbing; }
.itil-canvas svg { display: block; }

/* Zeitleiste */
.itil-rail {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.itil-rail[hidden] { display: none; }
.itil-rail__nav {
  font: inherit; cursor: pointer; flex: 0 0 auto;
  width: 1.85rem; height: 1.85rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2);
}
.itil-rail__nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.itil-rail__nav:disabled { opacity: 0.35; cursor: default; }
.itil-track { display: flex; gap: 0.15rem; overflow-x: auto; flex: 1; padding-bottom: 0.2rem; }
.itil-tick {
  font: inherit; cursor: pointer; flex: 0 0 auto;
  text-align: left; padding: 0.3rem 0.55rem 0.35rem;
  border: 0; border-top: 2px solid var(--border-strong); background: none;
  min-width: 5.2rem;
}
.itil-tick__n { display: block; font-size: 0.66rem; letter-spacing: 0.08em; color: var(--text-3); }
.itil-tick__t { display: block; font-size: 0.78rem; color: var(--text-2); white-space: nowrap; }
.itil-tick:hover { border-top-color: var(--text-3); }
.itil-tick:hover .itil-tick__t { color: var(--text); }
.itil-tick[aria-current="step"] { border-top-color: var(--accent); }
.itil-tick[aria-current="step"] .itil-tick__t { color: var(--accent); font-weight: 600; }
.itil-tick[aria-current="step"] .itil-tick__n { color: var(--accent); }

/* Diagramm */
.itil-diagram .node { cursor: pointer; }
.itil-diagram .shape {
  fill: var(--surface); stroke: var(--text-3); stroke-width: 1.4;
  transition: stroke 0.12s, stroke-width 0.12s, fill 0.12s;
}
.itil-diagram .t-main {
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 550;
  fill: var(--text); text-anchor: middle; pointer-events: none;
}
.itil-diagram .t-sub {
  font-family: var(--font-sans); font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.07em; text-transform: uppercase;
  fill: var(--text-3); text-anchor: middle; pointer-events: none;
}
.itil-diagram .node--rel .shape { fill: var(--surface-3); }
.itil-diagram .node--rel .t-main { font-size: 11.5px; font-weight: 500; fill: var(--text-2); }
.itil-diagram .node--attr .shape { fill: var(--surface-2); stroke-dasharray: 4 3; stroke-width: 1.2; }
.itil-diagram .node--attr .t-main { font-size: 11px; fill: var(--text-2); }
.itil-diagram .node--isa .shape { fill: var(--surface-3); }
.itil-diagram .node--isa .t-main { font-size: 10.5px; letter-spacing: 0.06em; fill: var(--text-2); }
.itil-diagram .node--hub .shape { fill: var(--text); stroke: var(--text); }
.itil-diagram .node--hub .t-main { fill: var(--surface); font-size: 15px; font-weight: 650; }
.itil-diagram .node--hub .t-sub { fill: var(--surface); opacity: 0.72; }
.itil-diagram .node:hover .shape { stroke: var(--accent); }
.itil-diagram .node:focus-visible { outline: none; }
.itil-diagram .node:focus-visible .shape { stroke: var(--accent); stroke-width: 2.6; }

.itil-diagram .edge path { fill: none; stroke: var(--border-strong); stroke-width: 1.4; transition: stroke 0.12s, stroke-width 0.12s; }
.itil-diagram .edge--attr path { stroke-width: 1.1; }
.itil-diagram .edge text {
  font-family: var(--font-mono);
  font-size: 10px; fill: var(--text-2); text-anchor: middle; dominant-baseline: middle;
  paint-order: stroke; stroke: var(--column-bg); stroke-width: 4px; stroke-linejoin: round;
}
.itil-diagram .grid-line { stroke: var(--border); }
.itil-diagram .legend text { font-family: var(--font-sans); fill: var(--text-3); }
.itil-diagram .lg-title { font-size: 9.5px; letter-spacing: 0.14em; fill: var(--text-2); }
.itil-diagram .lg-lbl { font-size: 10.5px; }
.itil-diagram .lg-shape { fill: none; stroke: var(--border-strong); stroke-width: 1.3; }
.itil-diagram .lg-shape--attr { stroke-dasharray: 4 3; }

.itil-diagram.has-selection .node { opacity: 0.2; }
.itil-diagram.has-selection .edge { opacity: 0.14; }
.itil-diagram.has-selection .node.is-near { opacity: 0.55; }
.itil-diagram.has-selection .node.is-link,
.itil-diagram.has-selection .node.is-on,
.itil-diagram.has-selection .edge.is-link,
.itil-diagram.has-selection .edge.is-on { opacity: 1; }
.itil-diagram .node.is-on .shape { stroke: var(--accent); stroke-width: 2.6; }
.itil-diagram .node--hub.is-on .shape { fill: var(--accent); stroke: var(--accent); }
.itil-diagram .node--hub.is-on .t-main, .itil-diagram .node--hub.is-on .t-sub { fill: #fff; }
.itil-diagram .node.is-link .shape { stroke: var(--accent-2); }
.itil-diagram .edge.is-on path { stroke: var(--accent); stroke-width: 2.2; }
.itil-diagram .edge.is-link path { stroke: var(--accent-2); stroke-width: 1.8; }
.itil-diagram .edge.is-on text, .itil-diagram .edge.is-link text { fill: var(--accent); }

/* Detailtafel */
.itil-panel { max-height: calc(var(--itil-h) + 5.6rem); overflow-y: auto; padding: 0; }
.itil-panel__inner { padding: 1.05rem 1.15rem; display: flex; flex-direction: column; gap: 1.15rem; }
.itil-tag {
  display: inline-block; font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.16rem 0.5rem; border-radius: 999px;
  background: var(--neutral-bg); color: var(--neutral-fg);
}
.itil-tag--on { background: var(--accent-soft); color: var(--accent); }
.itil-panel__title { font-size: 1.4rem; line-height: 1.2; margin: 0.5rem 0 0; text-wrap: balance; }
.itil-panel__sub {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-3); margin-top: 0.3rem;
}
.itil-lead { font-size: 1rem; line-height: 1.55; color: var(--text); }
.itil-block { display: flex; flex-direction: column; gap: 0.55rem; }
.itil-block__h {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3); padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
}
.itil-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.itil-points li {
  display: grid; grid-template-columns: 0.9rem 1fr; gap: 0.35rem;
  font-size: 0.88rem; line-height: 1.5; color: var(--text-2);
}
.itil-points li::before { content: "—"; color: var(--text-3); }
.itil-case {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.45rem;
}
.itil-case__h {
  display: flex; justify-content: space-between; gap: 0.6rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--accent);
}
.itil-case__txt { font-size: 0.93rem; line-height: 1.6; color: var(--text); }
.itil-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.itil-chip {
  font: inherit; font-size: 0.78rem; cursor: pointer;
  padding: 0.24rem 0.55rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  transition: border-color 0.15s, color 0.15s;
}
.itil-chip:hover { border-color: var(--accent); color: var(--accent); }
.itil-foot {
  font-size: 0.78rem; line-height: 1.5; color: var(--text-3);
  border-top: 1px solid var(--border); padding-top: 0.7rem;
}
.itil-foot b { color: var(--text-2); font-weight: 600; }
.intro__list { display: flex; flex-direction: column; gap: 0.6rem; }
.intro__row { display: grid; grid-template-columns: 4.2rem 1fr; gap: 0.6rem; align-items: center; }
.intro__row p { font-size: 0.83rem; line-height: 1.45; color: var(--text-2); }
.intro__row b { display: block; color: var(--text); font-weight: 650; font-size: 0.86rem; }

@media (max-width: 1100px) {
  .itil { grid-template-columns: 1fr; --itil-h: 58vh; }
  .itil-panel { max-height: none; }
}

/* ---------------------------------------------- Ticketsystem */

/* Farbtöne für Kategorien und Labels */
.c-neutral { --chip-bg: var(--neutral-bg); --chip-fg: var(--neutral-fg); }
.c-blau    { --chip-bg: var(--blue-bg);    --chip-fg: var(--blue-fg); }
.c-gruen   { --chip-bg: var(--green-bg);   --chip-fg: var(--green-fg); }
.c-gelb    { --chip-bg: var(--amber-bg);   --chip-fg: var(--amber-fg); }
.c-rot     { --chip-bg: var(--red-bg);     --chip-fg: var(--red-fg); }
.c-lila    { --chip-bg: var(--accent-soft);--chip-fg: var(--accent); }

.tk-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--chip-bg, var(--neutral-bg));
  color: var(--chip-fg, var(--neutral-fg));
  font-size: 0.7rem; font-weight: 600; white-space: nowrap;
}
.tk-label::before { content: "#"; opacity: 0.55; }
.tk-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; margin-top: 0.35rem; }

.tk-type {
  display: inline-block; padding: 0.08rem 0.4rem; border-radius: 5px;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
}
.tk-type-stoerung { background: var(--red-bg); color: var(--red-fg); }
.tk-type-anfrage { background: var(--blue-bg); color: var(--blue-fg); }

.tk-no {
  font-family: var(--font-mono);
  font-size: 0.72rem; font-weight: 600; color: var(--text-3);
  text-decoration: none; letter-spacing: -0.01em;
}
.tk-no:hover { color: var(--accent); }
.tk-no.big { font-size: 0.9rem; color: var(--accent); display: block; margin-bottom: 0.15rem; }

.tk-due {
  display: inline-flex; align-items: center; gap: 0.2rem;
  font-size: 0.7rem; font-weight: 600; color: var(--text-3);
}
.tk-due.is-soon { color: var(--amber-fg); }
.tk-due.is-over { color: var(--danger); }

.board-tools { display: flex; gap: 0.4rem; align-items: center; }
.btn.warn { border-color: var(--amber-dot); color: var(--amber-fg); }
.tk-more {
  display: block; padding: 0.5rem; text-align: center;
  font-size: 0.78rem; color: var(--text-2); text-decoration: none;
}
.tk-more:hover { color: var(--accent); }
.todo-card h3 a { color: inherit; text-decoration: none; }
.todo-card h3 a:hover { color: var(--accent); }

/* Formular für Anlegen und Bearbeiten */
.tk-form { margin-top: 0.7rem; }
.tk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}
.tk-f { display: grid; gap: 0.2rem; margin-bottom: 0; font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.tk-f-wide { grid-column: 1 / -1; }
.tk-f-grow { flex: 1 1 14rem; }
.tk-flabel { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.tk-labelpick { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.15rem; }
.tk-pick {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.5rem; border-radius: 999px;
  background: var(--chip-bg, var(--neutral-bg)); color: var(--chip-fg, var(--neutral-fg));
  font-size: 0.75rem; font-weight: 600; cursor: pointer; margin: 0;
  opacity: 0.55; transition: opacity 0.12s;
}
.tk-pick:has(input:checked) { opacity: 1; }
.tk-pick input { width: auto; margin: 0; }
.tk-formactions { display: flex; gap: 0.4rem; }

/* Filterleiste */
.tk-quick { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.8rem; }
.tk-qbtn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); text-decoration: none;
  font-size: 0.8rem; font-weight: 600;
}
.tk-qbtn span { font-size: 0.72rem; color: var(--text-3); }
.tk-qbtn:hover { border-color: var(--accent); color: var(--accent); }
.tk-qbtn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tk-qbtn.is-on span { color: rgba(255, 255, 255, 0.75); }

.tk-filter { display: flex; flex-direction: column; gap: 0.6rem; }
.tk-filter-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
.tk-filter-actions { display: flex; gap: 0.4rem; margin-left: auto; }

/* Massenaktionen */
.tk-bulk {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  position: sticky; top: 0.5rem; z-index: 15;
  border-color: var(--accent); box-shadow: var(--shadow-2);
}
.tk-bulk[hidden] { display: none; }
.tk-bulk-count { font-size: 0.85rem; color: var(--text-2); }
.tk-bulk select { width: auto; min-width: 9rem; }

/* Tabelle – dicht, mit Statusstreifen je Zeile und fester Kopfzeile */
.tk-listcard { padding: 0; overflow-x: auto; }
.tk-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.tk-table th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; padding: 0.55rem 0.7rem;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tk-table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.tk-table tr:last-child td { border-bottom: none; }
.tk-table tbody tr { transition: background 0.12s; }
.tk-table tbody tr:hover { background: var(--surface-2); }

/* Der Streifen sitzt auf der ersten Zelle – border-left auf <tr> zeichnet nicht */
.tk-table tbody td:first-child {
  border-left: 3px solid var(--stripe, transparent);
}
.tk-table tbody tr:has(.st-offen) { --stripe: var(--st-offen); }
.tk-table tbody tr:has(.st-in_bearbeitung) { --stripe: var(--st-in_bearbeitung); }
.tk-table tbody tr:has(.st-warten) { --stripe: var(--st-warten); }
.tk-table tbody tr:has(.st-geschlossen) { --stripe: var(--st-geschlossen); }

.tk-table .tk-c { width: 2.4rem; text-align: center; }
.tk-table .tk-c input { width: auto; margin: 0; cursor: pointer; }
.tk-titlecell { min-width: 16rem; }
.tk-titlelink { color: var(--text); font-weight: 600; text-decoration: none; }
.tk-titlelink:hover { color: var(--accent); }
.tk-table .is-closed .tk-titlelink { color: var(--text-2); }
.tk-table .is-closed { opacity: 0.82; }
.tk-table .is-closed:hover { opacity: 1; }
/* Datums- und Zahlenspalten sollen untereinander fluchten */
.tk-table td:nth-last-child(-n+2), .tk-no { font-variant-numeric: tabular-nums; }

/* Detailseite */
.tk-detailhead { align-items: flex-start; }
.tk-detailhead h1 { margin: 0.1rem 0 0.4rem; }
.tk-statusbar { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tk-statusbar form { display: contents; }
.tk-detail { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1rem; align-items: start; }
.tk-main, .tk-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.tk-main .card, .tk-side .card { margin-bottom: 0; }
.tk-desc { white-space: pre-wrap; line-height: 1.6; }
.tk-meta { margin-top: 0.5rem; }
.tk-side .history { max-height: 22rem; overflow-y: auto; }

/* Kategorien & Labels */
.taxo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; align-items: start; }
.taxo-table td { padding: 0.3rem 0; border: none; }
.taxo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.taxo-row input[name="name"] { flex: 1 1 8rem; min-width: 7rem; }
.taxo-row select { width: auto; }
.taxo-add { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px solid var(--border); }
.taxo-add input { flex: 1 1 9rem; }
.taxo-add select { width: auto; }

@media (max-width: 900px) {
  .tk-detail { grid-template-columns: 1fr; }
}

/* ---------------------------------------------- Team-Chat */

.chat-widget { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60; }

.chat-launcher {
  width: 3.25rem; height: 3.25rem;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: var(--shadow-2);
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}
.chat-launcher:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.chat-launcher.has-unread { animation: chatpulse 2.4s ease-in-out infinite; }
@keyframes chatpulse {
  0%, 100% { box-shadow: var(--shadow-2); }
  50% { box-shadow: 0 0 0 6px var(--accent-ring); }
}
.chat-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 1.15rem; height: 1.15rem; padding: 0 0.28rem;
  display: grid; place-items: center;
  background: var(--danger); color: #fff;
  font-size: 0.66rem; font-weight: 700;
  border-radius: 999px;
  border: 2px solid var(--bg);
}

.chat-panel {
  position: absolute; right: 0; bottom: 4rem;
  width: min(23rem, calc(100vw - 2.5rem));
  height: min(32rem, calc(100vh - 7rem));
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: pop 0.16s ease;
}
.chat-panel[hidden] { display: none; }
/* Beim Ziehen keine Textmarkierung und kein weiches Nachlaufen */
.chat-panel.is-resizing { user-select: none; animation: none; }
.chat-panel.is-resizing .chat-scroll { pointer-events: none; }

/* Anfasser oben links – zwei Striche, wie man es von Fenstergriffen kennt */
.chat-resize {
  position: absolute; top: 0; left: 0; z-index: 2;
  /* Schmaler als die linke Polsterung des Kopfes (1 rem), sonst schluckt der
     Anfasser die obere linke Ecke des Zurück-Knopfes */
  width: 0.9rem; height: 0.9rem;
  cursor: nwse-resize;
  background:
    linear-gradient(to bottom right, transparent 46%, var(--border-strong) 46%,
                    var(--border-strong) 54%, transparent 54%) no-repeat 0.18rem 0.18rem / 0.55rem 0.55rem,
    linear-gradient(to bottom right, transparent 46%, var(--border-strong) 46%,
                    var(--border-strong) 54%, transparent 54%) no-repeat 0.02rem 0.02rem / 0.55rem 0.55rem;
  border-top-left-radius: var(--radius);
}
.chat-resize:hover, .chat-resize:focus-visible {
  background-color: var(--accent-soft);
  outline: none;
}

.chat-head {
  display: flex; align-items: center; gap: 0.4rem;
  /* links etwas mehr Luft: dort sitzt der Anfasser für die Fenstergröße */
  padding: 0.6rem 0.7rem 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex: 0 0 auto;
}
.chat-title {
  flex: 1; margin: 0;
  font-size: 0.95rem; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-icon, .chat-back {
  display: grid; place-items: center;
  width: 1.75rem; height: 1.75rem; padding: 0;
  border: none; background: transparent; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chat-icon:hover, .chat-back:hover { background: var(--surface-3); color: var(--text); }
.chat-icon[hidden], .chat-back[hidden] { display: none; }

/* Tonschalter: nur eines der beiden Glockensymbole ist sichtbar */
#chatSound .snd-off, #chatSound.is-muted .snd-on { display: none; }
#chatSound.is-muted .snd-off { display: inline-flex; }
#chatSound.is-muted { color: var(--text-3); }
#chatSound:not(.is-muted) { color: var(--accent); }

.chat-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-view[hidden] { display: none; }
.chat-scroll { overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; }

.chat-search {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  flex: 0 0 auto;
}
.chat-search input {
  flex: 1; border: none; background: transparent; padding: 0.15rem 0;
  font-size: 0.86rem; color: var(--text);
}
.chat-search input:focus { outline: none; }

.chat-newgroup {
  display: flex; align-items: center; gap: 0.35rem;
  width: 100%; padding: 0.5rem 0.75rem;
  border: none; border-bottom: 1px solid var(--border);
  background: transparent; color: var(--accent);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  flex: 0 0 auto;
}
.chat-newgroup:hover { background: var(--accent-soft); }

.chat-thread {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; padding: 0.6rem 0.75rem;
  border: none; background: transparent; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.chat-thread:hover { background: var(--surface-2); }
.chat-avatar {
  flex: 0 0 auto;
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.8rem; font-weight: 700;
}
.chat-avatar.is-group { background: var(--blue-bg); color: var(--blue-fg); }
.chat-avatar.small { width: 1.5rem; height: 1.5rem; font-size: 0.66rem; }
.chat-thread-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.chat-thread-top { display: flex; align-items: baseline; gap: 0.4rem; }
.chat-thread-name {
  flex: 1; min-width: 0;
  font-size: 0.86rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-thread-time { font-size: 0.68rem; color: var(--text-3); flex: 0 0 auto; }
.chat-thread-prev {
  font-size: 0.76rem; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-unread {
  flex: 0 0 auto;
  min-width: 1.2rem; height: 1.2rem; padding: 0 0.3rem;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 0.66rem; font-weight: 700; border-radius: 999px;
}
.chat-sectionlabel {
  margin: 0; padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
}
.chat-empty { margin: 0; padding: 1rem 0.9rem; font-size: 0.8rem; color: var(--text-3); }

.chat-messages { padding: 0.7rem; display: flex; flex-direction: column; gap: 0.45rem; }
.chat-msg {
  max-width: 82%;
  align-self: flex-start;
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface-3);
  border-radius: 12px 12px 12px 3px;
}
.chat-msg.is-mine {
  align-self: flex-end;
  background: var(--accent); color: #fff;
  border-radius: 12px 12px 3px 12px;
}
.chat-msg-author { font-size: 0.68rem; font-weight: 700; color: var(--accent); }
.chat-msg-body { font-size: 0.86rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.chat-msg-time { font-size: 0.63rem; opacity: 0.65; align-self: flex-end; }

/* GIF-Nachricht: das Bild trägt die Blase, deshalb weniger Polsterung */
.chat-msg.is-gif { padding: 0.25rem; max-width: 70%; }
.chat-msg.is-gif .chat-msg-author { padding: 0.1rem 0.3rem 0.15rem; }
.chat-msg.is-gif .chat-msg-time { padding: 0.1rem 0.3rem 0; }
.chat-gif {
  display: block; width: 100%; height: auto;
  border-radius: 9px; background: var(--surface-2);
}
.chat-system {
  align-self: center; margin: 0.2rem 0;
  font-size: 0.72rem; color: var(--text-3); text-align: center;
}

.chat-composer {
  display: flex; align-items: flex-end; gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex: 0 0 auto;
}
.chat-composer textarea {
  flex: 1; resize: none; max-height: 7.5rem;
  padding: 0.45rem 0.6rem;
  font: inherit; font-size: 0.86rem; line-height: 1.35;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.chat-send {
  flex: 0 0 auto;
  width: 2.1rem; height: 2.1rem;
  display: grid; place-items: center;
  border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; cursor: pointer;
}
.chat-send:hover { filter: brightness(1.08); }
.chat-gifbtn {
  flex: 0 0 auto; align-self: stretch;
  padding: 0 0.5rem; min-height: 2.1rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2);
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em;
  cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.chat-gifbtn:hover { color: var(--accent); border-color: var(--accent); }
.chat-gifbtn[aria-expanded="true"] {
  color: var(--accent); border-color: var(--accent); background: var(--accent-soft);
}

/* ── GIF-Auswahl ── */
.chat-gifs {
  display: flex; flex-direction: column;
  /* höchstens die halbe Fensterhöhe, damit der Verlauf sichtbar bleibt */
  max-height: 50%;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex: 0 0 auto;
}
.chat-gifs[hidden] { display: none; }
.chat-gifsearch {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.5rem 0.4rem 0.7rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  flex: 0 0 auto;
}
.chat-gifsearch input {
  flex: 1; min-width: 0;
  border: none; background: transparent; padding: 0.15rem 0;
  font-size: 0.84rem; color: var(--text);
}
.chat-gifsearch input:focus { outline: none; }
.chat-gifgrid {
  /* Mauerwerk in zwei Spalten: GIFs sind unterschiedlich hoch */
  columns: 2; column-gap: 0.3rem;
  padding: 0.4rem; overflow-y: auto;
  flex: 1; min-height: 0; scrollbar-width: thin;
}
.chat-gifpick {
  display: block; width: 100%; padding: 0; margin: 0 0 0.3rem;
  border: 2px solid transparent; border-radius: 8px;
  background: none; cursor: pointer; overflow: hidden;
  break-inside: avoid;
}
.chat-gifpick img {
  display: block; width: 100%; height: auto;
  border-radius: 6px; background: var(--surface-3);
}
.chat-gifpick:hover, .chat-gifpick:focus-visible {
  border-color: var(--accent); outline: none;
}
.chat-gifnote {
  margin: 0; padding: 0.5rem 0.7rem 0.6rem;
  font-size: 0.76rem; color: var(--text-3); text-align: center;
}
.chat-error {
  margin: 0; padding: 0.4rem 0.7rem;
  font-size: 0.78rem; color: var(--red-fg); background: var(--red-bg);
}

.chat-groupform { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.7rem; flex: 1; min-height: 0; }
.chat-picker { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.3rem; }
.chat-pick {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.4rem; border-radius: var(--radius-sm);
  font-size: 0.84rem; cursor: pointer; margin: 0;
}
.chat-pick:hover { background: var(--surface-2); }
.chat-pick input { width: auto; margin: 0; }
.chat-groupactions { display: flex; gap: 0.4rem; justify-content: flex-end; padding: 0.6rem 0.7rem; flex: 0 0 auto; }
.chat-memberrow { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.75rem; font-size: 0.84rem; }
.chat-inactive { font-size: 0.68rem; color: var(--text-3); }
.chat-memberadd { padding: 0 0.75rem 0.5rem; display: flex; flex-wrap: wrap; gap: 0.3rem; flex: 0 0 auto; }
.chat-addbtn {
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 999px; padding: 0.2rem 0.6rem;
  font-size: 0.76rem; color: var(--text-2); cursor: pointer;
}
.chat-addbtn:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 640px) {
  .chat-widget { right: 0.8rem; bottom: 0.8rem; }
  .chat-panel { width: calc(100vw - 1.6rem); height: min(28rem, calc(100vh - 6rem)); }
}
@media print { .chat-widget { display: none; } }

/* ------------------------------------------------------------------ Sniper Arena */

.sn-hero {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 1fr); gap: 1.4rem;
  color: #fff; border: none; position: relative; overflow: hidden;
  background:
    radial-gradient(60% 80% at 90% 110%, rgba(123, 200, 98, 0.9), transparent 70%),
    radial-gradient(40% 50% at 10% 0%, rgba(255, 255, 255, 0.35), transparent 70%),
    linear-gradient(165deg, #2f7fd6 0%, #5aa6ee 55%, #bfe3ff 100%);
}
.sn-hero::after {
  /* Noppenreihe am unteren Rand */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; pointer-events: none;
  background: radial-gradient(circle at 12px 7px, rgba(255,255,255,0.45) 0 5px, transparent 6px) 0 0 / 24px 14px repeat-x, #4b974b;
}
.sn-hero > * { position: relative; z-index: 1; }
.sn-hero h1 { margin: 0.2rem 0 0.45rem; font-size: 2.5rem; font-weight: 900; letter-spacing: -0.02em; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.18); }
.sn-hero p { margin: 0; max-width: 34rem; color: #f2f8ff; }
.sn-kicker { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 750; color: #ffe27a; }
.sn-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin: 1.2rem 0 1rem; }
.sn-play { font-size: 1rem; padding: 0.7rem 1.3rem; }
.sn-hours { font-size: var(--fs-sm); background: rgba(0, 0, 0, 0.22); padding: 0.25rem 0.6rem; border-radius: 999px; }
.sn-live { background: rgba(8, 30, 60, 0.45); border-radius: 14px; padding: 0.9rem 1rem 1.2rem; align-self: start; backdrop-filter: blur(3px); }
.sn-live-head { display: flex; align-items: center; gap: 0.5rem; font-size: var(--fs-sm); font-weight: 650; }
.sn-dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa1ad; flex: none; }
.sn-dot.on { background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.25); }
.sn-score { display: flex; justify-content: center; gap: 0.6rem; margin: 0.5rem 0; font-size: 1.7rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.sn-score:empty { display: none; }
.sn-score .rot { color: #ff9b8f; }
.sn-score .blau { color: #9cc4ff; }
.sn-players { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.2rem; font-size: var(--fs-sm); }
.sn-players li { display: flex; justify-content: space-between; padding: 0.15rem 0.45rem; border-radius: 6px; background: rgba(255,255,255,0.08); }
.sn-players li.rot { border-left: 3px solid #ff6b5b; }
.sn-players li.blau { border-left: 3px solid #6aa7ff; }
.sn-players li.dead { opacity: 0.55; }
.sn-players .kd { opacity: 0.8; font-variant-numeric: tabular-nums; }
.sn-msg { margin: 0.5rem 0 0; font-size: var(--fs-sm); color: #e3f0ff; min-height: 1em; }

.sn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.sn-col > .card + .card { margin-top: 1rem; }
.sn-profile-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.7rem; }
.sn-profile-head h2 { margin: 0; font-size: 1.1rem; }
.sn-profile-head > div { flex: 1; }
.sn-coins strong { font-variant-numeric: tabular-nums; }
.sn-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-top: 0.9rem; }
.sn-achievements { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.sn-ach { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.55rem 0.65rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); opacity: 0.6; }
.sn-ach.earned { opacity: 1; border-color: #e8b923; background: color-mix(in srgb, #f5cd30 14%, var(--surface)); }
.sn-ach > div { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.sn-ach-icon { font-size: 1.3rem; line-height: 1; }
.sn-weapons { display: grid; gap: 0.55rem; }
.sn-weapon { display: flex; gap: 0.75rem; padding: 0.65rem 0.8rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.sn-weapon p { margin: 0.2rem 0 0.35rem; }
.sn-weapon-icon { font-size: 1.6rem; line-height: 1; }
.sn-slot { margin-left: 0.4rem; font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.sn-dmg { display: flex; flex-wrap: wrap; gap: 0.7rem; font-size: var(--fs-xs); color: var(--text-2); font-variant-numeric: tabular-nums; }
.sn-matches { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.sn-matches li { display: flex; gap: 0.8rem; align-items: flex-start; }
.sn-matches li > div { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.sn-result { font-weight: 850; padding: 0.25rem 0.55rem; border-radius: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; color: #fff; }
.sn-result.tdm { background: linear-gradient(90deg, #d63a2f 50%, #1e6fd0 50%); }
.sn-result.ffa { background: #8c5bb4; }
.sn-result.gungame { background: linear-gradient(135deg, #3fb950, #da8541); }
.sn-roster { overflow-wrap: anywhere; }
.sn-maps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.sn-map { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.7rem 0.85rem; border-radius: 12px; color: #fff; }
.sn-map span { font-size: var(--fs-sm); opacity: 0.92; }
.sn-map.wolkeninsel { background: linear-gradient(135deg, #3b8fe0, #5aa65a); }
.sn-map.buerodach { background: linear-gradient(135deg, #35589e, #c98552); }
.sn-map.spielzeugkiste { background: linear-gradient(135deg, #c4281c, #d9a520); }
.sn-keys { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem 1rem; margin: 0 0 0.7rem; font-size: var(--fs-md); align-items: center; }
.sn-keys dt { white-space: nowrap; }
.sn-keys dd { margin: 0; color: var(--text-2); }
.sn-keys kbd, .card kbd {
  display: inline-block; min-width: 1.5em; padding: 0.08rem 0.4rem; margin-right: 0.2rem; text-align: center;
  font: 600 0.75rem var(--font-sans); border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 6px; background: var(--surface);
}

/* Spind */
.sn-spind-head { margin-bottom: 0.8rem; }
.sn-spind-head h1 { margin: 0.2rem 0 0; }
.sn-spind { display: grid; grid-template-columns: minmax(16rem, 0.8fr) 1.2fr; gap: 1rem; align-items: start; }
.sn-preview-card { position: sticky; top: 1rem; }
.sn-preview {
  position: relative; height: 24rem; border-radius: 14px; cursor: grab; touch-action: none; overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #d6ecff, #7fb6e8);
}
.sn-preview:active { cursor: grabbing; }
.sn-preview canvas { display: block; width: 100%; height: 100%; }
.sn-preview-note { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: #234; }
.sn-preview.no3d .sn-preview-note { display: flex; }
.sn-preview-info { display: flex; gap: 0.5rem; align-items: center; margin: 0.8rem 0 0.4rem; }
.sn-look h2 { font-size: 1rem; margin: 1.2rem 0 0.5rem; }
.sn-swatches { border: 0; padding: 0; margin: 0 0 0.7rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sn-swatches legend { font-weight: 650; font-size: var(--fs-sm); margin-bottom: 0.35rem; }
.sn-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.sn-swatch span {
  display: block; width: 1.9rem; height: 1.9rem; border-radius: 8px; cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2), 0 0 0 1px var(--border-strong);
}
.sn-swatch input:checked + span { box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2), 0 0 0 3px var(--accent); }
.sn-swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.sn-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 0.5rem; }
.sn-item {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.7rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap;
}
.sn-item:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.sn-item.locked { opacity: 0.6; }
.sn-item-name { flex: 1; font-weight: 600; font-size: var(--fs-md); }
.sn-item-tag { font-size: var(--fs-xs); color: var(--text-3); }
.sn-save { position: sticky; bottom: 0; display: flex; align-items: center; gap: 0.8rem; margin-top: 1.2rem; padding: 0.8rem 0 0.2rem; background: var(--surface); border-top: 1px solid var(--border); }
#look-warning { color: var(--danger); }
.sniper-hours { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.6rem; font-size: var(--fs-sm); }
.sniper-hours label { display: flex; align-items: center; gap: 0.35rem; }

@media (max-width: 960px) {
  .sn-hero, .sn-grid, .sn-spind { grid-template-columns: 1fr; }
  .sn-preview-card { position: static; }
  .sn-achievements { grid-template-columns: 1fr; }
}
