/* SOKO Kupfer - dunkles Lagezentrum (Spec §9) */

:root {
  --bg: #0d1117;
  --bg-panel: #161b22;
  --bg-raised: #1c2330;
  --border: #2d3644;
  --text: #e6edf3;
  --text-muted: #9aa7b5;
  --accent: #35c98f;
  --accent-dim: #1f7a5a;
  --danger: #e5534b;
  --warn: #d29922;
  --info: #539bf5;
  --copper: #c9905f;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* CSP: keine Inline-Styles - initiales Verstecken ueber [hidden] */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh;
}

body { display: flex; flex-direction: column; }

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.2rem;
  background: var(--bg-panel);
  border-bottom: 2px solid var(--accent-dim);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: baseline; gap: 0.7rem; }
.brand-badge {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-size: 1.15rem;
  text-transform: uppercase;
}
.brand-sub { color: var(--text-muted); font-size: 0.9rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 700;
  padding: 0.15rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
}
.timer.timer-warn { color: var(--warn); border-color: var(--warn); }
.timer.timer-crit { color: var(--danger); border-color: var(--danger); }

.phase-chip {
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  font-size: 0.9rem;
  white-space: nowrap;
}
.phase-chip.active { border-color: var(--accent); color: var(--accent); }

/* --- Layout --- */
.content { flex: 1; padding: 1.2rem; max-width: 1200px; width: 100%; margin: 0 auto; }
.footer {
  padding: 0.6rem 1.2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
}
.panel-narrow { max-width: 460px; margin: 3rem auto; }

h1 { font-size: 1.5rem; margin: 0 0 0.6rem; }
h2 { font-size: 1.15rem; margin: 0.4rem 0; }
.muted { color: var(--text-muted); }

.alert {
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  margin: 0.6rem 0;
  border: 1px solid var(--border);
}
.alert-error { border-color: var(--danger); color: #ffb4ae; background: rgba(229, 83, 75, 0.08); }
.alert-warn { border-color: var(--warn); color: #ffd57a; background: rgba(210, 153, 34, 0.08); }
.alert-info { border-color: var(--info); color: #a8c9fa; background: rgba(83, 155, 245, 0.08); }

/* --- Formulare --- */
.stack { display: flex; flex-direction: column; gap: 0.4rem; }
label { font-weight: 600; margin-top: 0.4rem; }
input[type="text"], input[type="password"], select, textarea {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-size: 1rem;
  font-family: var(--font);
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  font-family: var(--font);
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent-dim); border-color: var(--accent); font-weight: 600; }
.btn-danger { border-color: var(--danger); color: #ffb4ae; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Lobby-Rollen --- */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.role-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.role-card.role-taken { opacity: 0.55; }
.badge {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}
.badge-taken { color: var(--warn); border-color: var(--warn); }
.badge-free { color: var(--accent); border-color: var(--accent); }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.5rem 0.9rem;
  font-size: 1rem;
  cursor: pointer;
  font-family: var(--font);
}
.tab-btn[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Tabellen (Beweise) --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table.data {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td.wrap { white-space: normal; min-width: 16rem; }
table.data th {
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
}
table.data th[aria-sort]::after { content: " \2195"; color: var(--text-muted); }
table.data tr:hover td { background: rgba(53, 201, 143, 0.05); }

.filter-input { width: min(420px, 100%); margin-bottom: 0.6rem; }

/* --- Dokumente --- */
.doc {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  white-space: pre-wrap;
  font-size: 0.98rem;
}
.doc h1, .doc h2 { font-size: 1.1rem; }

/* --- Chat --- */
.chat-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  min-height: 14rem;
  max-height: 26rem;
  overflow-y: auto;
  background: var(--bg);
}
.chat-msg { padding: 0.5rem 0.8rem; border-radius: 8px; max-width: 85%; }
.chat-msg.user { align-self: flex-end; background: var(--accent-dim); }
.chat-msg.assistant { align-self: flex-start; background: var(--bg-raised); border: 1px solid var(--border); }
.chat-msg .chat-meta { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.15rem; }
.chat-form { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.chat-form textarea { flex: 1; resize: vertical; min-height: 3.2rem; }

.char-list { display: flex; flex-direction: column; gap: 0.5rem; }
.char-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
}

/* --- Verdächtigenübersicht (Briefing) --- */
.suspect-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}
.suspect-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
}
.suspect-monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--copper);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.suspect-card h2 { font-size: 1.02rem; margin: 0; line-height: 1.3; }
.suspect-role { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.35; }
.suspect-intro { margin: 0.5rem 0 0; font-size: 0.95rem; line-height: 1.4; }

/* --- Hinweise --- */
.hint-item { border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 1rem; margin-bottom: 0.5rem; }
.hint-item.locked { color: var(--text-muted); }

/* --- Lagebericht-Aussagen --- */
/* Initiales Erscheinungsbild identisch für alle Aussagen (kein Korrektheits-Hinweis) */
.claim-wrap { margin: 0.3rem 0; }
.claim-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}
.claim-btn:hover { border-color: var(--border); }
.claim-btn:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
.claim-btn.selected { border-color: var(--danger); background: rgba(229, 83, 75, 0.12); }
.claim-btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }

/* --- Einsatzbefehl --- */
.dispatch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem; }

/* --- Admin --- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.kpi {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
}
.kpi .kpi-value { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .kpi-label { color: var(--text-muted); font-size: 0.85rem; }

table.plain { border-collapse: collapse; width: 100%; }
table.plain th, table.plain td { text-align: left; padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--border); }

/* --- Dialog --- */
dialog {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
  max-width: 480px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

/* --- Pause-Overlay --- */
.pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.pause-overlay .pause-box {
  background: var(--bg-panel);
  border: 2px solid var(--warn);
  border-radius: 10px;
  padding: 2rem 3rem;
  text-align: center;
  font-size: 1.3rem;
}

@media (min-width: 1080px) {
  .suspect-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .content { padding: 0.8rem; }
  body { font-size: 16px; }
  .suspect-grid { grid-template-columns: 1fr; }
}

/* --- Klassen statt Inline-Styles (CSP style-src 'self') --- */
.inline-form { display: inline; }
.panel-raised { background: var(--bg-raised); }
.dialog-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
.panel-wide { max-width: 640px; margin: 2rem auto; }
.btn-link { text-decoration: none; display: inline-block; }
.kpi-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.kpi-row-gap { margin-bottom: 0.8rem; }
.muted-top { margin-top: 0.6rem; }
.section-gap { margin-top: 1rem; }
