:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface-muted: #f0efe9;
  --text: #1c1b19;
  --text-secondary: #5f5e5a;
  --text-muted: #8a8880;
  --border: #ddd9d0;
  --ok-bg: #eaf3de; --ok-text: #27500a;
  --warn-bg: #faeeda; --warn-text: #633806;
  --danger-bg: #fcebeb; --danger-text: #791f1f;
  --muted-bg: #f0efe9; --muted-text: #8a8880;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

h1 { font-size: 20px; font-weight: 600; margin: 0; }
h1 a { color: inherit; text-decoration: none; }
h1 a:hover { color: var(--text-secondary); }

.summary { display: flex; gap: 12px; }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  min-width: 110px;
}

.stat-label { font-size: 12px; color: var(--text-secondary); }
.stat-value { font-size: 22px; font-weight: 600; }
.stat-value.ok { color: var(--ok-text); }
.stat-value.danger { color: var(--danger-text); }

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar input {
  flex: 1;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.toolbar button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
}

.toolbar button.active {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-text);
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 1100px; }

thead tr { background: var(--surface-muted); }

th {
  text-align: left;
  padding: 10px 8px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

td { padding: 8px; vertical-align: top; border-top: 1px solid var(--border); }

.nas-name { font-weight: 600; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--text-secondary); }

.muted { color: var(--text-muted); font-size: 12px; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok-text); }
.pill.warn { background: var(--warn-bg); color: var(--warn-text); }
.pill.danger { background: var(--danger-bg); color: var(--danger-text); }
.pill.muted { background: var(--muted-bg); color: var(--muted-text); }

.cap-line { font-size: 11px; margin-bottom: 3px; }
.cap-pct { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.cap-pct.warn { color: var(--warn-text); }
.cap-pct.danger { color: var(--danger-text); }

.bar { background: var(--surface-muted); border-radius: 4px; height: 5px; overflow: hidden; }
.bar-fill { height: 100%; }
.bar-fill.ok { background: #639922; }
.bar-fill.warn { background: #ba7517; }
.bar-fill.danger { background: #a32d2d; }

.job-line { display: flex; align-items: center; gap: 5px; padding: 1px 0; white-space: nowrap; }
.job-name { font-size: 11px; }
.job-info { font-size: 10px; }
.job-info.ok { color: var(--ok-text); }
.job-info.warn { color: var(--warn-text); }
.job-info.danger { color: var(--danger-text); }

.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot.ok { background: #639922; }
.dot.warn { background: #ba7517; }
.dot.danger { background: #a32d2d; }

.hint { font-size: 10px; color: var(--warn-text); }
.warn-text { color: var(--warn-text); }
.danger-text { color: var(--danger-text); font-weight: 600; }

tr.is-bad { background: #fffaf5; }

/* Ikonky v hlavičce */
.icon-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-nav a,
.icon-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
}

.icon-nav a:hover,
.icon-nav button:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.icon-nav form { margin: 0; }

/* Flash zprávy */
.flash-wrap { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.flash-ok { background: var(--ok-bg); color: var(--ok-text); }
.flash-err { background: var(--danger-bg); color: var(--danger-text); }

/* Formuláře */
form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

form input[type="text"],
form input[type="password"] {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

form button[type="submit"],
.button-link {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

form button[type="submit"]:hover,
.button-link:hover { border-color: var(--text-secondary); }

.btn-danger { color: var(--danger-text); border-color: var(--danger-text); }

/* Přihlašovací karty */
.auth-card {
  max-width: 340px;
  margin: 40px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.auth-card h2 { margin: 0 0 16px; font-size: 17px; }

/* Nastavení */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  max-width: 800px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.card h2 { margin: 0 0 14px; font-size: 16px; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --surface: #211f1c;
    --surface-muted: #29271f;
    --text: #f0efe9;
    --text-secondary: #c3c2b7;
    --text-muted: #8a8880;
    --border: #3a3833;
    --ok-bg: #173404; --ok-text: #c0dd97;
    --warn-bg: #412402; --warn-text: #fac775;
    --danger-bg: #501313; --danger-text: #f7c1c1;
    --muted-bg: #29271f; --muted-text: #8a8880;
  }
  tr.is-bad { background: #241c14; }
}
