/* =========================================================
   2S DEVELOPMENT — Client Portal ("cp-*" components, portal.html)
   Purely additive, same discipline as css/agent.css: reuses design
   tokens from css/main.css and shell/component classes already
   defined in css/project.css (pe-app/pe-topbar/pe-stage, pe-btn,
   pe-card) and the ag-field/ag-form-actions form-field pattern from
   css/agent.css (deliberately copied rather than imported — portal.html
   does not load css/agent.css, that file is the internal Agent tool's
   own additive layer). Nothing in main.css/project.css/agent.css is
   modified here.
   ========================================================= */

/* The old auth shell/card/oauth/divider components
   (.cp-auth-topbar/.cp-auth-wrap/.cp-auth-card/.cp-auth-sub/
   .cp-auth-switch/.cp-auth-links/.cp-oauth-row/.cp-oauth-btn/
   .cp-oauth-note/.cp-divider) were replaced by the shared auth-entry
   system (css/owner-portal.css's "AUTH ENTRY" section) when the
   unauthenticated Client entry/login pages were redesigned. Removed
   after confirming zero remaining references anywhere in the repo. */

/* ---------------- form fields (mirrors css/agent.css .ag-field) ---------------- */
.cp-field-row{ display:flex; gap:16px; flex-wrap:wrap; }
.cp-field-row > .cp-field{ flex:1; min-width:170px; }
.cp-field{ display:flex; flex-direction:column; gap:8px; margin-bottom:20px; }
.cp-field label{ font:10px var(--mono); text-transform:uppercase; letter-spacing:.06em; color:var(--sage); }
.cp-field input, .cp-field select, .cp-field textarea{
  font:14px var(--sans); padding:12px 14px; border:1px solid var(--line); border-radius:3px; background:var(--ivory); color:var(--ink);
  width:100%;
}
.cp-field input:focus, .cp-field select:focus, .cp-field textarea:focus{ outline:none; border-color:var(--ink); }
.cp-field textarea{ resize:vertical; }
.cp-field-hint{ font-size:11px; color:var(--sage); }

/* Delete Account (Account → Danger zone) — was .pe-btn.is-ghost, which
   deliberately zeroes border/padding for a text-like link button
   elsewhere; that made an irreversible action look like plain text.
   Keeps .pe-btn's own box/padding (via .is-small) and only recolors it
   with the same rust destructive tone used by network-agent.css's
   .is-danger, scoped here so no other .pe-btn is affected. */
