/*
 * backend/app.css — nur das Eigene des Backends (Rest: core/css/kit.css, ui.css):
 * Anmeldekarte, Formularfelder in Listenzellen, Hinweise/Fehler, Status-Badges.
 */

/* ---------- Anmelden ---------- */

.be-auth {
  height: 100%;
  overflow-y: auto;
  display: flex;
  align-items: safe center;
  justify-content: center;
  padding: var(--sp-6) var(--gutter);
  background: var(--surface-0);
}

.be-auth-card {
  width: min(420px, 100%);
}

.be-auth-mark {
  display: flex;
  justify-content: center;
  margin-bottom: var(--sp-3);
}

.be-auth-mark svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: square;
}

.be-auth-title {
  margin: 0 0 var(--sp-2);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  text-align: center;
}

.be-auth-sub {
  margin: 0 0 var(--sp-6);
  font-size: var(--fs-sm);
  line-height: 1.5;
  text-align: center;
  color: var(--text-2);
}

/* ---------- Felder ---------- */

.be-field {
  cursor: text;
}

.be-field-label {
  flex: 0 0 38%;
  max-width: 180px;
  font-size: var(--fs-md);
}

.be-field-stack {
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-1);
}

.be-field-stack .be-field-label {
  flex: none;
  max-width: none;
  font-size: 12px;
  color: var(--text-2);
}

.be-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: var(--sp-1) 0;
  font: inherit;
  font-size: var(--fs-md);
  color: var(--bar-fg);
}

.be-input:focus {
  outline: none;
}

.be-input::placeholder {
  color: var(--text-3, rgba(235, 235, 245, 0.3));
}

.be-select {
  appearance: none;
  text-align: right;
  cursor: pointer;
  color: var(--text-2);
}

.be-select option {
  background: var(--surface-1);
  color: var(--bar-fg);
}

.be-textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.45;
}

.be-static {
  color: var(--text-2);
}

.be-actions {
  margin: 0 0 var(--sp-6);
}

.be-actions .btn {
  flex: 0 0 auto;
}

.be-spacer {
  flex: 1;
}

/* ---------- Hinweise ---------- */

.be-error,
.be-note {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 10px;
  background: var(--surface-1);
  font-size: var(--fs-sm);
  line-height: 1.5;
  white-space: pre-wrap;
}

.be-error {
  border: 1px solid var(--bar-danger);
  color: var(--bar-danger);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}

.be-note.is-ok {
  border: 1px solid var(--ok, #30d158);
}

.be-lead {
  margin: 0 0 var(--sp-6);
  font-size: var(--fs-lg);
}

.be-howto {
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-2);
}

/* ---------- Badges ---------- */

.be-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--surface-3);
  color: var(--bar-fg-dim);
}

.be-badge.is-active,
.be-badge.is-live {
  background: rgba(48, 209, 88, 0.18);
  color: #30d158;
}

.be-badge.is-invited,
.be-badge.is-test {
  background: rgba(255, 159, 10, 0.18);
  color: var(--warn);
}

.be-badge.is-disabled,
.be-badge.is-off {
  background: rgba(255, 69, 58, 0.18);
  color: var(--bar-danger);
}

/* ---------- Profil, Spiele ---------- */

.be-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
}

.be-avatar {
  flex: none;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #3a3a3c, #1c1c1e);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.be-profile-name {
  font-size: var(--fs-lg);
  font-weight: 600;
}

.be-game .app-tile {
  --icon-size: 40px;
  flex: none;
}

.be-game .be-select {
  flex: 0 0 auto;
  width: auto;
}

.be-game .btn {
  flex: none;
  padding: 6px var(--sp-3);
}

/* ---------- Spiele-Werkstatt (workshop.js, editor.js) ---------- */

.be-game {
  align-items: flex-start;
  padding-top: var(--sp-3);
  padding-bottom: var(--sp-3);
}

.be-game-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.be-game-side {
  flex: none;
}

.be-live {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-2);
}

.be-game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--sp-2);
}

.be-game-actions .btn {
  flex: none;
  padding: 5px 10px;
  font-size: 12px;
}

.be-path {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  cursor: copy;
}

.be-editor-title {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.be-editor {
  margin: 0 0 var(--sp-4);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--separator);
}

.be-editor .cm-editor {
  height: min(65vh, 720px);
  font-size: 13px;
}

