﻿/**
 * JG Client Portal — component styles
 * Consumes semantic tokens from tokens.css only. No raw colour values.
 * Type roles follow the studio dictionary (tokens-spec.md §2).
 */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--type-family-sans); background: var(--color-surface-canvas); color: var(--color-text-strong); -webkit-font-smoothing: antialiased; display: flex; min-height: 100vh; }

/* ---------- Sidebar — JG Studio chrome (surface.inverse) ---------- */
.side { width: 236px; background: var(--color-surface-inverse); color: var(--color-text-inverse); display: flex; flex-direction: column; padding: 36px 28px 28px; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: var(--space-300); margin-bottom: 26px; }
.jgmark-img { width: 38px; height: 38px; border-radius: 10px; filter: invert(1); display: block; }
.side-ast { width: 18px; height: 18px; filter: invert(1); opacity: 0.35; display: block; margin: var(--space-500) 0 10px; }
.client-block { margin-bottom: 42px; }
.client-label { font-size: var(--type-legal-size); text-transform: uppercase; letter-spacing: var(--type-legal-tracking); color: var(--color-text-inverse-subtle); margin-bottom: var(--space-100); }
.client-name { font-family: var(--type-family-display); font-size: var(--type-heading-section-size); font-weight: var(--type-weight-medium); color: var(--color-text-inverse); letter-spacing: 0.01em; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: var(--color-text-inverse-subdued); text-decoration: none; font-size: var(--type-label-default-size); font-weight: var(--type-weight-medium); padding: 10px var(--space-300); border-radius: var(--radius-sm); border-left: 2px solid transparent; transition: color .12s ease, background .12s ease; }
.side nav a:hover { color: var(--color-text-inverse); background: var(--color-surface-inverse-hover); }
.side nav a.active { color: var(--color-text-inverse); background: var(--color-surface-inverse-active); border-left: 2px solid var(--color-border-inverse-strong); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.side-foot { margin-top: auto; font-size: var(--type-label-compact-size); line-height: 1.9; color: var(--color-text-inverse-subtle); }
.side-foot a { color: var(--color-text-inverse-link); text-decoration: none; border-bottom: 1px solid var(--color-border-inverse-subtle); padding-bottom: 1px; }
.side-foot a:hover { color: var(--color-text-inverse); border-bottom-color: var(--color-border-inverse-strong); }
.side-foot .copyright { font-size: var(--type-legal-size); letter-spacing: 0.1em; color: var(--color-text-inverse-faint); }

/* ---------- Content area ---------- */
.main { flex: 1; padding: 0; }
.content { max-width: 960px; margin: 0 auto; padding: 0 var(--space-1000); }
.page-band { background: var(--color-surface-raised); border-bottom: 1px solid var(--color-border-default); }
.page-band .content { padding-top: var(--space-1100); padding-bottom: var(--space-600); }
.content.body-content { padding-top: var(--space-1100); padding-bottom: 64px; }
header.page-head { display: flex; align-items: baseline; gap: var(--space-500); margin-bottom: var(--space-100); }
.proj-title { font-family: var(--type-family-display); font-size: var(--type-heading-title-size); font-weight: var(--type-weight-semibold); letter-spacing: -0.01em; }
.chip { margin-left: auto; font-size: var(--type-label-compact-size); font-weight: var(--type-weight-medium); color: var(--color-text-strong); border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); padding: 5px var(--space-400); white-space: nowrap; align-self: center; }
.subline { font-size: var(--type-body-compact-size); line-height: var(--type-body-compact-leading); color: var(--color-text-subdued); }

/* ---------- Phase cards (collapsible) ---------- */
details.phase { background: var(--color-surface-raised); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); padding: var(--space-100) 30px; margin-bottom: 22px; }
details.phase > summary { list-style: none; display: flex; align-items: center; gap: var(--space-400); padding: var(--space-500) 0; cursor: pointer; }
details.phase > summary::-webkit-details-marker { display: none; }
.phase-head { flex: 1; display: flex; flex-direction: column; gap: var(--space-100); }
details.phase > summary h2 { margin: 0; }
.phase-status { font-size: var(--type-label-compact-size); font-weight: var(--type-weight-medium); white-space: nowrap; }
.phase-status.done { color: var(--color-status-success-fg); }
.phase-status.active { color: var(--color-accent-text); }
.phase-chev { font-size: 18px; color: var(--color-text-subdued); transition: transform .15s ease; }
details.phase[open] .phase-chev { transform: rotate(180deg); }
.phase-body { padding: 0 0 var(--space-400); }
.phase-body .scope-meta { margin: -6px 0 var(--space-200); }
.phase-meta-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-400); margin: -6px 0 var(--space-400); }
.phase-meta-row .scope-meta { margin: 0; }

