/* Client pages: the client view at /clients/ and the editor at /account/clients/. Builds on page.css and account.css. */
:root { --step: #d4d4d4; }
@media (prefers-color-scheme: dark) { :root { --step: #3a3a3a; } }

.wrap.portal { max-width: 1000px; gap: 22px; }
.portal .head h1 { text-transform: none; letter-spacing: 0; font-size: clamp(26px, 5vw, 36px); }
.crumbs a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.sec { display: flex; flex-direction: column; gap: 12px; }
#view { display: flex; flex-direction: column; gap: 30px; }
#view[hidden] { display: none; }
.sec > h2 { margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sec > h2 small { font-size: 13px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--muted); }
.stat.static { cursor: default; }
.stat.static:hover { border-color: var(--line); }
.stat.bad b { color: var(--bad); }
.stat.good b { color: var(--ok); }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chip.corporate { color: var(--chip-member); background: var(--chip-member-bg); }
.chip.editorial { color: var(--chip-contrib); background: var(--chip-contrib-bg); }
.chip.agency { color: var(--chip-photo); background: var(--chip-photo-bg); }
.chip.paid { color: var(--ok); background: var(--ok-soft); }
.chip.overdue { color: var(--bad); background: var(--bad-soft); }
.chip.partly, .chip.due { color: var(--warn); background: var(--warn-soft); }
.chip.done { color: var(--ok); background: var(--ok-soft); }

/* Projects and their stages */
.projects { display: grid; gap: 14px; }
.project { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.project-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.project h3 { margin: 0; font-size: 18px; }
.project .muted { font-size: 13px; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); counter-reset: st; }
.stages li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 13px; color: var(--muted); padding: 0 4px; }
.stages li::before { counter-increment: st; content: counter(st); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--panel); border: 2px solid var(--step); color: var(--muted); position: relative; z-index: 1; }
.stages li::after { content: ""; position: absolute; top: 13px; left: calc(-50% + 14px); right: calc(50% + 14px); height: 2px; background: var(--step); }
.stages li:first-child::after { display: none; }
.stages li.done { color: var(--ink); }
.stages li.done::before { content: "\2713"; background: var(--ok); border-color: var(--ok); color: #fff; }
.stages li.done::after, .stages li.now::after { background: var(--ok); }
.stages li.now { color: var(--ink); font-weight: 700; }
.stages li.now::before { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 5px var(--ring); }
.project .links { display: flex; flex-wrap: wrap; gap: 8px; }
.project .links a { font-size: 13px; font-weight: 600; color: var(--accent-text); text-decoration: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }
.project .links a:hover { border-color: var(--accent-text); }
.project .links a.bad { color: var(--bad); }
@media (max-width: 560px) {
  .stages { grid-auto-flow: row; gap: 10px; }
  .stages li { flex-direction: row; text-align: left; padding: 0; }
  .stages li::after { display: none; }
}

/* Invoices */
.invoices { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.invoices table { width: 100%; border-collapse: collapse; font-size: 14px; }
.invoices th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.invoices td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.invoices tr:first-child td { border-top: 0; }
.invoices .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoices td b { display: block; }
.invoices td small { color: var(--muted); font-size: 12px; }
.invoices td a { color: var(--accent-text); font-weight: 600; text-decoration: none; white-space: nowrap; }
.invoices tfoot td { background: var(--bg); font-weight: 700; border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  .invoices thead { display: none; }
  .invoices tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
  .invoices tbody tr:first-child { border-top: 0; }
  .invoices td { padding: 0; border: 0; }
  .invoices td[data-l] { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
  .invoices td[data-l]::before { content: attr(data-l); color: var(--muted); }
  .invoices td.hide-m { display: none; }
  .invoices tfoot tr { background: var(--bg); }
  .invoices tfoot td { background: none; border: 0; }
}

/* Galleries (on SmugMug) */
.galleries { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.gallery { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: inherit; text-decoration: none; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.gallery:hover { border-color: var(--accent-text); transform: translateY(-2px); }
.gallery .cover { aspect-ratio: 3 / 2; background: linear-gradient(135deg, #2a2a2a, #111); display: grid; place-items: center; color: #9a9a9a; overflow: hidden; }
.gallery .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .cover svg { opacity: .6; }
.gallery div.txt { padding: 12px 14px 14px; display: grid; gap: 4px; }
.gallery b { font-size: 15px; }
.gallery small { font-size: 12px; color: var(--muted); }
.gallery .open { font-size: 13px; font-weight: 700; color: var(--accent-text); margin-top: 4px; }
.empty-card { background: var(--panel); border: 1px dashed var(--line); border-radius: 14px; padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }
.help { color: var(--muted); font-size: 13px; text-align: center; }
.help a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .gallery:hover { transform: none; } }

/* Admin editor */
.client-row { cursor: pointer; }
.client-row:hover { background: var(--bg); }
.client-row .bal { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.client-row .bal small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.ed-list { display: grid; gap: 12px; }
.ed-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 12px; background: var(--bg); }
.ed-item .form { gap: 12px; }
.ed-item .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.ed-item .row.wide2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.ed-item input, .ed-item select, .ed-item textarea, .panel textarea { font-size: 15px; padding: 9px 11px; background: var(--panel); }
.form textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; width: 100%; resize: vertical; min-height: 70px; }
.form textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 4px var(--ring); }
.ed-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-foot .left { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-head button { padding: 8px 14px; font-size: 13px; }
.savebar { position: sticky; bottom: max(14px, env(safe-area-inset-bottom, 0px)); z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #161616; color: #fff; border-radius: 14px; padding: 10px 10px 10px 18px; box-shadow: 0 12px 32px rgba(0,0,0,.3); animation: pop .2s ease; }
.savebar span { font-size: 14px; }
.savebar div { display: flex; gap: 8px; }
.savebar .alt { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.crumbs { font-size: 14px; }
.addon { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .portal .stats { grid-template-columns: repeat(2, 1fr); } }
.portal .head .muted a { color: #fff; font-weight: 700; }