.be-editor-path {
  padding: 6px var(--sp-3);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}

.kit-cell.is-muted {
  opacity: 0.5;
}

/* ---------- Tickets (tickets.js) ---------- */

.be-dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: var(--sp-4);
  align-items: start;
}

@media (max-width: 1100px) {
  .be-dash {
    grid-template-columns: 1fr;
  }
}

.be-notes {
  width: 100%;
  min-height: 220px;
  font-size: var(--fs-sm);
}

.be-notes-state {
  font-size: 12px;
}

.be-badges {
  display: inline-flex;
  gap: 4px;
  flex: none;
}

.be-badge.is-t-crash { background: rgba(255, 69, 58, 0.18); color: var(--bar-danger); }
.be-badge.is-t-problem { background: rgba(255, 159, 10, 0.18); color: var(--warn); }
.be-badge.is-t-bug { background: rgba(191, 90, 242, 0.2); color: #bf5af2; }
.be-badge.is-t-idea { background: rgba(10, 132, 255, 0.2); color: var(--accent); }
.be-badge.is-s-done { background: rgba(48, 209, 88, 0.18); color: #30d158; }

.be-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.be-mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  max-height: 360px;
  overflow: auto;
}

.be-shot {
  display: block;
  width: 100%;
  border-radius: 10px;
}

/* ---------- Rollen-Vorschau, geschuetzte Konten ---------- */

.app-backend .app-root,
.app-root.app-backend {
  display: flex;
  flex-direction: column;
}

.be-preview-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: 6px var(--gutter);
  background: #ff9f0a;
  color: #000;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.be-preview-exit {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.4);
  padding: 2px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.be-preview-cell .kit-cell-label {
  color: var(--accent);
}

.be-badge.is-protected {
  background: rgba(255, 214, 10, 0.16);
  color: #ffd60a;
}

.be-badge.is-t-task {
  background: rgba(100, 210, 255, 0.18);
  color: #64d2ff;
}

.app-root.app-backend .kit-split {
  flex: 1;
  min-height: 0;
  height: auto;
}

/* ---------- Statistik ---------- */

.be-chart {
  align-items: flex-end;
  gap: 3px;
  height: 120px;
  padding-top: var(--sp-3);
}

.be-bar {
  flex: 1;
  min-width: 4px;
  height: calc(var(--v) * 100%);
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}

/* Tickets: Offen · Archiv */
.be-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.16);
}

.be-tab {
  padding: 6px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.7;
  cursor: pointer;
}

.be-tab.is-active {
  background: var(--accent);
  color: #fff;
  opacity: 1;
}

.be-ticket-closed .kit-cell-label {
  text-decoration: line-through;
  opacity: 0.6;
}

.be-badge.is-s-rejected { background: rgba(142, 142, 147, 0.2); color: #8e8e93; }

/* ---------- Nachtschicht-Monitor (nightshift.js, nur Admins) ---------- */

.ns-lock {
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
}

.ns-lock svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  opacity: 0.7;
}

.ns-lock-title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 600;
}

.ns-lock-text {
  max-width: 420px;
  margin: 0 0 var(--sp-2);
  color: var(--bar-fg-dim);
}

.ns-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.ns-stamp,
.ns-count {
  color: var(--bar-fg-faint);
  font-size: var(--fs-sm);
  font-weight: 400;
}

/* zwei Spalten, auf schmalen Bildschirmen untereinander */
.ns-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}

@media (max-width: 900px) {
  .ns-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ns-stale .kit-cell-value {
  color: var(--bar-danger);
}

.ns-done {
  opacity: 0.6;
}

.ns-history {
  margin: 0;
  padding: var(--sp-2) var(--sp-4) var(--sp-2) calc(var(--sp-4) + 4px);
  max-height: 420px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  list-style: none;
}

.ns-history li {
  padding: 3px 0;
  border-bottom: 0.5px solid var(--separator);
}

.ns-history li.is-warn {
  color: var(--warn);
}

/* Grafikpool: scrollbare Flaeche mit Vorschaubildern auf Karo (Transparenz sichtbar) */
.ns-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--radius-lg);
  background: repeating-conic-gradient(#2a2a2e 0% 25%, #222226 0% 50%) 0 0 / 16px 16px;
}

.ns-tile {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.ns-tile img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
