/* PostWatch OS — calm, readable operating shell
   This layer intentionally overrides the legacy single-file styles without
   disturbing the existing operational modules. */

:root {
  --os-sidebar: 272px;
  --os-utility: 72px;
  --os-content: 1320px;
  --fs-meta: .875rem;
  --fs-xs: var(--fs-meta);
  --fs-sm: .9375rem;
  --fs-base: clamp(1rem, .97rem + .15vw, 1.0625rem);
  --fs-md: clamp(1.125rem, 1.05rem + .25vw, 1.3125rem);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --container-max: var(--os-content);
  --gutter: clamp(20px, 3vw, 44px);
}

body {
  font-size: var(--fs-base);
  line-height: 1.6;
  letter-spacing: -.005em;
}

:root {
  --text-muted: #526175;
  --text-subtle: #66758a;
}

.dark {
  --text-muted: #bac6d5;
  --text-subtle: #9dacc0;
}

.os-skip-link {
  position: fixed;
  z-index: 20000;
  left: 16px;
  top: 12px;
  padding: 11px 15px;
  border-radius: 10px;
  background: #fff;
  color: #0f2340;
  border: 2px solid #2563eb;
  font-weight: 750;
  transform: translateY(-180%);
}
.os-skip-link:focus { transform: translateY(0); }

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--focus-ring, #2563eb);
  outline-offset: 3px;
}

@media (forced-colors: active) {
  :where(a, button, input, select, textarea):focus-visible { outline: 3px solid Highlight; }
}

body::before { display: none; }
button, input, select, textarea { letter-spacing: 0; }
button, a, input, select, textarea { touch-action: manipulation; }

.btn {
  min-height: 46px;
  padding: 10px 16px;
  font-size: .9375rem;
  border-radius: 11px;
  font-weight: 650;
}

.btn--sm { min-height: 44px; padding: 9px 13px; font-size: .875rem; }
.icon-btn { width: 44px; height: 44px; border-radius: 11px; }
.icon-btn svg { width: 20px; height: 20px; }

.page-header { align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.page-header h1 { font-size: clamp(1.75rem, 1.45rem + .8vw, 2.35rem); line-height: 1.15; }
.page-header p { font-size: 1rem !important; line-height: 1.55; max-width: 70ch; }
.card { border-radius: var(--radius-lg); }
.table { font-size: .9375rem; }
.table th { font-size: var(--fs-meta); }
.table th, .table td { padding: 13px 15px; }

/* ── Desktop operating shell ───────────────────────────────────────────── */
.os-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 320;
  width: var(--os-sidebar);
  display: flex;
  flex-direction: column;
  background: #0f2340;
  color: #f8fafc;
  border-right: 1px solid rgba(255,255,255,.08);
  box-shadow: 12px 0 34px rgba(15,35,64,.08);
}

.os-sidebar__brand {
  min-height: 84px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}

.os-sidebar__mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #0f2340;
  font-weight: 850;
  font-size: .8125rem;
  letter-spacing: .04em;
}

.os-sidebar__brand strong { display: block; font-size: 1.125rem; letter-spacing: -.02em; }
.os-sidebar__brand small { display: block; color: #a9b8cc; font-size: .875rem; margin-top: 1px; }

.os-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 24px;
  scrollbar-width: thin;
}

.os-nav-group + .os-nav-group { margin-top: 17px; }
.os-nav-group__title {
  padding: 0 12px 6px;
  color: #91a4bd;
  font-size: .875rem;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.os-nav-link {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 11px;
  color: #d9e3ee;
  font-size: .9375rem;
  font-weight: 570;
  transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out);
}

