/* ============================================================
   TOKENS
   Grundidee: ein altes Terminal, an dem man sich in ein Netzwerk
   aus verschiedenen Datenbanken einloggt. Bernstein-Phosphor statt
   des üblichen Neongrüns, das passt besser zu den RP-Themen
   (Schiff, Foundation, After The Fall).
   ============================================================ */
:root {
  --bg: #0b0d0a;
  --bg-raised: #12150f;
  --surface: #161a13;
  --border: #2a2f22;
  --border-strong: #454e37;

  --text: #e8e4d5;
  --text-muted: #8d9078;
  --text-dim: #5e6350;

  --amber: #ffb000;
  --amber-dim: #b37e00;
  --amber-soft: rgba(255, 176, 0, 0.12);

  --ok: #5ee88a;
  --ok-soft: rgba(94, 232, 138, 0.14);
  --err: #ff5f56;
  --err-soft: rgba(255, 95, 86, 0.14);

  --font-mono: "JetBrains Mono", "IBM Plex Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 3px;
  --shadow-panel: 0 0 0 1px var(--border), 0 8px 30px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, rgba(255, 176, 0, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--amber);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

::selection {
  background: var(--amber);
  color: #0b0d0a;
}

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

/* Sehr feiner Scanline-Effekt. Rein dekorativ, respektiert
   prefers-reduced-motion und ist bewusst kaum wahrnehmbar. */
.crt-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015),
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* ============================================================
   LAYOUT PRIMITIVES
   ============================================================ */
.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.brand .prompt {
  color: var(--amber);
}

.brand small {
  color: var(--text-dim);
  font-weight: 400;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.topbar nav a {
  color: var(--text-muted);
}
.topbar nav a:hover {
  color: var(--amber);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-muted);
}

.role-tag {
  color: var(--amber);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin: 0 0 6px;
}

h1 {
  font-size: 22px;
  margin: 0 0 4px;
}

h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

.subline {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 13px;
}

/* ============================================================
   PANEL / TERMINAL WINDOW CHROME
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
}

.panel-head .dots {
  display: inline-flex;
  gap: 5px;
  margin-right: 4px;
}
.panel-head .dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}

.panel-body {
  padding: 18px;
}

/* ============================================================
   SITE CARDS (DASHBOARD)
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.card-sub {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 2px;
}

.card p.desc {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
  flex-grow: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.badge.amber {
  border-color: var(--amber-dim);
  color: var(--amber);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status.online .status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  animation: pulse 2.4s ease-in-out infinite;
}

.status.offline .status-dot {
  background: var(--err);
  box-shadow: 0 0 0 3px var(--err-soft);
}

.status.unknown .status-dot {
  background: var(--text-dim);
}

.status.online {
  color: var(--ok);
}
.status.offline {
  color: var(--err);
}
.status.unknown {
  color: var(--text-dim);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .status.online .status-dot {
    animation: none;
  }
  .card {
    transition: none;
  }
}

.card-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
  margin-top: 6px;
}

.card-open::after {
  content: "→";
  transition: transform 0.15s ease;
}
.card:hover .card-open::after {
  transform: translateX(3px);
}

.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 18px;
}

/* ============================================================
   FORMS / BUTTONS
   ============================================================ */
label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 9px 10px;
  border-radius: var(--radius);
}

input:focus,
select:focus {
  border-color: var(--amber);
}

.field {
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--amber-soft);
  border: 1px solid var(--amber-dim);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover {
  background: rgba(255, 176, 0, 0.22);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-muted);
}
.btn.ghost:hover {
  border-color: var(--amber-dim);
  color: var(--amber);
  background: transparent;
}

.btn.danger {
  background: var(--err-soft);
  border-color: var(--err);
  color: var(--err);
}
.btn.danger:hover {
  background: rgba(255, 95, 86, 0.22);
}

.btn.block {
  width: 100%;
}

.btn.small {
  padding: 5px 10px;
  font-size: 12px;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 380px;
}

.login-box .panel-body {
  padding: 24px 20px;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--amber);
  margin-left: 4px;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.form-error {
  background: var(--err-soft);
  border: 1px solid var(--err);
  color: var(--err);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.form-success {
  background: var(--ok-soft);
  border: 1px solid var(--ok);
  color: var(--ok);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius);
  margin-bottom: 14px;
}

/* ============================================================
   ADMIN TABLE
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  font-weight: 600;
}

td select {
  padding: 5px 6px;
  font-size: 12px;
  width: auto;
}

.section {
  margin-bottom: 32px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.hint {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 4px;
}

footer.foot {
  margin-top: 40px;
  color: var(--text-dim);
  font-size: 12px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
