/* Datenbank-Backup – Farbwelt und Schriftrollen nach time.schmeer / Studio CMS */

:root {
  /* Akzent aus dem Studio CMS */
  --accent: #f2c230;
  --accent-ink: #1a1508;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.18);
}

[data-theme="dark"] {
  --bg: #0b0f14;
  --surface: #121a24;
  --surface-2: #17222e;
  --line: #223040;
  --text: #e6edf5;
  --muted: #8ba0b5;
  --accent: #f2c230;
  --accent-ink: #1a1508;
  --ok: #4bbf87;
  --bad: #e0645c;
}

[data-theme="light"] {
  --bg: #f2efe9;
  --surface: #fffdfa;
  --surface-2: #f7f3ec;
  --line: #e0d9cd;
  --text: #1d2229;
  --muted: #6b6559;
  --accent: #d8a413;
  --accent-ink: #1a1508;
  --ok: #1f7a4a;
  --bad: #a83a32;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: block;
  background: var(--bg);
  color: var(--text);
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: Syne, sans-serif; font-weight: 700; letter-spacing: -.01em; margin: 0 0 .3em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
code, .mono, .num, .slug { font-family: "IBM Plex Mono", monospace; font-size: .86em; }
.muted { color: var(--muted); margin: 0; }
.hint { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: .72rem; display: block; margin-top: 4px; }

/* ------------------------------------------------------------ Topbar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 22px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: Syne, sans-serif; font-weight: 700; }
.mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  font-family: "IBM Plex Mono", monospace; font-size: .78rem; font-weight: 500;
}
.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.tab {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font: 500 .9rem/1 "Public Sans", sans-serif;
  padding: 9px 13px; border-radius: var(--radius-sm); white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted); cursor: pointer;
  text-decoration: none; font-size: .95rem;
}
.icon-btn:hover { color: var(--text); }

main { max-width: 1180px; margin: 0 auto; padding: 26px 22px 80px; }

/* ------------------------------------------------------------ Panels */

.panel { display: none; }
.panel.is-active { display: block; animation: rise .18s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

.panel-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-title { margin: 30px 0 10px; }

/* ------------------------------------------------------------- Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card.wide { max-width: 780px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.db-card header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.db-card .slug { color: var(--muted); }
.db-card.is-off { opacity: .55; }
.db-card .meta { display: grid; gap: 4px; margin: 12px 0 14px; }
.db-card .meta > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 3px; }
.db-card dt { color: var(--muted); font-size: .82rem; }
.db-card dd { margin: 0; font-family: "IBM Plex Mono", monospace; font-size: .8rem; }
.card footer { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 28px; text-align: center; color: var(--muted);
}

/* -------------------------------------------------------- Formulare */

label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 10px; }
input, select {
  width: 100%; margin-top: 5px;
  padding: 9px 10px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: 400 .9rem/1.3 "Public Sans", sans-serif;
}
input.mono { font-family: "IBM Plex Mono", monospace; font-size: .84rem; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; }
.row > label.w-port { flex: 0 0 92px; }
.row > label.w-sel { flex: 0 0 170px; }
.cron-row > label { flex: 1 1 90px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--muted); }
.switch input { display: none; }
.switch span {
  width: 36px; height: 20px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  position: relative; transition: background .15s;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--accent-ink); }

/* ------------------------------------------------------------ Knöpfe */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font: 500 .87rem/1 "Public Sans", sans-serif;
  transition: transform .08s, border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 6px 10px; font-size: .8rem; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ------------------------------------------------------------ Tabelle */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 14px;
  background: var(--surface-2); color: var(--muted);
  font: 500 .74rem/1 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--line);
}
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num { font-family: Syne, sans-serif; font-weight: 600; font-size: .85rem; white-space: nowrap; }
td.right { text-align: right; white-space: nowrap; }
td.details { color: var(--muted); font-size: .82rem; max-width: 420px; }

.badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--muted);
  font: 500 .68rem/1.5 "IBM Plex Mono", monospace; text-transform: uppercase;
}
.badge.total { border-color: var(--accent); color: var(--accent); }
.badge.ok { border-color: var(--ok); color: var(--ok); }
.badge.bad { border-color: var(--bad); color: var(--bad); }

.url-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.url-row code {
  flex: 1 1 340px; padding: 9px 10px; word-break: break-all;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.output { white-space: pre-wrap; font-family: "IBM Plex Mono", monospace; font-size: .8rem; margin-top: 16px; }

.notice { padding: 10px 12px; border-radius: var(--radius-sm); font-size: .85rem; margin: 10px 0; }
.notice.error { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }

/* ------------------------------------------------------------- Toast */

#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: grid; gap: 8px; max-width: min(440px, 92vw); }
.toast {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 11px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  font-size: .86rem; animation: rise .18s ease;
}
.toast.bad { border-left-color: var(--bad); }
.toast ul { margin: 6px 0 0; padding-left: 16px; color: var(--muted); }

/* -------------------------------------------------------------- Gate */

body.gate { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.gate-card { width: min(380px, 100%); text-align: left; }
.gate-card .mark { margin-bottom: 14px; }
.gate-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.gate-card p { margin-bottom: 16px; font-size: .88rem; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; }
  .tabs { order: 3; width: 100%; }
  main { padding: 18px 14px 60px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.readonly-note { margin-bottom: 18px; }
.readonly-note p { font-size: .86rem; margin: 0 0 10px; }
.snippet { margin: 4px 0 10px; user-select: all; }

textarea {
  width: 100%; margin-top: 5px; padding: 9px 10px; resize: vertical;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: 400 .82rem/1.4 "IBM Plex Mono", monospace;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.keybox { margin: 6px 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.keybox summary { cursor: pointer; color: var(--muted); font-size: .84rem; }
.keybox[open] summary { margin-bottom: 10px; }
[hidden] { display: none !important; }

.fest { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 12px 14px; margin-bottom: 16px; }
.fest h3 { margin-bottom: 8px; }
.fest .meta { display: grid; gap: 4px; margin: 0; }
.fest .meta > div { display: flex; justify-content: space-between; gap: 12px; }
.fest dt { color: var(--muted); font-size: .82rem; }
.fest dd { margin: 0; font-family: "IBM Plex Mono", monospace; font-size: .8rem; }

.wer { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: .76rem; padding-right: 6px; }

table.hist td { vertical-align: top; }
table.hist .datei { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; max-width: 320px; }
table.hist .datei + .datei { margin-top: 3px; }
table.hist .weg { color: var(--muted); text-decoration: line-through; }
table.hist a { color: var(--text); }
table.hist a:hover { color: var(--accent); }
table.hist .ziele div { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: .84rem; }
table.hist .ziele div + div { margin-top: 4px; }
tr.ist-fehler td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.gut { background: var(--ok); }
.dot.schlecht { background: var(--bad); }

.fund { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.fund:last-of-type { border-bottom: 0; }
.fund > input[type=checkbox] { display: block; width: auto; margin-top: 10px; accent-color: var(--accent); }
.fund-rechts { flex: 1; display: grid; gap: 4px; }
.fund-feld { margin: 0; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-family: "IBM Plex Mono", monospace; }
.fund-name { max-width: 320px; font-weight: 500; }
.fund .quelle { font-size: .76rem; }
.fund-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .84rem; }
.fund.ist-drin, .fund.ohne-pw { opacity: .6; }
#discoverList { margin: 12px 0; }

.js-fehler {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: var(--bad); color: #fff;
  padding: 12px 18px;
  font: 500 .86rem/1.4 "Public Sans", sans-serif;
}
