/* Homelab dashboard, Notch design language (dark only).
   Same class names app.js renders, restyled: flat graphite ground (no photos, no glass),
   Roboto, heavy rules opening each section, stat cards for headline numbers, ruled rows
   for lists, status as shape + color + word, square meters. Soft corners: 6px controls,
   10px containers. app.js reads the color variables below by name (--accent, --green,
   --muted, --inset-bg ...), so those names stay. */

html { font-size: 21px; } /* app.js writes some sizes inline in rem; keep its scale */

:root {
  color-scheme: dark;
  --ground: #131618;
  --surface: #1A1E21;
  --sunk: #0D1012;
  --fill: #23292E;
  --fill-hover: #2D3439;
  --rule: #7F8990;
  --line: #30363B;
  --line-soft: #22272B;
  --text: #E6EAED;
  --muted: #A3ACB3;
  --muted2: #7F8990;
  --dim: #7F8990;
  --accent: #9DDDFF;
  --accent-soft: #13303F;
  --on-accent: #00324F;

  /* names app.js uses */
  --bg: var(--ground);
  --card: var(--surface);
  --inset-bg: var(--fill);
  --border: var(--line);
  --border-2: var(--line);
  --accent-dim: rgba(157, 221, 255, .14);
  --accent-glow: rgba(157, 221, 255, .22);
  --green: #4DBA86;  --green-dim: transparent;
  --yellow: #E0A54A; --yellow-dim: transparent;
  --red: #EE6A5D;    --red-dim: transparent;
  --blue: #1FA0A0;   --blue-dim: transparent;   /* second data series (upload): Notch teal */

  --font: 'Roboto', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px;
  --shell-max: 1200px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--ground); }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  background: var(--ground); color: var(--text); min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* no photo background, no theme toggle: Notch ships dark only */
#site-bg, #site-bg-next, #site-bg-dim { display: none; }
.theme-toggle-btn { display: none; }

/* label style (was Martian Mono caps; Roboto 500 caps with tracking) */
.card-title, .stat-tile-hd, .stat-line-label, .table-hd, .monitor-group-name, .flow-label, .donut-label, .brand-sub {
  font-family: var(--font); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--dim);
}

/* ===== shell + header ===== */
.shell { max-width: var(--shell-max); margin: 0 auto; padding: 0 40px 48px; }
@media (max-width: 720px) { .shell { padding: 0 16px 40px; } }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 32px;
  height: 60px; margin: 0 -40px 36px; padding: 0 40px;
  background: var(--ground); border-bottom: 1px solid var(--rule);
}
.topbar.card { border-radius: 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: var(--r-xs); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.brand-sub { font-size: 10px; }

.topbar-nav { display: flex; align-items: center; gap: 24px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 14px 0; }
.topbar-nav::-webkit-scrollbar { display: none; }
.nav-pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 0; border: 0; background: none; cursor: pointer; white-space: nowrap;
  font-family: var(--font); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
  text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 3px; text-underline-offset: 8px;
}
.nav-pill .nav-icon { display: none; }
.nav-pill:hover { color: var(--text); }
.nav-pill.active { color: var(--text); text-decoration-color: var(--accent); }
.nav-badge { font-size: 10.5px; font-weight: 500; letter-spacing: 0; padding: 1px 6px; border-radius: var(--r-xs); background: var(--fill); color: var(--muted); text-decoration: none; }
.nav-badge.gray { background: var(--fill); color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.self-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* live marker: a filled square, not a glowing dot */
.dot-live { width: 8px; height: 8px; background: var(--green); flex: none; animation: live 2s infinite; }
@keyframes live { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (max-width: 900px) {
  .topbar { gap: 16px; margin: 0 -16px 28px; padding: 0 16px; }
  .brand-text { display: none; }
  .self-status { display: none; }
}

/* ===== sections: a title on the page, then its content in cards ===== */
.content { display: flex; flex-direction: column; gap: 36px; }
.section { scroll-margin-top: 72px; }
.section-hd {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 0 0 12px; margin: 0;
}
.section-title { font-size: 20px; font-weight: 600; letter-spacing: -.015em; }
.section-sub { font-size: 13px; color: var(--muted); }
/* "Last refresh" under every section repeats the header's live marker */
.section-meta { display: none; }

/* ===== cards: every block is a Sheet-shaded card, 16px apart; light rules divide rows inside ===== */
.card:not(.topbar) {
  background: var(--surface); border: 0; border-radius: var(--r-md); padding: 16px 20px 20px;
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; transform: none;
  --line-soft: #2A3035; /* row dividers read on the card shade */
}
.card-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 0 10px; border-bottom: 1px solid var(--line-soft); }
/* stat tiles inside a card sit in the Well shade so they don't blend into it */
.card .stat-tile { background: var(--sunk); }
.card-hd-actions { display: flex; align-items: center; gap: 8px; }
.card-title { color: var(--text); }
.card-bd { padding: 16px 0 0; }
.card-bd.tight { padding: 10px 0 0; }
.section > .card + .card { margin-top: 16px; }
.inset-box { background: var(--fill); border: 0; border-radius: var(--r-md); }

/* ===== stat cards ===== */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-bottom: 20px; }
.stat-tile { background: var(--surface); border: 0; border-radius: var(--r-md); padding: 14px 16px 16px; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; transform: none; }
.stat-tile-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stat-tile-value { font-size: 28px; font-weight: 500; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-tile-value .unit { font-size: 13px; font-weight: 400; color: var(--dim); margin-left: 4px; letter-spacing: 0; }
.stat-tile-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.stat-tile-icon { display: none; }

/* ===== status: rounded square, color + word, no pills ===== */
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 0; background: none !important; border-radius: 0; font-size: 12.5px; font-weight: 400; letter-spacing: 0; color: var(--muted) !important; white-space: nowrap; }
.badge-dot { width: 8px; height: 8px; flex: none; border-radius: 2px; }
.badge-green .badge-dot  { background: var(--green); }
.badge-yellow .badge-dot { background: var(--yellow); }
.badge-red .badge-dot    { background: var(--red); }
.badge-blue .badge-dot, .badge-accent .badge-dot { background: var(--accent); }
.badge-gray .badge-dot   { background: var(--dim); }
.badge-gray { background: var(--fill) !important; border-radius: var(--r-xs); padding: 2px 7px; }

