/* ============================================================================
   Pro UI — DEVICES surface (sessions / signed-in devices).
   Scoped ENTIRELY under #pro-devices so it can never collide with the generic
   chat-slim.css classes (.card/.rail/.head/.drow/.body/.mode/etc.).
   Uses ONLY var(--pro-*) from pro-tokens.css. No external assets — every icon
   is inline SVG in the markup. Ports Desktop/J-Bot Pro UI/devices.html.
   Flag: jbot_pro_ui.devices  (surface shows when window.proFlag('devices')).
   ============================================================================ */

/* ---- surface shell (hidden panel, fills the chat column) ---- */
#pro-devices.pro-surface {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  font-family: var(--pro-font-body);
  color: var(--pro-text);
  background:
    radial-gradient(1200px 700px at 60% -10%, rgba(34, 211, 238, 0.07), transparent 60%),
    var(--pro-base);
  -webkit-font-smoothing: antialiased;
}
#pro-devices[hidden] { display: none; }
#pro-devices *,
#pro-devices *::before,
#pro-devices *::after { box-sizing: border-box; }
#pro-devices .pro-mono { font-family: var(--pro-font-mono); }

/* ---- header ---- */
#pro-devices .pd-head {
  padding: 26px 40px 20px;
  border-bottom: 1px solid rgba(34, 211, 238, 0.08);
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
#pro-devices .pd-htext { flex: 1; min-width: 0; }
#pro-devices .pd-title {
  font-family: var(--pro-font-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: 0.05em;
  color: #eaf6fa;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0;
}
#pro-devices .pd-title svg {
  width: 22px;
  height: 22px;
  stroke: var(--pro-spine-cyan);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
#pro-devices .pd-sub {
  font-size: 13px;
  color: var(--pro-text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* Sign out everywhere — danger ghost button */
#pro-devices .pd-signout {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  flex: none;
  border: 1px solid rgba(240, 85, 95, 0.35);
  color: var(--pro-danger);
  font-family: var(--pro-font-body);
  font-size: 12.5px;
  font-weight: 500;
  background: rgba(240, 85, 95, 0.04);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
#pro-devices .pd-signout:hover {
  background: rgba(240, 85, 95, 0.09);
  border-color: rgba(240, 85, 95, 0.55);
}
#pro-devices .pd-signout svg {
  width: 16px;
  height: 16px;
  stroke: var(--pro-danger);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---- body ---- */
#pro-devices .pd-body { overflow: auto; padding: 26px 40px; }
#pro-devices .pd-wrap { max-width: 720px; }

#pro-devices .pd-glabel {
  font-family: var(--pro-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--pro-study);
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#pro-devices .pd-glabel svg {
  width: 14px;
  height: 14px;
  stroke: var(--pro-study);
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
#pro-devices .pd-glabel .pd-cnt { color: #4a5860; letter-spacing: 0.14em; }

/* ---- card + rows ---- */
#pro-devices .pd-card {
  background: rgba(9, 15, 23, 0.6);
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-radius: 16px;
  overflow: hidden;
}
#pro-devices .pd-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 17px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}
#pro-devices .pd-row:last-child { border-bottom: 0; }
#pro-devices .pd-row.is-current {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.055), transparent 70%);
}
#pro-devices .pd-empty {
  padding: 28px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--pro-text-muted);
}

/* icon tile */
#pro-devices .pd-tile {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(34, 211, 238, 0.15), rgba(34, 211, 238, 0.05));
  border: 1px solid rgba(34, 211, 238, 0.22);
  box-shadow: inset 0 0 14px rgba(34, 211, 238, 0.08);
}
#pro-devices .pd-tile svg {
  width: 23px;
  height: 23px;
  stroke: var(--pro-glow-cyan);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* device info */
#pro-devices .pd-info { min-width: 0; flex: 1; }
#pro-devices .pd-name {
  font-family: var(--pro-font-body);
  font-weight: 600;
  font-size: 15px;
  color: #eef4f8;
  display: flex;
  align-items: center;
  gap: 9px;
}
#pro-devices .pd-name .pd-os {
  font-family: var(--pro-font-body);
  font-weight: 400;
  font-size: 12.5px;
  color: var(--pro-text-muted);
}
#pro-devices .pd-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 7px;
  flex-wrap: wrap;
}
#pro-devices .pd-node {
  font-family: var(--pro-font-mono);
  font-size: 11.5px;
  color: #8ab4bf;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}
#pro-devices .pd-node svg {
  width: 13px;
  height: 13px;
  stroke: #4a5860;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
#pro-devices .pd-node .pd-ip { color: var(--pro-text-faint); }

/* active-when + status dot */
#pro-devices .pd-act {
  font-family: var(--pro-font-mono);
  font-size: 11px;
  color: var(--pro-text-faint);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 6px;
}
#pro-devices .pd-act.is-live { color: var(--pro-success); }
#pro-devices .pd-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pro-success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
  flex: none;
}
#pro-devices .pd-dot.is-idle { background: #4a5860; box-shadow: none; }

/* session token pill */
#pro-devices .pd-tokpill {
  font-family: var(--pro-font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: #8bd8e6;
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 20px;
  padding: 2px 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: none;
}
#pro-devices .pd-tokpill svg {
  width: 11px;
  height: 11px;
  stroke: #4d8f9c;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---- row actions ---- */
#pro-devices .pd-actcell { flex: none; display: flex; align-items: center; }

/* THIS DEVICE badge (current row, no revoke) */
#pro-devices .pd-thisbadge {
  font-family: var(--pro-font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--pro-spine-cyan);
  text-transform: uppercase;
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 20px;
  padding: 6px 12px;
  background: rgba(34, 211, 238, 0.07);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.12);
  display: flex;
  align-items: center;
  gap: 7px;
}
#pro-devices .pd-thisbadge .pd-thisdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pro-success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
}

/* Revoke button (other rows) — danger-soft */
#pro-devices .pd-revoke {
  font-family: var(--pro-font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--pro-danger-soft);
  letter-spacing: 0.02em;
  border: 1px solid rgba(240, 85, 95, 0.28);
  border-radius: 9px;
  padding: 7px 14px;
  background: rgba(240, 85, 95, 0.03);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
#pro-devices .pd-revoke:hover {
  background: rgba(240, 85, 95, 0.08);
  border-color: rgba(240, 85, 95, 0.45);
}
#pro-devices .pd-revoke[disabled] { opacity: 0.5; cursor: default; }
#pro-devices .pd-revoke svg {
  width: 13px;
  height: 13px;
  stroke: var(--pro-danger-soft);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---- footer ---- */
#pro-devices .pd-foot {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--pro-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #4a5860;
}
#pro-devices .pd-foot svg {
  width: 14px;
  height: 14px;
  stroke: #3e4b53;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* narrow-viewport / mobile fallback (chat column can be phone-width) */
@media (max-width: 640px) {
  #pro-devices .pd-head { padding: 20px 18px 16px; flex-direction: column; gap: 14px; }
  #pro-devices .pd-signout { align-self: flex-start; }
  #pro-devices .pd-body { padding: 18px; }
  #pro-devices .pd-row { flex-wrap: wrap; gap: 12px; }
  #pro-devices .pd-actcell { margin-left: auto; }
}