.num { font-family: var(--type-family-display); color: var(--color-text-subdued); font-weight: var(--type-weight-medium); font-size: 13px; letter-spacing: 0.1em; }
h2 { font-family: var(--type-family-display); font-size: var(--type-heading-section-size); font-weight: var(--type-weight-semibold); margin: 6px 0 14px; }
section { margin-bottom: 52px; }
html { scrollbar-gutter: stable; }
p { font-size: var(--type-body-default-size); line-height: var(--type-body-default-leading); color: var(--color-text-default); max-width: 64ch; }

/* ---------- File list (deliverables) ---------- */
.file-list { margin-top: var(--space-400); }
.file-group { background: var(--color-surface-raised); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-400); }
.file-group > .file-row:last-child { border-bottom: none; }
details.file-explore { background: var(--color-surface-sunken); border-top: 1px solid var(--color-border-default); }
details.file-explore .file-row:last-child { border-bottom: none; }
details.file-explore[open] > summary.file-toggle { border-bottom: 1px solid var(--color-border-default); }
.file-row { display: flex; align-items: center; gap: var(--space-500); padding: var(--space-300); border-bottom: 1px solid var(--color-border-default); text-decoration: none; color: inherit; transition: background .12s ease; }
a.file-row:hover, summary.file-row:hover, .file-toggle:hover { background: var(--color-surface-tint); }
.file-row .fthumb { width: 56px; aspect-ratio: 1 / 1; flex: none; border: 1px solid var(--color-border-default); border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface-raised); display: flex; align-items: center; justify-content: center; }
.file-row .fthumb img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.file-row .fthumb.contain img { object-fit: contain; padding: 8%; }
.file-row .fthumb.ink { background: var(--color-surface-inverse); }
.file-row .fbody { flex: 1; min-width: 0; }
.file-row .fname { font-family: var(--type-family-display); font-size: var(--type-heading-component-size); font-weight: var(--type-weight-medium); }
.file-row .fdesc { font-size: var(--type-body-compact-size); color: var(--color-text-subdued); line-height: var(--type-body-compact-leading); margin-top: 2px; }
.file-row .fdate { font-size: var(--type-meta-size); font-weight: var(--type-weight-medium); color: var(--color-text-subdued); letter-spacing: 0.08em; white-space: nowrap; }
details.file-item > summary.file-row { list-style: none; cursor: pointer; }
details.file-item > summary.file-row::-webkit-details-marker { display: none; }
.file-row .fcaret, .file-row .fcaret-gap { flex: none; width: 16px; text-align: center; }
.file-row .fcaret { font-size: 14px; color: var(--color-text-subdued); transition: transform .15s ease; }
details.file-item[open] > summary .fcaret { transform: rotate(180deg); }
.file-row .fcount { font-size: var(--type-meta-size); color: var(--color-text-subdued); white-space: nowrap; }
.file-row.sub { padding-left: calc(var(--space-300) + var(--space-600)); }
.file-row.sub .fthumb { width: 84px; }
.file-row.sub .fname { font-size: var(--type-label-default-size); }
.file-subhead { font-size: var(--type-legal-size); font-weight: var(--type-weight-medium); letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-subdued); padding: var(--space-300) var(--space-300) var(--space-100) calc(var(--space-300) + var(--space-600)); }
details.file-explore > summary.file-toggle { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--space-200); font-size: var(--type-legal-size); font-weight: var(--type-weight-medium); letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-default); padding: var(--space-300) var(--space-300) var(--space-300) calc(var(--space-300) + var(--space-600)); transition: background .12s ease; }
details.file-explore > summary.file-toggle::-webkit-details-marker { display: none; }
details.file-explore[open] > summary.file-toggle .fcaret { transform: rotate(180deg); }
.file-row.sub { padding-top: var(--space-200); padding-bottom: var(--space-200); gap: var(--space-400); }
.file-row.sub .fthumb { width: 36px; aspect-ratio: 1 / 1; border-radius: 6px; }
.file-row.sub .ffile { font-family: var(--type-family-sans); font-size: var(--type-body-compact-size); font-weight: var(--type-weight-regular); color: var(--color-text-default); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.fthumb.fico { background: none; border: none; }
.fthumb.fico svg { width: 20px; height: 20px; stroke: var(--color-text-subdued); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.file-row.sub .fdate { width: 96px; flex: none; font-weight: var(--type-weight-regular); letter-spacing: 0.02em; }
.file-row.sub .ftype { width: 44px; flex: none; font-size: var(--type-meta-size); font-weight: var(--type-weight-regular); color: var(--color-text-subdued); letter-spacing: 0.02em; white-space: nowrap; }

/* ---------- Work tiles ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-600); margin-top: var(--space-600); }
.work { background: var(--color-surface-raised); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; display: block; text-decoration: none; color: inherit; }
.work:hover { transform: translateY(-2px); box-shadow: var(--elevation-raised-hover); }
.work .thumb { aspect-ratio: 3 / 2; overflow: hidden; background: var(--color-surface-canvas); display: flex; align-items: center; justify-content: center; }
.work .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.work .thumb.contain img { object-fit: contain; padding: 10%; }
.work .thumb.ink { background: var(--color-surface-inverse); }
.work .meta { padding: var(--space-400) var(--space-500) 18px; }
.work .date { font-size: var(--type-meta-size); font-weight: var(--type-weight-medium); color: var(--color-text-subdued); letter-spacing: 0.08em; }
.work .title { font-family: var(--type-family-display); font-size: var(--type-heading-component-size); font-weight: var(--type-weight-medium); margin: 3px 0 4px; }
.work .blurb { font-size: var(--type-body-compact-size); color: var(--color-text-subdued); line-height: 1.5; }

.more-link { display: inline-block; margin-top: var(--space-500); font-size: var(--type-label-default-size); font-weight: var(--type-weight-medium); color: var(--color-text-link); text-decoration: none; border-bottom: 1px solid var(--color-border-strong); padding-bottom: 1px; }

/* ---------- Invoices ---------- */
.inv-row { background: var(--color-surface-raised); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); padding: var(--space-500) 26px; display: flex; align-items: baseline; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; }
.inv-no { font-family: var(--type-family-display); font-size: var(--type-heading-component-size); font-weight: var(--type-weight-semibold); }
.inv-desc { font-size: var(--type-body-compact-size); color: var(--color-text-default); flex: 1; min-width: 220px; }
.inv-date { font-size: var(--type-meta-size); color: var(--color-text-subdued); white-space: nowrap; }
.inv-amt { font-size: var(--type-metric-default-size); font-weight: var(--type-weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.paid { font-size: var(--type-label-compact-size); font-weight: var(--type-weight-medium); color: var(--color-status-success-fg); background: var(--color-status-success-bg); border-radius: var(--radius-pill); padding: 3px var(--space-300); white-space: nowrap; }
/* Settlement pending. Same pill grammar as .paid so the two read as one system,
   but outlined rather than filled — an unsettled row is visibly "not filled in
   yet". Calm by design: an open invoice is information, not a scolding. */
.open { font-size: var(--type-label-compact-size); font-weight: var(--type-weight-medium); color: var(--color-status-open-fg); background: var(--color-status-open-bg); border: 1px solid var(--color-status-open-border); border-radius: var(--radius-pill); padding: 2px calc(var(--space-300) - 1px); white-space: nowrap; }
/* The dated facts share one full-width line beneath the headline row: when it was
   issued on the left, how it settled on the right. An unpaid invoice simply has
   nothing on the right, so the line reads as a single left-aligned date rather
   than a gap. `justify-content: space-between` gives that for free — with one
   child it behaves exactly like flex-start. */
.inv-meta { width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.inv-note { font-size: var(--type-meta-size); color: var(--color-text-subdued); text-align: right; }
/* Billing documents open from the identifier that names them: the invoice number
   opens the invoice, the receipt reference opens the receipt. Inline links, so
   unlike .file-row (a whole-row target with a background hover) they need an
   inline affordance — an underline at rest, keeping their own ink so an invoice
   number still reads as an identifier rather than as chrome. */
.inv-doc { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; transition: color .12s ease; }
.inv-doc:hover { color: var(--color-text-link); }
.total-line { margin-top: 22px; font-size: var(--type-body-default-size); color: var(--color-text-default); }

/* ---------- Scope ---------- */
.scope-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-400); }
.pdf-link { display: inline-flex; align-items: center; gap: 7px; font-size: var(--type-label-compact-size); font-weight: var(--type-weight-medium); color: var(--color-text-strong); text-decoration: none; border: 1px solid var(--color-border-default); border-radius: var(--radius-sm); padding: 6px var(--space-300); white-space: nowrap; transition: border-color .12s ease, background .12s ease; }
.pdf-link:hover { border-color: var(--color-border-strong); background: var(--color-surface-raised); }
.pdf-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.scope-meta { font-size: var(--type-meta-size); color: var(--color-text-subdued); margin: -8px 0 10px; }
details.scope-item { border-top: 1px solid var(--color-border-default); }
details.scope-item summary { display: flex; gap: 14px; padding: 14px 0; align-items: center; cursor: pointer; list-style: none; }
details.scope-item summary::-webkit-details-marker { display: none; }
details.scope-item summary .body { flex: 1; }
details.scope-item summary .chev { margin-left: 6px; color: var(--color-text-subdued); font-size: 16px; transition: transform .15s ease; }
details.scope-item[open] summary .chev { transform: rotate(180deg); }
.legal { font-size: var(--type-body-compact-size); color: var(--color-text-quote); line-height: var(--type-body-compact-leading); max-width: 70ch; margin: 0 0 18px 36px; padding-left: var(--space-400); border-left: 2px solid var(--color-border-default); }

details.scope-item .it { font-family: var(--type-family-display); font-size: var(--type-heading-component-size); font-weight: var(--type-weight-medium); }
.fphase { font-size: var(--type-meta-size); color: var(--color-text-subdued); text-decoration: none; white-space: nowrap; }
a.fphase:hover { color: var(--color-text-strong); text-decoration: underline; }
a.fcount { text-decoration: none; }
a.fcount:hover { color: var(--color-text-strong); text-decoration: underline; }
a.scope-state { text-decoration: none; }
a.scope-state:hover { text-decoration: underline; }
.scope-state { font-size: var(--type-label-compact-size); font-weight: var(--type-weight-medium); color: var(--color-status-success-fg); white-space: nowrap; }
.scope-state.pending { color: var(--color-text-subdued); }
.scope-state.inprog { color: var(--color-accent-text); }

.tick { width: 22px; height: 22px; border-radius: 50%; background: var(--color-status-success-icon); color: var(--color-text-inverse); display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; } /* token-audit: ok — the delivered marker IS the icon; the disc is the glyph's own body, not a surface */
.circle { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--color-border-marker); flex-shrink: 0; margin: 0 4.5px; }
.circle.inprog { border-color: var(--color-accent-default); background: var(--color-accent-default); }

/* ---------- Proposed state ---------- */
.proposed-group { background: var(--color-surface-raised); border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-lg); padding: 26px 30px 22px; margin-bottom: 22px; }
.sign-btn { display: inline-flex; align-items: center; gap: var(--space-200); background: var(--color-action-primary-bg); color: var(--color-action-primary-fg); font-size: var(--type-label-default-size); font-weight: var(--type-weight-medium); border-radius: var(--radius-pill); padding: 9px var(--space-500); text-decoration: none; white-space: nowrap; transition: opacity .12s ease; }
.sign-btn:hover { opacity: 0.85; }
.fee-line { font-size: var(--type-body-compact-size); line-height: var(--type-body-compact-leading); color: var(--color-text-default); margin-top: 14px; }
.action-card { background: var(--color-surface-raised); border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-md); padding: 18px var(--space-600); display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.action-card .body { flex: 1; min-width: 240px; }
.action-card .it { font-family: var(--type-family-display); font-size: var(--type-heading-component-size); font-weight: var(--type-weight-medium); }
.action-card .desc { font-size: var(--type-body-compact-size); color: var(--color-text-subdued); margin-top: 2px; }

footer.page-foot { margin-top: 56px; text-align: center; font-size: var(--type-legal-size); letter-spacing: 0.14em; color: var(--color-text-subdued); }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: var(--space-400) var(--space-500); gap: 18px; }
  .brand { margin-bottom: 0; }
  .client-block { margin-bottom: 0; }
  .side nav { flex-direction: row; }
  .side-foot { display: none; }
  .main { padding: 0 0 var(--space-800); }
  .content { padding: 0 var(--space-500); }
  .grid { grid-template-columns: 1fr; }
}