/* ===== buttons ===== */
.btn-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: var(--fill); color: var(--text); font-family: var(--font); font-size: 13px; font-weight: 500; cursor: pointer; }
.btn-pill:hover { background: var(--fill-hover); }
.btn-pill.active { background: var(--text); color: var(--ground); }
.btn-solid { height: 36px; padding: 0 16px; border: 0; border-radius: var(--r-sm); background: var(--accent); color: var(--on-accent); font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-solid:hover { background: #C2EAFF; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* ===== meters: square bars ===== */
.meter { height: 6px; border-radius: 0; background: var(--fill); overflow: hidden; position: relative; }
.meter-fill { height: 100%; border-radius: 0; background: var(--accent); transition: width .6s ease; }
.meter-fill.ok { background: var(--green); }
.meter-fill.warn { background: var(--yellow); }
.meter-fill.crit { background: var(--red); }
.stat-line { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.stat-line:last-child { margin-bottom: 0; }
.stat-line-label { width: 40px; flex: none; }
.stat-line-meter { flex: 1; }
.stat-line-val { font-size: 12.5px; width: 40px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }

/* ===== layout grids ===== */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; }

/* machines: a ruled grid (columns divided by light rules), not floating cards */
.machine-row { display: grid; gap: 0; border-bottom: 1px solid var(--line-soft); }
.machine-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.machine-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.machine-card { padding: 16px 20px 16px 0; display: flex; flex-direction: column; gap: 12px; }
.machine-row > .machine-card + .machine-card { padding-left: 20px; border-left: 1px solid var(--line-soft); }
.machine-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.machine-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.machine-icon { width: 32px; height: 32px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); background: var(--fill); color: var(--muted); }
.machine-icon svg { width: 16px; height: 16px; }
.machine-name { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.machine-meta { font-size: 12.5px; color: var(--muted); }
.machine-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--dim); padding-top: 10px; border-top: 1px solid var(--line-soft); }
.machine-foot span { display: flex; align-items: center; gap: 4px; }

