/* Deckwright repository UI */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #16181d;
  --ink-soft: #5a5f6a;
  --line: #e3e1db;
  --accent: #0e1b30;
  --accent-ink: #ffffff;
  --tier1: #1a7f4e;
  --tier2: #1d5fb4;
  --tier3: #b07908;
  --tier4: #b3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.boot { padding: 4rem; text-align: center; color: var(--ink-soft); }

/* header */

header {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
}

header .wordmark {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent-ink);
  text-decoration: none;
}

header .tag {
  font-size: 0.8rem;
  opacity: 0.65;
  letter-spacing: 0.04em;
}

header .who {
  margin-left: auto;
  font-size: 0.85rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

header button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--accent-ink);
  border-radius: 6px;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
}

header button:hover { border-color: rgba(255, 255, 255, 0.8); }

/* header search (DECK_SEARCH_SPEC section 5): present on every view */

header { flex-wrap: wrap; align-items: center; }

.header-search { margin-left: auto; flex: 0 1 320px; min-width: 160px; }

header .who { margin-left: 0; }

.header-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--accent-ink);
  border-radius: 6px;
  padding: 0.32rem 0.7rem;
  font-size: 0.85rem;
  font-family: inherit;
}

.header-search input::placeholder { color: rgba(255, 255, 255, 0.55); }

.header-search input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.16);
}

main { max-width: 1080px; margin: 0 auto; padding: 1.6rem 1.5rem 4rem; }

/* login */

.login-card {
  max-width: 420px;
  margin: 12vh auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
}

.login-card h1 {
  margin: 0 0 0.2rem;
  font-size: 1.3rem;
  letter-spacing: 0.12em;
}

.login-card p { color: var(--ink-soft); font-size: 0.9rem; }

.login-card form { display: flex; gap: 0.5rem; margin-top: 1rem; }

.login-card form.stacked { flex-direction: column; }

.login-card input {
  flex: 1;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.95rem;
}

.alt-actions {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.8rem;
  font-size: 0.85rem;
}

.alt-actions a { color: var(--ink-soft); }
.alt-actions a:hover { color: var(--ink); }

.login-card button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 6px;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.notice { margin-top: 0.9rem; font-size: 0.88rem; color: var(--ink-soft); }
.notice.error { color: var(--tier4); }

/* company browse strip */

