/* ============================================================
   CARDES Admin – Stylesheet
   Look von cardes.xyz: tiefes Schwarz, Orange als Akzent, Inter
   ============================================================ */
:root {
  --bg: #0c0c0c;
  --bg-2: #101010;
  --panel: #141414;
  --panel-2: #1a1a1a;
  --line: #222222;
  --line-2: #2e2e2e;
  --text: #f5f5f4;
  --text-2: #a3a3a3;
  --muted: #6b6b6b;
  --accent: #ff7a1a;
  --accent-2: #ff8f3d;
  --accent-soft: rgba(255, 122, 26, .12);
  --ok: #46a758;
  --ok-soft: rgba(70, 167, 88, .14);
  --warn: #f5b83d;
  --warn-soft: rgba(245, 184, 61, .12);
  --bad: #e5484d;
  --bad-soft: rgba(229, 72, 77, .13);
  --info: #3e9bff;
  --info-soft: rgba(62, 155, 255, .12);
  --radius: 16px;
  --radius-sm: 10px;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sidebar: 256px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1000px 560px at 100% -10%, rgba(255,122,26,.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--text-2); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0;
  z-index: 40;
  transition: transform .2s ease;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  color: var(--text);
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #e85d04);
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 20px rgba(255,122,26,.3);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { letter-spacing: .08em; font-size: 15px; }
.brand-text small { color: var(--muted); font-size: 11.5px; }
/* Logo wie auf cardes.xyz */
.brand-logo { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-logo img { height: 28px; width: auto; display: block; }
.brand-logo small {
  align-self: flex-start; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px;
}
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-group {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); padding: 16px 10px 6px; font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 10px; position: relative;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--panel); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-link.active .ico { color: var(--accent); }
.nav-link.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-link .pill {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600;
  background: var(--bad); color: #fff; border-radius: 999px; padding: 0 7px; line-height: 18px;
}
.sidebar-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-top: 1px solid var(--line);
}
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me > span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.me strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--muted); font-size: 11.5px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line-2);
  display: grid; place-items: center; font-weight: 600; color: var(--accent);
}

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; min-height: 68px;
  background: rgba(12,12,12,.8); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.topbar .site-link { display: inline-flex; align-items: center; gap: 6px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .menu-btn { display: none; }
.content { padding: 24px 28px 48px; }
.backdrop { display: none; }

/* ---------- Buttons ---------- */
.btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 13px var(--sans); cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 15px;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
  white-space: nowrap;
}
.btn:hover, .icon-btn:hover { border-color: rgba(255,122,26,.45); color: var(--text); }
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; transform: translateY(-1px); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.icon-btn { padding: 7px; background: transparent; border-color: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--panel-2); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

/* ---------- Cards / Grid ---------- */
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 28px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head .sub { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 8px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
}
.tile::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line-2);
}
.tile.accent::before { background: var(--accent); }
.tile.ok::before { background: var(--ok); }
.tile.warn::before { background: var(--warn); }
.tile.bad::before { background: var(--bad); }
.tile.info::before { background: var(--info); }
.tile:hover { border-color: var(--line-2); }
.tile-label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.tile-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: 12px; }

.chart-wrap { position: relative; width: 100%; }

/* Linke Spalte so hoch wie die rechte, Inhalt scrollt in der Karte (z. B. Sicherheits-Log) */
.fit-side { display: flex; flex-direction: column; contain: size; min-height: 460px; }
.fit-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fit-scroll { flex: 1; min-height: 0; overflow-y: auto; }
table.sticky-head thead th { position: sticky; top: 0; z-index: 1; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; background: var(--bg-2); white-space: nowrap;
}
th a { color: var(--muted); }
th a:hover, th a.sorted { color: var(--text); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
td.actions { text-align: right; white-space: nowrap; width: 1%; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; max-width: 420px; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line-2);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.live { box-shadow: 0 0 0 0 currentColor; animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(70,167,88,.6); } 70% { box-shadow: 0 0 0 7px rgba(70,167,88,0); } 100% { box-shadow: 0 0 0 0 rgba(70,167,88,0); } }

/* ---------- Formulare ---------- */
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; font: 14px var(--sans); color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 9px 12px; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
textarea.code { font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.7); }
input[type=file] {
  width: 100%; font: 13px var(--sans); color: var(--text-2); cursor: pointer;
  background: var(--bg-2); border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 10px;
}
input[type=file]:hover { border-color: var(--muted); }
.upload-progress { margin: -6px 0 16px; display: flex; flex-direction: column; gap: 6px; }
.upload-progress .bar > i { width: 0; transition: width .2s; }
.upload-progress.bad .bar > i { background: var(--bad); }
.upload-progress.bad span { color: var(--bad); }
.badge .ico { width: 12px; height: 12px; }
input[type=file]::file-selector-button {
  font: 600 12.5px var(--sans); color: #fff; background: var(--accent); border: 0;
  border-radius: 6px; padding: 6px 12px; margin-right: 12px; cursor: pointer;
}
.field { margin-bottom: 16px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }

.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; margin: 0; color: var(--text); font-size: 14px; }
.toggle input { display: none; }
.toggle .sw {
  width: 40px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; flex: none;
  transition: background .15s;
}
.toggle .sw::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.toggle input:checked + .sw { background: var(--accent); }
.toggle input:checked + .sw::after { transform: translateX(18px); }
.toggle small { display: block; color: var(--muted); font-size: 12px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.toolbar .search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; }
.toolbar .search input { padding-left: 34px; }
.toolbar select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }

