:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #dde3ec;
  --text: #1c2430;
  --muted: #64748b;
  --accent: #0f5ea8;
  --accent-dark: #0a4780;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1 { font-size: 19px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
code { font-family: Consolas, "SF Mono", monospace; font-size: 0.92em; background: #eef2f7; padding: 1px 4px; border-radius: 4px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: var(--radius); background: var(--accent);
  color: #fff; font-weight: 700; display: grid; place-items: center; letter-spacing: -.5px;
}
.sub { margin: 0; color: var(--muted); font-size: 13px; }
.session { display: flex; align-items: center; gap: 10px; }

.pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-on { background: var(--ok-bg); color: var(--ok); }
.pill-off { background: var(--bad-bg); color: var(--bad); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }

main, .login { max-width: 1240px; margin: 20px auto; padding: 0 24px; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.login.panel { max-width: 560px; margin-top: 60px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: 8px 16px; border-radius: var(--radius); cursor: pointer; font: inherit; font-weight: 600;
}
.tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius); cursor: pointer; font: inherit; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: progress; }

input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15,94,168,.35); outline-offset: 1px; border-color: var(--accent); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; color: var(--text); }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > input { flex: 1 1 220px; width: auto; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid .span2 { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.filters label { flex: 1 1 180px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
td.mono, .mono { font-family: Consolas, "SF Mono", monospace; }
td.nowrap { white-space: nowrap; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 14px; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; font-family: Consolas, "SF Mono", monospace; }

.code {
  background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: var(--radius);
  overflow-x: auto; font-family: Consolas, "SF Mono", monospace; font-size: 12.5px; max-height: 340px;
}

.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.hint.error-text { color: var(--bad); }
.error { color: var(--bad); background: var(--bad-bg); padding: 9px 12px; border-radius: var(--radius); margin: 12px 0 0; font-size: 14px; }

/* Aktionsspalte bleibt beim horizontalen Scrollen einer breiten Tabelle sichtbar (ein einzelner
   Dropdown-Button statt vieler Einzel-Buttons je Zeile - siehe actionsDropdown() in app.js). */
td.actions-cell { position: sticky; right: 0; background: var(--surface); }
tbody tr:hover td.actions-cell { background: #f8fafc; }

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: 100%; margin-top: 4px; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 180px; padding: 4px;
}
.dropdown-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none;
  border-radius: 6px; cursor: pointer; font: inherit; color: var(--text); white-space: nowrap;
}
.dropdown-menu button:hover { background: var(--bg); }
.dropdown-menu button.danger { color: var(--bad); }

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

/* Author-Stylesheet-Regeln wie "label { display: block }" gewinnen sonst gegen die UA-Standardregel für
   [hidden] (Origin schlägt Spezifität) - betrifft insbesondere die dynamisch ein-/ausgeblendeten Felder
   im Ausstellungsformular (Laufzeitmodell-/Geräte-Bindungs-abhängige Felder, siehe app.js). */
[hidden] { display: none !important; }