.company-strip {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.company-strip .co {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  width: 84px;
}

.company-strip .co-mark {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.12s ease;
}

.company-strip .co-mark img {
  max-width: 78%;
  max-height: 78%;
  display: block;
}

.company-strip .co-mono {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.company-strip .co-name {
  font-size: 0.7rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.25;
}

.company-strip .co:hover .co-mark { border-color: var(--accent); }

.company-strip .co.active .co-mark {
  border: 2px solid var(--accent);
  background: var(--bg);
}

.company-strip .co.active .co-name { color: var(--ink); font-weight: 600; }

/* shelf card grid */

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(14, 27, 48, 0.08);
}

/* Reserved cover slot: fixed aspect ratio whether it holds a monogram tile
   (today) or a real cover image (DECK_PREVIEW_SPEC), so nothing shifts. */
.card-cover {
  aspect-ratio: 16 / 9;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-cover { position: relative; }

.card-cover .monogram {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  opacity: 0.55;
}

.card-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-cover[data-preview] { cursor: zoom-in; }

.card-pages {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 1;
  background: rgba(14, 27, 48, 0.82);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 4px;
  padding: 0.14rem 0.45rem;
}

.card-body { padding: 0.8rem 0.95rem 0.95rem; display: flex; flex-direction: column; gap: 0.45rem; }

.card-body h3 { margin: 0; font-size: 1rem; line-height: 1.3; }

.card-company { font-size: 0.8rem; color: var(--ink-soft); }

.card-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* search results (DECK_SEARCH_SPEC section 5) */

.search-summary { margin: 0.4rem 0 0; color: var(--ink-soft); }

.card-hits { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.page-chip {
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}

.page-chip:hover { border-color: var(--accent); }

.page-chip.static { cursor: default; color: var(--ink-soft); }

.hit-snippet {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.hit-snippet strong {
  font-weight: 650;
  color: var(--ink);
  background: #f8ecc4;
  border-radius: 3px;
  padding: 0 0.12rem;
}

/* header nav (rows 7-8) */

.hdr-nav { display: flex; gap: 0.9rem; }

.hdr-nav a {
  color: var(--accent-ink);
  opacity: 0.75;
  text-decoration: none;
  font-size: 0.85rem;
}

.hdr-nav a:hover { opacity: 1; text-decoration: underline; }

/* people (PEOPLE_SPEC) */

.page-title { margin: 0.4rem 0 1rem; font-size: 1.35rem; }

.section-title { margin: 2.2rem 0 0.7rem; font-size: 1.05rem; }

.sub-title { margin: 1.2rem 0 0.5rem; font-size: 0.9rem; color: var(--ink-soft); }

.people-list { display: flex; flex-direction: column; gap: 0.5rem; max-width: 640px; }

.person-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  color: inherit;
  text-decoration: none;
}

.person-card:hover { border-color: var(--accent); }

.person-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.person-mark img { width: 100%; height: 100%; object-fit: cover; }

.person-mark .co-mono { font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); }

.person-body { display: flex; flex-direction: column; gap: 0.1rem; }

.person-name { font-weight: 600; }

.person-meta { font-size: 0.8rem; color: var(--ink-soft); }

.person-seen { font-size: 0.72rem; color: var(--ink-soft); opacity: 0.8; }

.profile-head { display: flex; gap: 1.1rem; align-items: flex-start; margin-bottom: 1.2rem; }

.profile-head .person-mark { width: 72px; height: 72px; flex-basis: 72px; }

.profile-fields { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }

.f-label { display: inline-block; min-width: 5.5rem; color: var(--ink-soft); font-size: 0.78rem; }

.you-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  vertical-align: middle;
}

.invite-box {
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin: 0 0 1.2rem;
}

.invite-box summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }

.invite-box form { margin-top: 0.8rem; }

.invite-box select {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: var(--surface);
}

.avatar-label { font-size: 0.8rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: 0.3rem; }

.fine-print { font-size: 0.75rem; color: var(--ink-soft); margin: 0.6rem 0 0; }

.admin-actions { display: flex; gap: 0.6rem; margin-bottom: 1rem; }

.admin-actions button {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.admin-actions button:hover { border-color: var(--accent); }

.admin-actions .danger { color: var(--tier4); border-color: var(--tier4); }

/* audit log (AUDIT_SPEC) */

.audit-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }

.audit-filters select {
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.82rem;
  background: var(--surface);
}

.audit-table {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.audit-row {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.45rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.83rem;
  flex-wrap: wrap;
}

.audit-row:last-child { border-bottom: 0; }

.audit-row.denied { background: #fdf2f1; }

.a-when { color: var(--ink-soft); font-size: 0.75rem; flex: 0 0 7.5rem; }

.a-actor { font-weight: 600; flex: 0 0 10rem; }

.a-actor a { color: inherit; }

.a-action { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.76rem; color: var(--ink-soft); }

.a-label a { color: inherit; }

.a-completion { display: flex; align-items: center; gap: 0.5rem; font-size: 0.76rem; color: var(--ink-soft); }

.comp-bar {
  display: inline-block;
  width: 90px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
}

.comp-bar span { display: block; height: 100%; background: var(--accent); }

.denied-text { color: var(--tier4); font-weight: 600; }

/* access console (RBAC_CONSOLE_SPEC) */

.rbac-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.5rem;
}

.rbac-name { font-weight: 600; color: inherit; text-decoration: none; flex: 0 0 auto; }

.rbac-meta { font-size: 0.78rem; color: var(--ink-soft); flex: 0 0 auto; }

.rbac-roles { display: flex; gap: 0.35rem; flex-wrap: wrap; flex: 1 1 auto; }

.rbac-none { font-size: 0.78rem; color: var(--ink-soft); font-style: italic; }

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.12rem 0.35rem 0.12rem 0.6rem;
  cursor: help;
}

