﻿/* WorthyJoin Host — matte black, list + machine profile */
[hidden] { display: none !important; }

:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --pane: #141414;
  --pane-2: #1a1a1a;
  --ink: #f0f0f0;
  --ink-dim: #a3a3a3;
  --ink-faint: #737373;
  --line: #262626;
  --line-strong: #333333;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --online: #22c55e;
  --offline: #525252;
  --select: #1a2332;
  --danger: #f87171;
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --display: "Outfit", "Plus Jakarta Sans", sans-serif;
  --credit: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  min-height: 100%;
}

/* —— Login —— */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.gate-card {
  width: min(400px, calc(100vw - 32px));
  background: var(--pane);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 28px 26px;
  display: grid;
  gap: 12px;
}
.gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.gate-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.gate-card h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.gate-sub { margin: 0; color: var(--ink-dim); line-height: 1.45; }
.gate-card input {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  background: var(--bg);
  color: var(--ink);
}
.gate-card input::placeholder { color: var(--ink-faint); }
.gate-card input:focus {
  outline: none;
  border-color: var(--accent);
}
.gate-card button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.gate-card button:hover { background: var(--accent-hover); }
.gate-err { margin: 0; color: var(--danger); }

.logo {
  width: 18px;
  height: 18px;
  background: var(--accent);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  flex-shrink: 0;
}
.logo-lg { width: 28px; height: 28px; }

.tenant-chip {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #bfdbfe;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 999px;
  padding: 3px 9px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* —— Shell —— */
.host {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  background: var(--bg);
}

.host-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--line);
}
.host-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-right: 8px;
}
.host-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.05;
}
.host-brand strong {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.mode-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.mode-tab {
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.mode-tab:hover { color: var(--ink); background: #1f1f1f; }
.mode-tab.active {
  color: #fff;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35);
}
.mode-tab[data-mode="support"] { opacity: 0.55; }

.host-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.health {
  color: var(--ink-faint);
  font-size: 11px;
  font-family: var(--mono);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-btn {
  border: 1px solid var(--line-strong);
  background: var(--pane);
  color: var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.tool-btn:hover {
  background: #1f1f1f;
  border-color: #404040;
}

/* —— Body: list | profile —— */
.host-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 0;
}

.list-pane,
.detail {
  min-height: 0;
  overflow: auto;
  background: var(--pane);
}

.list-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--pane);
  border-bottom: 1px solid var(--line);
}

.groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--ink-dim);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
}
.group:hover { color: var(--ink); background: #1f1f1f; }
.group.active {
  color: #fff;
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.35);
}
.group .count {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  background: #0a0a0a;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 1.4em;
  text-align: center;
}
.group.active .count {
  color: #bfdbfe;
  background: rgba(37, 99, 235, 0.3);
}

.list-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
#filter {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  background: var(--bg);
  color: var(--ink);
}
#filter::placeholder { color: var(--ink-faint); }
#filter:focus {
  outline: none;
  border-color: var(--accent);
}
.add-machine-btn {
  flex-shrink: 0;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.add-machine-btn:hover { background: var(--accent-hover); }

.session-list {
  padding: 8px;
  display: grid;
  gap: 2px;
}
.session-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  grid-template-areas:
    "dot name listen"
    "dot meta listen";
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}
.session-row > :nth-child(1) { grid-area: dot; align-self: center; }
.session-row .listen-cell { grid-area: listen; justify-self: end; }
.session-row .name { grid-area: name; }
.session-row .guest,
.session-row .activity {
  grid-area: meta;
  display: none;
}
.session-row .guest { display: block; }
.session-row:hover {
  background: #1a1a1a;
}
.session-row.selected {
  background: var(--select);
  border-color: rgba(59, 130, 246, 0.35);
}
.session-row.offline .name { color: var(--ink-dim); }
.session-row.offline { opacity: 0.85; }
.session-row .name {
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.session-row .guest,
.session-row .activity {
  color: var(--ink-faint);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-row .listen-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}
.session-row .vu {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  width: 22px;
}
.session-row .vu span {
  display: block;
  width: 3px;
  min-height: 2px;
  border-radius: 1px;
  background: #404040;
  transition: height 80ms linear, background 80ms linear;
}
.session-row .vu.hot span { background: #60a5fa; }
.session-row .vu.hot span:nth-child(3),
.session-row .vu.hot span:nth-child(4) { background: #34d399; }
.session-row .btn-listen {
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink-dim);
  border-radius: 8px;
  width: 30px;
  height: 28px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.session-row .btn-listen.on {
  border-color: rgba(59, 130, 246, 0.5);
  color: #93c5fd;
  background: var(--accent-soft);
}
.session-row .btn-listen:hover { border-color: #525252; }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--offline);
  display: inline-block;
}
.dot.on {
  background: var(--online);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

/* ScreenConnect-style machine monitor */
.host-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: #6b7280;
  flex-shrink: 0;
  line-height: 0;
}
.host-ico svg { display: block; }
.host-ico .host-ico-screen {
  fill: currentColor;
  opacity: 0.18;
  stroke: none;
}
.host-ico.on {
  color: var(--online);
  filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.35));
}
.host-ico.on .host-ico-screen {
  opacity: 0.28;
}
.session-row.offline .host-ico {
  color: #4b5563;
  filter: none;
}
.detail-status-line .host-ico {
  vertical-align: -4px;
  margin-right: 4px;
}

.list-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-dim);
  line-height: 1.5;
}

