:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e3e6ea;
  --text: #1c2430;
  --muted: #6b7684;
  --accent: #2f6feb;
  --ok: #23a06b;
  --warn: #e0a23a;
  --crit: #db4a4a;
  --track: #eceef1;
  --shadow: 0 1px 3px rgba(20, 30, 45, .07), 0 1px 2px rgba(20, 30, 45, .04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a;
    --card: #1b1f27;
    --border: #2a303b;
    --text: #e6eaf0;
    --muted: #8b94a3;
    --accent: #5b8def;
    --ok: #37b784;
    --warn: #e6b45a;
    --crit: #ef6a6a;
    --track: #262c36;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
[hidden] { display: none !important; }

/* ── topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar-left { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; letter-spacing: .3px; color: inherit; text-decoration: none; }
.brand-icon { display: block; width: 24px; height: 24px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: .9rem; padding: 4px 10px; border-radius: 6px; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); background: var(--track); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.user { font-size: .9rem; }
.logout-form { margin: 0; }
.logout { background: none; border: 0; padding: 0; font: inherit; font-size: .9rem; color: var(--muted); cursor: pointer; }
.logout:hover { color: var(--text); }

main { max-width: 1548px; margin: 0 auto; padding: 24px; }
.section-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 8px 0 14px; }
.muted { color: var(--muted); font-size: .85rem; }

/* ── pruhy: doručení, problémy ──────────────────────────────────────────── */
.banner { background: color-mix(in srgb, var(--crit) 14%, var(--card)); border: 1px solid var(--crit);
  color: var(--crit); border-radius: 8px; padding: 9px 14px; margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
.all-ok { background: color-mix(in srgb, var(--ok) 14%, var(--card)); border: 1px solid var(--ok);
  color: var(--ok); border-radius: 8px; padding: 10px 14px; font-weight: 600; }
.inc { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--crit);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 6px; display: flex; gap: 12px;
  justify-content: space-between; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow); }
.inc.warn { border-left-color: var(--warn); }
.inc-text { min-width: 0; overflow-wrap: anywhere; }
.inc-meta { color: var(--muted); font-size: .85rem; }
.inc-actions { display: flex; gap: 6px; align-items: flex-start; }
.inc-actions form { margin: 0; }
.btn, .inc-actions summary {
  font: inherit; font-size: .8rem; border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 6px; padding: 3px 10px; cursor: pointer; list-style: none; }
.btn:hover, .inc-actions summary:hover { border-color: var(--muted); }
.inc-actions summary::-webkit-details-marker { display: none; }
.mute { position: relative; }
.mute[open] summary { border-color: var(--accent); }
.mute-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 4; display: flex; gap: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px; box-shadow: 0 4px 14px rgba(20, 30, 45, .18); }

/* ── grid + karty ───────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 28px; }
.group-title { grid-column: 1 / -1; margin: 8px 0 -2px; font-size: .9rem; font-weight: 650; }
.card { display: block; color: inherit; text-decoration: none; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; box-shadow: var(--shadow); }
a.card:hover { border-color: var(--muted); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head > div { min-width: 0; }
.card-title { font-weight: 650; font-size: 1rem; overflow-wrap: anywhere; }
.card-sub { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; flex: none;
  font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--track); color: var(--muted); }
.badge.up, .badge.online { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.down { background: color-mix(in srgb, var(--crit) 16%, transparent); color: var(--crit); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.spark { display: block; width: 100%; height: 34px; margin-top: 4px; }
.spark-label { font-size: .72rem; color: var(--muted); margin-top: 8px; }
.hb { display: flex; gap: 2px; margin-top: 8px; }
.hb i { flex: 1; height: 8px; border-radius: 2px; background: var(--track); }
.hb i.ok { background: var(--ok); }
.hb i.warn { background: var(--warn); }
.hb i.error { background: var(--crit); }
.card-foot { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: 6px; }
.card-foot .ssl-warn { color: var(--warn); }

/* ── karty serverů ──────────────────────────────────────────────────────── */
.srv { position: relative; }
.srv:hover { border-color: var(--muted); }
.srv.offline > :not(.card-head):not(.srv-actions), .srv.waiting { opacity: .6; }
.card-link { color: inherit; text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.mr { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; margin-top: 6px; }
.mr .v { color: var(--muted); text-align: right; }
.bar { height: 5px; background: var(--track); border-radius: 3px; overflow: hidden; margin: 2px 0 2px; }
.bar span { display: block; height: 100%; }
.bar .ok { background: var(--ok); }
.bar .warn { background: var(--warn); }
.bar .crit { background: var(--crit); }
.srv-actions { position: relative; z-index: 1; display: flex; justify-content: flex-end; margin-top: 10px; }
.srv-actions .mute summary { font: inherit; font-size: .8rem; border: 1px solid var(--border); background: var(--card);
  color: var(--text); border-radius: 6px; padding: 3px 10px; cursor: pointer; list-style: none; }
.srv-actions .mute summary::-webkit-details-marker { display: none; }
.srv-actions .mute summary:hover { border-color: var(--muted); }
.srv-actions .mute-menu { margin: 0; }
.k8s-pods { margin-top: 12px; }
.lvl { display: inline-block; vertical-align: middle; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--ok); }
.lvl.warn { background: var(--warn); }
.lvl.error { background: var(--crit); }
.srv-k8s { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85rem; margin-top: 8px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.charts .card { padding: 12px; min-width: 0; overflow: hidden; }
.chart-title { font-size: .8rem; font-weight: 600; margin-bottom: 6px; }
.chart-legend { display: flex; gap: 12px; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.chart-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* ── login ──────────────────────────────────────────────────────────────── */
.login-page { display: grid; place-items: center; min-height: 100vh; max-width: none; padding: 24px; }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 32px; width: 300px; max-width: 100%; text-align: center; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 18px; font-size: 1.5rem; }
.btn-primary { display: block; padding: 11px; font-size: 1rem; font-weight: 600; border-radius: 8px;
  background: var(--accent); color: #fff; text-decoration: none; }
.btn-primary:hover { filter: brightness(1.05); }
.error { color: var(--crit); font-size: .88rem; margin: 0 0 12px; }

/* ── podstránky ─────────────────────────────────────────────────────────── */
a { color: var(--accent); }
.page-title { font-size: 1.35rem; margin: 0 0 6px; overflow-wrap: anywhere; }
.banner.warn { background: color-mix(in srgb, var(--warn) 16%, var(--card)); border-color: var(--warn); color: var(--warn); }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.detail-head .muted { overflow-wrap: anywhere; }
.section-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-row .section-title { margin: 0; }
section { margin-bottom: 28px; }
.range { display: flex; gap: 4px; }
.btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chart-card { padding: 12px; min-height: 280px; }
#chart .u-legend { display: none; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 16px; }
.card .facts { margin: 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.reasons { margin: 0; padding-left: 18px; }
.mono, code, .source { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.source { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  overflow-x: auto; font-size: .82rem; line-height: 1.5; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .nowrap { white-space: nowrap; }
.table .wrap { overflow-wrap: anywhere; min-width: 180px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0 18px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: .78rem; color: var(--muted); }
.filters select, .filters input { font: inherit; font-size: .9rem; color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; color-scheme: light dark; }
.inline-form { margin: 0; }

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  main { padding: 16px; }
  .charts { grid-template-columns: 1fr; }
}