.role-x {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
}

.role-x:hover { color: var(--tier4); }

.rbac-grant {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.78rem;
  background: var(--surface);
  max-width: 15rem;
}

.rung-def { margin: 0.6rem 0 0; font-size: 0.85rem; }

/* named parties (NAMED_PARTIES_SPEC) */

.party-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.party-filter select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.82rem;
  background: var(--surface);
}

.named-block {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.9rem;
  margin-top: 0.5rem;
  background: var(--bg);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.named-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: help;
}

.named-party { font-weight: 600; }

.named-rel {
  font-weight: 400;
  color: var(--ink-soft);
  font-style: italic;
  cursor: help;
  margin-left: 0.3rem;
}

.named-sep { color: var(--line); margin: 0 0.1rem; }

/* content kinds (CONTENT_KINDS_SPEC): company sections + bands + badge */

.company-section { margin-top: 2rem; }

.company-head {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.band-head {
  margin: 1rem 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.band-count {
  font-weight: 500;
  opacity: 0.7;
  margin-left: 0.2rem;
}

.company-section .shelf-grid { margin-top: 0; }

.badge.kind {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
}

/* help text (ACCESS_MODEL_SPEC section 16, first build under the rule) */

.help-line {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.kind-control {
  display: inline-flex;
  flex-direction: column;
  margin-left: auto;
}

.kind-control select {
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.78rem;
  background: var(--surface);
}

.chip {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.08rem 0.4rem;
  color: var(--ink-soft);
  background: var(--bg);
}

/* library */

.company { margin: 2rem 0 0.8rem; }

.company h2 {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--line);
  padding-bottom: 0.4rem;
}

.deck {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 0.9rem;
}

.deck .deck-head { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }

.deck h3 { margin: 0; font-size: 1.05rem; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.badge.tier { color: #fff; border: 0; }
.badge.tier-1 { background: var(--tier1); }
.badge.tier-2 { background: var(--tier2); }
.badge.tier-3 { background: var(--tier3); }
.badge.tier-4 { background: var(--tier4); }

.version { margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px dashed var(--line); }

.version .v-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.version .v-label { font-weight: 600; }

.assets { display: flex; gap: 0.5rem; margin-top: 0.55rem; flex-wrap: wrap; }

.assets button {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--ink);
}

.assets button:hover { border-color: var(--accent); }

.assets button .gen { color: var(--ink-soft); font-size: 0.72rem; }

.empty {
  margin-top: 3rem;
  text-align: center;
  color: var(--ink-soft);
}

/* flip viewer */

.pv-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 14, 22, 0.94);
  display: flex;
  flex-direction: column;
  color: #fff;
}

.pv-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  flex: 0 0 auto;
}

.pv-title { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; }

.pv-pos { font-size: 0.85rem; opacity: 0.75; margin-left: auto; }

.pv-jump input {
  width: 4.2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  color: #fff;
  padding: 0.25rem 0.45rem;
  font-size: 0.85rem;
}

.pv-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  padding: 0 0.2rem;
}

.pv-close:hover { opacity: 1; }

.pv-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  min-height: 0;
  padding: 0 0.8rem 0.8rem;
}

.pv-img {
  max-width: calc(100% - 7rem);
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  background: #1a1e27;
}