/* ---------- Tabs / Segmented ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
  padding: 9px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--accent); border-color: var(--accent); }

/* ---------- Alerts ---------- */
.alert {
  padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  border: 1px solid; font-weight: 500;
}
.alert.ok { background: var(--ok-soft); border-color: rgba(70,167,88,.35); color: var(--ok); }
.alert.bad { background: var(--bad-soft); border-color: rgba(229,72,77,.35); color: #ff8080; }
.alert.warn { background: var(--warn-soft); border-color: rgba(245,184,61,.35); color: var(--warn); }
.alert.info { background: var(--info-soft); border-color: rgba(62,155,255,.35); color: var(--info); }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 4px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager a, .pager span:not(.muted) {
  min-width: 30px; height: 30px; display: grid; place-items: center; padding: 0 8px;
  border-radius: 7px; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.pager a:hover { background: var(--panel-2); color: var(--text); }
.pager .cur { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pager .dis { opacity: .35; }
.pager .muted { margin-left: auto; }

/* ---------- Listen / Timeline ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { color: var(--muted); font-size: 12px; }

.release { border-left: 2px solid var(--line-2); padding: 0 0 22px 22px; position: relative; }
.release:last-child { padding-bottom: 0; }
.release::before {
  content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line-2);
}
.release.current::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.release-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.release-head .ver { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.release-body { color: var(--text-2); white-space: pre-wrap; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; }

.chat-log { max-height: 560px; overflow-y: auto; padding: 8px 0; }
.msg { display: flex; gap: 12px; padding: 8px 18px; }
.msg:hover { background: rgba(255,255,255,.015); }
.msg .avatar { width: 30px; height: 30px; font-size: 12px; }
.msg .body { flex: 1; min-width: 0; }
.msg .who { font-weight: 600; font-size: 13px; }
.msg .who time { color: var(--muted); font-weight: 400; font-size: 11.5px; margin-left: 6px; }
.msg .txt { color: var(--text-2); word-wrap: break-word; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- Modal ---------- */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
dialog .card-body { max-height: 70vh; overflow-y: auto; }

/* ---------- Login ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(255,122,26,.10), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { justify-content: center; padding: 0 0 24px; }
.auth-card .card-body { padding: 26px; }
.auth-card .btn { width: 100%; padding: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-21 { grid-template-columns: 1fr; }
  .fit-side { contain: none; min-height: 0; }
  .fit-scroll { max-height: 70vh; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px 40px; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar-right .small { display: none; }
}
@media (max-width: 520px) {
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar select { flex: 1; min-width: 0; }
  .g-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile-value { font-size: 22px; }
  th, td { padding: 9px 12px; }
}

/* ---------- Begrüßung ---------- */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 24px 28px; margin-bottom: 16px; border-radius: var(--radius);
  border: 1px solid rgba(255,122,26,.28);
  background: linear-gradient(160deg, rgba(255,122,26,.16), var(--panel) 62%);
}
.hero h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.hero p { margin: 4px 0 0; color: var(--text-2); }
.hero .notice { white-space: normal; max-width: 460px; font-size: 12.5px; line-height: 1.45; padding: 6px 12px; border-radius: 12px; }

/* ---------- Login (Split-Layout mit GTA-Bild wie cardes.xyz) ---------- */
[hidden] { display: none !important; }
.login-split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(400px, 1fr); min-height: 100vh; }
.login-visual { position: relative; overflow: hidden; background: #e9dcae; isolation: isolate; }
.login-visual svg, .login-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; display: block; }
.login-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(12,12,12,.35) 0%, transparent 30%, transparent 50%, rgba(12,12,12,.92) 100%),
    linear-gradient(90deg, transparent 70%, rgba(12,12,12,.6) 100%);
}
.login-copy { position: absolute; left: 56px; right: 56px; bottom: 52px; color: #fff; }
.login-kicker {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: #fff; background: var(--accent); padding: 4px 12px; border-radius: 99px; margin-bottom: 14px;
}
.login-copy h1 {
  font-size: clamp(44px, 6vw, 84px); font-weight: 900; letter-spacing: -.04em; line-height: 1;
  text-shadow: 0 6px 30px rgba(0,0,0,.5);
}
.login-copy h1 span { color: var(--accent); }
.login-side {
  display: grid; place-items: center; padding: 40px 32px;
  background: radial-gradient(600px 420px at 100% 0%, rgba(255,122,26,.10), transparent 60%), var(--bg);
  border-left: 1px solid var(--line);
}
.login-box { width: 100%; max-width: 380px; }
.login-box .brand { padding: 0 0 40px; }
.login-box h2 { font-size: 30px; font-weight: 900; letter-spacing: -.03em; margin-bottom: 8px; }
.login-box > p.muted { margin: 0 0 28px; font-size: 15px; color: var(--text-2); }
.login-box input { padding: 12px 14px; border-radius: 12px; }
.login-btn { width: 100%; padding: 12px; font-size: 14.5px; margin-top: 6px; border-radius: 12px; }
.login-foot { margin: 32px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; grid-template-rows: 280px auto; }
  .login-copy { left: 22px; right: 22px; bottom: 22px; }
  .login-copy h1 { font-size: 46px; }
  .login-side { border-left: 0; border-top: 1px solid var(--line); padding: 32px 20px 40px; place-items: start center; }
  .login-box .brand { display: none; }
}