/* Study sharing: Share dialog, People → Study access dialog, card badges and the read-only banner. */
.share-dialog { width:min(560px, calc(100vw - 32px)); max-width:none; max-height:calc(100vh - 48px); padding:0; border:1px solid var(--border); border-radius:18px; color:var(--ink); background:var(--surface,#fff); box-shadow:0 24px 80px rgba(23,32,51,.24); }
.share-dialog::backdrop { background:rgba(23,32,51,.5); backdrop-filter:blur(3px); }
.share-card { display:flex; flex-direction:column; gap:16px; padding:22px 24px; max-height:calc(100vh - 50px); }
.share-card-wide { min-height:0; }
.share-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.share-head h2 { margin:0; font-family:var(--font-display); font-size:1.2rem; }
.share-sub { margin:4px 0 0; color:var(--ink-muted); font-size:.875rem; }
.share-close { flex:none; }
.share-add { display:grid; grid-template-columns:minmax(0,1fr) 150px auto; gap:10px; align-items:end; }
.share-field { display:flex; flex-direction:column; gap:6px; font-size:.8rem; font-weight:600; color:var(--ink-soft); min-width:0; }
.share-field select, .share-person select, .share-filter input { width:100%; min-height:38px; padding:7px 10px; border:1px solid var(--border); border-radius:10px; background:var(--surface,#fff); color:var(--ink); font:inherit; font-size:.875rem; }
.share-person select { width:auto; min-width:138px; }
.share-list { display:flex; flex-direction:column; border:1px solid var(--border); border-radius:12px; overflow:auto; min-height:0; }
.share-list-studies { max-height:52vh; }
.share-person { display:flex; align-items:center; gap:12px; padding:10px 14px; border-bottom:1px solid var(--border); }
.share-person:last-child { border-bottom:0; }
.share-person[hidden] { display:none; }
.share-avatar { flex:none; width:32px; height:32px; border-radius:50%; display:grid; place-items:center; font-size:.75rem; font-weight:700; color:#fff; background:var(--brand-primary,#303485); }
.share-person-text { display:flex; flex-direction:column; min-width:0; flex:1; }
.share-person-text strong { font-size:.9rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.share-person-text small { color:var(--ink-muted); font-size:.78rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.share-row-actions { display:flex; align-items:center; gap:6px; flex:none; }
.share-level-fixed { flex:none; font-size:.82rem; font-weight:600; color:var(--ink-muted); padding:0 6px; }
.share-empty, .share-note { margin:0; padding:12px 14px; color:var(--ink-muted); font-size:.85rem; }
.share-note { padding:10px 12px; border-radius:10px; background:var(--surface-muted,#f4f5fa); }
.share-levels { font-size:.85rem; color:var(--ink-soft); }
.share-levels summary { cursor:pointer; font-weight:600; color:var(--ink); }
.share-levels ul { margin:8px 0; padding-left:18px; display:grid; gap:4px; }
.share-levels p { margin:6px 0 0; }
.share-actions { display:flex; justify-content:flex-end; gap:10px; }
@media (max-width:560px) {
  .share-add { grid-template-columns:1fr; }
  .share-person { flex-wrap:wrap; }
  .share-row-actions { width:100%; justify-content:flex-end; }
}

/* Workspace header: Share button / access badge */
.workspace-access { display:flex; align-items:center; gap:8px; }
.workspace-access-badge { font-size:.78rem; font-weight:600; padding:4px 10px; border-radius:999px; background:var(--surface-muted,#eef0f8); color:var(--ink-soft); white-space:nowrap; }

/* Dashboard: owner line, shared badge, filter */
.study-card-owner { margin:-4px 0 0; font-size:.78rem; color:var(--ink-muted); }
.study-badge.status-shared { background:rgba(48,52,133,.1); color:var(--brand-primary,#303485); }
.study-filter { display:flex; gap:6px; flex-wrap:wrap; margin:0 0 14px; grid-column:1 / -1; }
.study-filter button { border:1px solid var(--border); background:var(--surface,#fff); color:var(--ink-soft); border-radius:999px; padding:5px 12px; font:inherit; font-size:.82rem; cursor:pointer; }
.study-filter button[aria-pressed="true"] { background:var(--brand-primary,#303485); border-color:var(--brand-primary,#303485); color:#fff; }

/* Read-only shared studies (viewer / results only) reuse the sample-study banner style */
body.study-readonly #btn-publish, body.study-readonly #btn-publish-inline, body.study-readonly #btn-save, body.study-readonly #btn-save-inline,
body.study-readonly #btn-export-study-backup, body.study-readonly #btn-undo-builder, body.study-readonly #btn-redo-builder,
body.study-readonly #tab-invite, body.study-readonly .journey-link[data-link="create-invite"], body.study-readonly #study-autosave-status,
body.study-not-owner #btn-delete-study { display:none !important; }
body.study-readonly #study-form { cursor:default; }
body.study-results-only #tab-create, body.study-results-only .journey-link, body.study-results-only #create-nav, body.study-results-only #btn-preview { display:none !important; }
/* Creating a public results link changes the study, so read-only people don't get the button. */
body.study-readonly #btn-create-results-share { display:none !important; }

/* People: delete button and access-end help text */
.user-delete-btn { color:#9b2c20; }
.user-delete-btn:hover { background:#fbeaea; color:#9b2c20; }
.form-help { margin:6px 0 0; font-size:.8rem; color:var(--ink-muted); }

/* ── People cards: keep badges inside the card, style the edit form ── */
.people-card { box-sizing:border-box; overflow:hidden; padding:18px 20px; }
.people-card .feedback-card-head { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:flex-start; gap:10px 16px; margin:0; width:100%; }
.people-card-title { min-width:0; flex:1 1 220px; }
.people-card-title strong { overflow-wrap:anywhere; }
.people-card-badges { flex:0 1 auto; max-width:100%; justify-content:flex-end; }
.people-card-badges .study-badge { white-space:nowrap; }
.people-card-meta { margin-top:12px; }
.people-edit-form { margin-top:16px; padding-top:16px; }
.people-edit-form .grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:14px 16px; }
.people-edit-form label { display:flex; flex-direction:column; gap:6px; font-size:.82rem; font-weight:600; color:var(--ink-soft); min-width:0; }
.people-edit-form input, .people-edit-form select { width:100%; min-height:40px; box-sizing:border-box; padding:8px 12px; border:1px solid var(--border); border-radius:10px; background:#fff; color:var(--ink); font:inherit; font-size:.9rem; font-weight:400; }
.people-edit-form input:focus, .people-edit-form select:focus { outline:2px solid color-mix(in srgb, var(--brand-primary) 35%, transparent); outline-offset:1px; border-color:var(--brand-primary); }
.people-edit-form .form-help { margin:10px 0 0; }
.people-edit-form .inline-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }
.people-edit-form .inline-actions .btn { min-height:38px; }

/* ── Demo sample studies: roomier cards and chips, search ── */
.demo-study-grid { gap:24px; grid-template-columns:repeat(auto-fill, minmax(320px, 1fr)); }
.demo-study-card { padding:22px; gap:14px; box-sizing:border-box; }
.demo-study-caps { gap:8px; }
.demo-study-caps li { padding:5px 11px; }
.demo-study-group h2 { margin-bottom:16px; }
.demo-study-search { margin:0 0 24px; }
.demo-study-search input { width:100%; max-width:440px; min-height:42px; box-sizing:border-box; padding:9px 14px; border:1px solid var(--border); border-radius:12px; background:#fff; color:var(--ink); font:inherit; font-size:.92rem; }
.demo-study-search input:focus { outline:2px solid color-mix(in srgb, var(--brand-primary) 35%, transparent); outline-offset:1px; border-color:var(--brand-primary); }
.demo-study-empty { margin:0; color:var(--ink-muted); font-size:.92rem; }
.demo-study-card[hidden], .demo-study-group[hidden] { display:none; }

/* ── People cards (final): self-contained layout, badges stay inside the card ── */
.people-card.people-card { box-sizing:border-box; width:100%; margin:0; padding:18px 20px; overflow:hidden; border:1px solid var(--border); border-radius:14px; background:#fff; }
.people-card.people-card .people-card-head { display:flex; flex-direction:column; align-items:flex-start; gap:10px; margin:0; width:100%; }
.people-card.people-card .people-card-title { display:flex; flex-direction:column; gap:4px; min-width:0; max-width:100%; }
.people-card.people-card .people-card-title strong { overflow-wrap:anywhere; }
.people-card.people-card .people-card-badges { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-start; max-width:100%; }
.people-card.people-card .people-card-meta { margin-top:12px; }
.people-card.people-card .user-card-actions { margin-top:14px; }

/* Demo: keep the search clear of the banner above and the first section below */
.demo-study-library > .demo-study-search, .demo-study-search { margin:32px 0 36px; }

/* Read-only people (viewer / results only): no Ask tab, no Generate insights button */
body.study-readonly .rtab[data-tab="ask"], body.study-readonly [data-hook="generate"] { display:none !important; }