.pv-nav {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.pv-nav:hover { background: rgba(255, 255, 255, 0.18); }

.pv-progress {
  flex: 0 0 auto;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
}

.pv-progress-fill {
  height: 100%;
  background: #fff;
  opacity: 0.85;
  transition: width 0.15s ease;
}

/* inline mount (CONTENT_KINDS_SPEC section 4): same component, same
   classes, hosted in a container on the deck page instead of the fixed
   overlay. Dark chrome kept so the two presentations read as one thing. */

.pv-inline {
  background: rgba(10, 14, 22, 0.96);
  border-radius: var(--radius);
  color: #fff;
  display: flex;
  flex-direction: column;
  margin: 1.2rem 0;
  overflow: hidden;
  outline: none;
}

.pv-inline:focus-visible { box-shadow: 0 0 0 3px rgba(29, 95, 180, 0.5); }

.pv-inline .pv-stage { padding: 0 0.8rem 0.8rem; }

.pv-inline .pv-img { max-height: 70vh; }

/* A one-pager renders without nav, so the image can use the full width. */
.pv-inline .pv-img:only-child { max-width: 100%; }

.pv-fs {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  padding: 0 0.2rem;
  margin-left: 0.4rem;
}

.pv-fs:hover { opacity: 1; }

.pv-head .pv-fs:first-of-type { margin-left: auto; }

.pv-inline .pv-head:has(.pv-pos) .pv-fs { margin-left: 0.4rem; }

/* viewer comments (COMMENTS_SPEC section 6): the panel is part of the
   component, both mounts. Light chrome inside the dark shell so comment
   text reads as page furniture, not slide content. */

.pv-comments {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  padding: 0 0.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.pv-comments:hover { opacity: 1; }

.pv-ccount { font-size: 0.78rem; font-weight: 700; }

/* Right-side grouping: the comments button takes the push when nothing
   else does; the fs auto-push rule yields when the button is present. */
.pv-head .pv-comments { margin-left: auto; }
.pv-head:has(.pv-pos) .pv-comments { margin-left: 0.4rem; }
.pv-head:has(.pv-comments) .pv-fs { margin-left: 0.4rem; }

.pv-overlay, .pv-inline { position: relative; }

/* With the panel open, the stage and progress bar give up its width so
   the next-page arrow sits beside the panel, never under it. */
.pv-panel-open .pv-stage,
.pv-panel-open .pv-progress { margin-right: min(320px, 85%); }

.pv-cpanel {
  position: absolute;
  top: 3rem;
  right: 0;
  bottom: 0;
  width: min(320px, 85%);
  background: var(--surface);
  color: var(--ink);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 0.7rem 0.9rem 1rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.pv-cpanel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.88rem;
}

.pv-cpanel-x {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}

.pv-cpanel-x:hover { color: var(--ink); }

.pv-cpanel .comment-thread { padding: 0.5rem 0.7rem; }

.pv-cpanel .pv-compose { margin-top: auto; }

.pv-placeholder {
  padding: 2.5rem;
  text-align: center;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.crumb { margin: 0 0 1rem; font-size: 0.88rem; }
.crumb a { color: var(--ink-soft); text-decoration: none; }
.crumb a:hover { color: var(--ink); }

/* deck page */

.deck-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.deck-hero .hero-co {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.deck-hero .co-mark {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.deck-hero .co-mark img { max-width: 78%; max-height: 78%; display: block; }

.deck-hero .co-mono { font-weight: 800; font-size: 0.75rem; letter-spacing: 0.06em; color: var(--ink-soft); }

.deck-hero .hero-co-name { font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }

.deck-hero h1 { margin: 0; font-size: 1.5rem; line-height: 1.25; }

.deck-desc { margin: 0.2rem 0 0; color: var(--ink-soft); font-size: 0.95rem; max-width: 62ch; }

/* PDP two-column grid (DECK_PAGE_SPEC section 11): viewer left ~65%,
   sticky action rail right. Collapses at 1000px, not 900: below that the
   65% column would put the slide under ~600px wide, the spec's early-
   collapse line. */

.pdp-grid {
  display: grid;
  grid-template-columns: minmax(0, 65fr) minmax(280px, 35fr);
  gap: 1.2rem;
  align-items: start;
  margin-top: 1rem;
}

.pdp-viewer { min-width: 0; }

.pdp-rail {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.pdp-rail .version-block { margin-top: 0; }

.pdp-rail #deck-activity .section-title { margin: 0.2rem 0 0.7rem; }

/* Compact single-line file rows in the rail. */
.pdp-rail .asset-row { font-size: 0.82rem; gap: 0.5rem; }
.pdp-rail .asset-row .a-fmt { min-width: 2.8rem; }
.pdp-rail .asset-row .a-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdp-rail .asset-row button { padding: 0.26rem 0.6rem; font-size: 0.78rem; }

@media (max-width: 1000px) {
  .pdp-grid { grid-template-columns: 1fr; }
  .pdp-rail { position: static; max-height: none; overflow-y: visible; }
}

.version-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-top: 1rem;
}

/* version history (DECK_AUTHORING_SPEC § 5): current is the hero, history
   behind a disclosure. Single-version decks render no disclosure at all. */

.version-history {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.55rem 0.9rem;
}

.version-history summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.version-history .version-block { margin-top: 0.7rem; }

.vh-count {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
}

.badge.current-badge {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
}

.v-date { font-size: 0.74rem; color: var(--ink-soft); }

/* authoring (DECK_AUTHORING_SPEC): courtesy affordances, Worker is the gate */

.authoring-actions { display: inline-flex; gap: 0.4rem; margin-left: auto; }

.authoring-btn {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.24rem 0.6rem;
  font-size: 0.76rem;
  cursor: pointer;
  color: var(--ink);
}

.authoring-btn:hover { border-color: var(--accent); }

.badge.intake { background: #fff4e0; color: #8a5a00; border-color: #e3c98f; }
.badge.intake.failed { background: #fdf2f1; color: #a13c31; border-color: #e5b5b0; }

.new-deck-box, .upload-box { margin-top: 0.4rem; }

.upload-box select, .upload-box input[type="text"], .upload-box input[type="file"],
.new-deck-box select, .new-deck-box input[type="text"] {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  width: 100%;
}

.version-block .v-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.version-block .v-label { font-weight: 700; font-size: 1rem; }

.version-block .bundle-btn {
  margin-left: auto;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 6px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.version-block .bundle-btn:hover { opacity: 0.88; }

.asset-table { margin-top: 0.7rem; border-top: 1px solid var(--line); }

.asset-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.asset-row:last-child { border-bottom: 0; }

.asset-row .a-fmt { font-weight: 700; min-width: 3.4rem; }

.asset-row .a-meta { color: var(--ink-soft); flex: 1; }

.asset-row .gen { color: var(--ink-soft); font-size: 0.75rem; }

.asset-row button {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--ink);
}

.asset-row button:hover { border-color: var(--accent); }

.asset-none { margin-top: 0.7rem; color: var(--ink-soft); font-size: 0.88rem; }

/* comments (COMMENTS_SPEC, deck row 9) */

.hidden { display: none !important; }

.comment-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  vertical-align: middle;
}

.comment-new {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  vertical-align: middle;
}

.comment-empty { color: var(--ink-soft); font-size: 0.85rem; }

.comment-list { display: flex; flex-direction: column; gap: 0.8rem; }

.comment-thread {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
}

.thread-anchor { margin-bottom: 0.4rem; }

.comment-row { padding: 0.3rem 0; }

.comment-row.reply {
  margin-left: 1rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--line);
}

.comment-row.tombstone {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 0.82rem;
}

.comment-meta { display: flex; gap: 0.5rem; align-items: baseline; }

.comment-author { font-weight: 600; font-size: 0.84rem; }

.comment-when { color: var(--ink-soft); font-size: 0.74rem; }

.comment-body {
  font-size: 0.86rem;
  margin: 0.15rem 0 0.2rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-actions { display: flex; gap: 0.6rem; }

.comment-actions button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.comment-actions button:hover { color: var(--accent); }

.comment-composer { margin-top: 0.5rem; }

.comment-composer textarea {
  width: 100%;
  min-height: 4rem;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
}

.composer-actions { display: flex; gap: 0.6rem; margin-top: 0.35rem; }

.composer-actions button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.composer-actions button[data-c-cancel] {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}

.comment-thread.resolved { background: var(--bg); }

.resolved-line {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-wrap: wrap;
  cursor: pointer;
  font-size: 0.82rem;
}

.resolved-snippet { color: var(--ink-soft); }

.resolved-by { color: var(--ink-soft); font-size: 0.74rem; margin-left: auto; }

.comment-show-resolved {
  margin-top: 0.7rem;
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.resolved-list { margin-top: 0.6rem; }

/* access diagnosis panel (ACCESS_EXPERIENCE_SPEC § 5) */

.diag-controls { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.9rem; }

.diag-controls select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  max-width: 18rem;
}

.diag-controls button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.86rem;
  cursor: pointer;
}

.diag-overall {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
}

.diag-overall.ok { background: #e8f5ec; color: #1b6b34; }
.diag-overall.fail { background: #fdf2f1; color: #a13c31; }

.diag-version {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
}

.diag-vhead { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem; }

.diag-verdict { font-weight: 700; font-size: 0.8rem; margin-left: auto; }
.diag-verdict.ok { color: #1b6b34; }
.diag-verdict.fail { color: #a13c31; }

.diag-cond { font-size: 0.85rem; padding: 0.15rem 0; }
.diag-cond.ok { color: var(--ink-soft); }
.diag-cond.fail { color: #a13c31; font-weight: 600; }

.diag-fix {
  margin-top: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  font-size: 0.85rem;
}

/* the unconditional contact line (ACCESS_EXPERIENCE_SPEC §§ 3.4, 4) */

.contact-line {
  margin: 2.5rem 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.contact-line a { color: inherit; }

.login-card .contact-line { margin-top: 1.4rem; }

/* transient delivery-error banner (DECK_PAGE_SPEC section 11) */

.flash-error {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  max-width: min(92vw, 480px);
  background: #7f1d1d;
  color: #fff;
  border-radius: 8px;
  padding: 0.65rem 1.1rem;
  font-size: 0.88rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 200;
}

/* conversion backlog (DECK_CONVERSION_SPEC § 5) */

.backlog-list { display: flex; flex-direction: column; gap: 0.5rem; }

.backlog-row {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font-size: 0.86rem;
}

.backlog-row.failed { border-color: #e5b5b0; }

.drain-now { margin-top: 0.8rem; }

.drain-now code {
  display: block;
  margin-top: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.72rem;
  overflow-x: auto;
  white-space: pre;
}

/* brand library (BRAND_ASSETS_SPEC) */

.brand-row {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.brand-label { font-weight: 600; }

.brand-usage { font-size: 0.78rem; color: var(--ink-soft); font-style: italic; }

.company-head .authoring-btn { margin-left: 0.7rem; vertical-align: middle; }

.brand-upload input[type="file"], .brand-upload input[type="text"], .brand-upload select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  width: 100%;
}

/* STAGING band (STAGING_SPEC § 9): fixed, unmissable, every page. Only
   rendered when /api/config says deployEnv is staging. */

.staging-band {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #1a1200;
  background: repeating-linear-gradient(-45deg, #ffb703 0 18px, #ffc93c 18px 36px);
  border-bottom: 2px solid #8a5a00;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.5rem;
}

body.is-staging { padding-top: 30px; }
body.is-staging .pv-overlay { top: 30px; }
body.is-staging .pdp-rail { top: calc(1rem + 30px); max-height: calc(100vh - 2rem - 30px); }

.login-card .staging-note {
  color: #8a5a00;
  font-weight: 600;
}