/* ===== lists: ruled rows ===== */
.event-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.event-row:last-child { border-bottom: 0; }
.event-dot { width: 8px; height: 8px; margin-top: 6px; flex: none; }
.event-text { font-size: 14px; }
.event-time { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.table-row { display: grid; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.table-row:last-child { border-bottom: 0; }

.donut-wrap { position: relative; width: 132px; height: 132px; margin: 0 auto; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-value { font-size: 22px; font-weight: 600; }

.disk-bay { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); background: none; border-radius: 0; margin: 0; }
.disk-bay:last-child { border-bottom: 0; }
.disk-bay-slot { width: 24px; height: 24px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: var(--r-xs); background: var(--fill); font-size: 11px; font-weight: 600; color: var(--muted); }
.disk-bay-info { flex: 1; min-width: 0; }
.disk-bay-model { font-size: 14px; font-weight: 500; }
.disk-bay-meta { font-size: 12.5px; color: var(--dim); }
.disk-bay-temp { font-size: 13px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }

/* ===== solar flow ===== */
.solar-flow { display: flex; align-items: center; padding: 8px 0 24px; }
.flow-node { display: flex; flex-direction: column; align-items: center; flex: none; width: 96px; text-align: center; }
.flow-icon { width: 34px; height: 34px; margin-bottom: 8px; flex: none; }
.flow-label { margin-bottom: 4px; }
.flow-value { font-size: 22px; font-weight: 500; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.flow-value .unit { font-size: 12.5px; font-weight: 400; margin-left: 2px; color: var(--dim); }
.flow-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.flow-link { flex: 1; height: 10px; min-width: 20px; }
.flow-link svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* ===== docker containers: ruled rows ===== */
.container-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); background: none; border-radius: 0; margin: 0; }
.container-dot { width: 8px; height: 8px; flex: none; background: var(--green); box-shadow: none; }
.container-info { flex: 1; min-width: 0; }
.container-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.container-image { font-size: 12.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.container-ring { position: relative; width: 36px; height: 36px; flex: none; }
.container-ring svg circle { transition: stroke-dashoffset .6s ease; }
.container-ring-value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; }

/* ===== uptime ===== */
.uptime-banner { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; margin-bottom: 16px; border: 0; border-radius: var(--r-md); background: var(--sunk); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; font-size: 15px; font-weight: 500; color: var(--text); }
.uptime-banner svg { display: none; }
.uptime-banner.all-good { color: var(--text); }
.uptime-banner.degraded { color: var(--yellow); }
.uptime-banner.outage { background: #3B2421; color: var(--red); }

.monitor-group { margin-top: 24px; }
.monitor-group-name { margin-bottom: 4px; }
.monitor-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; background: none; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; margin: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.monitor-row:last-child { border-bottom: 0; }
.monitor-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 2px; }
.dot-up { background: var(--green); box-shadow: none; }
.dot-down { background: var(--red); box-shadow: none; }
.dot-pend { background: var(--yellow); }
.dot-maint { background: var(--dim); }
.monitor-dot-pulse { animation: live 2.5s ease-in-out infinite; }
.monitor-name { font-size: 14px; font-weight: 500; flex: 1; min-width: 50px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* heartbeat history as thin square ticks */
.monitor-hb-bars { display: flex; align-items: center; justify-content: space-between; height: 18px; flex: 0 0 260px; }
.hb-bar { flex: 0 0 auto; width: 5px; height: 16px; border-radius: 1px; background: var(--fill); }
.hb-bar.hb-up { background: var(--green); }
.hb-bar.hb-down { background: var(--red); }
.hb-bar.hb-pending { background: var(--yellow); }
.hb-bar.hb-maint { background: var(--dim); }
.hb-bar.hb-empty { background: var(--fill); opacity: 1; }
.monitor-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-shrink: 0; width: 118px; }
.monitor-uptime { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.ulog-wrap { margin-top: 14px; }
.ulog-empty { font-size: 14px; color: var(--muted); padding: 16px 0; }
.ulog-entry { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.ulog-entry:last-child { border-bottom: 0; }
.ulog-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 2px; }
.ulog-dot.up { background: var(--green); box-shadow: none; }
.ulog-dot.down { background: var(--red); box-shadow: none; }
.ulog-dot.pend { background: var(--yellow); }
.ulog-title { flex: 1; min-width: 0; font-weight: 500; color: var(--text); }
.ulog-time { flex-shrink: 0; color: var(--dim); font-size: 12.5px; text-align: right; }

/* ===== responsive ===== */
@media (max-width: 900px) {
  .machine-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .machine-row-4 > .machine-card:nth-child(3) { padding-left: 0; border-left: 0; }
  .machine-row-4 > .machine-card:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 680px) {
  html { font-size: 19px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-tile { padding: 12px 12px 14px; }
  .stat-tile-value { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .machine-row-3, .machine-row-4 { grid-template-columns: minmax(0, 1fr); }
  .machine-row > .machine-card + .machine-card { padding-left: 0; border-left: 0; border-top: 1px solid var(--line-soft); }
  .machine-card { padding-right: 0; }
  .monitor-hb-bars, .monitor-uptime { display: none; }
  .monitor-meta { gap: 8px; width: auto; }
  .flow-node { width: 70px; }
  .flow-icon { width: 26px; height: 26px; margin-bottom: 6px; }
  .flow-value { font-size: 16px; }
  .flow-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* machines: one row of individual cards (user, 2026-09-28), equal heights */
.machine-row.machine-row-all {
  grid-template-columns: repeat(var(--machines, 4), minmax(0, 1fr));
  gap: 8px; border-bottom: 0; align-items: stretch;
}
.machine-row-all > .machine-card,
.machine-row-all > .machine-card + .machine-card {
  background: var(--surface); border: 0; border-top: 0; border-radius: var(--r-md);
  padding: 16px;
}
/* first footer takes the free space, so footers line up across cards */
.machine-row-all > .machine-card > .machine-foot:nth-last-child(2) { margin-top: auto; }
.machine-row-all > .machine-card > .machine-foot:only-of-type { margin-top: auto; }
@media (max-width: 1000px) { .machine-row.machine-row-all { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .machine-row.machine-row-all { grid-template-columns: minmax(0, 1fr); } }
/* room for a two-line description, so the meters line up across cards too */
.machine-row-all .machine-hd { min-height: 62px; }
