/* Access Edge operator UI — dark hub + bento site dashboard. */
:root {
  --ink: #e8eaed;
  --ink-strong: #f5f6f7;
  --muted: #9aa3ad;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --surface: #171b22;
  --surface-2: #1e242e;
  --canvas: #0e1116;
  --canvas-glow: #161b24;
  --accent: #d9dee7;
  --accent-ink: #0e1116;
  --ok: #3dbe74;
  --deny: #e35d5d;
  --warn: #d4a017;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --font: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --display: "Outfit", "IBM Plex Sans", sans-serif;
  font-family: var(--font);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 12% -8%, #1c2430 0%, transparent 55%),
    radial-gradient(700px 360px at 100% 0%, #182028 0%, transparent 50%),
    linear-gradient(180deg, var(--canvas-glow), var(--canvas));
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 17, 22, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brand-link {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.crumb a:hover { color: var(--ink-strong); }
.crumb-sep { opacity: 0.45; }

.kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3 {
  margin: 0.15rem 0 0;
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink-strong);
}

.lede {
  color: var(--muted);
  margin: 0.6rem 0 0;
  max-width: 34rem;
  line-height: 1.5;
}

.section-hint {
  margin: 0.35rem 0 1rem;
  font-size: 0.9rem;
}

.muted { color: var(--muted); }

.session-bar {
  display: flex;
  gap: 12px;
  align-items: center;
}

button {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  margin-right: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

button.danger {
  background: transparent;
  color: #9b1c1c;
  border: 1px solid #c45c5c;
}

button.danger:hover {
  background: rgba(155, 28, 28, 0.08);
}

button.compact {
  padding: 6px 10px;
  font-size: 0.85rem;
  margin: 0;
  font-weight: 500;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn-row button { margin-right: 0; }

input {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
  background: #12161d;
  color: var(--ink);
  font: inherit;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.error {
  margin: 0.75rem 0 0;
  color: var(--deny);
  font-size: 0.85rem;
}

.empty-note { margin-top: 1rem; }

.view {
  padding: 28px 32px 48px;
  animation: rise 280ms ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-intro h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

/* Sites hub tiles */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.site-tile {
  display: grid;
  gap: 8px;
  padding: 20px;
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease;
  min-height: 160px;
}

.site-tile:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.site-tile-top {
  display: flex;
  justify-content: flex-end;
}

.pill {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.pill.ok {
  color: var(--ok);
  border-color: rgba(61, 190, 116, 0.35);
  background: rgba(61, 190, 116, 0.08);
}

.pill.off {
  color: var(--deny);
  border-color: rgba(227, 93, 93, 0.35);
  background: rgba(227, 93, 93, 0.08);
}

.site-tile-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

.site-tile-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  flex: 1;
}

.site-destroy-btn {
  flex-shrink: 0;
  font-size: 0.78rem;
  padding: 6px 10px;
}

.arrow {
  color: var(--ink);
  opacity: 0.7;
}

/* Site dashboard hero + status chips */
.site-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.site-hero h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
}

.status-widgets {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 10px;
}

.status-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 96px;
}

.status-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.status-value {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
}

.status-value.ok { color: var(--ok); }
.status-value.bad { color: var(--deny); }
.status-value.warn { color: var(--warn); }

/* Bento tiles */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.bento-tile {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
  min-height: 188px;
  padding: 18px 18px 14px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #222833 0%, #171c25 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.bento-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(160deg, #273041 0%, #1a202b 100%);
}

.bento-tile.is-placeholder {
  opacity: 0.72;
}

.bento-tile.is-placeholder:hover {
  opacity: 0.9;
}

.bento-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: #c6ced8;
}

.tile-icon-svg {
  width: 22px;
  height: 22px;
}

.bento-tile h2 {
  font-size: 1.15rem;
}

.bento-tile p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.bento-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

/* Feature panels */
.panel-header {
  margin-bottom: 18px;
}

.back-link {
  display: inline-block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 10px;
}

.back-link:hover { color: var(--ink-strong); }

.panel-body {
  max-width: 760px;
}

.panel-body.panel-states,
.panel-body.panel-live-events {
  max-width: 1100px;
}

.card-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.stub-card {
  text-align: left;
}

.stub-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px dashed var(--line-strong);
  color: var(--warn);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Credentials */
.people-list .person-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.person-meta {
  display: grid;
  gap: 2px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
}

.badge.ok {
  color: var(--ok);
  border-color: rgba(61, 190, 116, 0.35);
  background: rgba(61, 190, 116, 0.08);
}

.badge.off {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.badge.warn {
  color: var(--warn);
  border-color: rgba(212, 160, 23, 0.35);
  background: rgba(212, 160, 23, 0.08);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.person-form {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.person-form label {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check {
  display: flex !important;
  align-items: center;
  gap: 8px;
  grid-template-columns: none !important;
}

.check input {
  width: auto;
  min-width: 0;
}

/* Swipe feed */
.events-list .event-row {
  display: grid;
  gap: 2px;
  padding: 10px 0 10px 12px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
}

.events-list .event-row.granted { border-left-color: var(--ok); }
.events-list .event-row.denied { border-left-color: var(--deny); }
.events-list .event-row.controller { border-left-color: #7f8ea3; }

.events-list time {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Standalone login (light panel on dark canvas) */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(1000px 480px at 8% -12%, #243041 0%, transparent 55%),
    linear-gradient(180deg, #12161d 0%, var(--canvas) 100%);
  display: grid;
  place-items: center;
  padding: 24px;
  font-family: var(--font);
}

.login-shell {
  width: min(440px, 100%);
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  font-family: var(--display);
}

.login-stack {
  display: grid;
  gap: 12px;
}

.login-stack label {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
}

.login-stack button {
  margin-top: 4px;
  margin-right: 0;
  width: 100%;
}

@media (max-width: 1100px) {
  .tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar, .view {
    padding-left: 16px;
    padding-right: 16px;
  }

  .status-widgets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .tile-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .people-list .person-row {
    flex-direction: column;
  }
}

.top-nav {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto;
  margin-right: 12px;
}

.top-nav-link {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
}

.top-nav-link:hover {
  color: var(--ink-strong);
  background: rgba(255, 255, 255, 0.04);
}

.owner-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 18px;
}

.owner-tab {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.owner-tab.is-active {
  color: var(--ink-strong);
  border-color: var(--accent, #5b8def);
  background: rgba(91, 141, 239, 0.08);
}

.owner-pane {
  margin-top: 4px;
}

.platform-toolbar {
  display: flex;
  gap: 16px;
  align-items: end;
  margin: 8px 0 20px;
}

.filter-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.filter-label select {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
}

.platform-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.platform-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.platform-host {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.15rem;
}

.platform-meta {
  margin: 0;
  font-size: 0.88rem;
}

.platform-row-side {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.status-pill.status-pending {
  color: var(--warn);
  border-color: rgba(212, 160, 23, 0.45);
}

.status-pill.status-active {
  color: var(--ok);
  border-color: rgba(61, 190, 116, 0.45);
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
  }

  .top-nav {
    order: 3;
    width: 100%;
    margin: 0;
  }

  .platform-row {
    flex-direction: column;
    align-items: stretch;
  }

  .device-grid {
    grid-template-columns: 1fr;
  }

  .node-card-toggle {
    flex-wrap: wrap;
  }

  .health-table-wrap {
    overflow-x: auto;
  }
}

/* ——— States (PDK-style) ——— */
.states-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.states-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px 10px 0 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.states-tab.is-active {
  color: var(--ink-strong);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 -2px 0 var(--ok);
}

.node-card {
  background: #141820;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  overflow: visible;
}

.node-card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #1a2029;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.node-chevron {
  color: var(--muted);
  width: 1rem;
}

.node-card-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.node-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
}

.node-id {
  font-size: 0.8rem;
}

.node-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.node-count {
  color: var(--muted);
  font-size: 0.85rem;
  margin-right: 4px;
}

.node-card-body {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.states-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.states-pill.connected,
.states-pill.synced,
.states-pill.closed,
.states-pill.locked {
  color: #3dbe74;
  border-color: rgba(61, 190, 116, 0.4);
  background: rgba(61, 190, 116, 0.1);
}

.states-pill.unlocked,
.states-pill.pending {
  color: #e0a84a;
  border-color: rgba(224, 168, 74, 0.45);
  background: rgba(224, 168, 74, 0.12);
}

.states-pill.forced,
.states-pill.disconnected,
.states-pill.bad {
  color: #e35d5d;
  border-color: rgba(227, 93, 93, 0.45);
  background: rgba(227, 93, 93, 0.12);
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.device-tile {
  position: relative;
  background: #1b222c;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.device-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.device-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #9eb0c4;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}

.device-icon svg {
  width: 22px;
  height: 22px;
}

.device-name {
  margin: 4px 0 0;
  font-size: 1rem;
}

.device-type {
  margin: 0;
  font-size: 0.8rem;
}

.device-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

.kebab-wrap {
  position: relative;
}

.kebab-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 8px;
}

.kebab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-strong);
}

.kebab-menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 5;
  min-width: 160px;
  padding: 6px;
  background: #12161d;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
}

.kebab-menu[hidden] {
  display: none;
}

.kebab-item {
  background: transparent;
  border: none;
  color: var(--ink);
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.kebab-item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

.kebab-item:disabled {
  color: var(--muted);
  opacity: 0.55;
  cursor: not-allowed;
}

.states-command-result {
  margin-top: 12px;
}

.health-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.health-table th,
.health-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.health-table th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
  background: #161b24;
}

.health-table tr:last-child td {
  border-bottom: none;
}

.health-status.ok { color: var(--ok); }
.health-status.warn { color: var(--warn); }
.health-status.bad { color: var(--deny); }

/* ——— Live Events ——— */
.live-events-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.live-events-toolbar .section-hint {
  margin: 0;
  max-width: 40rem;
}

.live-events-status {
  margin-top: 10px;
  font-size: 0.8rem;
}

