/* Shared dashboard layer. Page-only rules belong in the adjacent page CSS files. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body>header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  min-width: 100%;
  max-width: 100vw;
}

main.app-shell {
  display: flex;
  width: min(1180px, calc(100% - 2rem));
  max-width: none;
  min-height: calc(100dvh - var(--header-h, 76px));
  margin: 0 auto;
  padding-top: calc(var(--header-h, 76px) + 1rem);
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.billing-wrap,
.consent-builder-shell,
.participants-shell {
  width: auto;
}

main.hidden,
.content-card.is-hidden,
.is-hidden {
  display: none !important;
}

.controls,
.nav-actions,
.fab-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

html body>header>nav .nav-actions {
  flex-direction: row;
  align-items: center;
}

body>header>nav .button, body>header>nav select, body>header>nav button, body>header>nav .donate-toggle, body>header>nav .signin-toggle, .contact-toggle {
    min-width: 100%;
    text-decoration:unset;
    border-color: var(--border);
    color: var(--fg);
    background: var(--chip-bg);
    margin-top: 0;
    margin-bottom: 0;
}

html body>header>nav .nav-actions select {
  width: auto;
  min-width: 9rem;
}

html body>header>nav .nav-actions .button:has(> svg),
html body>header>nav .nav-actions form .button:has(> svg) {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  height: 44px;
  min-height: 44px;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  white-space: nowrap;
  padding: .35rem;
  transition: width .2s ease, max-width .2s ease, gap .2s ease, padding .2s ease, background-color .15s ease;
}

html body>header>nav .nav-actions .button:has(> svg):hover,
html body>header>nav .nav-actions .button:has(> svg):focus-visible,
html body>header>nav .nav-actions form .button:has(> svg):hover,
html body>header>nav .nav-actions form .button:has(> svg):focus-visible {
  width: max-content;
  max-width: 16rem;
  gap: .45rem;
  padding: .35rem .75rem;
}

html body>header>nav .nav-actions .button:has(> svg)>span,
html body>header>nav .nav-actions form .button:has(> svg)>span {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width .2s ease, opacity .16s ease;
}

html body>header>nav .nav-actions .button:has(> svg):hover>span,
html body>header>nav .nav-actions .button:has(> svg):focus-visible>span,
html body>header>nav .nav-actions form .button:has(> svg):hover>span,
html body>header>nav .nav-actions form .button:has(> svg):focus-visible>span {
  max-width: 12rem;
  opacity: 1;
}

html body>header>nav .nav-actions .button:has(> svg)>svg,
html body>header>nav .nav-actions form .button:has(> svg)>svg {
  flex: 0 0 20px;
}

.dashboard-fab,
.project-fab {
  max-width: calc(100vw - 2rem);
}

.dashboard-fab .nav-toggle {
  display: inline-flex;
  width: 38px;
  height: 38px;
  padding: .35rem;
}

.dashboard-fab .nav-toggle svg {
  display: block;
  margin: auto;
  fill: currentColor;
  stroke: currentColor;
}

[data-theme="light"] .nav-toggle,
[data-theme="light"] .nav-toggle svg {
  color: #000;
  fill: #000;
  stroke: #000;
}

.sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.sort-wrap .sort-icon,
.sort-wrap .sort-icon svg {
  display: inline-flex;
  width: 15px;
  height: 15px;
}

.dashboard-icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
}

.dashboard-icon-button svg {
  flex: 0 0 20px;
}

.controls .button,
.controls select {
  font: inherit;
}

select {
  appearance: unset;
}

.status-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 1.45rem;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: .1rem .35rem;
  font-size: .62rem;
  line-height: 1;
  text-transform: uppercase;
  opacity: .85;
  top: 1rem;
  right: 1rem;
}

.status-active {
  color: #0f766e;
}

.status-archived {
  color: #64748b;
}

.status-inventory {
  color: #166534;
  background: #f0fdf4;
}

[data-theme="dark"] .status-badge {
  opacity: 1;
}

[data-theme="dark"] .status-active,
[data-theme="dark"] .status-inventory {
  color: #86efac;
  background: rgba(20, 83, 45, .5);
}

[data-theme="dark"] .status-archived {
  color: #cbd5e1;
  background: rgba(51, 65, 85, .6);
}

.card-grid[data-view="list"] {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.card-grid[data-view="list"] .content-card {
  display: flex;
  width: auto;
  max-width: none;
  min-height: 0;
  padding: .65rem .8rem;
  flex-direction: column;
}

.card-grid[data-view="list"] .content-card-top-row,
.card-grid[data-view="list"] .content-card-middle-row,
.card-grid[data-view="list"] .content-card-bottom-row {
  min-height: 0;
  margin: 0;
  padding: .12rem 0;
}

.card-grid[data-view="list"] .content-card hr {
  margin-block: .25rem;
}

.card-grid[data-view="list"] .card-action-panel {
  padding: .45rem 3rem .45rem .75rem;
}

.card-grid[data-view="list"] .card-action-panel .group-row {
  width: 100%;
  flex-flow: row wrap;
}
/* card info rows — match portfolio (inventories.onlinepsychologystudies.com) */
.content-card-info {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
  width:100%;
}