.os-nav-link svg { width: 19px; height: 19px; flex: 0 0 auto; color: #a8bad0; }
.os-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.os-nav-link.is-active { background: #fff; color: #0f2340; font-weight: 720; }
.os-nav-link.is-active svg { color: #2563eb; }
.os-nav-link__badge {
  margin-left: auto;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #dc2626;
  color: var(--on-status, #fff);
  font-size: var(--fs-meta);
  font-weight: 800;
}

.os-sidebar__footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.09); }
.os-sidebar__guide {
  min-height: 44px;
  margin-bottom: 8px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) 16px;
  gap: 9px;
  align-items: center;
  border-radius: 11px;
  color: #d7e3f1;
  font-size: .875rem;
  font-weight: 650;
}
.os-sidebar__guide:hover { background: rgba(255,255,255,.08); color: #fff; }
.os-sidebar__guide svg { width: 18px; height: 18px; }
.os-sidebar__guide svg:last-child { width: 14px; height: 14px; color: #8fa4bd; }
.os-user-card {
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) 18px;
  gap: 9px;
  align-items: center;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.os-user-card:hover { background: rgba(255,255,255,.12); }
.os-user-card__avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.14); font-weight: 800; }
.os-user-card strong, .os-user-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-user-card strong { font-size: .9375rem; }
.os-user-card small { color: #aebed1; font-size: .875rem; margin-top: 1px; }

.os-utility {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--os-sidebar);
  z-index: 300;
  height: var(--os-utility);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.os-utility__context { min-width: 0; }
.os-utility__eyebrow { color: var(--text-muted); font-size: .875rem; font-weight: 720; text-transform: uppercase; letter-spacing: .07em; }
.os-utility__title { color: var(--text); font-size: 1.0625rem; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-utility__actions { display: flex; align-items: center; gap: 8px; }
.last-saved--error {
  color: #b42318 !important;
  background: #fff0ed;
  border: 1px solid #f8b4aa;
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 750;
}
.dark .last-saved--error { color: #fecaca !important; background: #3b1111; border-color: #7f1d1d; }
.os-guide-btn { width: auto; padding: 0 13px; gap: 8px; font-size: .875rem; font-weight: 700; border-color: var(--border); background: var(--surface); }
.os-guide-btn span { display: inline; }

body.pw-authenticated #app-root {
  max-width: none;
  margin-left: var(--os-sidebar);
  padding-top: calc(var(--os-utility) + 30px);
  padding-right: var(--gutter);
  padding-left: var(--gutter);
  padding-bottom: 72px;
}

body.pw-authenticated #app-root > * { max-width: var(--os-content); margin-left: auto; margin-right: auto; }
body.pw-authenticated #bottom-nav-root { display: none; }
.os-mobile-topbar, .os-mobile-sheet { display: none; }

/* ── Daily command card ────────────────────────────────────────────────── */
.os-daily-command {
  max-width: var(--os-content);
  margin: 0 auto 28px;
  padding: clamp(20px, 2.4vw, 30px);
  display: grid;
  grid-template-columns: minmax(250px,.82fr) minmax(420px,1.5fr);
  gap: clamp(22px, 3vw, 44px);
  background: linear-gradient(135deg, #0f2a4a 0%, #173e69 58%, #22528a 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 22px;
  box-shadow: 0 24px 54px -34px rgba(15,42,74,.9);
}

.os-daily-command__eyebrow { font-size: .875rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #afc5df; }
.os-daily-command h1 { margin: 6px 0 8px; max-width: 13ch; font-size: clamp(1.7rem, 1.25rem + 1.15vw, 2.45rem); line-height: 1.12; letter-spacing: -.035em; }
.os-daily-command__summary { color: #d5e1ee; max-width: 42ch; font-size: .9625rem; line-height: 1.55; }
.os-daily-command__actions { margin-top: 19px; display: flex; flex-wrap: wrap; gap: 9px; }
.os-daily-command .btn--light { background: #fff; color: #0f2a4a; border-color: #fff; }
.os-daily-command .btn--quiet { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }

.os-work-list { display: grid; gap: 10px; align-content: start; }
.os-work-item {
  min-height: 76px;
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  color: #fff;
}
.os-work-item:hover { background: rgba(255,255,255,.13); }
.os-work-item__icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: rgba(255,255,255,.13); }
.os-work-item__icon svg { width: 20px; height: 20px; }
.os-work-item strong { display: block; font-size: 1rem; line-height: 1.3; }
.os-work-item small { display: block; color: #d6e2ee; font-size: .9rem; line-height: 1.4; margin-top: 3px; }
.os-work-item__go { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.12); }
.os-work-item__go svg { width: 17px; height: 17px; }
.os-work-item--urgent .os-work-item__icon { background: #b91c1c; }
.os-work-item--attention .os-work-item__icon { background: #a16207; }
.os-work-item--clear .os-work-item__icon { background: #15803d; }

.os-home-details {
  margin: 20px 0 40px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: clip;
}
.os-home-details > summary {
  min-height: 72px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
}
.os-home-details > summary::-webkit-details-marker { display: none; }
.os-home-details > summary span { display: grid; gap: 3px; }
.os-home-details > summary strong { font-size: 1.05rem; line-height: 1.35; }
.os-home-details > summary small { color: var(--text-muted); font-size: .9rem; line-height: 1.45; }
.os-home-details > summary > svg { width: 22px; height: 22px; flex: 0 0 auto; transition: transform .18s ease; }
.os-home-details[open] > summary > svg { transform: rotate(180deg); }
.os-home-details[open] > summary { border-bottom: 1px solid var(--border); }
.os-home-details__body { padding: 20px; }

/* ── Calm spotlight coach ──────────────────────────────────────────────── */
.os-coach { position: fixed; inset: 0; z-index: 12000; pointer-events: none; }
.os-coach__ring {
  position: fixed;
  border: 4px solid #60a5fa;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(7,15,27,.72), 0 0 0 8px rgba(96,165,250,.22);
  /* Only transform is animated. Transitioning top/left/width/height forced
     layout and paint on every frame of the move; the position now rides the
     compositor and the size settles immediately. */
  transition: transform 220ms var(--ease-out);
  will-change: transform;
}
.os-coach__card {
  pointer-events: auto;
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 28px));
  padding: 22px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.os-coach__step { color: var(--pw-accent); font-size: .875rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.os-coach__card h2 { margin: 5px 0 7px; font-size: 1.35rem; line-height: 1.2; }
.os-coach__card p { margin: 0; color: var(--text-muted); font-size: 1rem; line-height: 1.55; }
.os-coach__actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; }
.os-coach__nav { display: flex; gap: 8px; }
.os-coach__preference { display: flex; align-items: center; gap: 9px; margin-top: 16px; color: var(--text-muted); font-size: .875rem; }
.os-coach__preference input { width: 20px; height: 20px; }

/* ── Conventional AI entry point (no mascot) ───────────────────────────── */
.os-assistant-fab {
  position: fixed;
  z-index: 430;
  right: 22px;
  bottom: 22px;
  min-height: 50px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: #0f2a4a;
  color: #fff;
  box-shadow: 0 16px 36px -18px rgba(15,42,74,.85);
  font: inherit;
  font-size: .9rem;
  font-weight: 750;
  cursor: pointer;
}
.os-assistant-fab:hover { background: #173e69; }
.os-assistant-fab svg { width: 20px; height: 20px; }
.os-inline-assistant { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.os-inline-assistant__icon { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.os-inline-assistant__copy { min-width: 0; flex: 1; }
.os-inline-assistant__copy strong { display: block; font-size: 1rem; }
.os-inline-assistant__copy span { display: block; color: var(--text-muted); font-size: var(--fs-meta); }

.ai2 { max-width: 820px !important; }
.ai2-hero__av { border-radius: 14px !important; color: var(--pw-accent); }
.ai2-hero__av svg { width: 25px; height: 25px; }
.ai2-hero__greet { font-size: 1.3rem !important; }
.ai2-hero__sub, .ai2-call__t small { font-size: .875rem !important; }
.ai2-row textarea { font-size: 1rem !important; min-height: 50px; }
.ai2-send { width: 50px !important; height: 50px !important; }
.ai2-foot { font-size: var(--fs-meta) !important; }

/* ── Team chat ─────────────────────────────────────────────────────────── */
.os-chat { max-width: 980px; margin: 0 auto; }
.os-chat__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.os-chat__header h1 { margin: 0; font-size: clamp(1.8rem, 1.4rem + .8vw, 2.35rem); }
.os-chat__header p { margin: 4px 0 0; color: var(--text-muted); font-size: 1rem; }
.os-chat__status { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; background: var(--ok-soft); color: var(--ok-ink, var(--ok)); font-size: var(--fs-meta); font-weight: 750; white-space: nowrap; }
.os-chat__status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.os-chat__frame { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-2); }
.os-chat__notice { padding: 11px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-meta); }
.os-chat__log { min-height: 400px; height: min(58vh, 650px); overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
.os-chat__empty { margin: auto; max-width: 390px; text-align: center; color: var(--text-muted); }
.os-chat__empty svg { width: 38px; height: 38px; color: var(--text-subtle); margin-bottom: 10px; }
.os-message { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 10px; align-items: start; max-width: min(78%, 660px); }
.os-message--mine { align-self: flex-end; grid-template-columns: minmax(0,1fr) 38px; }
.os-message__avatar { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--text); font-size: .75rem; font-weight: 800; }
.os-message--mine .os-message__avatar { order: 2; background: var(--accent-soft); color: var(--pw-accent); }
.os-message__meta { display: flex; align-items: baseline; gap: 7px; margin: 0 2px 4px; color: var(--text-muted); font-size: var(--fs-meta); }
.os-message--mine .os-message__meta { justify-content: flex-end; }
.os-message__meta strong { color: var(--text); font-size: var(--fs-meta); }
.os-message__bubble { padding: 11px 14px; background: var(--surface-2); border-radius: 4px 15px 15px 15px; font-size: 1rem; line-height: 1.48; overflow-wrap: anywhere; }
.os-message--mine .os-message__bubble { background: var(--primary); color: #fff; border-radius: 15px 4px 15px 15px; }
.os-message__bubble img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; object-fit: contain; }
.os-message__bubble img + div { margin-top: 8px; }
.os-chat__composer { padding: 14px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: end; gap: 10px; border-top: 1px solid var(--border); background: var(--surface); }
.os-chat__composer textarea { min-height: 50px; max-height: 150px; padding: 13px 14px; resize: none; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 13px; font-size: 1rem; line-height: 1.45; }
.os-chat__photo, .os-chat__send { min-height: 50px; }
.os-chat__photo { min-width: 50px; }
.os-chat__send { min-width: 104px; }

/* ── Team Messages channel workspace ─────────────────────────────────── */
.pwc-page [hidden] { display: none !important; }

.pwc-team-scope {
  margin: 0 0 18px;
  padding: 20px;
  border: 1px solid var(--pwc-border);
  border-radius: 18px;
  background: var(--pwc-surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.pwc-team-scope__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.pwc-team-scope__heading > div { min-width: 0; }
.pwc-team-scope__step {
  margin: 0 0 2px;
  color: var(--pwc-primary);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.pwc-team-scope h2 {
  margin: 0;
  color: var(--pwc-text);
  font-size: clamp(21px, 2.4vw, 26px);
  line-height: 1.25;
}

.pwc-team-scope__heading p:last-child {
  max-width: 65ch;
  margin: 5px 0 0;
  color: var(--pwc-muted);
  font-size: 16px;
  line-height: 1.55;
}

.pwc-team-scope__controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.pwc-team-field { min-width: 0; }
.pwc-team-field label {
  display: block;
  margin: 0 0 7px;
  color: var(--pwc-text);
  font-size: 16px;
  font-weight: 750;
}

.pwc-team-field select {
  width: 100%;
  min-height: 54px;
  padding: 10px 42px 10px 13px;
  border: 2px solid var(--pwc-border);
  border-radius: 12px;
  background: var(--pwc-bg);
  color: var(--pwc-text);
  font: inherit;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.35;
  cursor: pointer;
}

.pwc-team-field select:hover { border-color: var(--pwc-primary); }
.pwc-team-field select:focus-visible {
  border-color: var(--pwc-primary);
  outline: 3px solid var(--focus-ring, #2563eb);
  outline-offset: 3px;
}

.pwc-team-field select:disabled { cursor: not-allowed; opacity: .6; }
.pwc-team-scope__help {
  margin: 12px 0 0;
  color: var(--pwc-subtle);
  font-size: var(--fs-meta);
  line-height: 1.5;
}

.pwc-team-scope__error:empty,
.pwc-team-moderation-error:empty { display: none; }
.pwc-team-scope__error { margin-top: 8px; }

.pwc-team-context {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.pwc-team .pwc-toolbar { flex-wrap: wrap; }

.pwc-team-context__icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--pwc-primary) 12%, var(--pwc-surface));
  color: var(--pwc-primary);
}

.pwc-team-context__icon svg { width: 23px; height: 23px; }
.pwc-team-access {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, #15803d 40%, var(--pwc-border));
  border-radius: 999px;
  background: color-mix(in srgb, #16a34a 10%, var(--pwc-surface));
  color: #166534;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.pwc-team-access[data-mode="read"] {
  border-color: color-mix(in srgb, var(--warn) 42%, var(--pwc-border));
  background: color-mix(in srgb, var(--warn) 12%, var(--pwc-surface));
  color: var(--warn-ink, var(--warn));
}

html.dark .pwc-team-access { color: #bbf7d0; }
html.dark .pwc-team-access[data-mode="read"] { color: var(--warn-ink, var(--warn)); }
html.dark .pwc-team-field select:focus-visible,
html.dark .pwc-message__remove:focus-visible { outline-color: var(--focus-ring, #6e93ff); }

.pwc-team-readonly {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px 16px calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--pwc-border);
  background: color-mix(in srgb, var(--warn) 9%, var(--pwc-surface));
  color: var(--pwc-text);
}

.pwc-team-readonly > svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--warn-ink, var(--warn));
}

.pwc-team-readonly strong,
.pwc-team-readonly span { display: block; }
.pwc-team-readonly strong { font-size: 16px; }
.pwc-team-readonly span {
  margin-top: 2px;
  color: var(--pwc-muted);
  font-size: 15px;
  line-height: 1.5;
}

.pwc-message__role {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--pwc-border);
  border-radius: 999px;
  background: var(--pwc-surface-2);
  color: var(--pwc-muted);
  font-size: var(--fs-meta);
  font-weight: 800;
  line-height: 1.2;
}

.pwc-message__actions {
  display: flex;
  justify-content: flex-start;
  margin: 5px 8px 0;
}

.pwc-message--mine .pwc-message__actions { justify-content: flex-end; }
.pwc-message__remove {
  min-width: 92px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--pwc-danger);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
}

.pwc-message__remove:hover {
  border-color: color-mix(in srgb, var(--pwc-danger) 38%, var(--pwc-border));
  background: color-mix(in srgb, var(--pwc-danger) 8%, var(--pwc-surface));
}

.pwc-message__remove:focus-visible {
  outline: 3px solid var(--focus-ring, #2563eb);
  outline-offset: 2px;
}

.pwc-message__remove:disabled { cursor: not-allowed; opacity: .55; }
.pwc-message__remove svg { width: 18px; height: 18px; }
.pwc-team-moderation-error {
  min-height: 0;
  margin: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid color-mix(in srgb, var(--pwc-danger) 25%, var(--pwc-border));
  background: color-mix(in srgb, var(--pwc-danger) 6%, var(--pwc-surface));
}

.pwc-team-loading { min-height: 300px; }

@media (max-width: 720px) {
  .pwc-team-scope { padding: 17px 14px; border-radius: 16px; }
  .pwc-team-scope__heading { display: block; }
  .pwc-team-refresh { width: 100%; margin-top: 14px; }
  .pwc-team-scope__controls { grid-template-columns: minmax(0, 1fr); }
  .pwc-team-field select { min-height: 56px; font-size: 18px; }
  .pwc-team-context { align-items: flex-start; }
  .pwc-team-context__icon { width: 40px; height: 40px; flex-basis: 40px; }
  .pwc-team-access { align-self: flex-start; }
  .pwc-message__remove { min-height: 48px; }
}

@media (forced-colors: active) {
  .pwc-team-scope,
  .pwc-team-field select,
  .pwc-team-context__icon,
  .pwc-team-access,
  .pwc-team-readonly,
  .pwc-message__remove { border: 2px solid ButtonText; }
}

@media print {
  .pwc-team-scope__controls,
  .pwc-team-refresh,
  .pwc-team-scope__help,
  .pwc-team-scope__error,
  .pwc-team-readonly,
  .pwc-message__actions,
  .pwc-team-moderation-error { display: none !important; }
  .pwc-team-scope { padding: 0 0 12pt; border: 0; box-shadow: none; }
  .pwc-team-scope__heading p,
  .pwc-team-scope__step { display: none; }
  .pwc-team-access { color: #000; background: #fff; border: 1px solid #555; }
}

/* ── Admin control center ──────────────────────────────────────────────── */
.admin-os { max-width: var(--os-content); margin: 0 auto; }
.admin-os__intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.admin-os__intro h1 { margin: 0; font-size: clamp(1.85rem, 1.45rem + .9vw, 2.5rem); }
.admin-os__intro p { margin: 6px 0 0; color: var(--text-muted); max-width: 65ch; }
.admin-os__summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 24px; }
.admin-os-stat { padding: 16px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
.admin-os-stat strong { display: block; font-size: 1.55rem; line-height: 1.1; }
.admin-os-stat span { color: var(--text-muted); font-size: .875rem; }
.admin-os-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.admin-os-card { min-height: 180px; padding: 20px; display: flex; flex-direction: column; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 17px; box-shadow: var(--shadow-1); }
.admin-os-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.admin-os-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.admin-os-card__icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; color: var(--pw-accent); background: var(--accent-soft); }
.admin-os-card__icon svg { width: 22px; height: 22px; }
.admin-os-card__status { padding: 5px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: .875rem; font-weight: 750; }
.admin-os-card h2 { margin: 15px 0 4px; font-size: 1.1rem; }
.admin-os-card p { margin: 0; color: var(--text-muted); font-size: .875rem; line-height: 1.48; }
.admin-os-card__action { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; color: var(--pw-accent); font-size: .8375rem; font-weight: 750; }
.admin-os-section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.admin-os-section-head .btn { flex: 0 0 auto; }
.admin-os-section-head div { min-width: 0; }
.admin-os-section-head h1 { margin: 0; font-size: 1.65rem; }
.admin-os-section-head p { margin: 2px 0 0; color: var(--text-muted); font-size: .875rem; }
.admin-toolbar { gap: 9px; flex-wrap: wrap; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 16px; }
.admin-hint { padding: 13px 15px; border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: .9rem; }
.admin-edit-cell input, .admin-edit-cell select { min-height: 44px; font-size: .9375rem; }

.policy-studio { max-width: 1040px; margin: 0 auto; }
.policy-studio__toolbar { display: grid; grid-template-columns: minmax(220px,1fr) auto; gap: 12px; align-items: end; margin-bottom: 18px; }
.policy-panel { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.policy-panel + .policy-panel { margin-top: 14px; }
.policy-panel h2 { margin: 0 0 4px; font-size: 1.16rem; }
.policy-panel > p { margin: 0 0 17px; color: var(--text-muted); font-size: 1rem; line-height: 1.55; }
.policy-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.policy-field { display: flex; flex-direction: column; gap: 6px; }
.policy-field label { font-size: 1rem; font-weight: 740; color: var(--text); }
.policy-field input, .policy-field select, .policy-field textarea { width: 100%; min-height: 48px; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--bg); color: var(--text); font-size: 1rem; }
.policy-field small { color: var(--text-muted); font-size: .9rem; line-height: 1.45; }
.policy-warning { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border)); border-radius: 12px; background: var(--warn-soft); color: var(--text); font-size: 1rem; line-height: 1.5; }
.policy-warning svg { width: 19px; height: 19px; color: var(--warn); flex: 0 0 auto; margin-top: 1px; }
.policy-advanced { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--border); }
.policy-advanced summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; color: var(--brand); font-weight: 760; font-size: 1rem; }
.policy-advanced summary::marker { color: var(--brand); }
.policy-advanced > p { margin: 0 0 15px; color: var(--text-muted); line-height: 1.55; }
.policy-actions { position: sticky; bottom: 16px; z-index: 20; display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-2); backdrop-filter: blur(14px); }
.form-status { flex: 1; align-self: center; color: var(--text-muted); font-size: .875rem; }
.status-pill { align-self: center; padding: 8px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-muted); font-size: var(--fs-meta); font-weight: 730; }
.check-row { min-height: 48px; display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg); }
.check-row input { width: 21px !important; height: 21px !important; min-height: 0 !important; flex: 0 0 auto; }

.health-list { display: grid; gap: 10px; }
.health-row { min-height: 78px; display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
.health-row__icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); color: var(--text-muted); }
.health-row__icon svg { width: 21px; height: 21px; }
.health-row strong, .health-row small { display: block; }
.health-row strong { font-size: .975rem; }
.health-row small { margin-top: 2px; color: var(--text-muted); font-size: .875rem; }
.health-row__state { white-space: nowrap; padding: 6px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: .875rem; font-weight: 760; }
.health-row--good .health-row__icon, .health-row--good .health-row__state { background: var(--ok-soft); color: var(--ok-ink, var(--ok)); }
.health-row--warn .health-row__icon, .health-row--warn .health-row__state { background: var(--warn-soft); color: var(--warn-ink, var(--warn)); }
.health-row--danger .health-row__icon, .health-row--danger .health-row__state { background: var(--crit-soft); color: var(--crit-ink, var(--crit)); }

.toast { font-size: 1rem !important; line-height: 1.45; min-height: 48px; }

/* ── Notification inbox polish ─────────────────────────────────────────── */
.notif-panel { width: min(420px, calc(100vw - 16px)) !important; border-radius: 16px; }
.notif-panel__head { min-height: 56px; font-size: 1rem; }
.notif-item { min-height: 68px; padding: 11px 13px; }
.notif-item__title { font-size: .9rem; }
.notif-item__meta { font-size: .875rem; line-height: 1.45; }
.notif-item__icon { font-size: 0 !important; }
.notif-item__icon::before { font-size: 1rem; }
.notif-item__icon--concern::before { content: '⚠'; }
.notif-item__icon--incident::before { content: '!'; font-weight: 900; }
.notif-item__icon--manning::before { content: 'M'; font-weight: 850; }
.notif-item__icon--memo::before { content: 'M'; font-weight: 850; }
.notif-item__icon--billing::before { content: '₱'; font-weight: 850; }

.action-center { overflow: hidden; max-height: min(82vh, 780px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 26px 70px rgba(8,15,26,.26); }
.action-center__head { min-height: 70px; padding: 13px 14px 12px 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.action-center__head span { display: block; color: var(--pw-accent); font-size: .875rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.action-center__head h2 { margin: 1px 0 0; font-size: 1.2rem; }
.action-center__body { overflow-y: auto; padding: 13px; display: grid; gap: 14px; }
.action-center__body details > summary { cursor: pointer; }
.action-center__section-title { min-height: 44px; margin: 0 0 7px; display: flex; align-items: center; justify-content: space-between; color: var(--text); font-size: .9rem; font-weight: 780; list-style: none; }
.action-center__section-title::-webkit-details-marker { display: none; }
.action-center__section-title b { min-width: 26px; height: 26px; padding: 0 7px; display: grid; place-items: center; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-meta); }
.action-center__empty { padding: 16px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--text-muted); text-align: center; font-size: .875rem; }
.action-card { padding: 13px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 13px; background: var(--bg); }
.action-card + .action-card { margin-top: 8px; }
.action-card--normal { border-left-color: var(--primary); }
.action-card--important { border-left-color: var(--warn); }
.action-card--critical { border-left-color: var(--crit); }
.action-card__label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: .875rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.action-card__label b { color: var(--crit); }
.action-card h3 { margin: 5px 0 2px; font-size: .975rem; line-height: 1.3; }
.action-card p { margin: 0; color: var(--text-muted); font-size: .875rem; line-height: 1.5; }
.action-card__buttons { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.action-center__foot { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); background: var(--surface-2); }
.action-center__foot strong, .action-center__foot span { display: block; }
.action-center__foot strong { font-size: .875rem; }
.action-center__foot span { color: var(--text-muted); font-size: .875rem; }

@media (max-width: 1180px) {
  :root { --os-sidebar: 236px; }
  .os-sidebar__brand { padding-left: 16px; padding-right: 16px; }
  .os-daily-command { grid-template-columns: 1fr; }
  .os-daily-command h1 { max-width: none; }
  .admin-os-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 860px) {
  :root { --os-utility: 64px; }
  .os-sidebar, .os-utility { display: none; }
  .os-mobile-topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 340;
    min-height: calc(60px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 14px 0;
    display: grid;
    grid-template-columns: 44px minmax(0,1fr) auto;
    align-items: center;
    gap: 10px;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
  }
  .os-mobile-topbar__title { min-width: 0; }
  .os-mobile-topbar__title strong, .os-mobile-topbar__title small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .os-mobile-topbar__title strong { font-size: 1rem; }
  .os-mobile-topbar__title small { color: var(--text-muted); font-size: .875rem; }
  .os-mobile-topbar__actions { display: flex; gap: 4px; }
  body.pw-authenticated #app-root {
    margin-left: 0;
    padding-top: calc(60px + env(safe-area-inset-top) + 22px);
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }
  body.pw-authenticated #bottom-nav-root { display: block; }
  .bottom-nav { grid-template-columns: repeat(5,1fr) !important; }
  .bottom-nav__item { min-width: 0; }
  .bottom-nav button { border: 0; background: transparent; color: inherit; font: inherit; }
  .os-mobile-sheet {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    background: rgba(8,15,26,.55);
  }
  .os-mobile-sheet__panel { width: 100%; max-height: min(82dvh,760px); overflow-y: auto; padding: 12px 14px calc(22px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: 0 -20px 60px rgba(0,0,0,.2); }
  .os-mobile-sheet__handle { width: 46px; height: 5px; margin: 2px auto 14px; border-radius: 99px; background: var(--border-strong); }
  .os-mobile-sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .os-mobile-sheet__head h2 { margin: 0; font-size: 1.2rem; }
  .os-mobile-group + .os-mobile-group { margin-top: 16px; }
  .os-mobile-group__title { margin: 0 8px 5px; color: var(--text-muted); font-size: .875rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .os-mobile-link { min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; font-size: 1rem; font-weight: 620; }
  .os-mobile-link svg { width: 21px; height: 21px; color: var(--pw-accent); }
  .os-mobile-link.is-active { background: var(--accent-soft); color: var(--pw-accent); }
  .os-daily-command { padding: 20px; border-radius: 18px; gap: 20px; }
  .os-daily-command__actions .btn { flex: 1 1 140px; }
  .os-work-item { grid-template-columns: 38px minmax(0,1fr) 32px; padding: 11px; }
  .os-assistant-fab { bottom: calc(78px + env(safe-area-inset-bottom)); right: 14px; min-width: 50px; width: 50px; padding: 0; justify-content: center; border-radius: 15px; }
  .os-assistant-fab span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    padding: 0;
    margin: -1px;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .admin-os__summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .policy-grid { grid-template-columns: 1fr; }
  .os-chat__log { height: calc(100dvh - 310px); min-height: 330px; padding: 16px; }
  .os-message { max-width: 90%; }
}

@media (max-width: 560px) {
  .page-header h1 { font-size: 1.6rem; }
  .os-daily-command h1 { font-size: 1.65rem; }
  .os-daily-command__summary { font-size: .9rem; }
  .os-work-item small { font-size: .875rem; }
  .admin-os__intro { align-items: flex-start; flex-direction: column; }
  .admin-os-grid { grid-template-columns: 1fr; }
  .admin-os-card { min-height: 160px; }
  .admin-os__summary { gap: 8px; }
  .admin-os-stat { padding: 13px; }
  .admin-os-stat strong { font-size: 1.3rem; }
  .os-chat__header { flex-direction: column; }
  .os-chat__status { align-self: flex-start; }
  .os-chat__composer { grid-template-columns: 50px minmax(0,1fr) auto; }
  .os-chat__send { min-width: 76px; width: auto; padding: 0 12px; }
  .os-message { max-width: 96%; }
  .os-coach__card { padding: 18px; }
  .os-coach__card h2 { font-size: 1.2rem; }
  .health-row { grid-template-columns: 42px minmax(0,1fr); }
  .health-row__state { grid-column: 2; justify-self: start; }
  .action-center { top: calc(66px + env(safe-area-inset-top)) !important; right: 8px !important; left: 8px !important; width: auto !important; max-height: calc(100dvh - 150px); }
}

/* ── Calm, explicit Assistant voice controls ────────────────────────────── */
.pwc-composer .pwc-composer__row--assistant {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.pwc-composer .pwc-talk-button {
  min-width: 112px;
  border-color: var(--pwc-primary);
  background: var(--pwc-surface);
  color: var(--pwc-primary);
}

.pwc-composer .pwc-talk-button:hover {
  background: var(--pwc-surface-2);
}

.pwc-voice-panel {
  margin: 0 16px 16px;
  padding: 20px;
  border: 1px solid var(--pwc-border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--pwc-primary) 4%, var(--pwc-surface));
  color: var(--pwc-text);
}

.pwc-voice-panel[hidden] { display: none; }

.pwc-voice-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.pwc-voice-panel__eyebrow {
  margin: 0 0 3px;
  color: var(--pwc-primary);
  font-size: var(--fs-meta);
  font-weight: 800;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.pwc-voice-panel h2 {
  margin: 0;
  color: var(--pwc-text);
  font-size: clamp(20px, 3vw, 24px);
  line-height: 1.25;
}

.pwc-voice-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--pwc-border);
  border-radius: 999px;
  background: var(--pwc-surface);
  color: var(--pwc-text);
  font-size: var(--fs-meta);
  font-weight: 750;
  white-space: nowrap;
}

.pwc-voice-status__dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: currentColor;
}

.pwc-voice-panel[data-state="idle"] .pwc-voice-status { color: #475569; }
.pwc-voice-panel[data-state="connecting"] .pwc-voice-status { color: #1d4ed8; }
.pwc-voice-panel[data-state="listening"] .pwc-voice-status { color: #047857; }
.pwc-voice-panel[data-state="thinking"] .pwc-voice-status { color: #a16207; }
.pwc-voice-panel[data-state="speaking"] .pwc-voice-status { color: #6d28d9; }
.pwc-voice-panel[data-state="error"] .pwc-voice-status { color: #b91c1c; }

.dark .pwc-voice-panel[data-state="idle"] .pwc-voice-status { color: #cbd5e1; }
.dark .pwc-voice-panel[data-state="connecting"] .pwc-voice-status { color: #93c5fd; }
.dark .pwc-voice-panel[data-state="listening"] .pwc-voice-status { color: #6ee7b7; }
.dark .pwc-voice-panel[data-state="thinking"] .pwc-voice-status { color: #fde68a; }
.dark .pwc-voice-panel[data-state="speaking"] .pwc-voice-status { color: #c4b5fd; }
.dark .pwc-voice-panel[data-state="error"] .pwc-voice-status { color: #fca5a5; }

.pwc-voice-transcript {
  min-height: 136px;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 1px solid var(--pwc-border);
  border-radius: 13px;
  background: var(--pwc-surface);
  scroll-padding-block: 12px;
}

.pwc-voice-transcript:focus-visible {
  outline: 3px solid var(--focus-ring, #2563eb);
  outline-offset: 3px;
}

.pwc-voice-empty {
  display: grid;
  min-height: 110px;
  place-items: center;
  margin: 0;
  padding: 12px;
  color: var(--pwc-subtle);
  font-size: 16px;
  line-height: 1.55;
  text-align: center;
}

.pwc-voice-caption {
  max-width: 88%;
  margin: 0 0 12px;
  padding: 11px 13px;
  border: 1px solid var(--pwc-border);
  border-radius: 12px;
  background: var(--pwc-surface-2);
}

.pwc-voice-caption:last-child { margin-bottom: 0; }
.pwc-voice-caption--user { margin-left: auto; background: color-mix(in srgb, var(--pwc-primary) 10%, var(--pwc-surface)); }
.pwc-voice-caption strong { display: block; margin-bottom: 3px; font-size: 14px; }
.pwc-voice-caption p { margin: 0; font-size: 17px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.pwc-voice-caption.is-live { border-width: 2px; }

.pwc-voice-privacy {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 13px 0;
  color: var(--pwc-subtle);
  font-size: 15px;
  line-height: 1.55;
}

.pwc-voice-privacy svg { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 2px; color: var(--pwc-primary); }

.pwc-voice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.pwc-voice-actions .pwc-button {
  min-height: 48px;
  flex: 1 1 126px;
}

.pwc-voice-actions .pwc-voice-end {
  border-color: color-mix(in srgb, var(--pwc-danger) 48%, var(--pwc-border));
  color: var(--pwc-danger);
}

.pwc-voice-error { margin-bottom: 0; }
.pwc-voice-error:empty { display: none; }

@media (max-width: 720px) {
  .pwc-composer .pwc-composer__row--assistant {
    /* The Send button carries a 68px min-width for its label, so a fixed 52px
       track pushed it 16px past the composer's edge on every phone. Size the
       track to the button instead. Kept !important because that is how this
       rule already won; removing it would hand the row back to the wider
       three-column desktop rule. */
    grid-template-columns: minmax(0, 1fr) minmax(68px, auto) !important;
  }
  .pwc-composer__row--assistant .pwc-talk-button {
    grid-column: 1 / -1;
    width: 100% !important;
    min-width: 0 !important;
    padding: 11px 16px !important;
  }
  .pwc-composer__row--assistant .pwc-talk-button span { display: inline !important; }
  .pwc-composer__row--assistant textarea { grid-column: 1; }
  .pwc-composer__row--assistant #pwc-assistant-send { grid-column: 2; }
  .pwc-voice-panel { margin: 0 12px 12px; padding: 16px; }
  .pwc-voice-panel__header { display: block; }
  .pwc-voice-status { margin-top: 10px; white-space: normal; }
  .pwc-voice-transcript { max-height: 220px; }
  .pwc-voice-caption { max-width: 95%; }
  .pwc-voice-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pwc-voice-actions .pwc-button { width: 100% !important; min-width: 0 !important; padding: 10px !important; }
  .pwc-voice-actions .pwc-button span { display: inline !important; }
}

@media (max-width: 390px) {
  .pwc-voice-actions { grid-template-columns: 1fr; }
}

@media (forced-colors: active) {
  .pwc-voice-panel, .pwc-voice-status, .pwc-voice-transcript, .pwc-voice-caption { border: 2px solid ButtonText; }
}

@media print {
  .pwc-voice-panel, .pwc-talk-button { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .os-coach__ring, .os-chat__log, .pwc-voice-transcript { transition: none; scroll-behavior: auto; }
}

/* ── PostWatch unified product language v3 ──────────────────────────── */
:root {
  --pw-navy-950: #0b2037;
  --pw-navy-900: #0f2a47;
  --pw-navy-800: #123a62;
  --pw-steel-600: #456e91;
  --pw-gold-600: #a87920;
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-2: #edf2f7;
  --border: #d7e0e8;
  --border-strong: #b8c5d2;
  --text: #132235;
  --text-muted: #506176;
  --text-subtle: #5e7085;
  --primary: #123a62;
  --accent: #456e91;
  --accent-soft: #e7f0f8;
  --focus-ring: var(--pw-focus, #2563eb);
  --ok: #157347;
  --warn: #9a5b00;
  --crit: #b42318;
  --os-sidebar: 264px;
  --os-rail: 88px;
  --os-utility: 72px;
  --os-content: 1280px;
  --gutter: clamp(20px, 2.6vw, 40px);
}

html.dark {
  --bg: #0d141c;
  --surface: #141d27;
  --surface-2: #1b2734;
  --border: #334252;
  --border-strong: #4b5f73;
  --text: #f2f6fa;
  --text-muted: #b7c4d2;
  --text-subtle: #aab9c8;
  --primary: #93bce1;
  --accent: #8fb3d0;
  --accent-soft: #19324a;
  --ok: #6ed6a1;
  --warn: #f2bd63;
  --crit: #ff9b91;
}

html { color-scheme: light; }
html.dark { color-scheme: dark; }
body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

.os-rail { display: none; }
.os-sidebar__mark {
  overflow: hidden;
  padding: 2px;
  background: #f4f7fa;
  border: 1px solid rgba(255,255,255,.3);
}
.os-sidebar__mark img,
.os-mobile-brand img,
.os-rail__brand img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: inherit;
}

.os-sidebar,
.os-rail { background: linear-gradient(180deg, var(--pw-navy-950), #102d4d); }
.os-sidebar__brand strong { font-size: 1.08rem; }
.os-sidebar__brand small { font-size: .875rem; }
.os-nav-link { min-height: 48px; font-size: .96rem; }
.os-nav-link.is-active { box-shadow: inset 3px 0 0 var(--pw-gold-600); }

.btn,
.icon-btn,
.pwc-button,
.pwauth-primary,
.pwauth-secondary,
button,
input,
select,
textarea { font-family: inherit; }

.btn,
.pwc-button,
.pwauth-primary,
.pwauth-secondary { min-height: 48px; }
.icon-btn { width: 48px; height: 48px; }
button:not(:disabled),
[role="button"]:not([aria-disabled="true"]),
a[href] { -webkit-tap-highlight-color: rgba(18,58,98,.14); }
button:not(:disabled):active,
.btn:not([aria-disabled="true"]):active,
.pwc-button:not(:disabled):active { transform: translateY(1px); }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  min-height: 48px;
  font-size: 1rem;
  border-radius: 12px;
}

.page-header {
  align-items: flex-start;
  margin-bottom: 28px;
}
.page-header h1,
.pwc-page__heading h1,
.admin-os__intro h1 { font-size: clamp(1.75rem, 1.42rem + 1vw, 2.375rem); letter-spacing: -.035em; }
.page-header p,
.pwc-page__intro { color: var(--text-muted); font-size: 1.05rem !important; }

.card,
.policy-panel,
.pwc-surface,
.pwauth-card,
.admin-os-card {
  border-color: var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15,32,55,.04), 0 14px 34px -28px rgba(15,32,55,.34);
}
.card:hover,
.admin-os-card:hover { transform: none; }
.table-wrap { max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; border-radius: 14px; }
.table { font-size: .95rem; }
.table th { color: var(--text-muted); font-size: var(--fs-meta); }
.table th,
.table td { min-height: 48px; padding: 14px 16px; }
.muted { color: var(--text-muted) !important; }

button[aria-busy="true"],
.btn.is-loading,
.pwc-button.is-loading { cursor: wait; }
button[aria-busy="true"] svg,
.btn.is-loading svg,
.pwc-button.is-loading svg { animation: pw-spin .8s linear infinite; }
@keyframes pw-spin { to { transform: rotate(360deg); } }

.pw-skeleton {
  overflow: hidden;
  color: transparent !important;
  background: linear-gradient(90deg, var(--surface-2) 20%, color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 42%, var(--surface-2) 64%);
  background-size: 240% 100%;
  border-radius: 10px;
  animation: pw-skeleton 1.35s ease-in-out infinite;
}
@keyframes pw-skeleton { to { background-position: -180% 0; } }

.os-mobile-brand {
  overflow: hidden;
  padding: 4px;
  border-color: var(--border);
  background: #f4f7fa;
}

.os-coach__card {
  right: auto;
  bottom: auto;
  transform: none;
  max-height: min(560px, calc(100dvh - 32px));
  overflow: auto;
  padding: 24px;
}
.os-coach__card.is-sheet { border-radius: 22px 22px 16px 16px; }
.os-coach__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
}
.os-coach__card h2 { padding-right: 38px; }
.os-coach__actions { align-items: flex-end; }
.os-coach__nav { flex-wrap: wrap; justify-content: flex-end; }
.os-coach__nav .btn { min-height: 46px; }

.bottom-nav__item,
.bottom-nav a,
.bottom-nav button {
  min-width: 0;
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: .875rem;
  font-weight: 680;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}
.bottom-nav__item svg { width: 22px; height: 22px; }
.bottom-nav__item.is-active { color: var(--pw-accent); }
.bottom-nav__item.is-active .bottom-nav__icon-wrap::after {
  content: "";
  position: absolute;
  inset: auto 50% -4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pw-gold-600);
  transform: translateX(-50%);
}

@media (max-width: 767px) {
  :root { --os-utility: 64px; }
  .os-sidebar,
  .os-rail,
  .os-utility { display: none !important; }
  .os-mobile-topbar { display: grid !important; }
  #os-mobile-notif { display: none; }
  body.pw-authenticated #bottom-nav-root { display: block !important; }
  body.pw-authenticated #app-root {
    margin-left: 0;
    padding: calc(60px + env(safe-area-inset-top) + 20px) 16px calc(92px + env(safe-area-inset-bottom));
  }
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    min-height: calc(68px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border-top: 1px solid var(--border);
    box-shadow: 0 -12px 36px -28px rgba(11,32,55,.7);
    backdrop-filter: blur(20px) saturate(145%);
    -webkit-backdrop-filter: blur(20px) saturate(145%);
  }
  .os-daily-command { border-radius: 18px; }
  .os-daily-command__actions { display: grid; grid-template-columns: 1fr; }
  .os-daily-command__actions .btn { width: 100%; }
  .page-header { gap: 14px; }
  .page-header h1 { font-size: 1.75rem; }
  .os-coach__card {
    width: calc(100vw - 24px);
    max-height: min(48dvh, 430px);
    padding: 20px;
  }
  .os-coach__actions { display: grid; grid-template-columns: 1fr; }
  .os-coach__actions > .btn { width: 100%; }
  .os-coach__nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .os-coach__nav .btn { min-width: 0; padding-inline: 8px; }
  .table th,
  .table td { padding: 13px 12px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  :root { --os-utility: 64px; }
  .os-sidebar,
  .os-mobile-topbar { display: none !important; }
  .os-rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 360;
    width: var(--os-rail);
    display: flex;
    flex-direction: column;
    color: #fff;
    border-right: 1px solid rgba(255,255,255,.09);
    box-shadow: 12px 0 34px rgba(11,32,55,.1);
  }
  .os-rail__brand {
    width: 56px;
    height: 56px;
    margin: 14px auto 10px;
    padding: 4px;
    display: block;
    border-radius: 16px;
    background: #f4f7fa;
  }
  .os-rail__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px 8px;
  }
  .os-rail__item {
    position: relative;
    min-height: 66px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 3px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #bed0e1;
    font: inherit;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.05;
    text-align: center;
  }
  .os-rail__item svg { width: 22px; height: 22px; }
  .os-rail__item.is-active { background: #fff; color: var(--pw-navy-950); }
  .os-rail__icon-wrap { position: relative; display: grid; place-items: center; }
  .os-rail__icon-wrap b {
    position: absolute;
    top: -9px;
    right: -13px;
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border: 2px solid var(--pw-navy-950);
    border-radius: 999px;
    background: var(--crit);
    color: var(--on-status, #fff);
    font-size: var(--fs-meta);
  }
  .os-rail__account {
    width: 52px;
    height: 52px;
    margin: 8px auto max(14px, env(safe-area-inset-bottom));
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 16px;
    background: rgba(255,255,255,.09);
    color: #fff;
    font: inherit;
    font-weight: 800;
  }
  .os-utility { left: var(--os-rail); display: flex !important; }
  .os-utility #notif-bell-wrap { display: none; }
  body.pw-authenticated #app-root {
    margin-left: var(--os-rail);
    padding-top: calc(var(--os-utility) + 26px);
    padding-left: 28px;
    padding-right: 28px;
    padding-bottom: 64px;
  }
  body.pw-authenticated #bottom-nav-root { display: none !important; }
  .os-mobile-sheet { align-items: stretch; padding-left: var(--os-rail); }
  .os-mobile-sheet__panel {
    width: min(420px, calc(100vw - var(--os-rail)));
    height: 100%;
    max-height: none;
    margin-left: 0;
    border-radius: 0 22px 22px 0;
    padding-top: max(18px, env(safe-area-inset-top));
  }
  .os-mobile-sheet__handle { display: none; }
}

@media (min-width: 1024px) {
  .os-rail,
  .os-mobile-topbar { display: none !important; }
  .os-sidebar,
  .os-utility { display: flex; }
  body.pw-authenticated #bottom-nav-root { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  button:active,
  .btn:active,
  .pwc-button:active { transform: none !important; }
}

/* Server-backed collection and audit patterns. */
.collection-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(220px, 1.2fr) minmax(170px, .8fr) auto;
  gap: 14px;
  align-items: end;
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.collection-toolbar .form-field { margin: 0; }
.collection-toolbar__actions { display: flex; gap: 8px; align-items: center; }
.collection-summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: .9rem;
}
.collection-summary strong { color: var(--text); font-size: 1rem; }
.audit-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.audit-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}
.audit-row:last-child { border-bottom: 0; }
.audit-row__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--pw-steel-600);
}
.audit-row--ok .audit-row__icon { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); }
.audit-row--danger .audit-row__icon { background: color-mix(in srgb, var(--crit) 12%, var(--surface)); color: var(--crit); }
.audit-row__icon svg { width: 20px; height: 20px; }
.audit-row__title { line-height: 1.45; }
.audit-row__title span { color: var(--text-muted); }
.audit-row__title b { font-weight: 750; }
.audit-row__body > p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: .88rem;
  overflow-wrap: anywhere;
}
.audit-row > time {
  color: var(--text-muted);
  font-size: var(--fs-meta);
  white-space: nowrap;
}
.audit-diff { margin-top: 10px; }
.audit-diff > summary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--pw-steel-700);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
}
.audit-diff .table-wrap { margin-top: 8px; box-shadow: none; }
.audit-diff code { font-size: var(--fs-meta); }
.pagination {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
}
.pagination [aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* Admin collections: searchable list + one focused record. */
.admin-collection__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.search-field {
  min-height: 48px;
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 560px;
}
.search-field > svg {
  position: absolute;
  left: 15px;
  width: 19px;
  height: 19px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-field > input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px 10px 45px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.admin-collection__layout {
  min-height: 580px;
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  gap: 16px;
}
.admin-collection__master,
.admin-collection__detail {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.admin-collection__master { align-self: start; max-height: min(720px, calc(100dvh - 220px)); overflow-y: auto; }
.admin-collection__detail { align-self: start; }
.admin-collection__count {
  min-height: 52px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--fs-meta);
}
.admin-collection__count strong { color: var(--text); font-size: 1.08rem; }
.admin-record-list { padding: 7px; }
.admin-record {
  min-height: 68px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 13px;
  color: var(--text);
  text-decoration: none;
}
.admin-record:hover { background: var(--surface-2); }
.admin-record.is-active { background: color-mix(in srgb, var(--pw-steel-500) 12%, var(--surface)); box-shadow: inset 3px 0 var(--pw-steel-600); }
.admin-record__icon,
.admin-record__avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--pw-steel-700);
  font-size: var(--fs-meta);
  font-weight: 850;
}
.admin-record__icon svg { width: 19px; height: 19px; }
.admin-record strong,
.admin-record small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-record strong { font-size: .96rem; }
.admin-record small { margin-top: 3px; color: var(--text-muted); font-size: var(--fs-meta); }
.admin-record > svg { width: 17px; height: 17px; color: var(--text-muted); }
.admin-record-form { padding: clamp(18px, 3vw, 32px); }
.admin-record-form__head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.admin-record-form__head > div > span { color: var(--pw-steel-600); font-size: var(--fs-meta); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.admin-record-form__head h2 { margin: 3px 0 0; font-size: clamp(1.4rem, 2.6vw, 2rem); letter-spacing: -.025em; }
.admin-record-mobile-back { display: none; }
.admin-record-form .form-field { margin-bottom: 18px; }
.admin-record-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.record-context {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--surface-2);
}
.record-context a { color: var(--pw-steel-700); font-weight: 750; text-decoration: none; }
.record-context svg { width: 16px; vertical-align: -3px; }
.admin-record-empty { min-height: 420px; display: grid; place-content: center; text-align: center; }
.assignment-picker { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.assignment-picker__head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.assignment-picker__head h3 { margin: 0; font-size: 1.05rem; }
.assignment-picker__head p { margin: 4px 0 0; color: var(--text-muted); font-size: var(--fs-meta); }
.assignment-picker__head > span { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-meta); font-weight: 750; }
.assignment-picker .search-field { max-width: none; margin-bottom: 10px; }
.assignment-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: 14px; }
.assignment-row { min-height: 58px; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 13px; border-bottom: 1px solid var(--border); cursor: pointer; }
.assignment-row:last-child { border-bottom: 0; }
.assignment-row:hover { background: var(--surface-2); }
.assignment-row input { width: 20px; height: 20px; accent-color: var(--pw-navy-800); }
.assignment-row strong,
.assignment-row small { display: block; }
.assignment-row small { margin-top: 2px; color: var(--text-muted); font-size: var(--fs-meta); }

/* Daily manning workspace. */
.manning-date { min-width: 180px; }
.manning-date label { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: var(--fs-meta); font-weight: 750; }
.manning-date input,
.manning-client-filter select { min-height: 48px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; font-size: 1rem; }
.manning-date input { width: 100%; padding: 8px 12px; }
.manning-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.manning-summary > div { min-height: 88px; display: flex; flex-direction: column; justify-content: center; padding: 16px 18px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow-1); }
.manning-summary strong { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1; }
.manning-summary span { margin-top: 7px; color: var(--text-muted); font-size: var(--fs-meta); line-height: 1.35; }
.manning-summary .is-attention strong { color: var(--warn); }
.manning-summary .is-critical strong { color: var(--crit); }
.manning-toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.manning-toolbar .search-field { max-width: none; }
.manning-client-filter { min-width: min(300px, 35vw); }
.manning-client-filter select { width: 100%; padding: 8px 36px 8px 12px; }
.manning-layout { min-height: 580px; display: grid; grid-template-columns: minmax(310px, 380px) minmax(0, 1fr); gap: 16px; }
.manning-master,
.manning-detail-wrap { min-width: 0; align-self: start; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-1); }
.manning-master { max-height: min(720px, calc(100dvh - 260px)); overflow-y: auto; }
.manning-master__count { position: sticky; top: 0; z-index: 2; padding: 13px 15px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); color: var(--text-muted); font-size: var(--fs-meta); }
.manning-area-list { padding: 7px; }
.manning-area { min-height: 66px; display: grid; grid-template-columns: 9px minmax(0, 1fr) auto 18px; align-items: center; gap: 10px; padding: 9px 9px; border-radius: 13px; color: var(--text); text-decoration: none; }
.manning-area:hover { background: var(--surface-2); }
.manning-area.is-active { background: color-mix(in srgb, var(--pw-steel-500) 12%, var(--surface)); box-shadow: inset 3px 0 var(--pw-steel-600); }
.manning-area__status { width: 9px; height: 36px; border-radius: 99px; background: var(--border); }
.manning-area__status--missing,
.manning-area__status--short { background: var(--crit); }
.manning-area__status--over { background: var(--warn); }
.manning-area__status--complete { background: var(--ok); }
.manning-area strong,
.manning-area small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manning-area small { margin-top: 3px; color: var(--text-muted); font-size: var(--fs-meta); }
.manning-area > svg { width: 17px; color: var(--text-muted); }
.status-pill--missing,
.status-pill--short { color: var(--crit-ink, var(--crit)); background: color-mix(in srgb, var(--crit) 11%, var(--surface)); }
.status-pill--over { color: var(--warn-ink, var(--warn)); background: color-mix(in srgb, var(--warn) 13%, var(--surface)); }
.status-pill--complete { color: var(--ok-ink, var(--ok)); background: color-mix(in srgb, var(--ok) 11%, var(--surface)); }
.status-pill--not-required { color: var(--text-muted); background: var(--surface-2); }
.manning-detail { padding: clamp(18px, 3vw, 30px); }
.manning-detail__head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.manning-detail__head > div { min-width: 0; flex: 1; }
.manning-detail__head > div > span { color: var(--pw-steel-600); font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.manning-detail__head h2 { margin: 3px 0; font-size: clamp(1.4rem, 2.6vw, 2rem); }
.manning-detail__head p { margin: 0; color: var(--text-muted); font-size: var(--fs-meta); }
.manning-mobile-back { display: none; }
.manning-shifts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.manning-shift { padding: 17px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); }
.manning-shift > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.manning-shift > div:first-child > span { font-size: 1rem; font-weight: 800; }
.manning-shift > div:first-child > strong { color: var(--text-muted); font-size: var(--fs-meta); }
.manning-stepper { display: grid; grid-template-columns: 48px minmax(64px, 1fr) 48px; gap: 7px; margin: 16px 0 10px; }
.manning-stepper button,
.manning-stepper input { min-height: 52px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--text); font: inherit; }
.manning-stepper button { font-size: 1.45rem; font-weight: 650; cursor: pointer; }
.manning-stepper button:disabled { opacity: .4; cursor: not-allowed; }
.manning-stepper input { width: 100%; padding: 8px; text-align: center; font-size: 1.35rem; font-weight: 800; }
.manning-shift output { display: block; min-height: 22px; color: var(--text-muted); font-size: var(--fs-meta); text-align: center; }
.manning-tools { display: flex; gap: 8px; margin-top: 14px; }
.manning-detail__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.manning-detail__actions > span { color: var(--text-muted); font-size: var(--fs-meta); }
.manning-detail-empty { min-height: 460px; display: grid; place-content: center; text-align: center; }

.login-history-toolbar { grid-template-columns: minmax(220px, 1.3fr) minmax(170px, .8fr) minmax(170px, .8fr) auto; }
.login-event-list { overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-1); }
.login-event { min-height: 74px; display: grid; grid-template-columns: 44px minmax(170px, 1.2fr) minmax(150px, .8fr) auto; align-items: center; gap: 13px; padding: 13px 17px; border-bottom: 1px solid var(--border); }
.login-event:last-child { border-bottom: 0; }
.login-event__icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); color: var(--pw-steel-700); }
.login-event__icon svg { width: 20px; height: 20px; }
.login-event__identity strong,
.login-event__identity span,
.login-event__device strong,
.login-event__device span { display: block; }
.login-event__identity span,
.login-event__device span { margin-top: 3px; color: var(--text-muted); font-size: var(--fs-meta); }
.login-event__device strong { font-size: .88rem; }
.login-event time { color: var(--text-muted); font-size: var(--fs-meta); white-space: nowrap; }

