/* PostWatch Access v4 — clear personal activation and managed-station entry.
   Load after postwatch-unified-v4.css. Auth v2 injects its base rules at boot;
   the gated selectors below intentionally carry enough specificity to remain
   the final visual layer without changing authentication behavior. */

body.pwauth-gated #app-root { width: 100%; margin: 0; padding: 0; min-height: 100vh; min-height: 100dvh; }

body.pwauth-gated .pwauth-shell {
  min-height: 100vh; min-height: 100dvh;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  background: var(--pw-bg, #fafaf7);
}

body.pwauth-gated .pwauth-welcome {
  position: relative;
  justify-content: flex-end;
  min-width: 0;
  padding: clamp(36px, 5.5vw, 84px);
  overflow: hidden;
  background: #0a2644;
  isolation: isolate;
}

body.pwauth-gated .pwauth-welcome::before {
  position: absolute;
  z-index: -2;
  inset: clamp(20px, 3vw, 42px);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 26px;
  content: "";
}

body.pwauth-gated .pwauth-welcome::after {
  position: absolute;
  z-index: -1;
  left: clamp(30px, 6vw, 96px);
  top: 12%;
  color: rgba(255, 255, 255, .055);
  content: "POST\A WATCH";
  font-size: clamp(94px, 12vw, 210px);
  font-weight: 900;
  letter-spacing: -.095em;
  line-height: .69;
  white-space: pre;
}

body.pwauth-gated .pwauth-brand {
  position: absolute;
  z-index: 3;
  left: clamp(36px, 5.5vw, 84px);
  top: clamp(34px, 5vw, 74px);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  margin: 0;
}

body.pwauth-gated .pwauth-brand strong { color: #fff; font-size: 22px; }
body.pwauth-gated .pwauth-brand-copy > span { color: #c9d9e8; font-size: .875rem; }
body.pwauth-gated .pwauth-welcome h1 { position: relative; z-index: 2; max-width: 560px; color: #fff; font-size: clamp(40px, 4vw, 64px); }
body.pwauth-gated .pwauth-welcome > p { position: relative; z-index: 2; max-width: 540px; color: #d8e5f1; font-size: clamp(17px, 1.5vw, 21px); }
body.pwauth-gated .pwauth-points { position: relative; z-index: 2; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 650px; margin-top: 32px; }

body.pwauth-gated .pwauth-points li {
  min-width: 0;
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  background: rgba(255, 255, 255, .075);
  color: #f5f8fc;
  font-size: 15px;
}

body.pwauth-gated .pwauth-point-icon {
  width: 30px;
  height: 30px;
  background: #e7edf5;
  color: #0a2644;
  font-size: 14px;
}

body.pwauth-gated .pwauth-panel {
  align-items: center;
  padding: clamp(28px, 5vw, 72px);
  background: var(--pw-bg, #fafaf7);
}

body.pwauth-gated .pwauth-card {
  width: min(100%, 540px);
  padding: clamp(28px, 4vw, 46px);
  border-color: var(--pw-border, #e8e6e0);
  border-radius: 24px;
  background: var(--pw-surface, #fff);
  box-shadow: var(--pw-shadow-2, 0 24px 54px -34px rgba(20, 20, 15, .34));
}

body.pwauth-gated .pwauth-card h2 { font-size: clamp(1.75rem, 2.5vw, 2.25rem); overflow-wrap: anywhere; }
body.pwauth-gated .pwauth-lead { margin-bottom: 22px; color: var(--pw-text-muted, #6b6862); font-size: 1rem; }

body.pwauth-gated .pwauth-lanes {
  gap: 4px;
  padding: 4px;
  border-color: var(--pw-border, #e8e6e0);
  background: var(--pw-surface-muted, #f4f3ee);
}

body.pwauth-gated .pwauth-lane { min-height: 50px; background: transparent; color: var(--pw-text-muted, #6b6862); font-size: 16px; }
body.pwauth-gated .pwauth-lane[aria-selected="true"] { background: var(--pw-surface, #fff); color: var(--pw-text, #14140f); box-shadow: var(--pw-shadow-1); }
body.pwauth-gated .pwauth-field input { border-color: var(--pw-border-strong, #d2cfc6); background: var(--pw-surface, #fff); color: var(--pw-text, #14140f); }
body.pwauth-gated .pwauth-field input:hover { border-color: var(--pw-steel-600, #536a80); }

body.pwauth-gated .pwauth-primary {
  border-color: var(--pw-primary, #0f2a4a);
  background: var(--pw-primary, #0f2a4a);
  color: var(--pw-on-primary, #fff);
}

body.pwauth-gated .pwauth-primary:hover:not(:disabled) { border-color: var(--pw-primary-hover, #163a61); background: var(--pw-primary-hover, #163a61); color: var(--pw-on-primary, #fff); }
body.pwauth-gated .pwauth-show { background: var(--pw-surface-muted, #f4f3ee); color: var(--pw-text, #14140f); }
body.pwauth-gated .pwauth-security-note { color: var(--pw-text-subtle, #6b6558); }

.pwaccess-activation {
  margin-top: 16px;
  border: 1px solid var(--pw-border, #e8e6e0);
  border-radius: 14px;
  background: var(--pw-surface-muted, #f4f3ee);
}

.pwaccess-activation summary {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  color: var(--pw-text, #14140f);
  cursor: pointer;
  font-size: 16px;
  font-weight: 750;
  list-style: none;
}

.pwaccess-activation summary::-webkit-details-marker { display: none; }
.pwaccess-activation summary::before { color: var(--pw-gold-ink, #8a6112); content: "01"; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: .06em; }
.pwaccess-activation summary::after { margin-left: auto; color: var(--pw-text-muted, #6b6862); content: "+"; font-size: 22px; line-height: 1; }
.pwaccess-activation[open] summary::after { content: "−"; }
.pwaccess-activation__body { padding: 0 16px 16px; color: var(--pw-text-muted, #6b6862); font-size: 15px; line-height: 1.55; }
.pwaccess-activation__body p { margin: 0; }
.pwaccess-activation__body ol { display: grid; gap: 8px; margin: 12px 0 0; padding-left: 22px; }
.pwaccess-activation__body strong { color: var(--pw-text, #14140f); }

.pwaccess-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.pwaccess-progress li {
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: var(--pw-surface-muted, #f4f3ee);
  color: var(--pw-text-muted, #6b6862);
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.35;
}

.pwaccess-progress li.is-done { color: var(--pw-success, #157347); }
.pwaccess-progress li.is-current { background: var(--pw-primary, #0f2a4a); color: var(--pw-on-primary, #fff); }
.pwaccess-progress b { display: block; margin-bottom: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .875rem; letter-spacing: .04em; }

.pwaccess-recovery-layer {
  position: fixed;
  inset: 0;
  z-index: 16000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 18, 32, .66);
}

.pwaccess-recovery {
  width: min(100%, 500px);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: clamp(24px, 5vw, 34px);
  border: 1px solid var(--pw-border, #e8e6e0);
  border-radius: 22px;
  background: var(--pw-surface-raised, #fff);
  color: var(--pw-text, #14140f);
  box-shadow: var(--pw-shadow-overlay, 0 30px 90px rgba(5, 18, 32, .3));
}

.pwaccess-recovery__head { display: grid; grid-template-columns: minmax(0, 1fr) 48px; align-items: start; gap: 16px; }
.pwaccess-recovery h2 { margin: 0; font-size: clamp(27px, 5vw, 36px); line-height: 1.12; }
.pwaccess-recovery__head button { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--pw-border, #e8e6e0); border-radius: 12px; background: var(--pw-surface, #fff); color: var(--pw-text, #14140f); cursor: pointer; font-size: 24px; }
.pwaccess-recovery > p { margin: 10px 0 22px; color: var(--pw-text-muted, #6b6862); font-size: 16px; }
.pwaccess-recovery label { display: block; color: var(--pw-text, #14140f); font-size: 16px; font-weight: 750; }
.pwaccess-recovery input { width: 100%; min-height: 54px; margin-top: 8px; padding: 10px 14px; border: 2px solid var(--pw-border-strong, #d2cfc6); border-radius: 12px; background: var(--pw-surface, #fff); color: var(--pw-text, #14140f); font: inherit; font-size: 17px; }
.pwaccess-recovery__status { min-height: 25px; margin: 13px 0 0; color: var(--pw-text-muted, #6b6862); font-size: 15px; }
.pwaccess-recovery__status.is-error { color: var(--pw-danger, #b42318); }
.pwaccess-recovery__actions { display: grid; grid-template-columns: auto minmax(180px, 1fr); gap: 10px; margin-top: 18px; }

html.dark body.pwauth-gated .pwauth-welcome { background: #0b1725; }
html.dark body.pwauth-gated .pwauth-welcome::before { border-color: rgba(190, 214, 238, .2); }
html.dark body.pwauth-gated .pwauth-welcome::after { color: rgba(201, 217, 232, .06); }
html.dark body.pwauth-gated .pwauth-points li { border-color: rgba(190, 214, 238, .22); background: rgba(190, 214, 238, .08); }
html.dark body.pwauth-gated .pwauth-status--error { border-color: #6b2c2c; background: #2c1411; color: #ffb4ac; }
html.dark body.pwauth-gated .pwauth-mode { background: #2a2110; color: #f2cb78; }
html.dark .pwaccess-recovery-layer { background: rgba(0, 0, 0, .76); }

/* Sign-in remains one focused form on medium screens. A compact brand row
   leaves space for the task without assigning implicit grid rows to fields. */
@media (max-width: 1199px) {
  body.pwauth-gated .pwauth-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  body.pwauth-gated .pwauth-welcome { min-height: 88px; padding: max(20px, env(safe-area-inset-top)) 32px 20px; justify-content: center; }
  body.pwauth-gated .pwauth-brand { position: relative; inset: auto; }
  body.pwauth-gated .pwauth-welcome::before,
  body.pwauth-gated .pwauth-welcome::after,
  body.pwauth-gated .pwauth-welcome h1,
  body.pwauth-gated .pwauth-welcome > p,
  body.pwauth-gated .pwauth-points { display: none; }
  body.pwauth-gated .pwauth-panel { align-items: flex-start; padding: 40px 24px max(40px, env(safe-area-inset-bottom)); }
  body.pwauth-gated .pwauth-card { width: min(100%, 540px); }
}

@media (max-width: 767px) {
  body.pwauth-gated .pwauth-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  body.pwauth-gated .pwauth-welcome { min-height: 80px; justify-content: center; padding: max(18px, env(safe-area-inset-top)) 20px 16px; }
  body.pwauth-gated .pwauth-welcome::before { inset: 10px; border-radius: 18px; }
  body.pwauth-gated .pwauth-welcome::after,
  body.pwauth-gated .pwauth-welcome h1,
  body.pwauth-gated .pwauth-welcome > p,
  body.pwauth-gated .pwauth-points { display: none; }
  body.pwauth-gated .pwauth-brand { position: relative; inset: auto; grid-template-columns: 1fr; gap: 0; }
  body.pwauth-gated .pwauth-brand strong { font-size: 20px; }
  body.pwauth-gated .pwauth-panel { align-items: flex-start; padding: 16px 12px max(24px, env(safe-area-inset-bottom)); }
  body.pwauth-gated .pwauth-card { width: 100%; padding: 22px 18px; border-radius: 18px; }
  body.pwauth-gated .pwauth-card h2 { font-size: 1.75rem; }
  body.pwauth-gated .pwauth-lead { margin: 8px 0 16px; font-size: 1rem; }
  .pwaccess-progress { gap: 5px; }
  .pwaccess-progress li { padding: 8px 6px; font-size: .875rem; }
  .pwaccess-recovery-layer { align-items: end; padding: 0; }
  .pwaccess-recovery { width: 100%; max-height: min(86vh, 720px); max-height: min(86dvh, 720px); padding: 24px 18px max(22px, env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
  .pwaccess-recovery__actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .pwaccess-recovery-layer *,
  body.pwauth-gated .pwauth-shell * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
  body.pwauth-gated .pwauth-welcome::before,
  .pwaccess-activation,
  .pwaccess-recovery { border: 1px solid CanvasText; }
}

/* Shared task states retain the same readable form rhythm at enlarged text. */
body.pwauth-gated .pwauth-card { min-width: 0; }
body.pwauth-gated .pwauth-field label,
body.pwauth-gated .pwauth-field input,
body.pwauth-gated .pwauth-show,
body.pwauth-gated .pwauth-primary,
body.pwauth-gated .pwauth-secondary,
body.pwauth-gated .pwauth-role,
body.pwauth-gated .pwauth-text-button { font-size: 1rem; }
body.pwauth-gated .pwauth-field input { min-height: 54px; padding-top: 12px; padding-bottom: 12px; }
body.pwauth-gated .pwauth-help,
body.pwauth-gated .pwauth-security-note { font-size: .875rem; }
body.pwauth-gated .pwauth-text-button { color: var(--pw-accent, #0b6765); }
body.pwauth-gated .pwauth-role { display: grid; gap: 4px; padding: 15px 16px; border-width: 1px; }
body.pwauth-gated .pwauth-role small { font-size: .875rem; line-height: 1.45; font-weight: 400; }
body.pwauth-gated .pwauth-role:hover { border-color: var(--pw-accent, #0b6765); background: var(--pw-surface-muted); }
body.pwauth-gated .pwauth-state-icon { background: var(--pw-surface-muted); color: var(--pw-accent, #0b6765); border: 1px solid var(--pw-border); width: 52px; height: 52px; border-radius: 14px; }
.pwauth-spinner { display: block; width: 24px; height: 24px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: pwauth-spin 1s linear infinite; }
.pwauth-loading-line { width: 100%; height: 4px; margin-top: 24px; border-radius: 4px; background: var(--pw-surface-muted); overflow: hidden; }
.pwauth-loading-line::after { content: ''; display: block; width: 36%; height: 100%; border-radius: inherit; background: var(--pw-accent, #0b6765); animation: pwauth-progress 1.5s ease-in-out infinite alternate; }
.pwauth-connectivity { display: grid; gap: 5px; margin-bottom: 22px; padding: 14px; border: 1px solid var(--pw-border-strong); border-radius: 10px; background: var(--pw-surface-muted); color: var(--pw-text); font-size: .875rem; line-height: 1.5; }
.pwauth-connectivity[hidden] { display: none; }
.pwauth-connectivity span { color: var(--pw-text-muted); }
.pwaccess-progress { gap: 8px; }
.pwaccess-progress li { overflow-wrap: anywhere; }
.pwaccess-recovery :focus-visible,
.pwaccess-activation summary:focus-visible { outline: 3px solid var(--pw-focus, #0b6765); outline-offset: 3px; }
.pwaccess-recovery input { font-size: 1rem; }
.pwaccess-recovery__actions > button { margin-top: 0; font-size: 1rem; }
@media (max-width: 767px) {
  body.pwauth-gated .pwauth-brand strong { font-size: 1.125rem; }
  body.pwauth-gated .pwauth-brand-copy > span { font-size: .875rem; letter-spacing: .04em; }
  body.pwauth-gated .pwauth-panel { padding: 16px 16px max(24px, env(safe-area-inset-bottom)); }
  body.pwauth-gated .pwauth-card { padding: 24px 20px; border-radius: 16px; box-shadow: none; }
}
@media (max-height: 540px) {
  body.pwauth-gated .pwauth-panel { align-items: flex-start; }
  .pwaccess-recovery { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
}
@keyframes pwauth-spin { to { transform: rotate(360deg); } }
@keyframes pwauth-progress { to { transform: translateX(175%); } }
@media (prefers-reduced-motion: reduce) { .pwauth-spinner, .pwauth-loading-line::after { animation: none; } }

/* Account directory: search remains the main task; occasional tools unfold. */
html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-account-head h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); }
html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-account-head p { font-size: 1rem; line-height: 1.5; }
html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-actions { align-items: start; }
.pwauth-account-tools { min-width: 0; position: relative; }
.pwauth-account-tools > summary,
.pwauth-account-help > summary,
.pwaa-admin-disclosure > summary { min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 11px 14px; border: 1px solid var(--pw-border-strong); border-radius: 10px; background: var(--pw-surface); color: var(--pw-text); font-size: 1rem; font-weight: 650; line-height: 1.4; cursor: pointer; list-style: none; }
.pwauth-account-tools > summary::after,
.pwauth-account-help > summary::after,
.pwaa-admin-disclosure > summary::after { content: '+'; margin-left: auto; }
.pwauth-account-tools[open] > summary::after,
.pwauth-account-help[open] > summary::after,
.pwaa-admin-disclosure[open] > summary::after { content: '−'; }
.pwauth-account-tools > summary::-webkit-details-marker,
.pwauth-account-help > summary::-webkit-details-marker,
.pwaa-admin-disclosure > summary::-webkit-details-marker { display: none; }
.pwauth-account-tools > div { display: grid; gap: 8px; margin-top: 8px; }
.pwauth-account-tools a { display: flex; align-items: center; text-decoration: none; }
.pwauth-account-help { margin-top: 16px; }
.pwauth-account-help > summary { border: 0; background: transparent; font-size: .875rem; font-weight: 500; justify-content: flex-start; padding-inline: 0; }
.pwauth-account-help > summary::after { margin-left: 0; }
.pwauth-account-help .pwauth-admin-note { margin-top: 0; }
.pwaa-admin-disclosure { margin-top: 16px; }
.pwaa-admin-disclosure .pwaa-admin-slot { margin-top: 12px; }
html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-filter { margin-top: 8px; }
html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-status:empty,
html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-pager:empty { display: none; }
.pwauth-directory-error .pwauth-admin-button { margin-top: 18px; }
.pwauth-account-tools summary:focus-visible,
.pwauth-account-help summary:focus-visible,
.pwaa-admin-disclosure summary:focus-visible { outline: 3px solid var(--pw-accent, #0b6765); outline-offset: 3px; }
.pwauth-modal .pwauth-modal__card { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); }
@media (max-width: 767px) {
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page { padding: 0; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-button { min-height: 48px; padding: 10px 12px; font-size: .9375rem; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-account-head { gap: 16px; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-filter { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 14px; gap: 12px; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-filter__search,
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-filter__buttons { grid-column: 1 / -1; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-filter__buttons { display: grid; grid-template-columns: 1fr 1fr; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-filter input,
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-filter select { font-size: 1rem; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-admin-filter label { font-size: .875rem; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-identity-card__top { flex-wrap: wrap; }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-identity-card__meta { grid-template-columns: minmax(0,1fr); }
  html[data-pw-workspace="accounts"] #app-root .pwauth-account-page .pwauth-identity-card__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .pwauth-account-tools > div { grid-column: 1 / -1; }
}
