/* Cops & Robbers RPG – Server Panel
   Styleguide: Mafia-Noir, Oswald/Inter, Lichtbalken Blau/Rot, Gold-Akzent */

:root {
  --ink: #07080b;
  --surface: #101218;
  --surface-2: #161922;
  --surface-3: #1d212c;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #ECEAE4;
  --text-2: #B9B5AC;
  --muted: #8D8A84;
  --gold: #C9A24A;
  --gold-soft: rgba(201, 162, 74, 0.12);
  --cop: #2F7BF0;
  --robber: #E5383B;
  --green: #2FBF71;
  --amber: #E8892B;
  --danger: #D7263D;

  --display: 'Oswald', 'Arial Narrow', sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --sidebar: 248px;
  --pad: 32px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--ink);
  color: var(--text);
  font: 400 14px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Lichtbalken (das Markenelement) ---------- */
.lightbar {
  position: relative;
  height: 4px;
  background: linear-gradient(90deg, var(--cop) 0 50%, var(--robber) 50% 100%);
  overflow: visible;
}
.lightbar::before, .lightbar::after {
  content: '';
  position: absolute;
  top: 0; height: 100%; width: 50%;
  filter: blur(14px);
  opacity: .55;
}
.lightbar::before { left: 0; background: var(--cop); }
.lightbar::after { right: 0; background: var(--robber); }

/* Server online: Rundumleuchte im Wechsel */
body[data-server="online"] .lightbar::before { animation: flash-a 1.6s steps(1) infinite; }
body[data-server="online"] .lightbar::after  { animation: flash-b 1.6s steps(1) infinite; }
@keyframes flash-a { 0%, 12%, 25% { opacity: .95; } 6%, 19%, 50%, 100% { opacity: .15; } }
@keyframes flash-b { 0%, 50% { opacity: .15; } 56%, 69% { opacity: .95; } 62%, 75%, 100% { opacity: .15; } }

/* Server offline: Licht aus */
body[data-server="offline"] .lightbar { filter: saturate(.25) brightness(.55); }
body[data-server="offline"] .lightbar::before,
body[data-server="offline"] .lightbar::after { opacity: 0; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  font: 600 13px/1 var(--display);
  letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  transition: background .15s, border-color .15s, filter .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: rgba(255,255,255,.22); }
.btn:disabled, .btn:disabled:hover { opacity: .35; filter: grayscale(.7); cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #15120b; }
.btn-gold:hover { background: var(--gold); border-color: var(--gold); filter: brightness(1.1); }
.btn-green { background: var(--green); border-color: var(--green); color: #07130c; }
.btn-green:hover { background: var(--green); border-color: var(--green); filter: brightness(1.1); }
.btn-danger { background: transparent; border-color: rgba(229, 56, 59, .55); color: #ff8f91; }
.btn-danger:hover { background: rgba(229, 56, 59, .12); border-color: var(--robber); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(255,255,255,.05); border-color: transparent; color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }

/* ---------- Formular ---------- */
.field { display: block; margin-bottom: 18px; }
.field span { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 7px; }
.input {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--ink);
  border: 1px solid var(--line-strong);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: rgba(255,255,255,.22); }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; margin-bottom: 18px;
  font-size: 13px; line-height: 1.45;
  background: rgba(229, 56, 59, .08);
  border-left: 3px solid var(--robber);
  color: #f2c3c4;
}
.notice.warn { background: rgba(232, 137, 43, .08); border-left-color: var(--amber); color: #f3d3b0; }
.notice svg.i { margin-top: 1px; width: 16px; height: 16px; }
.notice[hidden] { display: none; }

/* =====================================================================
   LOGIN
   ===================================================================== */
.login-page {
  min-height: 100%;
  display: grid; place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(60% 50% at 0% 0%, rgba(47, 123, 240, .16), transparent 70%),
    radial-gradient(60% 50% at 100% 100%, rgba(229, 56, 59, .13), transparent 70%),
    var(--ink);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.login-body { padding: 36px 36px 30px; }
.login-brand { margin-bottom: 28px; }
.login-brand .mark {
  font: 700 34px/1 var(--display);
  letter-spacing: .04em; text-transform: uppercase;
}
.login-brand .mark b { color: var(--gold); font-weight: 700; padding: 0 .08em; }
.login-brand p { margin-top: 8px; color: var(--muted); font-size: 13.5px; }
.login-body .btn { width: 100%; height: 46px; margin-top: 6px; font-size: 14px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); }
.pw-toggle:hover { color: var(--text); }
.login-foot {
  display: flex; justify-content: space-between;
  padding: 14px 36px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* =====================================================================
   PANEL – Layout
   ===================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.app > .lightbar { grid-column: 1 / -1; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: calc(100vh - 4px);
}
.brand { padding: 26px 24px 22px; border-bottom: 1px solid var(--line); }
.brand .mark { font: 700 22px/1 var(--display); letter-spacing: .05em; text-transform: uppercase; }
.brand .mark b { color: var(--gold); font-weight: 700; padding: 0 .06em; }
.brand small { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; }

.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 14px;
  color: var(--text-2); font-weight: 500; font-size: 14px;
  border-left: 2px solid transparent;
  text-align: left;
}
.nav button:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav button[aria-current="page"] { color: var(--gold); background: var(--gold-soft); border-left-color: var(--gold); }

.side-status { margin: auto 12px 0; padding: 14px; border-top: 1px solid var(--line); }
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-top: 1px solid var(--line);
}
.avatar {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--gold);
  font: 600 14px var(--display); text-transform: uppercase;
}
.side-user .who { flex: 1; min-width: 0; line-height: 1.3; }
.side-user .who b { display: block; font-weight: 600; font-size: 13.5px; }
.side-user .who span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 22px var(--pad) 18px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font: 600 26px/1.1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.topbar p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.topbar .spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 9px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(47,191,113,.18); }
.dot.off { background: var(--robber); box-shadow: 0 0 0 3px rgba(229,56,59,.18); }
.dot.wait { background: var(--amber); box-shadow: 0 0 0 3px rgba(232,137,43,.18); }

