/* Sessions — Netz Design Kit (light-only). Tokens from netz-design-kit/reference/tokens.json. */
:root {
  color-scheme: light;
  --canvas: #f7f9fd;
  --surface: #ffffff;
  --surface-subtle: #f2f6fb;
  --ink: #111827;
  --ink-2: #34435c;
  --ink-3: #667085;
  --line: #e5eaf2;
  --line-strong: #d4dce9;
  --action: #1d61ee;
  --action-hover: #174fc8;
  --s-prog: #5a47ca;
  --s-prog-bg: #ece9ff;
  --s-crit: #bd2949;
  --s-crit-bg: #ffe7ed;
  --s-neu: #536176;
  --s-neu-bg: #edf1f6;
  --s-pos: #087d55;
  --s-pos-bg: #dff9ee;
  --shadow-surface: 0 16px 50px rgba(29, 36, 56, 0.08), 0 2px 8px rgba(29, 36, 56, 0.04);
  --shadow-overlay: 0 24px 64px -26px rgba(19, 39, 75, 0.42), 0 8px 22px -16px rgba(19, 39, 75, 0.22), inset 0 1px #fff;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: Inter, -apple-system, system-ui, 'San Francisco', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
button { font: inherit; }

/* ── frame ─────────────────────────────────────────────────────────────── */
.app {
  max-width: 920px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.015em; }
.logo { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 1.6; }
.top-r { display: flex; align-items: center; gap: 14px; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.readnote { display: inline-flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.read.live { color: var(--ink-3); }
.read.stale { color: var(--ink-2); }
.acct { display: flex; align-items: center; gap: 10px; margin: 0; min-width: 0; }
.email { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

/* ── buttons ───────────────────────────────────────────────────────────── */
.btn {
  height: 38px; padding: 0 15px; border-radius: 10px; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; text-decoration: none; cursor: pointer; transition: background-color 180ms var(--ease), border-color 180ms var(--ease);
}
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.primary { background: var(--action); color: #fff; }
.btn.primary:hover { background: var(--action-hover); }
.btn.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 32, 64, 0.05); }
.btn.secondary:hover { border-color: #b9c5d8; }
.btn:focus-visible, .lnk:focus-visible { outline: none; box-shadow: 0 0 0 1px rgba(10, 100, 235, 0.25), 0 0 18px 2px rgba(10, 100, 235, 0.18); }
.lnk { background: none; border: 0; font-size: 13px; font-weight: 600; color: var(--action); padding: 8px 12px; margin: -8px -12px; cursor: pointer; border-radius: 8px; }

/* ── the panel ─────────────────────────────────────────────────────────── */
.panel {
  position: relative; margin-top: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow-surface); padding: 18px 0 8px; overflow: hidden; min-height: 220px;
}
.panel-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin: 0 20px 10px; }
.panel-t { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 8px; }
.panel-t .count { font-size: 15px; color: var(--ink-3); font-weight: 500; }
.summary { margin: 0; font-size: 13.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; }
.summary b { color: var(--ink-2); margin-right: 4px; }
.sum-part { white-space: nowrap; }
.dot-sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: #9aa6b8; margin: 0 9px; flex: none; }

.group + .group { border-top: 1px solid var(--line); }
.group-h {
  margin: 0; padding: 16px 20px 6px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px;
}
.group-h .count { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.rows { list-style: none; margin: 6px 0 0; padding: 0 8px 8px; border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center;
  padding: 12px 12px; min-width: 0;
  animation: row-in 320ms var(--ease) both;
}
.row + .row { border-top: 1px solid var(--line); }
.row-main { min-width: 0; }
.name { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; overflow-wrap: anywhere; }
.meta { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; min-width: 0; }
.tool { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); font-weight: 500; white-space: nowrap; }
.tool svg { width: 13px; height: 13px; flex: none; }
.machine { white-space: nowrap; color: var(--ink-2); }
.when { color: var(--ink-3); }
.leaves { display: none; }
.row-side { display: flex; align-items: center; gap: 12px; justify-self: end; }
/* wide screens: agents · status · Hide in one line; the wrapper only matters on a phone */
.side-sub { display: contents; }
.side-sub .agents { order: -1; }
.side-sub .hide-btn { order: 1; }
.hide-btn {
  height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  font-size: 12.5px; font-weight: 500; color: var(--ink-3); cursor: pointer; transition: background-color 180ms var(--ease), color 180ms var(--ease);
}
.hide-btn:hover { background: var(--surface-subtle); color: var(--ink-2); }
.hide-btn:focus-visible { outline: none; box-shadow: 0 0 0 1px rgba(10, 100, 235, 0.25), 0 0 18px 2px rgba(10, 100, 235, 0.18); }
.hide-btn:disabled { opacity: 0.5; cursor: default; }
.hidden-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 20px 6px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.rows-hidden { border-top: 0; margin-top: 0; }
.rows-hidden .row { opacity: 0.72; }
.row[data-status='closed'] .name { color: var(--ink-2); }
.agents { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.agents b { color: var(--ink); }
.status {
  height: 28px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 600; display: inline-flex;
  align-items: center; white-space: nowrap;
}
.s-prog { color: var(--s-prog); background: var(--s-prog-bg); }
.s-crit { color: var(--s-crit); background: var(--s-crit-bg); }
.s-neu { color: var(--s-neu); background: var(--s-neu-bg); }
.s-pos { color: var(--s-pos); background: var(--s-pos-bg); }
.row[data-status='offline'] .name { color: var(--ink-2); }

@keyframes row-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.row.leaving { animation: row-out 240ms var(--ease) both; }
@keyframes row-out { to { opacity: 0; } }

.empty { padding: 36px 20px 40px; max-width: 520px; }
.empty h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.empty p { margin: 8px 0 0; color: var(--ink-2); }

/* ── first load: one quiet veil with one slow light sweep (kit loading rule) ─ */
.placeholder { height: 260px; }
.veil {
  position: absolute; inset: 0; background: rgba(255, 255, 255, 0.72); overflow: hidden;
}
.veil::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(234, 241, 255, 0.9) 50%, transparent 70%);
  transform: translateX(-100%); animation: sweep 1800ms var(--ease) infinite;
}
@keyframes sweep { to { transform: translateX(100%); } }
.panel.revealed > :not(.veil) { animation: fade-in 480ms var(--ease) both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── machines: compact tiles, two side by side even on a phone ──────────── */
.machines-sec { margin-top: 10px; }
.machines-placeholder { height: 132px; }
.machines { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.mcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px;
  min-width: 0; display: flex; flex-direction: column; gap: 1px;
}
.m-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.m-name { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.m-state { font-size: 12px; font-weight: 500; white-space: nowrap; }
.m-state.ok { color: var(--s-pos); }
.m-state.off { color: var(--ink-3); }
.m-agents { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.m-agents b { font-size: 21px; color: var(--ink); margin-right: 1px; letter-spacing: -0.01em; }
.m-counts { margin: 0; font-size: 12px; color: var(--ink-3); }
.m-users { margin: 0; font-size: 12px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 0 9px; }
.m-users b { color: var(--ink-2); font-weight: 600; }
.m-load { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.meter-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 32px; align-items: center; gap: 8px; font-size: 12px; }
.meter-label { color: var(--ink-3); font-weight: 500; }
.meter-value { color: var(--ink-2); font-weight: 500; white-space: nowrap; text-align: right; }
.netz-meter { display: block; position: relative; height: 6px; border-radius: 3px; background: var(--s-neu-bg); overflow: visible; }
.netz-meter-fill { display: block; position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: #8d99ab; transition: width 390ms var(--ease); }
.netz-meter.is-critical .netz-meter-fill { background: var(--s-crit); }
.netz-meter-mark { display: block; position: absolute; left: 80%; top: -3px; width: 2px; height: 12px; border-radius: 1px; background: #b9c3d3; }
.m-spec { margin: 7px 0 0; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard[data-online='false'] .m-agents b { color: var(--ink-3); }
.m-err { margin: 6px 0 0; color: var(--s-crit); font-size: 12px; overflow-wrap: anywhere; }
.sources-none { margin: 0; font-size: 13.5px; color: var(--ink-2); padding: 14px 4px; }
.rule { margin: 14px 4px 0; font-size: 13px; color: var(--ink-3); }

/* ── wider screens: a calmer table-like row ─────────────────────────────── */
@media (min-width: 768px) {
  .app { padding-top: max(28px, env(safe-area-inset-top)); }
  .panel { padding: 22px 0 10px; }
  .panel-h { margin: 0 28px 10px; }
  .group-h { padding: 18px 28px 6px; }
  .rows { padding: 0 14px 10px; }
  .row { padding: 13px 14px; }
  .name { font-size: 16px; }
  .leaves { display: inline; }
}
@media (max-width: 560px) {
  .email { display: none; }
  .row { align-items: start; gap: 4px 12px; }
  /* status beside the name, the agent count under it */
  /* status on top; agents and Hide share the line under it */
  .row-side { flex-direction: column; align-items: flex-end; gap: 4px; }
  .side-sub { display: flex; align-items: center; gap: 4px; order: 0; margin-right: -10px; }
  /* timing on its own line, so no separator is left hanging at a line end */
  .meta .when { flex-basis: 100%; }
  .meta .when + .dot-sep, .meta .machine + .dot-sep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .row, .row.leaving, .panel.revealed > :not(.veil) { animation: none; }
  .netz-meter-fill { transition: none; }
  .veil::after { animation: none; }
}

/* ── sign-in ───────────────────────────────────────────────────────────── */
.signin {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(120% 90% at 8% 4%, #fff 0%, #fff 28%, transparent 60%), linear-gradient(135deg, #fff, #eef4ff 32%, #dbe8ff 58%, #b4d0fb 78%, #8ab6fa);
}
.card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid rgba(212, 220, 233, 0.9);
  border-radius: 22px; box-shadow: var(--shadow-overlay); padding: 32px 28px 28px;
}
.card .logo { width: 30px; height: 30px; }
.card h1 { margin: 18px 0 0; font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.card p.sub { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.gbtn { margin-top: 26px; min-height: 44px; display: flex; justify-content: flex-start; }
.notice { margin-top: 20px; padding: 12px 14px; border-radius: 12px; background: var(--surface-subtle); font-size: 14px; color: var(--ink-2); display: flex; flex-direction: column; gap: 2px; }
.notice b { color: var(--ink); font-weight: 600; }
.notice[data-kind='denied'] b, .notice[data-kind='failed'] b { color: var(--s-crit); }
.fineprint { margin: 22px 0 0; font-size: 13px; color: var(--ink-3); }
.noscript { margin-top: 20px; font-size: 14px; color: var(--s-crit); }