.cp-danger-btn{ border-color:#9c5b3e; color:#9c5b3e; align-self:flex-start; }
.cp-danger-btn:hover{ background:#9c5b3e; color:var(--ivory); border-color:#9c5b3e; }
.cp-danger-btn:focus-visible{ outline:2px solid #9c5b3e; outline-offset:2px; }
.cp-form-actions{ display:flex; align-items:center; gap:16px; margin-top:8px; flex-wrap:wrap; }

/* ---------------- alerts ---------------- */
.cp-alert{
  font-size:13px; line-height:1.6; padding:14px 16px; border-radius:3px; margin-bottom:24px;
  border:1px solid var(--line);
}
.cp-alert.is-error{ border-color:#e3c9be; background:#fbf1ec; color:#9c5b3e; }
.cp-alert.is-ok{ border-color:#c9d3c3; background:#f1f4ee; color:#3f4a3a; }
.cp-alert.is-info{ border-color:var(--line); background:var(--clay); color:var(--sage-deep); }
.cp-dev-link{ display:block; margin-top:8px; font:11px var(--mono); word-break:break-all; color:var(--sage-deep); }

/* project.css's .pe-save-exit is only ever an <a> elsewhere on this
   site; the portal's "Log out" is a <button> (no href to log out to)
   so it needs the browser's default button chrome reset to match. */
button.pe-save-exit{ background:none; cursor:pointer; font-family:inherit; color:var(--ink); }
button.pe-save-exit:hover{ color:var(--ivory); }

/* ---------------- authenticated shell ---------------- */
.cp-topbar{ justify-content:flex-start; gap:28px; }
.cp-topbar-badge{
  font:10px var(--mono); text-transform:uppercase; letter-spacing:.1em; color:var(--ivory);
  background:var(--sage-deep); padding:5px 10px; border-radius:3px; flex:0 0 auto;
}
.cp-nav{ display:flex; align-items:center; gap:4px; flex:1; overflow-x:auto; scrollbar-width:none; }
.cp-nav::-webkit-scrollbar{ display:none; }
.cp-nav-link{
  border:none; background:none; cursor:pointer; white-space:nowrap;
  font:11px var(--sans); letter-spacing:.02em; color:var(--sage); padding:8px 12px; border-radius:3px; transition:background .2s, color .2s;
  text-decoration:none;
}
.cp-nav-link:hover{ color:var(--ink); }
.cp-nav-link.is-active{ background:var(--ink); color:var(--ivory); }
/* flex-basis:0 from the base .cp-nav's `flex:1` otherwise wins over
   `width:100%` in a flex-wrap row (flex-basis beats width when both are
   set), so the nav never actually drops to its own line — it just gets
   squeezed into whatever sliver of space is left on row 1, pushing its
   later buttons out past the viewport edge. `flex:1 1 100%` forces a
   full-width basis so the wrap genuinely happens. */
@media (max-width:900px){ .cp-topbar{ flex-wrap:wrap; height:auto; padding:12px 16px; } .cp-nav{ order:3; flex:1 1 100%; width:100%; margin-top:6px; } }

.cp-stage{ padding-top:calc(var(--nav-h) + 40px); }

/* ---------------- dashboard ---------------- */
/* cp-welcome-sub is still live — reused by the Network Agent Portal's
   ported Vendor Network screens (js/network-agent-vendor-port.js), a
   cross-portal consumer of this shared css/portal.css file. Verified
   via repo-wide grep before touching anything in this file. */
.cp-welcome-sub{ font-size:14px; color:var(--sage); margin-bottom:8px; }

.cp-empty-state{
  border:1px dashed var(--line); border-radius:4px; padding:44px 30px; text-align:center; max-width:640px; margin-top:20px;
}
.cp-empty-state p{ font-size:13.5px; color:var(--sage); line-height:1.7; max-width:44ch; margin:0 auto 18px; }

/* ---------------- profile ---------------- */
.cp-section-title{ font:400 14px var(--sans); text-transform:uppercase; letter-spacing:.06em; color:var(--sage); margin:48px 0 20px; }
.cp-section-title:first-of-type{ margin-top:0; }
.cp-field-grid{ max-width:760px; }

/* ---------------- property address autocomplete (Google Places) ---------------- */
.cp-address-field{ position:relative; }
.cp-address-suggestions{
  position:absolute; top:calc(100% + 4px); left:0; right:0; z-index:20;
  background:var(--ivory); border:1px solid var(--line); border-radius:3px;
  max-height:260px; overflow-y:auto; box-shadow:0 8px 24px rgba(0,0,0,.08);
}
.cp-address-suggestion{
  display:block; width:100%; text-align:left; padding:10px 14px; border:none; background:none; cursor:pointer;
  font:13px var(--sans); color:var(--ink); border-bottom:1px solid var(--line);
}
.cp-address-suggestion:last-child{ border-bottom:none; }
.cp-address-suggestion:hover, .cp-address-suggestion.is-active{ background:var(--clay); }
.cp-address-suggestion .cpas-secondary{ display:block; font-size:11px; color:var(--sage); margin-top:2px; }

/* =========================================================
   Client Project Experience (dashboard CTA + creation wizard +
   workspace) — additive only. Every component that already existed
   for the public "Start a Project" flow (css/project.css's
   .pe-topbar/.pe-back chrome, .pe-card-grid/.pe-card,
   .pe-tier-grid/.pe-tier, .pe-upload-dropzone/.pe-upload-thumbs,
   .pe-chip-grid/.pe-chip, .pe-concept-grid/.pe-concept-card family,
   .pe-dash-timeline/.pe-dash-stage-row, .pe-dash-grid/.pe-dash-panel,
   .pe-budget-row) is reused as-is from js/portal-app.js — nothing
   below duplicates them. This block only adds the handful of pieces
   that don't already exist: the dashboard's start-project callout,
   wizard step scaffolding, the Step 2 drag-and-drop feedback states,
   and the concept card's extra direction/materials/furniture meta
   list.
   ========================================================= */

/* ---------------- dashboard: Start Your Project ---------------- */
.cp-start-card{
  border:1px solid var(--line); padding:40px 36px; margin:36px 0 44px; max-width:640px;
}
.cp-start-card h2{ font:400 26px var(--serif); letter-spacing:-.01em; margin-bottom:12px; }
.cp-start-card p{ font-size:13.5px; line-height:1.7; color:var(--sage); max-width:48ch; margin-bottom:24px; }
.cp-empty-state-tight{ padding:26px 24px; }
.cp-empty-state-tight p{ margin:0; }

/* Phase 28: project creation no longer happens as an in-portal wizard —
   "+ CREATE NEW PROJECT" navigates to the real project.html?mode=portal
   page, the same shared component and the same css/project.css styling
   the public /project flow uses. The Steps 1-7 wizard scaffolding that
   used to live here (cp-wizard-head/cp-wizard-step, upload-dropzone
   drag states, cp-pref-form spacing, cp-concept-meta) has been removed
   along with the portal-app.js screens it styled; nothing in the
   current file references those classes any more. */

/* ---------------- project workspace ---------------- */
.cp-workspace-back{
  display:inline-block; margin-bottom:20px; font:11px var(--mono); text-transform:uppercase; letter-spacing:.05em;
  color:var(--sage); cursor:pointer; text-decoration:none;
}
.cp-workspace-back:hover{ color:var(--ink); }

/* =========================================================
   PREMIUM PORTAL REDESIGN — additive only, same discipline as every
   block above: reuses css/main.css tokens and css/project.css's
   pe-card/pe-card-grid/pe-chip/pe-budget-row/pe-dash-*/pe-vendor-*
   families wherever a matching component already exists (Design
   Concepts, Products, Materials, Vendors, Budget, Timeline all lean on
   those almost entirely — see js/portal-app.js for exactly which
   classes each screen reuses). What follows is only the handful of
   genuinely new component shapes the redesign needs: the dashboard's
   "Current Project" hero, the workspace tab bar, My Projects' segmented
   filter + richer cards, the message thread UI, the documents list, and
   the Approval Center's decision rows.
   ========================================================= */

/* cp-hero-eyebrow is still live — reused by the Vision tab
   (js/portal-app.js's renderVisionTab) for the "Selected direction"
   label. The rest of the old Dashboard "Current Project" hero
   (.cp-hero-card/-name/-meta/-progress*/-next*) was replaced by the
   own-vd-masthead conversion and confirmed dead via repo-wide grep. */
.cp-hero-eyebrow{ font:10px var(--mono); text-transform:uppercase; letter-spacing:.1em; color:var(--sage); }

/* ---------------- dashboard: overview grid (recent updates / budget / timeline / messages previews) ---------------- */
.cp-overview-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:1px; background:var(--line); margin-top:8px; max-width:920px; }
.cp-overview-panel{ background:var(--ivory); padding:26px 28px; }
.cp-overview-panel h4{ font:10px var(--mono); text-transform:uppercase; letter-spacing:.08em; color:var(--sage); margin-bottom:16px; display:flex; justify-content:space-between; align-items:center; }
.cp-overview-panel h4 a{ color:var(--sage); text-decoration:underline; font-weight:400; text-transform:none; letter-spacing:0; cursor:pointer; }
.cp-overview-panel h4 a:hover{ color:var(--ink); }
/* v2: a 5th panel (Pending approvals) makes the grid odd — let a lone
   trailing panel span both columns instead of leaving an empty
   background cell beside it. */
.cp-overview-panel:last-child:nth-child(odd){ grid-column:1 / -1; }
@media (max-width:760px){ .cp-overview-grid{ grid-template-columns:1fr; } .cp-overview-panel:last-child:nth-child(odd){ grid-column:auto; } }

.cp-activity-row{ display:flex; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); font-size:12.5px; }
.cp-activity-row:last-child{ border-bottom:none; }
.cp-activity-row time{ flex:0 0 auto; font:10px var(--mono); color:var(--sage); white-space:nowrap; padding-top:1px; }
.cp-activity-row span{ color:var(--ink); line-height:1.5; }

/* Workspace tab bar (.cp-ws-tabs/.cp-ws-tab/.cp-tab-count/.cp-ws-panel)
   and My Projects' old segmented filter + card grid (.cp-segment/
   .cp-segment-btn/.cp-project-cards/.cp-project-card/.cpc-*) were
   replaced by own-tab-nav/own-tab-link and the own-pill-row/pe-chip +
   .pe-mp-card conversions respectively — confirmed dead via
   repo-wide grep (js/portal-app.js now uses these ids only as plain
   DOM ids, not classes; no other file references any of these
   classes as markup). Removed. */

/* ---------------- Design Concepts tab ---------------- */
.cp-concept-hero{ max-width:920px; margin-top:8px; }
.cp-concept-hero figure{ position:relative; aspect-ratio:16/9; overflow:hidden; background:var(--clay); margin:0; }
.cp-concept-hero img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.cp-concept-hero figcaption{ margin-top:18px; }
.cp-concept-direction-list{ margin-top:24px; display:flex; flex-direction:column; gap:10px; max-width:560px; }
.cp-concept-direction-list div{ display:flex; gap:14px; font-size:13px; }
.cp-concept-direction-list span{ flex:0 0 108px; font:10px var(--mono); text-transform:uppercase; letter-spacing:.05em; color:var(--sage); padding-top:1px; }
.cp-concept-note{ margin-top:20px; font-size:12px; color:var(--sage); max-width:60ch; line-height:1.7; }

/* ---------------- Selections tab (Products / Materials / Furniture / Lighting / Finishes) ---------------- */
.cp-item-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:1px; background:var(--line); margin-top:28px; max-width:960px; }
/* a sole trailing item (count ≡ 1 mod 3) spans the full row instead of
   leaving two empty background cells beside it — its figure's
   aspect-ratio keeps the image from stretching too tall */
.cp-item-grid .cp-item-card:last-child:nth-child(3n+1){ grid-column:1 / -1; }
.cp-item-grid .cp-item-card:last-child:nth-child(3n+1) .cpi-figure{ max-width:320px; }
.cp-item-card{ background:var(--ivory); padding:20px; }
.cp-item-card .cpi-figure{ position:relative; aspect-ratio:4/3; overflow:hidden; background:var(--clay); margin-bottom:14px; }
.cp-item-card .cpi-figure img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.cp-item-card .cpi-cat{ font:9px var(--mono); text-transform:uppercase; letter-spacing:.06em; color:var(--sage); }
.cp-item-card .cpi-name{ margin-top:6px; font:400 17px var(--serif); letter-spacing:-.01em; }
.cp-item-card .cpi-vendor{ margin-top:4px; font-size:11.5px; color:var(--sage); }
.cp-item-card .cpi-price{ margin-top:10px; font:11px var(--mono); color:var(--ink); }
.cp-item-card .cpi-actions{ margin-top:14px; display:flex; gap:10px; }
.cp-item-card .cpi-actions button{ font:9px var(--mono); text-transform:uppercase; letter-spacing:.05em; color:var(--sage); background:none; border:none; cursor:pointer; padding:0; }
.cp-item-card .cpi-actions button:hover{ color:var(--ink); text-decoration:underline; }
@media (max-width:900px){ .cp-item-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:560px){ .cp-item-grid{ grid-template-columns:1fr; } }

/* ---------------- Budget tab ---------------- */
.cp-budget-cat-head{ display:flex; justify-content:space-between; align-items:baseline; margin:36px 0 4px; }
.cp-budget-cat-head:first-of-type{ margin-top:20px; }
.cp-budget-cat-head span{ font:10px var(--mono); text-transform:uppercase; letter-spacing:.06em; color:var(--sage); }
.cp-budget-cat-head b{ font:11px var(--mono); color:var(--ink); }

/* ---------------- Vendors tab ---------------- */
.cp-vendor-actions{ margin-top:14px; display:flex; gap:16px; }
.cp-vendor-actions a{ font:10px var(--mono); text-transform:uppercase; letter-spacing:.05em; color:var(--sage-deep); text-decoration:underline; }

/* ---------------- Documents tab ---------------- */
.cp-doc-list{ display:flex; flex-direction:column; gap:1px; background:var(--line); border:1px solid var(--line); max-width:900px; margin-top:24px; }
.cp-doc-row{ background:var(--ivory); padding:18px 22px; display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.cp-doc-name{ font:400 16px var(--serif); letter-spacing:-.01em; }
.cp-doc-meta{ font:10px var(--mono); color:var(--sage); margin-top:4px; text-transform:uppercase; letter-spacing:.05em; }
.cp-doc-row a{ font:10px var(--mono); text-transform:uppercase; letter-spacing:.05em; color:var(--sage-deep); text-decoration:underline; }

/* ---------------- Messages tab ---------------- */
.cp-msg-layout{ display:grid; grid-template-columns:260px 1fr; gap:1px; background:var(--line); border:1px solid var(--line); max-width:960px; margin-top:24px; min-height:420px; }
.cp-thread-list{ background:var(--ivory); display:flex; flex-direction:column; }
.cp-thread-row{ padding:16px 18px; border-bottom:1px solid var(--line); cursor:pointer; transition:background .2s; }
.cp-thread-row:hover{ background:var(--stone); }
.cp-thread-row.is-active{ background:var(--clay); }
.cp-thread-title{ font:400 15px var(--serif); letter-spacing:-.01em; }
.cp-thread-preview{ margin-top:4px; font-size:11px; color:var(--sage); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cp-thread-unread{ display:inline-block; margin-top:6px; font:9px var(--mono); text-transform:uppercase; letter-spacing:.05em; color:var(--ivory); background:var(--sage-deep); padding:2px 7px; border-radius:10px; }
.cp-msg-pane{ background:var(--ivory); display:flex; flex-direction:column; }
.cp-msg-thread{ flex:1; padding:24px; overflow-y:auto; max-height:420px; display:flex; flex-direction:column; gap:14px; }
.cp-msg-bubble{ max-width:72%; }
.cp-msg-bubble .cpm-meta{ font:9px var(--mono); text-transform:uppercase; letter-spacing:.05em; color:var(--sage); margin-bottom:5px; }
.cp-msg-bubble .cpm-body{ padding:12px 14px; border-radius:3px; font-size:13px; line-height:1.6; background:var(--stone); }
.cp-msg-bubble.is-client{ align-self:flex-end; text-align:right; }
.cp-msg-bubble.is-client .cpm-body{ background:var(--ink); color:var(--ivory); }
.cp-msg-compose{ border-top:1px solid var(--line); padding:18px 20px; display:flex; gap:12px; }
.cp-msg-compose textarea{
  flex:1; resize:none; font:13px var(--sans); padding:11px 13px; border:1px solid var(--line); border-radius:3px;
  background:var(--ivory); color:var(--ink); min-height:44px;
}
.cp-msg-compose textarea:focus{ outline:none; border-color:var(--ink); }
@media (max-width:760px){ .cp-msg-layout{ grid-template-columns:1fr; } .cp-thread-list{ max-height:180px; overflow-y:auto; } }

/* ---------------- Approval Center tab ---------------- */
.cp-approval-list{ display:flex; flex-direction:column; gap:1px; background:var(--line); border:1px solid var(--line); max-width:920px; margin-top:24px; }
.cp-approval-item{ background:var(--ivory); padding:22px 24px; display:flex; justify-content:space-between; align-items:center; gap:20px; flex-wrap:wrap; }
.cp-approval-item .cpa-kind{ font:9px var(--mono); text-transform:uppercase; letter-spacing:.06em; color:var(--sage); }
.cp-approval-item .cpa-name{ margin-top:5px; font:400 18px var(--serif); letter-spacing:-.01em; }
.cp-approval-item .cpa-sub{ margin-top:4px; font-size:12px; color:var(--sage); }
.cp-approval-actions{ display:flex; gap:10px; flex:0 0 auto; }
.cp-approval-actions button{
  font:10px var(--mono); text-transform:uppercase; letter-spacing:.05em; padding:9px 16px; border-radius:3px; cursor:pointer;
  border:1px solid var(--line); background:var(--ivory); color:var(--ink); transition:background .2s, color .2s;
}
.cp-approval-actions button.is-approve{ background:var(--ink); color:var(--ivory); border-color:var(--ink); }
.cp-approval-actions button.is-approve:hover{ background:var(--sage-deep); border-color:var(--sage-deep); }
.cp-approval-actions button:not(.is-approve):hover{ border-color:var(--ink); }