.content { padding: 28px var(--pad) 40px; flex: 1; min-height: 0; }
.view[hidden] { display: none; }

.secure-hint { margin: 20px var(--pad) 0; }

/* ---------- Dashboard ---------- */
.dash { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); padding: 22px 24px; min-width: 0; }
.card h2 { font: 500 13px/1.2 var(--body); color: var(--muted); margin-bottom: 14px; }

.status-card {
  grid-column: span 12;
  display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 32px; align-items: center;
  padding: 28px 30px;
  position: relative; overflow: hidden;
}
.status-card::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--muted);
}
body[data-server="online"] .status-card::before { background: var(--green); }
body[data-server="offline"] .status-card::before { background: var(--robber); }
body[data-server="busy"] .status-card::before { background: var(--amber); }

.status-word {
  font: 700 64px/0.95 var(--display);
  letter-spacing: .02em; text-transform: uppercase;
}
body[data-server="online"] .status-word { color: var(--text); }
body[data-server="offline"] .status-word { color: #6b6965; }
.status-meta { margin-top: 10px; color: var(--text-2); font-size: 14px; }
.status-meta span + span::before { content: ''; display: inline-block; width: 4px; height: 4px; background: var(--muted); margin: 0 10px 2px; }

.players { border-left: 1px solid var(--line); padding-left: 32px; }
.players .num { font: 600 48px/1 var(--display); letter-spacing: .02em; }
.players .num small { font-size: 24px; color: var(--muted); font-weight: 500; }
.players .lbl { color: var(--muted); font-size: 13px; margin-top: 6px; }
.slots { display: flex; gap: 2px; margin-top: 12px; flex-wrap: wrap; max-width: 300px; }
.slots i { width: 8px; height: 8px; background: rgba(255,255,255,.08); }
.slots i.on { background: var(--gold); }

.controls { display: flex; flex-direction: column; gap: 8px; min-width: 170px; }
.controls .btn { width: 100%; height: 42px; justify-content: flex-start; }

.meter { grid-column: span 4; }
.meter .row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.meter .val { font: 600 34px/1 var(--display); letter-spacing: .02em; }
.meter .val small { font-size: 16px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.meter .sub { color: var(--muted); font-size: 12.5px; text-align: right; }
.bar { height: 4px; background: rgba(255,255,255,.07); margin-top: 16px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .5s ease; }
.bar > i.hot { background: var(--amber); }
.bar > i.crit { background: var(--robber); }
.spark { display: block; width: 100%; height: 46px; margin-top: 14px; }

.facts { grid-column: span 12; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; }
.facts div { padding: 16px 24px; border-left: 1px solid var(--line); }
.facts div:first-child { border-left: 0; }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ---------- Terminal ---------- */
.term-card { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 420px; }
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.toolbar .spacer { flex: 1; }
.toolbar .hint { color: var(--muted); font-size: 12.5px; }
.toolbar kbd { font: 500 11.5px var(--mono); padding: 2px 6px; background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text-2); }
#terminal { flex: 1; min-height: 0; background: #05060a; padding: 10px 0 6px 12px; }
#terminal .xterm-viewport { background: #05060a !important; }

/* ---------- Dateimanager ---------- */
.files-card { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 420px; position: relative; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font: 13px var(--mono); min-width: 0; }
.crumbs button { padding: 4px 6px; color: var(--text-2); }
.crumbs button:hover { color: var(--gold); background: var(--gold-soft); }
.crumbs button:last-child { color: var(--text); font-weight: 500; }
.crumbs .sep { color: var(--muted); }
.search { height: 32px; width: 200px; font-size: 13px; padding: 0 10px; }

.table-wrap { flex: 1; overflow: auto; }
table.files { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.files th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted);
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
table.files td { padding: 0 16px; height: 42px; border-bottom: 1px solid rgba(255,255,255,.04); white-space: nowrap; }
table.files tr:hover td { background: rgba(255,255,255,.025); }
table.files td.num { color: var(--text-2); font-variant-numeric: tabular-nums; }
table.files td.actions { text-align: right; width: 1%; }
table.files td.actions .btn-icon { opacity: .55; }
table.files tr:hover td.actions .btn-icon, table.files td.actions .btn-icon:focus-visible { opacity: 1; }
.fname { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; text-align: left; }
.fname span { overflow: hidden; text-overflow: ellipsis; }
.fname.dir { color: var(--text); font-weight: 500; }
.fname.dir svg { color: var(--gold); }
.fname.file svg { color: var(--muted); }
button.fname.dir:hover span { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }

.dropzone {
  position: absolute; inset: 0; z-index: 5;
  display: none; place-items: center;
  background: rgba(7, 8, 11, .86);
  border: 2px dashed var(--gold);
  font: 600 22px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--gold);
}
.files-card.dragging .dropzone { display: grid; }
.progress { height: 3px; background: transparent; }
.progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }

