/* ── reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #f8f9fa;
  --bg-card:  #ffffff;
  --text:     #1a1a2e;
  --text-dim: #6b7280;
  --border:   #d1d5db;
  --nav-bg:   #1e293b;
  --nav-text: #e2e8f0;
  --nav-hover:#38bdf8;
  --head-bg:  #e2e8f0;
  --row-alt:  #f1f5f9;
  --row-hover:#eff6ff;
  --green:    #16a34a;
  --yellow:   #ca8a04;
  --red:      #dc2626;
  --gray:     #9ca3af;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0f172a;
    --bg-card:  #1e293b;
    --text:     #e2e8f0;
    --text-dim: #94a3b8;
    --border:   #334155;
    --nav-bg:   #0f172a;
    --nav-text: #e2e8f0;
    --head-bg:  #334155;
    --row-alt:  #1e293b;
    --row-hover:#1e3a5f;
    --green:    #4ade80;
    --yellow:   #fbbf24;
    --red:      #f87171;
    --gray:     #64748b;
  }
}

html { font-size: 15px; }

body {
  font-family: ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── nav ────────────────────────────────────────────────────── */
nav {
  background: var(--nav-bg);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  height: 3rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .site-title {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  margin-right: 1.5rem;
  letter-spacing: 0.03em;
}

nav a {
  color: var(--nav-text);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}

nav a:hover, nav a.active {
  background: rgba(255,255,255,0.1);
  color: var(--nav-hover);
}

/* ── page content ───────────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
h2 { font-size: 1.125rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.75rem; }

.meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

/* ── data tables ────────────────────────────────────────────── */
.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead tr {
  background: var(--head-bg);
}

th {
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

/* vertical column dividers */
th + th, td + td {
  border-left: 1px solid var(--border);
}

tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:hover           { background: var(--row-hover); }

.tr { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }

/* ── status colours ─────────────────────────────────────────── */
.ok     { color: var(--green); font-weight: 600; }
.warn   { color: var(--yellow); font-weight: 600; }
.err    { color: var(--red);   font-weight: 600; }
.muted  { color: var(--gray); }

/* ── info cards (system info, HA, sessions) ─────────────────── */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  min-width: 140px;
}

.card-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.card-value {
  font-weight: 600;
  font-size: 0.95rem;
}

/* ── homepage grid ──────────────────────────────────────────── */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.section-card:hover {
  border-color: var(--nav-hover);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.section-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.section-card p  { font-size: 0.8rem; color: var(--text-dim); }