@media (max-width: 1023px) {
  .collection-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-toolbar__actions { align-self: stretch; }
  .admin-collection__layout { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
  .manning-layout { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
  .manning-shifts { grid-template-columns: 1fr; }
  .login-history-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .collection-toolbar { grid-template-columns: 1fr; gap: 12px; padding: 14px; border-radius: 15px; }
  .collection-toolbar__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .audit-row { grid-template-columns: 42px minmax(0, 1fr); gap: 11px; padding: 15px 14px; }
  .audit-row > time { grid-column: 2; white-space: normal; }
  .audit-row__icon { width: 42px; height: 42px; border-radius: 13px; }
  .audit-diff .table-wrap { max-width: 100%; overflow-x: auto; }
  .pagination { min-height: 72px; }
  .pagination .btn { min-width: 48px; }
  .admin-collection__toolbar { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 5; padding: 8px 0; background: var(--bg); }
  .admin-collection__toolbar .btn { width: auto; min-width: 48px; padding: 0 12px; font-size: var(--fs-meta); white-space: nowrap; }
  .admin-collection__toolbar .btn svg { width: 21px; height: 21px; }
  .admin-collection__layout { min-height: 0; display: block; }
  .admin-collection__master { max-height: none; border-radius: 15px; }
  .admin-collection__detail { border-radius: 15px; }
  .admin-collection.has-selection .admin-collection__master { display: none; }
  .admin-collection:not(.has-selection) .admin-collection__detail { display: none; }
  .admin-record-form { padding: 17px 14px calc(20px + env(safe-area-inset-bottom)); }
  .admin-record-mobile-back { display: grid; flex: 0 0 auto; }
  .admin-record-form__actions { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 4; margin-inline: -14px; margin-bottom: -17px; padding: 12px 14px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); }
  .admin-record-form__actions .btn { flex: 1; }
  .assignment-list { max-height: 46dvh; }
  .manning-workspace .page-header { align-items: end; }
  .manning-date { min-width: 145px; }
  .manning-summary { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .manning-summary > div { min-height: 78px; padding: 12px 10px; border-radius: 14px; }
  .manning-summary span { font-size: var(--fs-meta); }
  .manning-toolbar { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 5; padding: 8px 0; background: var(--bg); }
  .manning-client-filter { min-width: 48px; width: 48px; overflow: hidden; }
  .manning-client-filter select { width: 48px; padding-inline: 8px; color: transparent; }
  .manning-layout { min-height: 0; display: block; }
  .manning-master { max-height: none; border-radius: 15px; }
  .manning-detail-wrap { border-radius: 15px; }
  .manning-workspace.has-selection .manning-master { display: none; }
  .manning-workspace:not(.has-selection) .manning-detail-wrap { display: none; }
  .manning-detail { padding: 17px 14px calc(20px + env(safe-area-inset-bottom)); }
  .manning-mobile-back { display: grid; flex: 0 0 auto; }
  .manning-detail__head { align-items: flex-start; }
  .manning-detail__head > .status-pill { position: absolute; right: 28px; margin-top: 51px; }
  .manning-shifts { grid-template-columns: 1fr; }
  .manning-tools { display: grid; grid-template-columns: 1fr 1fr; }
  .manning-detail__actions { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 4; margin-inline: -14px; margin-bottom: -17px; padding: 12px 14px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); }
  .manning-detail__actions > span { display: none; }
  .manning-detail__actions .btn { width: 100%; }
  .login-event { grid-template-columns: 42px minmax(0, 1fr); align-items: start; gap: 10px; padding: 14px; }
  .login-event__icon { width: 42px; height: 42px; border-radius: 13px; }
  .login-event__device { grid-column: 2; }
  .login-event time { grid-column: 2; white-space: normal; }
}

/* Conversation workspaces use the same adaptive shell and keep the work area
   inside the viewport. Only the transcript scrolls. */
body.pw-authenticated .pwc-page {
  --pwc-primary: var(--pw-navy-800);
  --pwc-primary-hover: var(--pw-navy-950);
  --pwc-text: var(--text);
  --pwc-muted: var(--text-muted);
  --pwc-subtle: var(--text-subtle);
  --pwc-surface: var(--surface);
  --pwc-surface-2: var(--surface-2);
  --pwc-bg: var(--bg);
  --pwc-border: var(--border);
  width: 100%;
  max-width: var(--os-content);
}
body.pw-authenticated .pwc-page__eyebrow { color: var(--pw-steel-600); }
body.pw-authenticated .pwc-page__header { margin-bottom: 14px; }
body.pw-authenticated .pwc-surface {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
}
body.pw-authenticated .pwc-transcript {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
}
body.pw-authenticated .pwc-composer {
  position: relative;
  flex: 0 0 auto;
  z-index: 2;
}
body.pw-authenticated .pwc-message--mine .pwc-message__bubble,
body.pw-authenticated .pwc-ai-message--user .pwc-ai-message__content {
  border-color: var(--pw-navy-800);
  background: var(--pw-navy-800);
}

@media (min-width: 1024px) {
  body.pw-authenticated .pwc-team {
    height: max(640px, calc(100dvh - var(--os-utility) - 64px));
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
  }
  body.pw-authenticated .pwc-team > .pwc-page__header { grid-column: 1 / -1; margin: 0; }
  body.pw-authenticated .pwc-team > .pwc-team-scope {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    margin: 0;
    overflow: auto;
    border-radius: 18px;
  }
  body.pw-authenticated .pwc-team > .pwc-surface {
    grid-column: 2;
    grid-row: 2;
    height: 100%;
  }
  body.pw-authenticated .pwc-team-scope__heading { display: block; }
  body.pw-authenticated .pwc-team-scope__heading .pwc-team-refresh { width: 100%; margin-top: 14px; }
  body.pw-authenticated .pwc-team-scope__controls { grid-template-columns: 1fr; }
  body.pw-authenticated .pwc-assistant {
    height: max(640px, calc(100dvh - var(--os-utility) - 64px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
  }
  body.pw-authenticated .pwc-assistant > .pwc-page__header { margin: 0; }
  body.pw-authenticated .pwc-assistant > .pwc-surface { height: 100%; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  body.pw-authenticated .pwc-team {
    height: max(620px, calc(100dvh - var(--os-utility) - 52px));
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
  }
  body.pw-authenticated .pwc-team > .pwc-page__header { grid-column: 1 / -1; margin: 0; }
  body.pw-authenticated .pwc-team > .pwc-team-scope { grid-column: 1; grid-row: 2; min-height: 0; margin: 0; overflow: auto; }
  body.pw-authenticated .pwc-team > .pwc-surface { grid-column: 2; grid-row: 2; height: 100%; }
  body.pw-authenticated .pwc-team-scope__heading { display: block; }
  body.pw-authenticated .pwc-team-scope__heading .pwc-team-refresh { width: 100%; margin-top: 12px; }
  body.pw-authenticated .pwc-team-scope__controls { grid-template-columns: 1fr; }
  body.pw-authenticated .pwc-assistant {
    height: max(620px, calc(100dvh - var(--os-utility) - 52px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
  }
  body.pw-authenticated .pwc-assistant > .pwc-page__header { margin: 0; }
  body.pw-authenticated .pwc-assistant > .pwc-surface { height: 100%; }
}

@media (max-width: 767px) {
  body.pw-authenticated[data-os-route-key^="#/chat"] #app-root,
  body.pw-authenticated[data-os-route-key^="#/ai"] #app-root {
    padding-top: calc(60px + env(safe-area-inset-top) + 8px);
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
  body.pw-authenticated .pwc-team,
  body.pw-authenticated .pwc-assistant {
    height: calc(100dvh - 144px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: 510px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 8px;
  }
  body.pw-authenticated .pwc-assistant { grid-template-rows: auto minmax(0, 1fr); }
  body.pw-authenticated .pwc-page__header {
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
  }
  body.pw-authenticated .pwc-page__heading { flex: 1; }
  body.pw-authenticated .pwc-page__eyebrow,
  body.pw-authenticated .pwc-page__intro { display: none; }
  body.pw-authenticated .pwc-page h1 { font-size: 1.45rem; }
  body.pw-authenticated .pwc-page__header > .pwc-button {
    width: 48px;
    min-width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
  }
  body.pw-authenticated .pwc-page__header > .pwc-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    padding: 0;
    margin: -1px;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  body.pw-authenticated .pwc-team-scope {
    margin: 0;
    padding: 10px;
    border-radius: 14px;
  }
  body.pw-authenticated .pwc-team-scope__heading,
  body.pw-authenticated .pwc-team-scope__help { display: none; }
  body.pw-authenticated .pwc-team-scope__controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }
  body.pw-authenticated .pwc-team-field label { font-size: var(--fs-meta); }
  body.pw-authenticated .pwc-team-field select { min-height: 44px; font-size: .9rem; }
  body.pw-authenticated .pwc-team > .pwc-surface,
  body.pw-authenticated .pwc-assistant > .pwc-surface { height: 100%; border-radius: 14px; }
  body.pw-authenticated .pwc-toolbar { min-height: 52px; padding: 8px 11px; }
  body.pw-authenticated .pwc-toolbar__copy strong { font-size: .95rem; }
  body.pw-authenticated .pwc-toolbar__copy span { font-size: var(--fs-meta); }
  body.pw-authenticated .pwc-transcript { padding: 12px 10px; }
  body.pw-authenticated .pwc-composer { padding: 10px; }
  body.pw-authenticated .pwc-composer > label,
  body.pw-authenticated .pwc-composer__help,
  body.pw-authenticated .pwc-privacy { display: none; }
  body.pw-authenticated .pwc-composer__row { gap: 7px; }
  body.pw-authenticated .pwc-composer textarea { min-height: 48px; font-size: 1rem; }
  body.pw-authenticated .pwc-suggestions {
    max-height: 118px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px 10px 0;
  }
  body.pw-authenticated .pwc-suggestions .pwc-chip { width: auto; min-width: min(260px, 75vw); }
  body.pw-authenticated .pwc-ai-message { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; }
  body.pw-authenticated .pwc-ai-message__avatar { width: 34px; height: 34px; border-radius: 10px; }
  body.pw-authenticated .pwc-ai-message__content { padding: 11px 13px; font-size: 1rem; }
}

/* Admin editors must clear the native bottom navigation. Record forms use a
   normal footer; the long rule studio keeps its Save control above the dock. */
@media (max-width: 767px) {
  html[data-pw-workspace="admin"] #app-root .admin-collection .admin-record-form__actions {
    position: static;
    margin: 18px 0 0;
    padding: 14px 0 0;
    background: transparent;
    backdrop-filter: none;
  }
  html[data-pw-workspace="admin"] #app-root .policy-studio .policy-actions {
    bottom: calc(var(--pw-shell-bottom-height, 64px) + 12px);
  }
}
