/* kin-hub, following the Machines mockup: white surfaces on a light canvas,
   one blue for actions, green/amber/red for status. */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("vendor/inter/inter-latin-400.da03732a27e1.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("vendor/inter/inter-latin-500.51205681a1ba.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("vendor/inter/inter-latin-600.2ede57db1a3a.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("vendor/inter/inter-latin-700.8ca0a5155296.woff2") format("woff2"); }

:root {
  --canvas: #f8f9fb;
  --surface: #ffffff;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --row-line: #eef0f3;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --primary: #2160e0;
  --primary-hover: #1b52c4;
  --primary-soft: #eaf1fe;
  --primary-text: #1d4fbf;
  --green: #22c55e;
  --green-soft: #ecfdf3;
  --green-text: #067647;
  --amber: #f59e0b;
  --amber-soft: #fff6e5;
  --amber-text: #b54708;
  --red: #ef4444;
  --red-dot: #dc2626;
  --red-soft: #fef3f2;
  --red-text: #c01f14;
  --info-soft: #eff5ff;
  --info-border: #d1e0ff;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-pop: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .06);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text-2);
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--text); margin: 0; }
code, pre, kbd { font-family: var(--mono); }
button { font: inherit; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon.sm { width: 16px; height: 16px; }
.icon.xs { width: 14px; height: 14px; }
.icon.lg { width: 22px; height: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* App frame */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 26px 16px 20px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { padding: 0 8px 22px; display: block; color: inherit; }
.brand:hover { text-decoration: none; }
.wordmark { font-size: 29px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); line-height: 1.1; }
.tagline { margin-top: 6px; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 14.5px;
}
.nav a .icon { color: #475467; }
.nav a:hover { background: #f4f6f9; text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav a.active .icon { color: var(--primary-text); }
.side-card {
  margin-top: auto; padding: 20px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fafbfc;
}
.side-card .term-badge {
  width: 36px; height: 36px; border-radius: 7px; background: #111827; color: #fff;
  display: grid; place-items: center; margin-bottom: 16px;
}
.side-card h3 { font-size: 15px; line-height: 1.35; font-weight: 600; margin-bottom: 14px; }
.side-card p { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.side-card a { font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 70px; display: flex; align-items: center; gap: 16px;
  padding: 0 30px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border);
}
.search {
  flex: 0 1 548px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted);
}
.search:focus-within { border-color: #84adff; box-shadow: 0 0 0 3px #e0eaff; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 14.5px; color: var(--text); background: transparent; }
.search input::placeholder { color: var(--muted); }
kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--border);
  border-radius: 5px; font-size: 12px; color: var(--muted); background: #f9fafb;
}
.spacer { flex: 1; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: #475467; cursor: pointer; position: relative;
}
.icon-btn:hover { background: #f2f4f7; }
.badge-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red-dot); border: 2px solid #fff; }

.user-menu summary {
  display: flex; align-items: center; gap: 12px; padding: 4px 6px 4px 4px; border-radius: 999px; cursor: pointer; list-style: none;
}
.user-menu summary::-webkit-details-marker { display: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: #dbe7fe; color: var(--primary-text); font-weight: 600; font-size: 13.5px;
}
.user-name { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.25; }
.user-org { font-size: 12.5px; color: var(--muted); line-height: 1.25; }

/* Pop-up menus built on <details> */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--text-2); font-size: 13.5px; text-align: left; cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: #f4f6f9; text-decoration: none; }
.menu-pop .danger { color: var(--red-text); }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu-head { padding: 8px 10px 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.notes { width: 360px; max-height: 440px; overflow: auto; }
.note { display: flex; gap: 10px; padding: 10px; border-radius: 6px; }
.note + .note { border-top: 1px solid var(--row-line); }
.note.unread { background: #f6f9ff; }
.note .when { font-size: 12px; color: var(--muted); }
.note-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--faint); }
.note-dot.online { background: var(--green); }
.note-dot.offline, .note-dot.refused { background: var(--red-dot); }
.note-dot.degraded { background: var(--amber); }
.note-dot.enrolled { background: var(--primary); }
.note-dot.login { background: var(--green); }
.note-dot.logout { background: var(--faint); }
.note-dot.failed { background: var(--red-dot); }
.note-dot.request { background: var(--primary); }
.log-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.log-tools .tabs { margin-bottom: 0; }
.log-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.log-filter select { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.list.log .log-day { padding: 8px 20px; background: #f7f8fa; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.list.log .log-when { color: var(--text-2); font-size: 13px; text-align: right; }
.list.log .log-when .sub { display: block; }
.notes-empty { padding: 18px 10px; color: var(--muted); font-size: 13.5px; }

.content { flex: 1; padding: 26px 30px 30px; }
.topbar-brand, .tabbar, .k-cap { display: none; }
.footer {
  display: flex; justify-content: space-between; align-items: center; padding: 16px 30px;
  border-top: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--muted);
}
.footer .product { color: var(--text); font-weight: 600; margin-right: 14px; }

/* Page header */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.page-title { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -0.025em; margin: 4px 0 6px; }
.page-sub { margin: 0; color: var(--text-2); font-size: 15px; }
.page-actions { display: flex; gap: 10px; padding-top: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow); }
.btn-outline:hover { background: #f9fafb; }
.btn-danger { background: #d92d20; color: #fff; }
.btn-danger:hover { background: #b42318; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f2f4f7; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; font-weight: 500; }
.btn[disabled], .btn.disabled { color: var(--faint); background: #fcfcfd; border-color: var(--border); box-shadow: none; cursor: not-allowed; pointer-events: none; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat {
  display: flex; align-items: center; gap: 16px; padding: 20px 22px; min-height: 78px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit;
}
a.stat:hover { border-color: var(--border-strong); text-decoration: none; }
a.stat.current { border-color: #84adff; box-shadow: 0 0 0 3px #e0eaff; }
.stat .num { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.15; }
.stat .label { font-size: 14px; color: var(--text-2); }
.stat .pct { margin-left: auto; font-size: 13px; color: var(--muted); }
.stat .glyph { color: #475467; }
.stat-dot { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.stat-dot.online { background: var(--green); }
.stat-dot.offline { background: var(--red-dot); }
.stat-warn { color: var(--amber); fill: none; }

/* Info banner */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 18px;
  background: var(--info-soft); border: 1px solid var(--info-border); border-radius: var(--radius); font-size: 14px;
}
.banner > .icon { color: var(--primary); }
.banner p { margin: 0; flex: 1; }
.banner strong { color: var(--text); font-weight: 600; }
.banner .icon-btn { width: 30px; height: 30px; }

/* Cards and tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 16px; font-weight: 600; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.card-body { padding: 18px 20px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--text-2); padding: 15px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.data th a { color: inherit; display: inline-flex; align-items: center; gap: 6px; }
table.data th a:hover { text-decoration: none; color: var(--text); }
table.data td { padding: 12px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fcfcfd; }
table.data .check { width: 46px; padding-left: 16px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); border-radius: 4px; vertical-align: middle; }
.cell-name { display: flex; align-items: center; gap: 13px; }
.machine-icon {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; flex: none;
  background: #e8f0fe; color: var(--primary);
}
.machine-icon.off { background: #f2f4f7; color: #475467; }
.name { font-weight: 600; color: var(--text); font-size: 14.5px; line-height: 1.3; }
a.name:hover { color: var(--primary); text-decoration: none; }
.sub { color: var(--muted); font-size: 13px; line-height: 1.35; }
.sub code, .check-row code, .card-head code { white-space: nowrap; }
td a.name, td .name { white-space: nowrap; }
.two { line-height: 1.35; }
.two .sub { margin-top: 2px; }
.cell-os { display: flex; align-items: center; gap: 12px; }
.os-icon { width: 20px; height: 20px; flex: none; fill: currentColor; }
.os-linux { color: #1d2939; }
.os-apple { color: #555; }
.os-pi { color: #c51a4a; }

.pill { display: inline-flex; align-items: center; gap: 7px; height: 27px; padding: 0 11px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.pill .pdot { width: 9px; height: 9px; border-radius: 50%; }
.pill.online { background: var(--green-soft); color: var(--green-text); }
.pill.online .pdot { background: var(--green); }
.pill.degraded { background: var(--amber-soft); color: var(--amber-text); }
.pill.degraded .icon { color: var(--amber); }
.pill.offline { background: var(--red-soft); color: var(--red-text); }
.pill.offline .pdot { background: var(--red); }
.pill.neutral { background: #f2f4f7; color: var(--text-2); }
.pill.blue { background: var(--primary-soft); color: var(--primary-text); }
.seen { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.seen .sdot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.seen.late .sdot { background: var(--amber); }

.cell-load { display: flex; align-items: center; gap: 14px; }
.spark { display: block; overflow: visible; }
.spark polyline { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { stroke: none; }
.spark-online polyline { stroke: #16a34a; } .spark-online .area { fill: rgba(34, 197, 94, .12); }
.spark-degraded polyline { stroke: #f59e0b; } .spark-degraded .area { fill: rgba(245, 158, 11, .16); }
.spark-flat path { stroke: #d0d5dd; stroke-width: 1.5; fill: none; }
.load-num { min-width: 34px; text-align: right; color: var(--text-2); }
.cell-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.cell-actions .icon-btn { width: 34px; height: 34px; }

.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--text-2); }
.pager { display: flex; align-items: center; gap: 12px; }
.pager select {
  height: 36px; padding: 0 30px 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  appearance: none; font: inherit; color: var(--text); cursor: pointer;
}
.pager-btns { display: flex; }
.pager-btns a, .pager-btns span {
  display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface);
}
.pager-btns > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.pager-btns > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }
.pager-btns span { color: var(--faint); }
.pager-btns a:hover { background: #f9fafb; text-decoration: none; }

.bulk-bar { display: none; align-items: center; gap: 12px; padding: 10px 16px; background: var(--primary-soft); border-bottom: 1px solid var(--info-border); font-size: 13.5px; color: var(--primary-text); }
.bulk-bar.show { display: flex; }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty h3 { font-size: 16px; margin-bottom: 6px; }
.empty p { margin: 0 auto 18px; max-width: 460px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 500; font-size: 13.5px; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, textarea.input, select.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; color: var(--text); outline: 0;
}
textarea.input { font-family: var(--mono); font-size: 12.5px; min-height: 84px; resize: vertical; }
.input:focus { border-color: #84adff; box-shadow: 0 0 0 3px #e0eaff; }
.errorlist { margin: 4px 0 0; padding: 0; list-style: none; color: var(--red-text); font-size: 13px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fcfcfd; cursor: pointer; }
.check-row input { margin-top: 2px; }
.check-row b { color: var(--text); font-weight: 600; }
.check-row span { display: block; font-size: 13px; color: var(--muted); }

/* Command boxes */
.cmd {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; margin: 6px 0 14px;
  background: #0f172a; color: #e2e8f0; border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12.5px;
}
.cmd code { flex: 1; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.cmd .prompt { color: #64748b; user-select: none; }
.copy-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border: 1px solid #334155;
  border-radius: 6px; background: #1e293b; color: #cbd5e1; cursor: pointer;
}
.copy-btn:hover { background: #273449; color: #fff; }
.copy-btn.done { color: #4ade80; border-color: #166534; }
.cmd-label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }

/* Dialogs */
dialog {
  width: min(680px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-pop); color: var(--text-2);
}
dialog::backdrop { background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 24px 4px; }
.dialog-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.dialog-head p { margin: 4px 0 0; color: var(--muted); }
.dialog-body { padding: 16px 24px 8px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; }
.tabs { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: #f2f4f7; margin-bottom: 12px; }
.tabs button, .tabs a { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-weight: 500; cursor: pointer; }
.tabs button.on, .tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; }
.notice.warn { background: var(--amber-soft); color: #7a2e0e; border: 1px solid #fedf89; }
.notice.warn .icon { color: var(--amber); }
.notice.ok { background: var(--green-soft); color: #054f31; border: 1px solid #abefc6; }
.notice.info { background: var(--info-soft); border: 1px solid var(--info-border); }
.messages { margin-bottom: 16px; }

/* Grids for the dashboard and detail pages */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--row-line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); margin: 0; }
.kv dt, .kv dd { padding: 11px 20px; margin: 0; border-bottom: 1px solid var(--row-line); font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); overflow-wrap: anywhere; }
.kv dt:nth-last-of-type(1), .kv dd:last-of-type { border-bottom: 0; }
.big-spark { padding: 18px 20px 14px; }
.big-spark .spark { width: 100%; height: 88px; }

.live-inline { display: contents; }

/* Terminal page. The page is as tall as the window and the terminal takes
   what the heading leaves, so no row falls below the fold. */
body.term-page .app { height: 100vh; height: 100dvh; min-height: 0; }
body.term-page .main { min-height: 0; overflow: hidden; }
body.term-page .content { display: flex; flex-direction: column; min-height: 0; padding-bottom: 20px; }
body.term-page .footer { display: none; }
.term-shell { flex: 1; min-height: 240px; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; border: 1px solid #1f2937; background: #0b1220; }
.term-bar { flex: none; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 4px 8px 4px 14px; background: #111827; color: #cbd5e1; font-size: 13px; border-bottom: 1px solid #1f2937; }
.term-bar > .icon { flex: none; }
.term-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-bar .state { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; }
.term-bar .sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.term-bar .sdot.on { background: var(--green); }
.term-bar .sdot.off { background: var(--red); }
.term-tools { flex: none; display: flex; align-items: center; gap: 2px; }
.term-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: #94a3b8; cursor: pointer; list-style: none;
}
.term-btn::-webkit-details-marker { display: none; }
.term-btn:hover { background: #1f2937; color: #e2e8f0; }
.term-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.term-btn.on { color: #93c5fd; }
.term-sep { width: 1px; height: 18px; margin: 0 4px; background: #334155; }
.term-keys .menu-pop { right: 0; left: auto; min-width: 290px; padding: 10px 12px; }
.term-keys table { width: 100%; border-collapse: collapse; font-size: 13px; }
.term-keys td { padding: 4px 0; color: var(--text-2); }
.term-keys td:last-child { text-align: right; white-space: nowrap; }
.term-keys kbd { min-width: 0; height: 20px; font-size: 11.5px; }
.term-panes { position: relative; flex: 1; min-height: 0; display: flex; }
.term-split { display: flex; flex: 1 1 0; min-width: 0; min-height: 0; }
.term-split.row { flex-direction: row; }
.term-split.col { flex-direction: column; }
.term-pane { position: relative; display: flex; flex: 1 1 0; min-width: 0; min-height: 0; padding: 8px 10px; border: 1px solid transparent; }
/* The fit addon measures the host and not its padding, so the padding
   lives on the pane around it. */
.term-host { flex: 1; min-width: 0; min-height: 0; }
.term-host .xterm-viewport { scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.term-panes.split .term-pane.active { border-color: rgba(96, 165, 250, .55); }
.term-divider { flex: none; background: #1f2937; touch-action: none; }
.term-split.row > .term-divider { width: 5px; cursor: col-resize; }
.term-split.col > .term-divider { height: 5px; cursor: row-resize; }
.term-divider:hover, .term-divider.drag { background: #334155; }
.term-panes.has-max .term-pane.max { position: absolute; inset: 0; z-index: 2; background: #0b1220; }

/* Focus mode: the terminal is the whole page. */
body.term-focus .sidebar, body.term-focus .topbar, body.term-focus .tabbar, body.term-focus .term-head, body.term-focus .messages { display: none; }
body.term-focus .app { grid-template-columns: minmax(0, 1fr); }
body.term-focus .content { padding: 0; }
body.term-focus .term-shell { border: 0; border-radius: 0; }
.term-shell:fullscreen { width: 100vw; height: 100vh; border: 0; border-radius: 0; }

/* Sign-in form */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-form { width: min(336px, 100%); }
.auth-form .btn { width: 100%; }

/* Public pages: landing, docs, downloads */
.pub-nav { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.pub-nav .inner { max-width: 1180px; margin: 0 auto; height: 68px; padding: 0 24px; display: flex; align-items: center; gap: 28px; }
.pub-nav .wordmark { font-size: 24px; }
.pub-nav nav { display: flex; gap: 24px; font-weight: 500; }
.pub-nav nav a { color: var(--text-2); }
.pub-nav nav a.active, .pub-nav nav a:hover { color: var(--text); text-decoration: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.pub-footer { border-top: 1px solid var(--border); background: var(--surface); }
.pub-footer .inner { max-width: 1180px; margin: 0 auto; padding: 22px 24px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }

.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; padding: 40px 0 64px; }
.docs-nav { position: sticky; top: 92px; align-self: start; font-size: 13.5px; }
.docs-nav h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.docs-nav a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--text-2); }
.docs-nav a.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.docs-nav .toc a { padding-left: 18px; font-size: 13px; }
.prose { max-width: 780px; color: var(--text-2); font-size: 15px; line-height: 1.7; }
.prose h1 { font-size: 34px; letter-spacing: -0.025em; margin: 0 0 18px; }
.prose h2 { font-size: 22px; margin: 38px 0 12px; padding-top: 8px; letter-spacing: -0.015em; }
.prose h3 { font-size: 17px; margin: 26px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose code { font-size: 13px; padding: 1px 5px; border-radius: 5px; background: #f2f4f7; color: var(--text); }
.prose pre { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 13px; line-height: 1.55; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { border-collapse: collapse; margin: 0 0 16px; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }

@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
/* Phones and small tablets: a bottom tab bar instead of the sidebar, and
   cards instead of wide tables. */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .footer { display: none; }
  .topbar { height: 60px; padding: 0 14px; gap: 10px; }
  .topbar-brand { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); white-space: nowrap; }
  .topbar-brand:hover { text-decoration: none; }
  .search { flex: 1 1 auto; min-width: 0; height: 38px; padding: 0 10px; }
  .search kbd { display: none; }
  .user-meta, .user-menu summary > .icon { display: none; }
  .user-menu summary { padding: 0; }
  .topbar .menu-pop { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; min-width: 0; }
  .content { padding: 18px 14px calc(88px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--border);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 5px;
    border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 500;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--primary-text); background: var(--primary-soft); }
  .tabbar .icon { width: 22px; height: 22px; }

  .page-head { flex-direction: column; gap: 14px; margin-bottom: 16px; }
  .page-title { font-size: 25px; }
  .page-sub { font-size: 14px; }
  .page-actions { padding-top: 0; width: 100%; }
  .page-actions .btn { flex: 1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .stat { padding: 14px; gap: 12px; min-height: 0; }
  .stat .num { font-size: 19px; }
  .stat .label { font-size: 13px; }
  .stat .pct { display: none; }
  .stat-dot { width: 14px; height: 14px; }
  .banner { padding: 10px 12px; font-size: 13px; gap: 10px; }
  .card-head { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .list li { padding: 12px 16px; }
  .docs { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 24px; }
  .docs-nav { position: static; }
  .pub-footer .inner { flex-direction: column; gap: 4px; }
  .pub-nav nav { gap: 14px; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .table-foot { padding: 10px 14px; }
  .per-label, .pager select { display: none; }
  .cmd { font-size: 12px; }
  dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .dialog-head { padding: 18px 16px 4px; }
  .dialog-body { padding: 12px 16px 8px; }
  .dialog-foot { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .tabs { display: flex; }
  .tabs button, .tabs a { flex: 1; justify-content: center; padding: 0 6px; }
  body.term-page .content { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.term-focus .content { padding: 0; }
  .term-head { margin-bottom: 10px; }
  .term-pane { padding: 4px; }
  .term-title { display: none; }
  .term-btn { width: 34px; height: 34px; }

  /* Tables become cards. */
  table.cards, table.cards tbody { display: block; }
  table.cards thead { display: none; }
  table.cards td { padding: 0; border: 0; }
  table.cards tbody tr:hover td { background: none; }
  table.cards tr { border-bottom: 1px solid var(--row-line); }
  table.cards tr:last-child { border-bottom: 0; }

  table.machines tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding: 14px 16px;
    grid-template-areas: "name status" "host seen" "os os" "load actions";
  }
  table.machines .c-check { display: none; }
  table.machines .c-name { grid-area: name; min-width: 0; }
  table.machines .c-status { grid-area: status; justify-self: end; }
  table.machines .c-host { grid-area: host; padding-left: 43px; }
  table.machines .c-host { min-width: 0; }
  table.machines .c-host > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.machines .c-host > div:first-child { color: var(--text-2); }
  table.machines .c-os { grid-area: os; padding-left: 43px; }
  table.machines .c-os .os-icon { width: 16px; height: 16px; }
  table.machines .c-os .cell-os { gap: 8px; }
  table.machines .c-os .two > div { display: inline; }
  table.machines .c-os .two .sub { margin-left: 4px; font-size: 13px; }
  table.machines .c-os .two { color: var(--text-2); font-size: 13px; }
  table.machines .c-seen { grid-area: seen; justify-self: end; text-align: right; }
  table.machines .c-load { grid-area: load; align-self: center; }
  table.machines .cell-load { gap: 8px; }
  table.machines .load-num { min-width: 0; }
  table.machines .c-actions { grid-area: actions; justify-self: end; }
  table.machines .cell-actions { gap: 6px; }
  table.machines .cell-actions .btn { height: 36px; padding: 0 10px; }

  table.sessions tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 16px; }
  table.sessions td { font-size: 13px; color: var(--muted); }
  table.sessions .s-machine { order: 1; flex: 1 1 auto; }
  table.sessions .s-status { order: 2; }
  table.sessions .s-key { order: 3; flex-basis: 100%; color: var(--text-2); }
  /* On a machine's own page there is no machine column: the key leads. */
  table.sessions tr:not(:has(.s-machine)) .s-key { order: 1; flex: 1 1 auto; flex-basis: auto; font-weight: 500; }
  table.sessions .s-key .sub { display: none; }
  table.sessions .s-from { order: 4; display: flex; gap: 6px; }
  table.sessions .s-from .sub::before { content: "("; } table.sessions .s-from .sub::after { content: ")"; }
  table.sessions .s-account, table.sessions .s-kind, table.sessions .s-started, table.sessions .s-len { order: 5; }
  table.sessions .s-account::before, table.sessions .s-kind::before, table.sessions .s-started::before, table.sessions .s-len::before { content: "· "; }

  table.keys tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 16px; }
  table.keys .k-label { flex: 1 1 auto; }
  table.keys .k-fp { order: 3; flex-basis: 100%; overflow-wrap: anywhere; }
  table.keys .k-added, table.keys .k-used { order: 4; font-size: 13px; color: var(--muted); }
  table.keys .k-cap { display: inline; }
}
@media (max-width: 600px) {
  .page-title { font-size: 25px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
}

/* Enrollment requests on the Machines page. */
.request-row { align-items: flex-start; }
.request-form { margin-top: 12px; display: grid; gap: 8px; max-width: 640px; }
