/* ==========================================================================
   Gameserver-Statusseite · Design im Stil des Schichtkalenders
   Alle Farben stehen hier oben als Variablen. Zum Anpassen nur diese ändern.
   Die Akzentfarbe (--accent) kommt aus den Einstellungen im Admin-Bereich.
   ========================================================================== */
:root {
  --accent: #22c55e;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 10px;
  --radius-sm: 6px;

  /* Dunkel (Standard) */
  --bg: #161617;
  --bar: #1b1b1d;
  --card: #222224;
  --card-2: #2a2a2d;
  --line: #303033;
  --text: #ececec;
  --muted: #8d8d93;
  --accent-text: var(--accent);
  --ok: #22c55e;   --ok-bg: rgba(34, 197, 94, .12);
  --warn: #eab308; --warn-bg: rgba(234, 179, 8, .12);
  --bad: #ef4444;  --bad-bg: rgba(239, 68, 68, .12);
  --none: #3a3a3e;
  --fam-mc: #22c55e;
  --fam-sf: #e040fb;
  --fam-steam: #22d3ee;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* Hell: automatisch nach Geraet, ausser der Besucher/Admin hat "dunkel" gewaehlt */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f4f3; --bar: #ffffff; --card: #ffffff; --card-2: #f1f1f0; --line: #e3e3e1;
    --text: #18181b; --muted: #6b6b72;
    --accent-text: color-mix(in srgb, var(--accent) 72%, #000);
    --ok: #15803d; --ok-bg: rgba(22, 163, 74, .12);
    --warn: #a16207; --warn-bg: rgba(202, 138, 4, .14);
    --bad: #dc2626; --bad-bg: rgba(220, 38, 38, .1);
    --none: #dcdcda;
    --fam-mc: #16a34a; --fam-sf: #c026d3; --fam-steam: #0891b2;
    --shadow: 0 1px 3px rgba(0, 0, 0, .06);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f4f3; --bar: #ffffff; --card: #ffffff; --card-2: #f1f1f0; --line: #e3e3e1;
  --text: #18181b; --muted: #6b6b72;
  --accent-text: color-mix(in srgb, var(--accent) 72%, #000);
  --ok: #15803d; --ok-bg: rgba(22, 163, 74, .12);
  --warn: #a16207; --warn-bg: rgba(202, 138, 4, .14);
  --bad: #dc2626; --bad-bg: rgba(220, 38, 38, .1);
  --none: #dcdcda;
  --fam-mc: #16a34a; --fam-sf: #c026d3; --fam-steam: #0891b2;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
  color-scheme: light;
}

/* ---- Grundlagen ---------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); }
code { background: var(--card-2); border: 1px solid var(--line); padding: 0 5px; border-radius: 4px; font-size: .85em; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.accent { color: var(--accent-text); }
.inline { display: inline; margin: 0; }
.ic { flex: none; vertical-align: -3px; }
h1, h2, h3 { margin: 0; }

/* ---- Kopfzeile ----------------------------------------------------------- */
.topbar { display: flex; align-items: center; gap: 18px; padding: 8px 16px; background: var(--bar);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; }
.brand-icon { width: 22px; height: 22px; border-radius: 5px; background: var(--accent); color: #fff;
  display: grid; place-items: center; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { display: flex; align-items: center; gap: 6px; color: var(--muted); padding: 6px 10px;
  border-radius: var(--radius-sm); border: 1px solid transparent; white-space: nowrap; font-size: .85rem; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.who { color: var(--muted); font-size: .85rem; }
.icon-btn { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; padding: 0; }
.icon-btn:hover { color: var(--text); text-decoration: none; }
.show-light { display: none; }
:root[data-theme="light"] .show-light { display: inline; }
:root[data-theme="light"] .show-dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .show-light, :root[data-theme=""] .show-light { display: inline; }
  :root:not([data-theme]) .show-dark, :root[data-theme=""] .show-dark { display: none; }
}

main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 22px 16px 32px; flex: 1;
  display: flex; flex-direction: column; gap: 14px; }
.footer { text-align: center; color: var(--muted); font: .72rem var(--mono); padding: 28px 16px; }

/* ---- Begruessung --------------------------------------------------------- */
.hello { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.hello h1 { font-size: 1.45rem; font-weight: 800; }
.hello h1 .badge { vertical-align: 4px; margin-left: 6px; }
.eyebrow { margin: 0; font: .72rem var(--mono); letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.back { font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; }

/* ---- Karten -------------------------------------------------------------- */
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.servers { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.two-col { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h3 { font-size: .95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card h3 .ic { color: var(--muted); }
.card-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card.empty { color: var(--muted); }
.narrow { width: 100%; max-width: 620px; margin-left: auto; margin-right: auto; }

.stat .big { font-size: 1.9rem; font-weight: 800; color: var(--accent-text); line-height: 1.1; }
.stat .big small { font-size: .9rem; color: var(--muted); font-weight: 600; }

/* Server-Karte */
.server-card { position: relative; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-title { flex: 1; min-width: 0; }
.card-title h2 { font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.card-title h2 a { color: var(--text); }
.game-chip { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; flex: none;
  font-weight: 800; color: #0b0b0c; background: var(--fam-steam); }
.game-chip.fam-mc { background: var(--fam-mc); }
.game-chip.fam-sf { background: var(--fam-sf); }
.server-card.is-off .game-chip { filter: grayscale(1); opacity: .55; }
.motd { margin: 0; font-style: italic; color: var(--muted); white-space: pre-line; }
.server-card p { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpis div { display: flex; flex-direction: column; }
.kpis .num { font-size: 1.35rem; font-weight: 800; color: var(--accent-text); line-height: 1.2; }
.kpis .num small { font-size: .75rem; color: var(--muted); margin-left: 2px; }
.kpis span { font-size: .72rem; color: var(--muted); }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; font-size: .85rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font: .75rem var(--mono); background: var(--card-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 7px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }

/* ---- Badges (Monospace wie "erledigt"/"offen") --------------------------- */
.badge { font: .7rem var(--mono); padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line);
  color: var(--muted); background: var(--card-2); white-space: nowrap; font-weight: 500; }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

/* ---- Knoepfe ------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 11px; font: 600 .8rem var(--font);
  cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.mono-btn { font-family: var(--mono); font-weight: 500; }
.buttons { display: flex; gap: 8px; }

/* Umschalter 24h / 7d / 30d */
.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px; }
.seg button { background: none; border: 1px solid transparent; color: var(--muted); padding: 4px 10px;
  border-radius: 5px; font: .75rem var(--mono); cursor: pointer; }
.seg button.active { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---- Hinweise ------------------------------------------------------------ */
.flash { padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid; font-size: .85rem; margin: 0; }
.flash.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-bg); }
.flash.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-bg); }
.flash.error { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-bg); }

/* ---- Tabellen ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font: 500 .7rem var(--mono); text-transform: uppercase; letter-spacing: .06em; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; }
.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.status-list li { display: flex; align-items: center; gap: 8px; }

/* ---- Formulare ----------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: .8rem; }
.form input:not([type=checkbox]):not([type=file]):not([type=color]), .form select, .form textarea {
  width: 100%; padding: 8px 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); font: .9rem var(--font); }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); }
.form input[type=color].color { width: 60px; height: 36px; padding: 2px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg); }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; align-items: end; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; font-size: .85rem !important; }
.check input { accent-color: var(--accent); }
.hint { color: var(--muted); font-size: .75rem; margin: -4px 0 0; }
.logo-row { display: flex; align-items: center; gap: 14px; }
.logo-preview { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }

/* ---- Diagramm ------------------------------------------------------------ */
.chart { position: relative; min-height: 220px; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 10px var(--mono); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: none; }
.chart .dot-pt { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; top: 0; pointer-events: none; background: var(--card-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 9px; font-size: .75rem; box-shadow: 0 4px 14px rgba(0,0,0,.25); white-space: nowrap; }
.table-view summary { cursor: pointer; }
.table-view table { margin-top: 8px; }
.table-view > div { max-height: 260px; overflow: auto; }

/* Verfuegbarkeit pro Tag (wie die Wochenleiste im Schichtkalender) */
.days { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.day i { display: block; width: 100%; height: 30px; border-radius: 4px; background: var(--none); }
.day.ok i { background: var(--ok); }
.day.warn i { background: var(--warn); }
.day.bad i { background: var(--bad); }
.day small { font: 9px var(--mono); color: var(--muted); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--none); }
.sw.ok { background: var(--ok); } .sw.warn { background: var(--warn); } .sw.bad { background: var(--bad); }

/* Einbetten */
pre.code { margin: 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .75rem; white-space: pre-wrap; word-break: break-all; }
.code-list { grid-template-columns: 1fr; gap: 4px; }
.code-list dt { margin-top: 6px; }
body.embed { min-height: 0; padding: 4px; gap: 6px; display: flex; flex-direction: column; }
.embed-row { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text); }
.embed-row:hover { text-decoration: none; border-color: var(--accent); }
.embed-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.embed-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Handy --------------------------------------------------------------- */
@media (max-width: 720px) {
  .nav a span { display: none; }
  .nav a.active span { display: inline; }
  .who { display: none; }
  .two { grid-template-columns: 1fr; }
  .grid.servers { grid-template-columns: 1fr; }
  .grid.stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px; gap: 4px; }
  .stat h3 { font-size: .7rem; font-weight: 600; }
  .stat h3 .ic { display: none; }
  .stat .big { font-size: 1.3rem; }
  .days { grid-template-columns: repeat(15, 1fr); }
  .day i { height: 22px; }
  .topbar { gap: 10px; }
  .brand span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
}

/* Live-Bereich auf der Startseite: gleicher Abstand wie zwischen Karten */
#live { display: flex; flex-direction: column; gap: 14px; }
.card > img { align-self: flex-start; max-width: 100%; }
