/* ═══════════════════════════════════════════════════════════════
   The client portal (portal.html, assets/js/portal.js).
   Built on the site's tokens and its profile cards (.pf__card) and
   form fields (.qx__field); this file adds only what a portal needs.
   ═══════════════════════════════════════════════════════════════ */

.section--portal { padding-top: clamp(32px, 4vw, 56px); }
.cp { max-width: 1100px; margin: 0 auto; }

.cp-eyebrow { font-size: 12.5px; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--ink-4); margin-bottom: 6px; }
.cp-small { font-size: 13px; color: var(--ink-4); }
.cp-muted { color: var(--ink-4) !important; }
.cp-lead { font-size: 17px; color: var(--ink-2); margin-bottom: 10px; }
.cp-big { font-size: clamp(22px, 3vw, 30px); margin-bottom: 6px; }
.cp-h { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--ink-3); margin: 34px 0 14px; }
.cp-h4 { font-size: 14px; font-weight: 600; color: var(--ink-3); margin: 26px 0 8px; }
.cp-link { background: none; border: 0; padding: 0; font: inherit; font-size: 13.5px; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cp-link:hover { color: var(--ink); }
.cp-back { display: inline-block; margin-bottom: 14px; font-size: 14px; color: var(--ink-3); }
.cp-back:hover { color: var(--ink); }
.cp-split { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cp-gate { max-width: 620px; margin: 0 auto; }

.cp-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: 999px; font-size: 12.5px; color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.cp-chip--ink { background: var(--ink); border-color: var(--ink); color: #fff; }
/* A chip's colour is its status (the roles are in styles.css, Status):
   a stage, an open or in-progress request are neutral; done and the
   recommended choice are good; warn and bad are what they say. */
.cp-chip--stage { background: var(--info-wash); border-color: transparent; color: var(--ink); }
.cp-chip--open { background: var(--info-wash); border-color: transparent; }
.cp-chip--in-progress { background: var(--fill); border-color: transparent; }
.cp-chip--done, .cp-chip--ok { background: var(--ok-wash); border-color: var(--ok-line); color: var(--ok); }
.cp-chip--warn { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.cp-chip--bad { background: var(--bad-wash); border-color: var(--bad-line); color: var(--bad); }

/* ── Home ─────────────────────────────────────────────────────── */
.cp-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.cp-hello { font-family: var(--font-display); font-size: clamp(26px, 3.4vw, 38px); font-weight: 600; letter-spacing: var(--track-tight); color: var(--ink); }
.cp-who { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.cp-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 980px) { .cp-cats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cp-cats { grid-template-columns: 1fr; } }
.cp-cat { display: flex; flex-direction: column; gap: 8px; min-height: 220px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  a.cp-cat:hover { border-color: var(--ink); transform: translateY(-2px); }
}
.cp-cat__n { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1; color: var(--ink-ghost); }
.cp-cat__t { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.02em; margin-top: 10px; }
.cp-cat__b { font-size: 14px; line-height: 1.55; color: var(--ink-3); }
.cp-cat__s { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; }
.cp-cat__go { font-size: 14px; font-weight: 500; }

.cp-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.cp-row { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--border); color: var(--ink); flex-wrap: wrap; }
.cp-row:first-child { border-top: 0; }
a.cp-row:hover { background: var(--bg); }
.cp-row__main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; min-width: 0; }
.cp-row__t { font-weight: 500; overflow-wrap: anywhere; }
.cp-row__meta { white-space: nowrap; }
.cp-studio { margin-top: 34px; }
.cp-clients { margin-top: 18px; }
.cp-grant .qx__grid { margin-bottom: 4px; }

/* ── The questionnaire ────────────────────────────────────────── */
.cp-form { display: flex; flex-direction: column; gap: 22px; margin-top: 10px; }
.cp-form .qx__actions { margin-top: 4px; }
.cp-q textarea, .cp-q input[type="text"] { width: 100%; }
.cp-opts { border: 0; padding: 0; margin: 0; }
.cp-opts legend { font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 10px; }
.cp-opts__row { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-opt { position: relative; display: inline-flex; cursor: pointer; }
.cp-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cp-opt span { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border: 1px solid var(--border-2); border-radius: 999px; font-size: 14px; color: var(--ink-2); background: var(--surface); transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.cp-opt input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.cp-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── A workspace ──────────────────────────────────────────────── */
.cp-ws-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cp-stage-ctl { display: inline-flex; align-items: center; gap: 8px; }
.cp-stage-ctl select, .cp-reqs select, .cp-people select { height: 34px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); font: inherit; font-size: 13.5px; color: var(--ink); }

.cp-stages { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 22px 0 6px; padding: 0; }
.cp-stages li { position: relative; padding-top: 12px; font-size: 13px; color: var(--ink-4); }
.cp-stages li::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; border-radius: 2px; background: var(--fill); }
.cp-stages li.is-done::before { background: var(--ok); }
.cp-stages li.is-now { color: var(--ink); font-weight: 600; }
.cp-stages li.is-now::before { background: var(--ink); }   /* where the project is: ink, not an alarm */
@media (max-width: 560px) { .cp-stages li span { font-size: 11px; } }

.cp-tabs { display: flex; gap: 4px; margin: 20px 0 -12px; border-top: 1px solid var(--border); padding-top: 10px; flex-wrap: wrap; }
.cp-tab { padding: 8px 12px; border-radius: var(--radius); font-size: 14px; color: var(--ink-3); }
.cp-tab:hover { color: var(--ink); background: var(--bg); }
.cp-tab.is-on { color: var(--ink); background: var(--fill); font-weight: 500; }

.cp-glance { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 640px) { .cp-glance { grid-template-columns: repeat(2, 1fr); } }
.cp-glance div { display: flex; flex-direction: column; gap: 4px; }
.cp-glance strong { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--ink); }
.cp-latest { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.cp-latest p { margin-top: 4px; color: var(--ink-2); white-space: pre-wrap; }
.cp-brief { margin-top: 10px; }
.cp-brief dd { white-space: pre-wrap; }
@media (max-width: 640px) {
  .cp-brief > div { display: block; }
  .cp-brief dd { text-align: left; margin-top: 2px; }
}

.cp-feed, .cp-reqs, .cp-people { list-style: none; margin: 0; padding: 0; }
.cp-feed li { padding: 16px 0; border-top: 1px solid var(--border); }
.cp-feed li:first-child { border-top: 0; padding-top: 0; }
.cp-feed__by { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.cp-feed p { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-feed li.is-event p { color: var(--ink-4); font-size: 14px; }
.cp-feed li.is-event .cp-feed__by strong { font-weight: 500; color: var(--ink-3); }

.cp-reqs li { display: flex; flex-direction: column; gap: 6px; padding: 16px 0; border-top: 1px solid var(--border); }
.cp-reqs li:first-child { border-top: 0; padding-top: 0; }
.cp-reqs li p { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-reqs li.is-done strong { color: var(--ink-4); }
.cp-req-ctl { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.cp-people li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.cp-people li:first-child { border-top: 0; }

.cp-guard, .cp-apply { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cp-btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.cp-invite { display: flex; gap: 8px; margin-top: 16px; }
.cp-invite input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: var(--radius); font: inherit; font-size: 13.5px; background: var(--bg); color: var(--ink); }
.cp-verify { border-color: var(--warn-mark); }   /* email not verified: a caution */

/* ── Unread and sections ───────────────────────────────── */
.cp-dot { display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.cp-section { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); padding-top: 18px; margin-top: 6px; border-top: 1px solid var(--border); }
.cp-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.cp-brief__section dt { font-family: var(--font-display); font-weight: 600; color: var(--ink) !important; padding-top: 10px; }
.cp-plain { list-style: none; margin: 0; padding: 0; }
.cp-plain li + li { margin-top: 2px; }
.cp-mentions { border-color: var(--ink); }   /* somebody named you: attention, not an error */
.cp-mention { color: var(--ink); }
.cp-mention:hover .cp-row__t { text-decoration: underline; text-underline-offset: 3px; }

/* ── The access checklist in the questionnaire ─────────────────── */
.cp-access { border: 0; padding: 0; margin: 0; }
.cp-access legend { font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.cp-access__rows { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin-top: 10px; }
@media (max-width: 720px) { .cp-access__rows { grid-template-columns: 1fr; } }
.cp-access__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cp-access__row label { font-size: 14px; color: var(--ink-2); }
.cp-access__row select { height: 36px; max-width: 58%; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); font: inherit; font-size: 13.5px; color: var(--ink); }
.cp-access__how { margin-top: 4px; line-height: 1.55; }
.cp-access__list { margin-top: 18px; }

/* ── Boosts ───────────────────────────────────────────────────── */
.cp-qn { color: var(--ink-4); font-weight: 500; }
.cp-boost input[type="url"], .cp-boost input[type="number"], .cp-boost input[type="date"], .cp-boost select { width: 100%; height: var(--field-h); padding: 0 12px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); font: inherit; color: var(--ink); }
.cp-boost__facts { color: var(--ink-2); }
.cp-boost__host { color: var(--ink-4); }
.cp-boost__link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.cp-boost__result { --s-pt: 10px; padding: 10px 12px; border-radius: var(--radius); white-space: pre-wrap; }   /* an info box: styles.css, Status */
.cp-boost__report textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: var(--radius); font: inherit; font-size: 14px; background: var(--surface); }
.cp-reqs li.is-boost strong::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 2px; background: var(--accent); vertical-align: middle; }

/* ── The vault ────────────────────────────────────────────────── */
.cp-vault .qx__grid { margin-top: 6px; }
.cp-vault select { width: 100%; height: var(--field-h); padding: 0 12px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); font: inherit; color: var(--ink); }
.cp-vault #cp-v-other { margin-top: 8px; }
.cp-invite--tight { margin-top: 0; align-items: center; }
.cp-invite--tight input { background: var(--surface); }
.cp-vault__item { align-items: flex-start !important; }
.cp-reveal { flex-basis: 100%; }
.cp-reveal:empty { display: none; }

/* ── The chat ─────────────────────────────────────────────────── */
.cp-chat__log { height: min(62vh, 560px); overflow-y: auto; padding: 4px 4px 12px; border-bottom: 1px solid var(--border); overscroll-behavior: contain; }
.cp-chat__day { position: sticky; top: 0; z-index: 1; width: fit-content; margin: 14px auto 10px; padding: 3px 10px; border-radius: 999px; background: var(--fill); font-size: 12px; color: var(--ink-3); }
.cp-msg { max-width: 78%; margin: 8px 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; background: var(--surface); }
.cp-msg.is-mine { margin-left: auto; border-radius: 14px 14px 4px 14px; background: var(--bg); }
.cp-msg.is-studio { border-color: var(--accent-wash); background: var(--accent-wash); }
.cp-msg__by { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; font-size: 13.5px; }
.cp-msg__del { margin-left: auto; font-size: 12px; opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.cp-msg:hover .cp-msg__del, .cp-msg__del:focus-visible { opacity: 1; }
@media (hover: none) { .cp-msg__del { opacity: 1; } }
@media (max-width: 640px) { .cp-msg { max-width: 92%; } }
.cp-rich { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-rich a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.cp-at { background: transparent; color: var(--ink); font-weight: 600; }
.cp-at.is-me { background: var(--accent-wash); color: var(--accent); border-radius: 4px; padding: 0 3px; }
.cp-chat__compose { display: flex; gap: 10px; align-items: flex-end; margin-top: 14px; }
.cp-chat__field { position: relative; flex: 1; min-width: 0; }
.cp-chat__field textarea { width: 100%; min-height: 48px; max-height: 180px; padding: 12px 14px; border: 1px solid var(--border-2); border-radius: var(--radius); font: inherit; font-size: 15px; resize: vertical; background: var(--surface); color: var(--ink); }
.cp-suggest { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 5; min-width: 220px; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); }
.cp-suggest li { padding: 8px 10px; border-radius: 6px; font-size: 14px; color: var(--ink); cursor: pointer; }
.cp-suggest li.is-on { background: var(--fill); }
.cp-chat .qx__warn a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
