:root {
  color-scheme: light dark;
  --bg: #0b0d12;
  --panel: #131722;
  --panel-2: #1a2030;
  --border: #232a3a;
  --text: #e6e9ef;
  --muted: #8a93a6;
  --accent: #4f8cff;
  --green: #2ecc71;
  --amber: #f5a623;
  --red: #ff5a6a;
  --grey: #6b7280;
  --radius: 14px;
}
@media (prefers-color-scheme: light) {
  :root { --bg:#f6f7fb; --panel:#fff; --panel-2:#f1f3f9; --border:#e3e6ef; --text:#161a23; --muted:#5b6478; }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.4;
}

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 16px; margin: 0; font-weight: 600; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stamp { color: var(--muted); font-size: 12px; }
button {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 11px; font-size: 14px; cursor: pointer; outline: none;
}
button:hover { border-color: var(--accent); }

main { max-width: 1100px; margin: 0 auto; padding: 16px 18px 8px; }
.status { color: var(--muted); padding: 4px 2px 8px; font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin: 14px 2px; }

.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin: 18px 2px 8px;
}

/* Kompaktes Icon-Raster */
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.tile {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 10px 12px; width: 100%;
  background: var(--panel); border: 1px solid var(--border);
  border-left: 4px solid var(--grey); border-radius: var(--radius);
  cursor: pointer; transition: transform .1s ease, border-color .1s ease;
}
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.tile.operational { border-left-color: var(--green); }
.tile.degraded    { border-left-color: var(--amber); }
.tile.outage      { border-left-color: var(--red); }
.tile.unknown     { border-left-color: var(--grey); }
.tile-icon { width: 28px; height: 28px; border-radius: 6px; flex: 0 0 28px; background: var(--panel-2); }
.tile-icon[hidden] { display: none; }
.tile-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tile-name { font-size: 14px; font-weight: 600; }
.tile-headline { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Status-Punkte / Pills */
.dot, .state-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--grey); flex: 0 0 11px; }
.dot.operational, .state-dot.operational { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 25%, transparent); }
.dot.degraded,    .state-dot.degraded    { background: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 25%, transparent); }
.dot.outage,      .state-dot.outage      { background: var(--red);   box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 25%, transparent); }
.dot.unknown,     .state-dot.unknown     { background: var(--grey); }

.pill { font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); }
.pill.operational { background: color-mix(in srgb, var(--green) 18%, var(--panel)); border-color: color-mix(in srgb, var(--green) 50%, var(--border)); }
.pill.degraded    { background: color-mix(in srgb, var(--amber) 18%, var(--panel)); border-color: color-mix(in srgb, var(--amber) 50%, var(--border)); }
.pill.outage      { background: color-mix(in srgb, var(--red) 18%, var(--panel));   border-color: color-mix(in srgb, var(--red) 50%, var(--border)); }
.pill.unknown     { background: var(--panel-2); }

footer { color: var(--muted); text-align: center; padding: 22px; font-size: 12px; max-width: 760px; margin: 0 auto; }

.error {
  background: color-mix(in srgb, var(--red) 14%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--red) 50%, var(--border));
  color: var(--text); padding: 12px 14px; border-radius: 10px;
}

/* Detail-Overlay */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; z-index: 1; width: min(560px, 100%); max-height: 86vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.modal-close { position: absolute; top: 12px; right: 12px; padding: 4px 9px; }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.m-icon { width: 40px; height: 40px; border-radius: 8px; background: var(--panel-2); }
.modal-head h2 { margin: 0 0 4px; font-size: 18px; }
.m-reason { font-size: 14.5px; margin: 6px 0; }
.m-method { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.m-srctitle { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 14px 0 6px; }
.m-sources { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.m-sources li {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  background: var(--panel-2); border-radius: 9px; padding: 9px 11px; font-size: 13.5px;
}
.m-sources a { color: var(--accent); text-decoration: none; }
.m-sources a:hover { text-decoration: underline; }
.src-val { color: var(--muted); font-size: 12.5px; text-align: right; flex-shrink: 0; }
.m-updated { color: var(--muted); font-size: 12px; margin-top: 14px; }