/* ---------- Datenbank ---------- */
.db-off { max-width: 640px; }
.db-off h2 { font: 600 20px/1.2 var(--display); letter-spacing: .04em; text-transform: uppercase; color: var(--text); margin-bottom: 10px; }
.db-off p { color: var(--text-2); margin-bottom: 12px; }

.db-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 16px; }
.db-head .spacer { flex: 1; }
.db-ident { display: flex; align-items: center; gap: 14px; min-width: 0; }
.db-ident svg.i { width: 26px; height: 26px; color: var(--gold); }
.db-ident b { display: block; font: 600 20px/1.1 var(--display); letter-spacing: .04em; }
.db-ident span { color: var(--muted); font-size: 12.5px; }

.db-grid { display: grid; grid-template-columns: 260px 1fr; gap: 16px; height: calc(100vh - 290px); min-height: 460px; }
.db-tables { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.db-tables .search { width: 100%; }
.tlist { list-style: none; overflow: auto; flex: 1; margin: 0 -4px; }
.tlist button {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; text-align: left; font-size: 13.5px; color: var(--text-2);
  border-left: 2px solid transparent;
}
.tlist button svg.i { width: 15px; height: 15px; color: var(--muted); }
.tlist button:hover { background: rgba(255,255,255,.04); color: var(--text); }
.tlist button[aria-current="true"] { background: var(--gold-soft); color: var(--gold); border-left-color: var(--gold); }
.tlist button[aria-current="true"] svg.i { color: var(--gold); }
.tname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
.tcount { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tnone { color: var(--muted); padding: 10px; font-size: 13px; }

.db-data { padding: 0; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.db-pick { margin: auto; max-width: 340px; }
#db-tableview { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#db-tableview[hidden] { display: none; }
.db-title b { font: 13.5px var(--mono); font-weight: 500; color: var(--gold); margin-right: 10px; }
.db-title span { color: var(--muted); font-size: 12.5px; }

table.grid { border-collapse: collapse; font-size: 13px; min-width: 100%; }
table.grid th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); border-bottom: 1px solid var(--line-strong); border-right: 1px solid var(--line);
  padding: 0; text-align: left; font-weight: 500; white-space: nowrap;
}
.th { display: flex; align-items: center; }
.th-sort { display: flex; align-items: center; gap: 6px; padding: 9px 10px 9px 12px; flex: 1; text-align: left; }
.th-sort span { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.th-sort small { color: var(--muted); font-size: 11px; }
.th-sort svg.i { width: 13px; height: 13px; color: var(--gold); }
.th-sort:hover span { color: var(--gold); }
.sort-ind { font-style: normal; font-size: 9px; color: var(--gold); }
.th-menu { width: 26px; height: 26px; margin-right: 4px; opacity: .5; }
.th:hover .th-menu, .th-menu:focus-visible { opacity: 1; }
table.grid th.th-act { width: 1%; border-right: 0; }
table.grid td {
  padding: 0 12px; height: 36px; max-width: 360px;
  border-bottom: 1px solid rgba(255,255,255,.04); border-right: 1px solid rgba(255,255,255,.03);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
}
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.null { color: #5c5a56; font-style: italic; }
table.grid td.bin { color: var(--text-2); }
table.grid td.long { cursor: pointer; }
table.grid td.long:hover { color: var(--gold); }
table.grid td.actions { width: 1%; padding: 0 4px; border-right: 0; }
table.grid td.actions .btn-icon { width: 28px; height: 28px; opacity: .45; }
table.grid tr:hover td { background: rgba(255,255,255,.025); }
table.grid tr:hover td.actions .btn-icon { opacity: 1; }

.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.pager .spacer { flex: 1; }
.pager-size { display: flex; align-items: center; gap: 8px; margin-right: 8px; color: var(--muted); }
.pager select { height: 30px; background: var(--ink); color: var(--text); border: 1px solid var(--line-strong); padding: 0 6px; }

.menu {
  position: fixed; z-index: 40; min-width: 220px;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  box-shadow: 0 14px 40px rgba(0,0,0,.55); padding: 6px;
}
.menu[hidden] { display: none; }
.menu-head { padding: 6px 10px 8px; font: 500 12.5px var(--mono); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head small { display: block; color: var(--muted); font-family: var(--body); font-size: 11.5px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; font-size: 13.5px; color: #ff9b9d; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: rgba(229,56,59,.12); }

.opts { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); cursor: pointer; }
.opt:hover { border-color: var(--line-strong); }
.opt:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.opt.disabled { opacity: .45; cursor: not-allowed; }
.opt input { margin-top: 3px; accent-color: var(--gold); }
.opt b { display: block; font-weight: 600; font-size: 13.5px; }
.opt small { color: var(--text-2); font-size: 12.5px; }
.opts .input { margin-top: 2px; }

.check-head { display: flex; align-items: baseline; gap: 12px; margin: 16px 0 8px; font-size: 13px; color: var(--text-2); }
.check-head span { flex: 1; }
.linkbtn { color: var(--gold); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; }
.checklist { max-height: 240px; overflow: auto; border: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; }
.checklist label { display: flex; align-items: center; gap: 9px; padding: 7px 12px; font: 12.5px var(--mono); cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.04); }
.checklist label:hover { background: rgba(255,255,255,.03); }
.checklist input { accent-color: var(--robber); }
.checklist span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checklist small { color: var(--muted); font-family: var(--body); font-size: 11px; }
.checklist label:has(input:not(:checked)) span { color: var(--muted); text-decoration: line-through; }
#dlg-extra .notice { margin: 14px 0 0; }

.cell-full { margin-top: 12px; max-height: 50vh; overflow: auto; padding: 12px; background: var(--ink); border: 1px solid var(--line); font: 12.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; color: var(--text); }

.bk-list { margin-top: 14px; max-height: 50vh; overflow: auto; border: 1px solid var(--line); }
.bk-list .empty { padding: 30px 20px; }
.bk-row { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 14px; border-bottom: 1px solid rgba(255,255,255,.04); }
.bk-row:last-child { border-bottom: 0; }
.bk-info { flex: 1; min-width: 0; }
.bk-info b { display: block; font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-info span { color: var(--muted); font-size: 12px; }

/* ---------- Dialog & Toasts ---------- */
dialog {
  margin: auto; width: min(440px, calc(100% - 32px));
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(0,0,0,.65); }
.dlg-body { padding: 24px 24px 8px; }
.dlg-body h3 { font: 600 20px/1.2 var(--display); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 10px; }
.dlg-body p { color: var(--text-2); }
.dlg-body code { font: 12.5px var(--mono); color: var(--text); background: var(--ink); padding: 2px 6px; word-break: break-all; }
.dlg-body .input { margin-top: 14px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 24px 22px; }
.dlg-actions .spacer { flex: 1; }
dialog.wide { width: min(680px, calc(100% - 32px)); }
.dlg-body p[hidden] { display: none; }
.dlg-confirm { display: block; margin-top: 18px; }
.dlg-confirm[hidden] { display: none; }
.dlg-confirm span { display: block; font-size: 13px; color: var(--text-2); }
.dlg-confirm .input { margin-top: 8px; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 260px; max-width: 380px;
  padding: 12px 16px; font-size: 13.5px;
  background: var(--surface-3); border: 1px solid var(--line-strong); border-left: 3px solid var(--green);
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: toast-in .2s ease-out;
}
.toast.err { border-left-color: var(--robber); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .status-card { grid-template-columns: 1fr 1fr; }
  .controls { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .controls .btn { width: auto; flex: 1; justify-content: center; }
  .meter { grid-column: span 12; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts div:nth-child(3) { border-left: 0; }
  .facts div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

@media (max-width: 820px) {
  :root { --pad: 16px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { border: 0; padding: 14px 16px; flex: 1; }
  .brand small { display: none; }
  .side-user { border: 0; padding: 10px 16px; }
  .side-user .who { display: none; }
  .nav { order: 3; width: 100%; flex-direction: row; padding: 0 8px; border-top: 1px solid var(--line); overflow-x: auto; }
  .nav button { border-left: 0; border-bottom: 2px solid transparent; height: 46px; white-space: nowrap; }
  .nav button[aria-current="page"] { border-bottom-color: var(--gold); }
  .topbar { flex-wrap: wrap; padding-top: 18px; }
  .topbar h1 { font-size: 22px; }
  .status-card { grid-template-columns: 1fr; gap: 22px; padding: 22px 20px; }
  .status-word { font-size: 48px; }
  .players { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .search { width: 100%; }
  table.files th.col-date, table.files td.col-date { display: none; }
  .term-card, .files-card { height: calc(100vh - 230px); }
  .db-grid { grid-template-columns: 1fr; height: auto; }
  .db-tables { max-height: 220px; }
  .db-data { height: 70vh; }
  .checklist { grid-template-columns: 1fr; }
  .pager-size { display: none; }
  .login-body { padding: 28px 24px 24px; }
  .login-foot { padding: 14px 24px; }
}

/* =====================================================================
   Scrollbalken
   ===================================================================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2f3b; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #4a4536; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-thumb:active { background: var(--gold); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-corner, ::-webkit-scrollbar-button { display: none; background: transparent; }
@supports (-moz-appearance: none) {
  * { scrollbar-width: thin; scrollbar-color: #2a2f3b transparent; }
}
.xterm .xterm-viewport::-webkit-scrollbar-thumb { background: #22262f; background-clip: padding-box; }

/* =====================================================================
   Spieler & Banliste
   ===================================================================== */
.nav .badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px;
  display: grid; place-items: center;
  font: 600 11.5px/1 var(--body); font-variant-numeric: tabular-nums;
  background: rgba(47, 191, 113, .14); color: #6fdc9f;
}
.nav .badge.red { background: rgba(229, 56, 59, .14); color: #ff8f91; }
.nav .badge[hidden] { display: none; }

.list-card { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 420px; }
.bridge { display: flex; align-items: center; gap: 24px; margin-bottom: 16px; border-left: 3px solid var(--amber); }
.bridge[hidden] { display: none; }
.bridge-text { flex: 1; }
.bridge-text b { display: block; font: 600 17px/1.2 var(--display); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.bridge-text p { color: var(--text-2); max-width: 75ch; }
.bridge + .list-card { height: calc(100vh - 340px); }

.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; margin-left: 6px; }
.toggle input { accent-color: var(--gold); }

table.plist td, table.blist td { height: 52px; }
.pid { color: var(--muted) !important; width: 1%; }
.pname { font-weight: 600; color: var(--text); }
.ident { font: 12px var(--mono); color: var(--text-2); }
.ping { font-variant-numeric: tabular-nums; }
.ping::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--green); }
.ping.mid::before { background: var(--amber); }
.ping.bad::before { background: var(--robber); }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 3px 8px; font-size: 11.5px; font-weight: 600; background: rgba(255,255,255,.06); color: var(--text-2); white-space: nowrap; }
.tag.warn { background: rgba(232, 137, 43, .14); color: #f0b070; cursor: help; }
.tag.ban { background: rgba(229, 56, 59, .14); color: #ff8f91; }
.muted { color: var(--muted); font-size: 12.5px; }
.act-row { display: flex; gap: 6px; justify-content: flex-end; }
.act-row .btn:disabled { opacity: .3; }

table.blist td.reason { white-space: normal; max-width: 380px; min-width: 200px; line-height: 1.4; color: var(--text); }
table.blist .sub { display: block; font: 11.5px var(--mono); color: var(--muted); margin-top: 2px; white-space: pre; }
table.blist td.until small { display: block; color: var(--muted); font-size: 11.5px; }
table.blist tr.expired td { opacity: .55; }

.form .field { margin-bottom: 14px; }
.form .field:last-child { margin-bottom: 0; }
#dlg-extra .form { margin-top: 16px; }
.input.area { height: auto; padding: 10px 14px; resize: vertical; font: 12.5px/1.5 var(--mono); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); font-size: 13px; font-weight: 500; color: var(--text-2); }
.chip:hover span { border-color: rgba(255,255,255,.25); color: var(--text); }
.chip input:checked + span { border-color: var(--robber); background: rgba(229, 56, 59, .14); color: #ffb3b4; }
.chip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (max-width: 1100px) {
  .col-hide { display: none; }
}
@media (max-width: 820px) {
  .bridge { flex-direction: column; align-items: stretch; }
  .act-row .btn { padding: 0 8px; }
  .act-row .btn svg + * { display: none; }
  .list-card, .bridge + .list-card { height: 70vh; }
}

/* =====================================================================
   Tickets (Bug-Reports & Support aus dem Spieler-Panel)
   ===================================================================== */
.nav .badge.gold { background: var(--gold-soft); color: var(--gold); }
.tk-grid { display: grid; grid-template-columns: 380px 1fr; gap: 16px; height: calc(100vh - 210px); min-height: 480px; }
.tk-grid[hidden] { display: none; }
.tk-side { padding: 0; display: flex; flex-direction: column; min-height: 0; }
.tk-filters { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.tk-tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.tk-tabs button { height: 28px; padding: 0 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); border: 1px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
.tk-tabs button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.tk-tabs button[aria-selected="true"] { color: var(--gold); border-color: rgba(201,162,74,.4); background: var(--gold-soft); }
.tk-tabs button span { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tk-tabs button span:empty { display: none; }
.tk-filter-row { display: flex; gap: 8px; }
.tk-filter-row .search { flex: 1; width: auto; min-width: 0; }
.tk-select {
  height: 32px; padding: 0 30px 0 10px; font-size: 13px; color: var(--text); cursor: pointer;
  border: 1px solid var(--line-strong); appearance: none; -webkit-appearance: none;
  background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B9B5AC' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px;
}
.tk-select:focus { outline: none; border-color: var(--gold); }
.tk-select option { background: var(--surface-2); }
.tk-list { flex: 1; overflow: auto; }
.tk-list .empty { padding: 40px 20px; }
.tk-item { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 11px 14px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.04); border-left: 2px solid transparent; }
.tk-item:hover { background: rgba(255,255,255,.03); }
.tk-item.current { background: var(--gold-soft); border-left-color: var(--gold); }
.tk-item-top { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); min-width: 0; }
.tk-item-top svg.i { width: 14px; height: 14px; }
.tk-item-top .no { font-family: var(--mono); }
.tk-item-top .cat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-item-top .spacer { flex: 1; }
.tk-item-top .when { white-space: nowrap; }
.tk-item .subj { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.tk-item.unread .subj { font-weight: 700; }
.tk-item.unread .subj::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-right: 7px; vertical-align: 1px; }
.tk-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.prio { font-size: 11.5px; font-weight: 600; }
.prio.high { color: #f0b070; }
.prio.critical { color: #ff8f91; }

.st { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: rgba(255,255,255,.06); color: var(--text-2); }
.st::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.open { background: rgba(232,137,43,.13); color: #f0b070; }
.st.in_progress { background: rgba(47,123,240,.14); color: #8db8ff; }
.st.answered { background: rgba(47,191,113,.13); color: #7fdcaa; }
.st.closed { color: var(--muted); }

.tk-main { padding: 0; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tk-top { display: flex; align-items: flex-start; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.tk-title { flex: 1; min-width: 0; }
.tk-kicker { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.tk-kicker svg.i { width: 15px; height: 15px; color: var(--gold); }
.tk-title h2 { font: 600 22px/1.2 var(--display); letter-spacing: .02em; color: var(--text); margin: 6px 0 0; overflow-wrap: anywhere; }
.tk-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tk-scroll { flex: 1; overflow: auto; min-height: 0; }
.tk-player { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.015); }
.tk-player .who { line-height: 1.3; }
.tk-player .who b { display: block; font-size: 13.5px; }
.tk-player .who span { font-size: 12px; color: var(--muted); }
.tk-player .spacer { flex: 1; }
.td-meta { display: flex; flex-wrap: wrap; margin: 16px 20px 0; border: 1px solid var(--line); overflow: hidden; }
.td-meta div { flex: 1 1 180px; padding: 9px 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.td-meta div.wide { flex-basis: 100%; }
.td-meta dt { color: var(--muted); font-size: 12px; }
.td-meta dd { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.thread { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; border: 1px solid var(--line); background: var(--surface-2); }
.msg.player { align-self: flex-start; }
.msg.mine { align-self: flex-end; border-color: rgba(47,123,240,.35); background: rgba(47,123,240,.07); }
.msg header { display: flex; align-items: baseline; gap: 10px; padding: 9px 13px 0; font-size: 12px; color: var(--muted); }
.msg header b { color: var(--text); font-weight: 600; font-size: 13px; }
.msg.mine header b { color: #8db8ff; }
.msg .body { padding: 5px 13px 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 13px 11px; }
.msg .atts button.thumb { width: 120px; height: 80px; border: 1px solid var(--line-strong); overflow: hidden; background: var(--ink); }
.msg .atts button.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg .atts button.thumb:hover { border-color: var(--gold); }
.msg .atts a.file { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); font-size: 12.5px; text-decoration: none; color: var(--text-2); }
.msg .atts a.file:hover { border-color: var(--gold); color: var(--text); }
.sysmsg { align-self: center; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 10px; text-align: center; }
.sysmsg::before, .sysmsg::after { content: ''; width: 32px; height: 1px; background: var(--line-strong); }
.tk-compose { border-top: 1px solid var(--line); padding: 12px 16px 14px; }
.tk-text { font-family: var(--body) !important; font-size: 13.5px !important; min-height: 70px; }
.tk-compose-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tk-compose-actions .spacer { flex: 1; }
.tk-compose-actions { justify-content: flex-end; }
.tk-compose-actions .muted { font-size: 12px; flex: 1 1 100%; }
.tk-compose-actions .spacer { display: none; }
.lightbox { width: auto; max-width: min(1200px, 94vw); padding: 0; background: #000; }
.lightbox img { display: block; max-width: 100%; max-height: 86vh; }
.lightbox form { position: absolute; top: 6px; right: 6px; }
.lb-close { background: rgba(0,0,0,.6); color: #fff; }

@media (max-width: 1100px) {
  .tk-grid { grid-template-columns: 300px 1fr; }
}
@media (max-width: 820px) {
  .sidebar, .nav, .tk-side, .tk-main { min-width: 0; }
  .tk-grid { grid-template-columns: minmax(0, 1fr); height: auto; }
  .tk-side { max-height: 340px; }
  .tk-main { height: 80vh; }
  .tk-top { flex-direction: column; }
  .msg { max-width: 94%; }
}
