/* ===========================================================
   BlackNode /workspace — page styles on tokens-v3
   =========================================================== */

/* CRITICAL: ensure hidden attr beats .ws-state display:flex */
[hidden] { display: none !important; }

.ws-body {
  min-height: 100vh;
  background: var(--bn-bg-page);
  color: var(--bn-ink);
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  margin: 0;
}

/* ---------- TOPNAV ---------- */
.ws-topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bn-bg-page);
  border-bottom: 1px solid var(--bn-border);
}
.ws-topnav__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--bn-ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  min-height: 36px;
  padding: 6px 8px 6px 4px;
  margin: -6px 0 -6px -4px;
  border-radius: 8px;
  transition: background 0.16s;
}
.ws-topnav__brand:hover { background: var(--bn-surface-1); }
.ws-topnav__brand:focus-visible {
  outline: 2px solid var(--bn-accent);
  outline-offset: 2px;
}
.ws-topnav__right { display: inline-flex; gap: 10px; align-items: center; }
.ws-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--bn-border);
  background: var(--bn-surface-1);
  color: var(--bn-ink);
  font: 600 13px/1 'Geist', system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 0.16s;
}
.ws-avatar:hover { border-color: var(--bn-accent); }
.ws-avatar:focus-visible {
  outline: 2px solid var(--bn-accent);
  outline-offset: 2px;
}

.ws-main {
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* ---------- STATE wrappers ---------- */
.ws-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  max-width: 900px;
  margin: 0 auto;
}
.ws-state__title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 24px 0 12px;
  color: var(--bn-ink);
}
.ws-state__desc {
  font-size: 17px;
  color: var(--bn-ink-muted);
  max-width: 560px;
  line-height: 1.55;
  margin: 0 0 32px;
}
.ws-state__hint {
  color: var(--bn-ink-muted);
  margin-top: 16px;
}
.ws-state__note {
  font-size: 13px;
  color: var(--bn-ink-muted);
  margin-top: 24px;
}

/* ---------- SPINNER ---------- */
.ws-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--bn-border);
  border-top-color: var(--bn-accent);
  border-radius: 50%;
  animation: ws-spin 0.9s linear infinite;
}
@keyframes ws-spin { to { transform: rotate(360deg); } }

/* ---------- PLAN CARDS ---------- */
.ws-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 900px;
  margin: 0 0 16px;
}
.ws-plan {
  position: relative;
  text-align: left;
  background: var(--bn-surface-1);
  border: 1.5px solid var(--bn-border);
  border-radius: var(--bn-radius-lg, 16px);
  padding: 24px 22px;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.16s, box-shadow 0.16s;
  font: inherit;
  color: inherit;
}
.ws-plan:hover {
  transform: translateY(-3px);
  border-color: var(--bn-accent);
  box-shadow: 0 12px 32px -12px rgba(233, 75, 44, 0.25);
}
.ws-plan:focus-visible,
.ws-plan:focus {
  outline: 2px solid var(--bn-accent);
  outline-offset: 3px;
  border-color: var(--bn-accent);
}
.ws-plan:focus:not(:focus-visible) {
  /* tone down mouse-only focus */
  outline-offset: 2px;
  outline-color: var(--bn-accent-glow);
}
.ws-plan--featured {
  border-color: var(--bn-accent);
  background: linear-gradient(180deg, var(--bn-surface-1) 0%, rgba(233, 75, 44, 0.04) 100%);
}
.ws-plan__badge {
  position: absolute;
  top: -10px; left: 22px;
  background: var(--bn-accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ws-plan__name { font-size: 14px; font-weight: 500; color: var(--bn-ink-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.ws-plan__price { font-size: 36px; font-weight: 600; margin: 6px 0 14px; letter-spacing: -0.02em; }
.ws-plan__price span { font-size: 14px; font-weight: 400; color: var(--bn-ink-muted); margin-left: 4px; }
.ws-plan__perks { list-style: none; padding: 0; margin: 0 0 16px; }
.ws-plan__perks li { font-size: 14px; padding: 5px 0; color: var(--bn-ink); border-top: 1px solid var(--bn-border); }
.ws-plan__perks li:first-child { border-top: 0; }
.ws-plan__cta {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--bn-accent);
  margin-top: 8px;
}

/* ---------- PROGRESS LOG ---------- */
.ws-progress {
  margin-top: 24px;
  width: 100%;
  max-width: 480px;
  background: var(--bn-surface-1);
  border: 1px solid var(--bn-border);
  border-radius: 10px;
  padding: 16px;
  font-family: 'Geist Mono', monospace;
  font-size: 13px;
  color: var(--bn-ink-muted);
  text-align: left;
  max-height: 180px;
  overflow-y: auto;
}
.ws-progress__line {
  padding: 3px 0;
  animation: ws-progress-line-in 0.28s cubic-bezier(0.16,1,0.3,1);
}
.ws-progress__line::before { content: '› '; color: var(--bn-accent); }
@keyframes ws-progress-line-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .ws-progress__line { animation: none !important; }
}

/* ---------- READY (iframe) ---------- */
.ws-ready {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bn-surface-1);
}
.ws-ready__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--bn-border);
  background: var(--bn-surface-2);
}
.ws-ready__title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500;
  font-family: 'Geist Mono', monospace;
}
.ws-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ws-status-dot--green { background: #19c37d; box-shadow: 0 0 6px rgba(25, 195, 125, 0.5); }
.ws-ready__plan {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bn-bg-page);
  border: 1px solid var(--bn-border);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--bn-ink-muted);
}
.ws-ready__actions { display: flex; gap: 6px; }
.ws-iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #0f0e0c;
}