/* —— Detail / profile —— */
.detail {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
}
.detail-empty {
  margin: auto;
  text-align: center;
  color: var(--ink-dim);
  padding: 32px;
}
.detail-empty-art {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--pane);
  border: 1px solid var(--line-strong);
}
.detail-empty p {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.detail-empty span { font-size: 13px; color: var(--ink-faint); }

.detail-body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.detail-back {
  display: none;
  align-self: flex-start;
  margin: 12px 16px 0;
  border: 0;
  background: var(--pane);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--line-strong);
}
.detail-back:hover { background: #1f1f1f; }

.detail-hero {
  padding: 22px 22px 8px;
}
.detail-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.detail-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg);
  border-radius: 999px;
  border: 1px solid var(--line);
}
.dtab {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 650;
  font-size: 13px;
  padding: 7px 14px;
  color: var(--ink-dim);
  border-radius: 999px;
  cursor: default;
}
.dtab.active {
  color: #fff;
  background: #262626;
}

.detail-name {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(26px, 3.2vw, 34px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}
.detail-status-line {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-dim);
  font-weight: 600;
  font-size: 14px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.detail-actions-top { margin-left: auto; }

.join-btn {
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-width: 96px;
}
.join-btn:hover { background: var(--accent-hover); }
.join-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.secondary-btn {
  border: 1px solid var(--line-strong);
  background: var(--pane);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.secondary-btn:hover {
  background: #1f1f1f;
  border-color: #404040;
}

.detail-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  padding: 12px 22px 8px;
}
.info-card {
  background: var(--pane);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.info-card h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.props {
  margin: 0;
  display: grid;
  gap: 8px;
}
.props > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.props > div:last-child { border-bottom: 0; }
.props dt {
  margin: 0;
  color: var(--ink-faint);
  font-weight: 600;
  font-size: 12px;
}
.props dd {
  margin: 0;
  word-break: break-all;
  font-weight: 500;
}
.mono { font-family: var(--mono); font-size: 12px; color: #d4d4d4; }

.detail-key-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.detail-note {
  margin: auto 22px 20px;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.45;
  min-height: 1.2em;
}

.detail-body .warn {
  color: #f59e0b;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #1a1a1a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
}
.modal-card {
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: var(--pane);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  gap: 12px;
  color: var(--ink);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.modal-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: -0.02em;
}
.modal-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-dim);
  padding: 0 4px;
}
.modal-help,
.modal-note {
  margin: 0;
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.45;
}
.modal-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.modal-form input,
.modal-form select {
  flex: 1 1 140px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  background: var(--bg);
  color: var(--ink);
}
.modal-form button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.modal-form button:disabled { opacity: 0.6; cursor: default; }
.enroll-result {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 10px;
}
.enroll-result label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.enroll-code-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.enroll-code-row code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 650;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px;
  color: #e5e5e5;
}
.enroll-advanced {
  border-top: 1px solid rgba(59, 130, 246, 0.2);
  padding-top: 8px;
}
.enroll-advanced summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
  margin-bottom: 8px;
}
.enroll-advanced label { display: block; margin-top: 6px; }
.modal-warn {
  margin: 0;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}
.enroll-list-wrap { display: grid; gap: 6px; }
.enroll-list-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.enroll-list { display: grid; gap: 4px; }
.enroll-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  background: var(--bg);
}
.enroll-empty { color: var(--ink-dim); font-size: 12px; padding: 6px 0; }
.link-btn {
  border: 0;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

@media (max-width: 860px) {
  .host-bar {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 6px;
  }
  .mode-tabs { margin-left: 0; width: 100%; order: 3; }
  .health { display: none; }
  .host-body {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .list-pane,
  .detail {
    min-height: calc(100vh - 90px);
  }
  .detail { display: none; }
  .host-body.show-detail .list-pane { display: none; }
  .host-body.show-detail .detail { display: flex; }
  .detail-back { display: inline-flex; }
  .detail-hero-top { flex-direction: column; align-items: stretch; }
  .detail-actions-top {
    margin-left: 0;
    width: 100%;
  }
  .join-btn, .secondary-btn { flex: 1; }
  .detail-name { font-size: 28px; }
}

@media (min-width: 861px) {
  .session-row {
    grid-template-columns: 14px minmax(0, 1.2fr) minmax(0, 0.9fr) auto;
    grid-template-areas: "dot name meta listen";
  }
  .session-row .guest { display: none; }
  .session-row .activity { display: block; grid-area: meta; }
}