.content-card-info.name h3 {
  margin: 0;
  font-size: 0.85rem;
  max-width: 95%;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-card-info.name strong {
  font-size: 1rem;
  line-height: 1.3;
}

.content-card-info.link {
  display: flex;
  align-items: center;
  gap: .6rem;
}


.folder-link .folder-open {
  display: none;
}

.folder-link:hover .folder-closed {
  display: none;
}

.folder-link:hover .folder-open {
  display: inline;
}

.group-row {
  display: flex;
  width: 90%;
  margin: auto;
  flex-direction: column;
  gap: .35rem;
}

.group-row button {
  padding: .35rem .5rem;
  color: inherit;
  background: var(--chip-bg, #f9fafb);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  cursor: pointer;
}

.card-action-panel {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  align-content: center;
  opacity: 0;
}

.card-panel-title {
  margin: 0 0 .25rem;
  font-size: .85rem;
  font-weight: 600;
}

.export-format-button {
  padding: .35rem .5rem;
  color: inherit;
  background: var(--chip-bg, #f9fafb);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.copy-link-button {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
}

.card-rule {
  width: 90%;
  margin-top: .2rem;
  opacity: .4;
}

.card-copy {
  display: flex;
  flex-direction: column;
  align-items: baseline;
}

.card-copy p,
.card-stat-list p {
  margin: 0;
  font-size: .8rem;
  font-weight: 600;
}

.card-stat-list {
  display: flex;
  flex-direction: column;
  align-items: baseline;
}

.card-stat-list p {
  margin-left: 0;
}

.empty-project-link {
  display: flex;
  width: 85%;
  margin: auto;
  align-content: center;
  justify-content: space-evenly;
}

.empty-project-link .plus {
  margin: auto;
  font-size: 2rem;
}

.empty-project-link p {
  width: 50%;
  margin: auto;
}

.study-progress {
  display: block;
  height: .45rem;
  overflow: hidden;
  background: color-mix(in srgb, var(--fg) 12%, transparent);
  border-radius: 999px;
}

.study-progress-bar {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: hsl(var(--progress-hue, 0) 72% 42%);
  border-radius: inherit;
  transition: width .2s ease, background-color .2s ease;
}

.study-progress-bar.is-complete { background: #15803d; }

.study-progress-list {
  display: flex;
  max-height: 12rem;
  overflow-x: hidden;
  overflow-y: auto;
  flex-direction: column;
  gap: .5rem;
  padding-right: .25rem;
  scrollbar-gutter: stable;
}

.study-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, .8fr) auto;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}

.study-progress-row .sp-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-progress-row .sp-pct {
  color: var(--muted);
  font-size: .75rem;
  white-space: nowrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .55);
  z-index: 80;
}

.modal-overlay.is-open,
.modal-overlay.is-visible,
.modal-overlay.open {
  display: grid;
}

.modal {
  width: min(780px, 100%);
  max-height: min(760px, calc(100dvh - 2rem));
  overflow: auto;
  background: var(--surface, #fff);
  color: var(--text, #111);
  border: 1px solid var(--border, #d1d5db);
  border-radius: var(--border-radius, 12px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
}

.feedback,
.modal-feedback {
  min-height: 1.2rem;
  color: var(--muted, #64748b);
}

.u-margin-0 {
  margin: 0 !important;
}

.u-text-left {
  text-align: left !important;
}

.u-hidden {
  display: none !important;
}

.u-link {
  color: inherit;
  text-decoration: underline;
}

.u-auto-left {
  margin-left: auto !important;
}

.u-inline-center {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

@media (max-width: 720px) {
  main.app-shell {
    width: min(100% - 1rem, 100%);
  }
}

/* Dashboard project cards */
.card-edit-controls {
  display: none;
  position: absolute;
  top: .65rem;
  right: .65rem;
  z-index: 3;
  align-items: center;
  gap: .35rem;
}

body.edit-mode .card-edit-controls {
  display: inline-flex;
}

.card-edit-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid #000;
  border-radius: var(--border-radius, 8px);
  background: var(--card-bg, #fff);
  color: var(--fg, #111);
  font: inherit;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}

.card-edit-controls svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-edit-controls button:hover {
  background: #000;
  color: #fff;
}

.card-edit-controls .delete-btn {
  background: #111;
  color: #fff;
}

.card-edit-controls .delete-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
}

body.edit-mode .content-card {
  position: relative;
  cursor: grab;
  animation: dashboard-jiggle .48s infinite alternate ease-in-out;
  transform-origin: center;
}

body.edit-mode .card-grid[data-view="list"] .content-card {
  animation-duration: .8s;
}

body.edit-mode .content-card:nth-child(2n) {
  animation-delay: -.24s;
}

body.edit-mode .content-card.is-dragging {
  z-index: 4;
  animation: none;
  opacity: .58;
  cursor: grabbing;
}

@keyframes dashboard-jiggle {
  from { transform: rotate(-.22deg); }
  to { transform: rotate(.22deg); }
}

body>header>nav>a[href="/billing"] {
  display: none;
}
body>header>nav .button,
body>header>nav select,
body>header>nav a {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

body>header>nav select.button {
  min-width: 0;
}

/* Project hub */
.hub-section {
  margin-top: .9rem;
  padding-top: 0;
  position: relative;
}

.hub-section.is-section-hidden,
.hub-section.collapsed .sec-body {
  display: none;
}

.topic-toggle-cont {
  

  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content:space-between;
  gap: .4rem;
  margin: .75rem auto;
  font-size: .7rem;
}


.topic-toggle-cont.filter-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--accent, #111) 24%, var(--border, #d1d5db));
  border-radius: var(--radius-md, 10px);
  padding: .75rem;
  background: var(--card-bg, #fff);
}
.filter-row{
  width:100%;
  max-width: 360px;
  display:flex; 
  justify-content:space-between;
  gap: .5rem;
}
.group-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}

.filter-dd-menu .group-filter {
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  padding: .45rem .55rem;
}

.filter-dd-menu .group-filter:hover,
.filter-dd-menu .group-filter.is-active {
  background: var(--chip-bg, #f9fafb);
  filter: none;
  transform: none;
}

/* Group selection changes the response set, not the button's visual priority. */
.responses-toggle.button.is-active {
  color: var(--fg);
  background: var(--card-bg);
}

[data-theme="dark"] .responses-toggle.button.is-active {
  color: var(--fg);
  background: var(--card-bg);
}
a.btn, a.button, button.btn, button.button {
    display: inline-flex;
    text-decoration:unset;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    text-align: center;
}

.tile-stats {
  margin-top: .25rem;
  font-size: .8rem;
}
.filter-dd-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
    border-color: color-mix(in srgb, var(--accent, #111) 28%, var(--border, #d1d5db));
}
.topic-toggle {
    white-space: nowrap;
    padding: .4rem .85rem;
    font-size: .8rem;
}

.consent-doc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: nowrap;
  margin: .5rem 0;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  padding: .6rem .8rem;
}

tr.detail-row td {
  background: var(--chip-bg, #f9fafb);
  font-size: .82rem;
}

tr.detail-row td>div {
  margin: .15rem 0;
}

.row-disclosure {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  color: inherit;
  background: transparent;
  cursor: pointer;
}
.row{
margin-top: 1.5rem;
margin-bottom: 1.5rem;
display: flex;
scroll-behavior: ;
justify-content: space-between;
align-content: center;
}
.caret {
  display: inline-block;
  width: 1em;
  transition: transform .15s ease;
}

.row-disclosure.open .caret {
  transform: rotate(90deg);
}

table caption {
  padding: .65rem;
  font-weight: 700;
  text-align: left;
}

/* Project participant roster */
.participant-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 14px;
  background: var(--card-bg, #fff);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .06);
}

.participant-table {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--fg, #111);
  font-size: .88rem;
}

.participant-table caption {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border, #d1d5db);
  background: color-mix(in srgb, var(--card-bg, #fff) 82%, var(--chip-bg, #f3f4f6));
  font-size: 1rem;
}

.participant-table th,
.participant-table td {
  padding: .8rem .75rem;
  border: 0;
  border-bottom: 1px solid var(--border, #d1d5db);
  text-align: left;
  vertical-align: middle;
}

.participant-table th {
  background: var(--chip-bg, #f3f4f6);
  color: var(--muted, #64748b);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.participant-table .part-row:nth-of-type(4n + 3) td {
  background: color-mix(in srgb, var(--card-bg, #fff) 92%, var(--chip-bg, #f3f4f6));
}

.participant-table .part-row:hover td {
  background: color-mix(in srgb, var(--card-bg, #fff) 82%, var(--chip-bg, #f3f4f6));
}

.participant-table tbody tr:last-child td {
  border-bottom: 0;
}

.participant-table code {
  display: inline-block;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  padding: .3rem .45rem;
  background: var(--chip-bg, #f3f4f6);
  font-size: .78rem;
  white-space: nowrap;
}

.participant-table .pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: .25rem .55rem;
  font-size: .72rem;
  font-weight: 800;
}

.participant-table .pill.yes {
  border: 1px solid #86efac;
  color: #166534;
  background: #dcfce7;
}

.participant-table .pill.no {
  border: 1px solid #fcd34d;
  color: #854d0e;
  background: #fef9c3;
}

[data-theme="dark"] .participant-table .pill.yes {
  border-color: #166534;
  color: #bbf7d0;
  background: #14532d;
}

[data-theme="dark"] .participant-table .pill.no {
  border-color: #854d0e;
  color: #fef08a;
  background: #713f12;
}

.participant-table .row-disclosure {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
}

.participant-table .icon-btn,
.participant-table .incontent-link {
  white-space: nowrap;
}

.participant-table tr.detail-row td {
  padding: 1rem 1.1rem 1.25rem;
  background: var(--chip-bg, #f3f4f6);
  line-height: 1.65;
}

.participant-table tr.detail-row td > div + div {
  margin-top: .4rem;
}

@media (max-width: 720px) {
  .participant-table-wrap {
    border-radius: 10px;
  }
}

.hub-section .page-header,
main.app-shell>.page-header {
  width: 100%;
  align-self: center;
  padding: 0;
  text-align: left;
  margin-bottom:0;
}

.sec-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  border-bottom: 0;
  padding-bottom: 0;
  cursor: default;
  user-select: text;
  text-align: left;
}

.sec-toggle .chev {
  display: none;
}

.hub-section.collapsed .sec-toggle .chev {
  transform: rotate(-90deg);
}

.sec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .9rem 0;
}

.toggle-label {
  margin: auto auto auto .4rem;
  color: var(--muted, #6b7280);
  font-size: .5rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.toggle-label:first-child { margin-left: 0; }
.tile { cursor: pointer; }

.tile:hover { filter: brightness(.97); }
.yes { color: #111; }
.no { color: #525252; }
code { 
  font-family: ui-monospace, Menlo, monospace;
  font-size: .82rem;
}

.empty {
  border: 1px dashed var(--border, #d1d5db);
  border-radius: 10px;
  padding: 1.5rem;
  color: var(--muted, #6b7280);
  text-align: center;
}

.art-card p { margin: .25rem 0; font-size: .82rem; }

.icon-btn {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.modal details { margin: .75rem 0; border: 1px solid var(--border, #d1d5db); }

.modal summary {
  cursor: pointer;
  padding: .7rem .8rem;
  font-weight: 700;
}

.modal details>div {
  padding: .25rem .8rem .8rem;
}

.req {
  color: #dc2626;
}

.card-kind {
  color: var(--muted, #6b7280);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.card-open {
  margin-top: auto;
  padding-top: .75rem;
  font-size: .75rem;
  font-weight: 700;
  text-decoration: underline;
}

/* Billing */
.billing-wrap {
  width: min(760px, 100%);
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--header-h, 76px) + 1.5rem) 1rem 4rem;
  box-sizing: border-box;
}

.plan-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
}

.plan-card {
  flex: 1 1 280px;
  min-width: 0;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 14px;
  padding: 1.25rem 1.25rem 1.5rem;
  background: var(--card-bg);
}

.plan-card.current {
  border-color: var(--fg);
  box-shadow: 0 0 0 1px var(--fg) inset;
}

.plan-card h3 {
  margin: .1rem 0 .25rem;
  font-size: 1.1rem;
}

.price {
  font-size: 2rem;
  font-weight: 800;
}

.price small {
  color: var(--muted, #6b7280);
  font-size: .85rem;
  font-weight: 600;
}

.feat {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin: 1rem 0 1.25rem;
  padding: 0;
  list-style: none;
}

.feat li {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .95rem;
}

.feat li::before {
  content: "\2713";
  color: var(--fg);
  font-weight: 800;
}

.badge.active,
.badge.free,
.badge.pending,
.badge.lapsed,
.badge.cancelled {
  color: var(--fg);
}

.btn-upgrade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--fg);
  border-radius: 10px;
  padding: .6rem 1.1rem;
  background: var(--fg);
  color: var(--bg);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  max-width: 100%;
  text-align: center;
}

.btn-upgrade:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.notice {
  margin-top: 1rem;
  border: 1px solid #e0c97f;
  border-radius: 10px;
  padding: .75rem 1rem;
  background: #fdf6e3;
  font-size: .9rem;
}

@media (max-width: 480px) {
  body.public-pricing>header {
    gap: .35rem;
    padding-right: .5rem;
    padding-left: .5rem;
  }

  body.public-pricing .brand {
    font-size: .78rem;
  }

  body.public-pricing .header-right .button {
    min-width: auto;
    padding-right: .7rem;
    padding-left: .7rem;
  }
}

/* Consent builder */
.consent-builder-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(var(--header-h, 64px) + 1.5rem) clamp(1rem, 4vw, 2rem) 3rem;
}

.consent-builder-shell h1 {
  margin-bottom: .25rem;
}

.preview {
  margin-top: 1rem;
  border: 1px dashed var(--border, #d1d5db);
  border-radius: 8px;
  padding: 1rem;
  background: var(--chip-bg, #f9fafb);
}

.consent-start-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin: 1.25rem 0;
}

.consent-option {
  display: grid;
  min-height: 10rem;
  align-content: center;
  gap: .45rem;
  border: 1.5px solid var(--fg);
  border-radius: 12px;
  padding: 1rem;
  color: var(--fg);
  background: var(--card-bg);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.consent-option:hover,
.consent-option:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 35px rgba(15, 23, 42, .1);
}

.consent-option-primary {
  color: var(--bg);
  background: var(--fg);
}

.consent-option .option-number {
  display: inline-flex;
  width: 1.6rem;
  height: 1.6rem;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
}

.consent-option strong {
  font-size: 1rem;
}

.consent-option > span:last-child {
  font-size: .82rem;
  line-height: 1.45;
  opacity: .8;
}

.consent-setup-panel {
  scroll-margin-top: calc(var(--header-h, 64px) + 1rem);
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.consent-options-back {
  display: inline-flex;
  margin: 0 0 1rem;
}

.consent-setup-panel .section-heading {
  margin-bottom: .9rem;
}

.consent-setup-panel .section-heading h2,
.consent-setup-panel .section-heading p {
  margin-block: .2rem;
}

.consent-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
}

.consent-fieldset legend {
  padding: 0 .35rem;
  font-weight: 700;
}

#preview-frame {
  width: 100%;
  height: min(760px, 78dvh);
  border: 0;
  margin-top: .5rem;
  background: #fff;
}

#construct-radars,
#scatterplots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: .75rem;
  align-items: stretch;
  margin-block: 1rem;
}

#construct-radars .chart-wrap,
#scatterplots .chart-wrap {
  min-width: 0;
  min-height: 300px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .65rem;
  background: var(--card-bg);
}

@media (max-width: 760px) {
  .consent-start-options {
    grid-template-columns: 1fr;
  }

  .consent-option {
    min-height: 0;
  }
}

/* Analysis */
.analysis-shell {
  width: min(1400px, calc(100% - 2rem));
  max-width: none;
}

.analysis-shell h1 small {
  color: var(--muted, #6b7280);
  font-size: .9rem;
  font-weight: 400;
}

.analysis-shell .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .6rem;
  margin: 1rem 0;
}

.analysis-shell .stat {
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px;
  padding: .7rem 1rem;
  background: linear-gradient(145deg, var(--card-bg), var(--chip-bg, #f9fafb));
}

.analysis-shell .stat .v {
  font-size: 1.4rem;
  font-weight: 700;
}

.analysis-shell .stat .l {
  color: var(--muted, #6b7280);
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.analysis-shell .table-scroll {
  overflow: auto;
  max-height: 460px;
  border: 1px solid var(--border, #d4d4d4);
  border-radius: 8px;
  margin-top:15px;
  background: var(--card-bg, #fff);
}

.analysis-shell table {
  width: 100%;
  border-collapse: collapse;
  color: var(--fg);
}

.analysis-shell td,
.analysis-shell th {
  border-bottom: 1px solid var(--border, #d4d4d4);
  padding: .55rem .65rem;
  text-align: left;
  vertical-align: top;
}

.analysis-shell tbody tr:nth-child(even) td {
  background: var(--chip-bg, #f9fafb);
}

.analysis-shell th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card-bg);
  color: var(--fg);
}

.analysis-shell h2 {
  margin-top: 2rem;
  border-bottom: 1px solid var(--border, #d1d5db);
  padding-bottom: .35rem;
}

.analysis-shell .chart-wrap {
  width: 100%;
  min-height: 330px;
  margin: 1rem 0;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px;
  padding: .75rem;
  background: var(--card-bg, #fff);
}

.analysis-shell .chart-wrap canvas {
  max-height: 280px;
}

.study-analysis-brief {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  margin: 1rem 0 1.25rem;
  border: 1px solid var(--border, #d1d5db);
  border-left: 5px solid #2563eb;
  border-radius: 12px;
  padding: clamp(1rem, 3vw, 1.35rem);
  background: linear-gradient(135deg, var(--chip-bg, #f8fafc), var(--card-bg, #fff));
}

.study-analysis-copy h2 {
  margin: .25rem 0 .35rem;
  border: 0;
  padding: 0;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}

.study-analysis-copy p {
  max-width: 75ch;
  margin: 0;
  color: var(--muted, #64748b);
  line-height: 1.55;
}

.analysis-eyebrow {
  color: #2563eb;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.primary-outcome {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px;
  padding: .8rem .9rem;
  background: var(--card-bg, #fff);
}

.primary-outcome span {
  color: var(--muted, #64748b);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.primary-outcome strong {
  line-height: 1.35;
}

.analysis-key-result {
  display: grid;
  gap: .25rem;
  margin: 1rem 0;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: var(--card-bg, #fff);
  box-shadow: inset 5px 0 #2563eb;
}

.analysis-key-result strong {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-variant-numeric: tabular-nums;
}

.analysis-key-result p {
  margin: 0;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

.analysis-caveat {
  margin: .75rem 0 1.2rem;
  border-left: 3px solid #b45309;
  padding: .7rem .85rem;
  background: var(--chip-bg, #f8fafc);
  color: var(--muted, #64748b);
  font-size: .85rem;
  line-height: 1.55;
}

.analysis-guidance {
  margin: .75rem 0;
  border-left: 3px solid #2563eb;
  padding: .65rem .8rem;
  background: var(--chip-bg, #f8fafc);
  color: var(--muted, #64748b);
  font-size: .84rem;
  line-height: 1.5;
}

.analysis-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 1rem;
  align-items: stretch;
}

.analysis-chart-grid .chart-wrap {
  margin: 0;
}

.analysis-shell .note {
  margin: 3vh auto;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  padding: .8rem 1rem;
  background: var(--chip-bg, #f9fafb);
  font-size: .85rem;
}

.analysis-shell .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
}

.analysis-section {
  margin: 1rem 0;
  border: 1px solid var(--border, #d4d4d4);
  background: var(--card-bg);
  color: var(--fg);
}

.analysis-section>summary {
  cursor: pointer;
  padding: .9rem 1rem;
  border-bottom: 1px solid transparent;
  font-weight: 800;
  list-style: none;
}

.analysis-section[open]>summary {
  border-bottom-color: var(--border, #d4d4d4);
}

.analysis-section>summary::-webkit-details-marker {
  display: none;
}

.analysis-section>summary::after {
  content: "+";
  float: right;
  font-size: 1.2rem;
}

.analysis-section[open]>summary::after {
  content: "-";
}

.analysis-section-body {
  padding: 0 1rem 1rem;
}

@media (max-width: 680px) {
  .study-analysis-brief {
    grid-template-columns: 1fr;
  }

  .analysis-shell .chart-wrap {
    min-height: 280px;
  }
}

.ai-analysis-card {
  margin: 1.25rem 0 1.5rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 2px solid var(--fg, #111);
  border-radius: 14px;
  background: var(--card-bg, #fff);
}

.ai-analysis-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.ai-analysis-heading h2,
.ai-analysis-report h2,
.ai-analysis-report h3,
.ai-analysis-report h4 {
  margin-top: 0;
}

.ai-analysis-heading p { margin: .35rem 0; }
.ai-analysis-heading .eyebrow,
.ai-report-meta {
  color: var(--muted, #6b7280);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ai-purchase-button { white-space: nowrap; }
.ai-analysis-information { margin-top: 1rem; border-top: 1px solid var(--border, #d1d5db); padding-top: .8rem; }
.ai-analysis-information summary { cursor: pointer; font-weight: 700; }
.ai-analysis-information>div { max-width: 860px; color: var(--muted, #4b5563); line-height: 1.6; }
.ai-analysis-status { margin-top: 1rem; padding: .85rem 1rem; border: 1px solid var(--border, #d1d5db); border-radius: 10px; }
.ai-analysis-status p { margin: .4rem 0; }
.ai-analysis-report { margin-top: 1.25rem; border-top: 2px solid var(--fg, #111); padding-top: 1.25rem; }
.ai-analysis-report section { margin: 1.4rem 0; }
.ai-executive-summary { font-size: 1.08rem; line-height: 1.65; }
.ai-finding { margin: .75rem 0; padding: .9rem 1rem; border-left: 3px solid var(--fg, #111); background: var(--bg, #f8f8f8); }
.ai-finding h4, .ai-finding p { margin: .25rem 0; }
.ai-evidence { font-variant-numeric: tabular-nums; }
.ai-disclaimer { margin-top: 1.5rem; padding: .85rem 1rem; border: 1px solid var(--border, #d1d5db); color: var(--muted, #4b5563); }

@media (max-width: 720px) {
  .ai-analysis-heading { align-items: stretch; flex-direction: column; }
  .ai-purchase-button { width: 100%; white-space: normal; }
}

.participant-link {
  display: inline-flex;
  margin: 1rem 0;
}

/* Participant analysis */
.participants-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(var(--header-h, 64px) + 1.25rem) clamp(1rem, 4vw, 2rem) 3rem;
}

.participant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.participant-card {
  border: 1px solid var(--border, #d4d4d4);
  padding: 18px;
  background: var(--card-bg, #fff);
  color: var(--fg, #111);
}

.participant-card h2 {
  margin: 0;
  font-size: 18px;
}

.participant-head,
.metric {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.participant-head {
  align-items: start;
}

.metric-list {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.metric {
  border-top: 1px solid var(--border, #e5e5e5);
  padding-top: 7px;
  font-size: 13px;
}

.metric strong {
  text-align: right;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
}

.filters input {
  min-height: 42px;
  border: 1px solid var(--border, #bdbdbd);
  padding: 0 12px;
  background: var(--card-bg, #fff);
  color: var(--fg, #111);
  font: inherit;
}

.filter-dd {
  position: relative;
  display: inline-block;
}

.filter-dd-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
}

.filter-dd-toggle .dd-caret {
  font-size: .7rem;
  transition: transform .15s ease;
}

.filter-dd.open .filter-dd-toggle .dd-caret {
  transform: rotate(180deg);
}

.filter-dd-menu {
  position: absolute;
  top: calc(100% + .35rem);
  left: 0;
  z-index: 200;
  min-width: 200px;
  max-width: 320px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .35rem;
  background: var(--card-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
}

.filter-dd.open {
  z-index: 1000;
}

.topic-toggle-cont:has(.filter-dd.open) {
  position: relative;
  z-index: 201;
}
.filter-dd-opt:hover{
  background: var(--chip-bg, #f9fafb);
}
.filter-dd-opt {
  display: flex;
  align-items: center;
  gap: .5rem;
  border-radius: 6px;
  padding: .4rem .55rem;
  color: var(--fg);
  cursor: pointer;
  font-size: .85rem;
  white-space: nowrap;
}

.filter-dd-opt input {
  flex: none;
  width: auto;
  margin: 0;
  cursor: pointer;
}


.topic-search,
.section-search {
  width: 100%;
  max-width: 360px;
  min-height: 36px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px;
  padding: .4rem .7rem;
  background: var(--card-bg, #fff);
  color: var(--fg, #111);
  font: 500 .95rem/1.2 inherit;
}

.topic-search::placeholder {
  color: var(--muted);
}

.topic-search:focus {
  outline: none;
  border-color: var(--fg);
}

/* ============================================================
   Restore rules dropped in the 2026-06-30 CSS consolidation.
   These classes lost their base definitions, which broke:
     - the grid / list view toggle (no base .card-grid grid layout)
     - the project cards (no base .content-card box)
     - the edit-project modal form (.field / .modal padding gone)
     - the dashboard nav controls on desktop (the view's inline
       mobile-FAB styles set .nav-actions{display:none} and leaked
       to desktop). Literals/fallbacks are used because --card-min
       is not defined anywhere after the consolidation.
   ============================================================ */

/* --- card grid + card box (dashboard.ejs + dashboard-projects.ejs) --- */
.card-grid {
  display: grid;
  gap: var(--gap-md, 1rem);
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  width: 100%;
}

.content-card {
  position: relative;
  z-index: auto;
  background-color: var(--card-bg, #fff);
  border: 1px solid var(--border, #d1d5db);
  border-radius: var(--radius-md, 10px);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-height: 220px;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

/* --- edit-project modal form fields --- */
.modal {
  padding: 1.25rem 1.4rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-bottom: .85rem;
}

.field label {
  font-size: .9rem;
  color: var(--muted, #64748b);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border, #d1d5db);
  border-radius: var(--radius-sm, 6px);
  padding: .6rem .7rem;
  background: var(--card-bg, #fff);
  color: var(--fg, #111);
  font: inherit;
}

.field input,
.field select {
  min-height: 44px;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

/* --- desktop nav toolbar: show the controls inline and hide the
       mobile hamburger above the 720px breakpoint. The mobile FAB
       dropdown (<=720px, defined inline in dashboard.ejs) is untouched. --- */
@media (min-width: 721px) {
  html body>header>nav .nav-actions {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    min-width: 0;
    max-height: none;
    overflow: visible;
  }

  .dashboard-fab {
    display: block;
  }
}

/* ============================================================
   Match portfolio card + search styling (request 2026-06-30):
   the content-card hover/rows and the search overlay are ported
   from /var/www/portfolio so the dashboards match the rest of
   the apps (inventories.onlinepsychologystudies.com). The .type
   pill rule is intentionally NOT ported — sapien's .type row
   holds completion stats, not a category pill.
   ============================================================ */
/* .content-card:hover {
  border-color: rgb(120, 120, 120);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
} */

.content-card-top-row {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  align-items: baseline;
  gap: .5rem;
}

.content-card-middle-row {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
}

.content-card-bottom-row {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.content-card-info.date strong {
  font-size: .75rem;
  color: var(--muted, #6b7280);
  font-weight: 500;
}

.content-card-info.blurb {
  font-size: .9rem;
  color: var(--fg, #111);
  opacity: .85;
  line-height: 1.4;
}

.content-card-info.link a,
.content-card-info.link button {
  min-height: unset;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  color: var(--fg, #111);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.25;
}

.content-card-info.type>p {
  font-size: .75rem;
  font-weight: 900;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 0;
  margin-right:0;
}

.link-icon {
  display: inline-flex;
  align-items: center;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  transition: transform .12s ease;
}

/* Keep the project action icons grouped against the card's right edge. */
.content-card-info.name > .link-icon:first-of-type {
  margin-left: auto;
}

.content-card-info.link a:hover {
  text-decoration: underline;
}

/* search overlay — matches the portfolio search box (bordered, rounded
   "toggle-cont" container) */
.search-overlay {
  position: fixed;
  top: var(--header-h, 56px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--card-bg, #fff);
  border-bottom: 1px solid var(--border, #d1d5db);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .06);
  padding: clamp(.6rem, 2vw, 1rem) clamp(.75rem, 3vw, 2rem);
}

.search-overlay[hidden] {
  display: none;
}

.search-overlay .search-box {
  display: flex;
  align-items: center;
  gap: .55rem;
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px;
  padding: .45rem .7rem;
  background: var(--bg, #fff);
}

.search-overlay .search-box svg {
  flex-shrink: 0;
  color: var(--muted, #6b7280);
}

.search-overlay .search-box input {
  flex: 1;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--fg, #111);
  font: 500 .98rem/1.2 inherit;
  outline: none;
}

.search-overlay .search-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--muted, #6b7280);
  font-size: 1.4rem;
  padding: .1rem .4rem;
}

.search-overlay .search-close:hover {
  color: var(--fg, #111);
}

.search-overlay .search-hint {
  max-width: 720px;
  margin: .4rem auto 0;
  color: var(--muted, #6b7280);
  font-size: .78rem;
}

.content-card.is-search-miss {
  display: none !important;
}

.content-card.is-search-hit {
  outline: 2px solid var(--accent, #111);
  outline-offset: 2px;
}

/* ============================================================
   Section spacing to match the portfolio home / /admin layout
   (portfolio styles bare <section> + .inner-section-main-header;
   sapien uses .app-section). Gives the projects section room
   below the fixed header/search and a gap between its heading
   and the card grid, so the cards aren't crammed up top.
   ============================================================ */
.app-section {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md, 1.25rem);
  padding: clamp(1.5rem, 3vw, 3rem) clamp(.25rem, 2vw, 1rem) 1.5rem;
  width: 100%;
  padding-top:0;
}

.inner-section-main-header {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  text-align: left;
}

.inner-section-main-header h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0;
}

.inner-section-main-header>p {
  color: var(--muted, #6b7280);
  margin: 0;
}

.section-search-wrap {

  margin-top: 10px;
  margin-bottom: 10px;
}

/* Subdomain-colored dashboard sections and controls. */
.app-section[data-subsite="inventories"] {
  --accent: #15803d;
  --focus-ring: #15803d;
}

.app-section[data-subsite="articles"] {
  --accent: #dc2626;
  --focus-ring: #dc2626;
}

.app-section[data-subsite="tools"] {
  --accent: #2563eb;
  --focus-ring: #2563eb;
}

[data-theme="dark"] .app-section[data-subsite="inventories"] {
  --accent: #3fa76a;
  --focus-ring: #3fa76a;
}

[data-theme="dark"] .app-section[data-subsite="articles"] {
  --accent: #fca5a5;
  --focus-ring: #fca5a5;
}

[data-theme="dark"] .app-section[data-subsite="tools"] {
  --accent: #7fa6ff;
  --focus-ring: #7fa6ff;
}

.app-section[data-subsite] .inner-section-main-header,
.app-section[data-subsite]>h2.sec-toggle {
  border-left: 4px solid var(--accent, #111);
  padding-left: .85rem;
}

.content-card[role="button"]:focus-visible {
  border-radius: var(--radius-sm, 8px);
  outline: 3px solid color-mix(in srgb, var(--accent, #15803d) 24%, transparent);
  outline-offset: 4px;
}

.inventory-library-empty {
  margin-top: 1rem;
  max-width: 42rem;
  padding: clamp(1.25rem, 3vw, 2rem);
}

.app-section[data-subsite] .section-search,
.app-section[data-subsite] .topic-search {
  border-color: color-mix(in srgb, var(--accent, #111) 28%, var(--border, #d1d5db));
}

.app-section[data-subsite] .section-search:focus,
.app-section[data-subsite] .topic-search:focus {
  border-color: var(--accent, #111);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #111) 14%, transparent);
}

.content-card.is-collapsed {
  display: none !important;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.1rem;
}

.load-more-btn {
  border-color: var(--accent, #111);
  color: var(--accent, #111);
  font-size: .85rem;
}

.load-more-btn:hover,
.load-more-btn:focus-visible {
  background: var(--accent, #111);
  color: var(--bg, #fff);
}

/* Centered participant-preview modal on /inventories. Reuses .modal-overlay /
   .modal, but the body is a large iframe of the real /inventories/:id view. */
.inventory-preview-overlay {
  background: rgba(0, 0, 0, .58);
}

.inventory-preview-modal {
  width: 650px;
  max-width:90vw;
  max-height: min(92dvh, 900px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.inventory-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border, #d1d5db);
}

.inventory-preview-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.inventory-preview-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.inventory-preview-close {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.inventory-preview-close svg {
  display: block;
}

.inventory-preview-frame-wrap {
  flex: 1;
  min-height: 0;
  background: var(--surface, #fff);
}

.inventory-preview-frame {
  width: 100%;
  height: min(78dvh, 760px);
  border: 0;
  display: block;
}

body.modal-open {
  overflow: hidden;
}

/* Owner-only test workspace and approval action center. */
.workspace-panel,
.ledger-panel,
.approvals-panel {
  border: 1px solid var(--border, #d1d5db);
  border-radius: 14px; padding: clamp(1rem, 3vw, 1.5rem); margin-bottom: 1rem;
}
.eyebrow,
.approval-meta {
  display: flex; gap: .5rem; align-items: center; margin: 0;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
}
.workspace-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem;
}
.workspace-metrics div,
.approval-item {
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px; padding: .9rem; background: var(--surface, #fff);
}
.workspace-metrics strong, .workspace-metrics span { display: block; }
.workspace-metrics strong { font-size: 1.5rem; }
.workspace-note, .approval-item h3, .approval-item p { margin: 0; }
.ledger-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem; margin: 1rem 0;
}
.ledger-form label { display: grid; gap: .35rem; font-weight: 700; }
.ledger-form input, .ledger-form select { width: 100%; }
.ledger-form .button { align-self: end; }
.ledger-table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; }
.ledger-table th, .ledger-table td {
  border-bottom: 1px solid var(--border, #d1d5db); padding: .65rem; text-align: left;
}
.ledger-table th:last-child, .ledger-table td:last-child { text-align: right; }
.approval-list { display: grid; gap: .75rem; }
.approval-item {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.approval-item h3 { margin-top: .45rem; }
.approval-actions { display: flex; gap: .5rem; flex: 0 0 auto; }
.risk-high { color: #b42318; }
.risk-medium { color: #8a4b08; }
.risk-low { color: #166534; }

@media (max-width: 640px) {
  .approval-item {
    align-items: stretch; flex-direction: column;
  }
  .approval-actions .button { flex: 1; }
  .inventory-preview-frame {
    height: 70dvh;
  }
}