/* fullscreen */
.ws-ready:fullscreen { background: var(--bn-surface-1); }

/* ---------- ERROR ---------- */
.ws-error-icon {
  font-size: 56px;
  color: var(--bn-accent);
  margin-bottom: 8px;
}

/* ---------- ICON BUTTON (header actions) ---------- */
.bn-icon-btn {
  width: 30px; height: 30px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--bn-ink-muted);
  cursor: pointer;
  font-size: 16px;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.bn-icon-btn:hover { background: var(--bn-surface-1); color: var(--bn-ink); border-color: var(--bn-border); }
.bn-icon-btn:focus-visible,
.bn-icon-btn:focus {
  outline: 2px solid var(--bn-accent);
  outline-offset: 2px;
  color: var(--bn-ink);
}
.bn-icon-btn:focus:not(:focus-visible) {
  outline: 1px solid var(--bn-border-strong);
}

/* ---------- MODAL OVERLAY (workspace password) ---------- */
.bn-modal-overlay {
  position: fixed; inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(26, 24, 21, 0.42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 100;
  animation: bn-modal-overlay-in 0.18s cubic-bezier(0.16,1,0.3,1);
}
.bn-modal-overlay[hidden] { display: none !important; }
.bn-modal {
  width: min(540px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bn-bg-page);
  border: 1px solid var(--bn-border);
  border-radius: 18px;
  box-shadow: 0 24px 64px -20px rgba(0,0,0,0.28);
  animation: bn-modal-in 0.24s cubic-bezier(0.16,1,0.3,1);
}
@keyframes bn-modal-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes bn-modal-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .bn-modal-overlay, .bn-modal { animation: none !important; }
}
.bn-modal__header {
  padding: 24px 28px 12px;
  border-bottom: 1px solid var(--bn-border-soft);
}
.bn-modal__header h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--bn-ink);
}
.bn-modal__header p {
  margin: 0;
  font-size: 14px;
  color: var(--bn-ink-muted);
  line-height: 1.55;
}
.bn-modal__body { padding: 20px 28px; }
.bn-modal__footer {
  padding: 16px 28px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- PASSWORD MODAL ---------- */
.bn-modal--password {
  max-width: 540px;
}
.ws-password-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--bn-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ws-password-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 14px 16px;
  background: var(--bn-bg-page);
  border: 1.5px solid var(--bn-border);
  border-radius: 12px;
}
.ws-password-row code {
  flex: 1;
  font-size: 15px;
  font-family: 'Geist Mono', monospace;
  color: var(--bn-ink);
  word-break: break-all;
  user-select: all;
}
.ws-password-warn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: #c4501e;
  background: rgba(233, 75, 44, 0.08);
  border: 1px solid rgba(233, 75, 44, 0.2);
  border-radius: 10px;
  padding: 10px 14px;
}

/* ---------- DARK THEME OVERRIDES ---------- */
[data-theme="dark"] .ws-ready__header { background: rgba(255, 255, 255, 0.02); }
[data-theme="dark"] .ws-iframe { background: #1e1e1e; }
[data-theme="dark"] .ws-password-warn { color: #ff8c5a; background: rgba(233, 75, 44, 0.12); }

/* ---------- MOBILE ---------- */
@media (max-width: 720px) {
  .ws-plans { grid-template-columns: 1fr; }
  .ws-state__title { font-size: 26px; }
  .ws-ready__header { flex-wrap: wrap; gap: 8px; }
}
