/* Studio (photographer's side) */
.studio-main { padding: 110px var(--gutter) 80px; max-width: 1280px; margin: 0 auto; }
.loading { color: var(--ash); }
.gate { max-width: 440px; }
.gate h1, .desk-head h1 { font-size: clamp(2.4rem, 7vw, 4rem); font-weight: 800; letter-spacing: -0.04em; }
.gate .lede { margin-bottom: 26px; }
.gate-links { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 22px; }
.link { background: none; border: 0; padding: 0; color: var(--sodium); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; text-align: left; }
.link:hover { color: var(--paper); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; color: var(--ash); margin-top: 4px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--sodium); }

.desk-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; }
.who { color: var(--ash); margin: 0; font-size: .95rem; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; margin: 26px 0 28px; border-bottom: 1px solid var(--line); }
.tabs button { white-space: nowrap; flex: none; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px 12px; cursor: pointer; font-weight: 600; color: var(--ash); margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--sodium); }
.tabs small { font-weight: 400; color: var(--ash); margin-left: 4px; }

.drop { border: 2px dashed var(--line); border-radius: 14px; padding: clamp(28px, 6vw, 56px) 20px; text-align: center; background: var(--dusk); transition: border-color .15s ease, background-color .15s ease; }
.drop.is-over { border-color: var(--sodium); background: var(--rise); }
.drop-big { font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 3.4vw, 2.1rem); margin: 0 0 6px; }
.drop-small { color: var(--ash); margin: 0 auto; max-width: 52ch; }

.queue { margin-top: 28px; }
.queue h2, .shelf-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 14px; }
.shelf-title { margin-top: 48px; }
.lede.small { font-size: .97rem; margin: 0 0 14px; }
.queue ul, .shelf, .inbox { list-style: none; margin: 0; padding: 0; }
.queue li, .shelf li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 12px; background: var(--dusk); border: 1px solid var(--line); border-radius: 10px; }
.queue ul { display: grid; gap: 10px; }
.queue li img, .shelf li img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; background: var(--rise); }
.row-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; align-content: start; }
.row-fields .field label { font-size: .85rem; }
.row-fields .field input, .row-fields .field select { padding: 9px 11px; background: var(--night); }
.row-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: .9rem; color: var(--ash); }
.row-meta .ghost { padding: 5px 12px; font-size: .88rem; }
.row-meta .danger { border-color: #8a4034; color: var(--alarm); }
.row-meta .danger:hover { border-color: var(--alarm); }
.row-meta .spacer { flex: 1; }
.queue-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.state { font-size: .88rem; }
.state.ok { color: var(--wheel); } .state.bad { color: var(--alarm); }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 12px; }
.shelf li.is-hidden img { opacity: .4; }

.inbox { display: grid; gap: 12px; max-width: 820px; }
.inbox li { background: var(--dusk); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.inbox li.is-new { border-left-color: var(--sodium); }
.inbox .from { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-bottom: 8px; }
.inbox .from b { font-weight: 700; }
.inbox .from span { color: var(--ash); font-size: .9rem; }
.inbox .body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; }
.inbox .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.inbox .acts .ghost, .inbox .acts a.ghost { padding: 6px 14px; font-size: .9rem; text-decoration: none; }

/* ---------- client galleries ---------- */
.gal-create { background: var(--dusk); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.gal-create .field input, .gal-create .field textarea { background: var(--night); }
.gal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.gal-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px 18px; align-items: center; padding: 14px 16px; background: var(--dusk); border: 1px solid var(--line); border-radius: 10px; }
.gal-main { display: grid; gap: 2px; min-width: 0; }
.gal-name { font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--paper); text-decoration: none; overflow-wrap: anywhere; }
.gal-name:hover { color: var(--sodium); }
.gal-sub { color: var(--ash); font-size: .92rem; }
.gal-state { font-size: .85rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.gal-open { color: var(--wheel); border-color: var(--wheel); }
.gal-closed, .gal-expired { color: var(--ash); }
.gal-list li.is-off .gal-name { color: var(--ash); }
.gal-acts { display: flex; gap: 8px; }
.gal-acts .ghost { padding: 7px 14px; font-size: .92rem; white-space: nowrap; }
.gal-share { background: var(--dusk); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: grid; gap: 14px; max-width: 980px; }
.gal-share input { background: var(--night); font-size: .95rem; }
.gal-share .lede { margin: 0; }
progress { width: 100%; height: 8px; margin-top: 12px; accent-color: var(--sodium); }
.gal-countbar { margin: 14px 0; }
.gal-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gal-grid li { background: var(--dusk); border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 6px; align-content: start; position: relative; }
.gal-grid li.is-picked { border-color: var(--sodium); }
.gal-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; background: var(--rise); }
.gp-name { font-size: .82rem; color: var(--ash); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-pick { position: absolute; top: 14px; left: 14px; background: var(--sodium); color: var(--night); font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.gal-grid .ghost { padding: 4px 10px; font-size: .84rem; justify-self: start; }
.gal-grid .danger, #galDelete { border-color: #8a4034; color: var(--alarm); }
#galSettings .check { display: flex; margin-top: 10px; }

/* ---------- culling ---------- */
.cull-how { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 0; margin: 18px 0 0; color: var(--ash); font-size: .95rem; }
.cull-how b, kbd { font-family: inherit; font-weight: 700; color: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 1px 7px; margin-right: 4px; font-size: .88em; }
kbd { margin: 0 0 0 6px; }
.cull-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 20px; }
.cull-top .filters { margin: 0 0 12px; }
.cull-stage { height: min(68vh, 760px); min-height: 280px; background: #0d0806; border: 3px solid var(--line); border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.cull-stage[data-flag="keep"] { border-color: #6fbf73; }
.cull-stage[data-flag="reject"] { border-color: var(--alarm); }
.cull-stage:focus { outline: none; }
.cull-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; cursor: zoom-in; }
.cull-stage.is-zoomed { overflow: auto; place-items: start; }
.cull-stage.is-zoomed img { max-width: none; max-height: none; cursor: zoom-out; }
.cull-stage .empty { border: 0; }
.cull-info { display: flex; justify-content: space-between; gap: 16px; color: var(--ash); font-size: .92rem; margin: 8px 0 12px; overflow-wrap: anywhere; }
.cull-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cull-controls .ghost { padding: 10px 18px; }
.cull-keep[aria-pressed="true"] { background: #6fbf73; border-color: #6fbf73; color: #0d1a0e; font-weight: 700; }
.cull-reject[aria-pressed="true"] { background: var(--alarm); border-color: var(--alarm); color: #2a0d08; font-weight: 700; }
.cull-keep[aria-pressed="true"] kbd, .cull-reject[aria-pressed="true"] kbd { color: inherit; border-color: currentColor; }
.cull-stars { display: inline-flex; margin: 0 6px; }
.cull-stars button { background: none; border: 0; color: var(--line); font-size: 1.7rem; line-height: 1; padding: 4px 3px; cursor: pointer; }
.cull-stars button[aria-pressed="true"] { color: var(--sodium); }
.cull-strip { display: flex; gap: 6px; overflow-x: auto; padding: 14px 0 10px; scrollbar-width: thin; }
.cull-strip button { flex: none; width: 96px; height: 72px; padding: 0; border: 3px solid transparent; border-radius: 6px; background: var(--rise); cursor: pointer; overflow: hidden; position: relative; }
.cull-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cull-strip button[data-flag="keep"] { border-color: #6fbf73; }
.cull-strip button[data-flag="reject"] { border-color: var(--alarm); }
.cull-strip button[data-flag="reject"] img { opacity: .35; }
.cull-strip button.is-on { outline: 2px solid var(--paper); outline-offset: 1px; }
.cull-send { background: var(--dusk); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-top: 14px; display: grid; gap: 12px; max-width: 520px; }
.cull-send select, .cull-send input { background: var(--night); }
.cull-end { margin-top: 26px; }

@media (max-width: 620px) {
  .gal-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .gal-acts { grid-column: 1 / -1; }
  .cull-stage { height: 52vh; }
  .cull-controls .ghost { padding: 10px 14px; }
}

/* ---------- invoices ---------- */
.inv-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.inv-bar .who { color: var(--paper); font-size: 1rem; }
.empty .ghost { margin-top: 6px; }
.inv-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--dusk); }
.inv-table { width: 100%; border-collapse: collapse; font-size: .97rem; }
.inv-table th { text-align: left; font-weight: 600; color: var(--ash); font-size: .85rem; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.inv-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.inv-table tr:last-child td { border-bottom: 0; }
.inv-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-table select, .inv-table input { background: var(--night); border: 1px solid var(--line); color: var(--paper); padding: 8px 10px; border-radius: 6px; width: 100%; }
.inv-table td select { width: auto; }
.inv-table tr.st-paid td:nth-child(5), .inv-table tr.st-cancelled td { color: var(--ash); }
.inv-table tr.st-overdue td:nth-child(5) { color: var(--alarm); font-weight: 600; }
.inv-table.items td:first-child { min-width: 240px; width: 55%; }
.inv-table.items .narrow { width: 92px; text-align: right; }
.inv-table.items .ghost { padding: 5px 12px; font-size: .88rem; }
.biz { margin-top: 34px; border: 1px solid var(--line); border-radius: 10px; padding: 0 18px; background: var(--dusk); }
.biz summary { cursor: pointer; padding: 16px 0; font-weight: 600; }
.biz[open] { padding-bottom: 20px; }
.biz-grid, .inv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.inv-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); max-width: 980px; }
.span2 { grid-column: 1 / -1; }
.biz .field input, .biz .field textarea, .biz .field select { background: var(--night); }
.inv-title { font-size: clamp(1.8rem, 4.5vw, 2.8rem); font-weight: 700; margin: 14px 0 22px; }
.inv-sub { font-family: var(--display); font-size: 1.25rem; font-weight: 700; margin: 34px 0 14px; }
.pick { max-width: 520px; margin-bottom: 14px; }
#invAddLine { margin-top: 12px; }
.inv-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 28px; margin-top: 30px; align-items: start; }
.inv-grid.adj { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inv-totals { background: var(--dusk); border: 1px solid var(--line); border-radius: 10px; padding: 8px 18px; position: sticky; top: 80px; }
.inv-totals div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--ash); }
.inv-totals div:last-child { border-bottom: 0; }
.inv-totals b { color: var(--paper); font-variant-numeric: tabular-nums; font-weight: 600; }
.inv-totals .due { color: var(--paper); font-weight: 600; }
.inv-totals .due b { color: var(--sodium); font-family: var(--display); font-size: 1.45rem; font-weight: 700; }
.inv-actions { margin-top: 28px; }
.inv-actions .danger { border-color: #8a4034; color: var(--alarm); margin-left: auto; }
#printSheet { display: none; }

@media (max-width: 820px) {
  .inv-foot { grid-template-columns: minmax(0, 1fr); }
  .inv-totals { position: static; }
}
@media (max-width: 620px) {
  .biz-grid, .inv-grid.adj { grid-template-columns: minmax(0, 1fr); }
  .inv-table.items thead { display: none; }
  .inv-table.items tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
  .inv-table.items td { padding: 0; border: 0; }
  .inv-table.items td:first-child { grid-column: 1 / -1; width: auto; min-width: 0; }
  .inv-table.items td[data-label]::before { content: attr(data-label); display: block; font-size: .8rem; color: var(--ash); margin-bottom: 3px; }
  .inv-table.items .narrow { width: 100%; text-align: left; }
  .inv-table.items .amt { align-self: end; font-weight: 600; text-align: left; }
  .inv-actions .danger { margin-left: 0; }
}

/* ---------- the paper invoice ---------- */
@media print {
  @page { margin: 16mm; }
  html, body { background: #fff !important; }
  body > *:not(#printSheet) { display: none !important; }
  #printSheet { display: block; color: #1a1a1a; font-family: var(--body); font-size: 10.5pt; line-height: 1.45; }
  #printSheet .ps-top { display: flex; justify-content: space-between; gap: 24pt; align-items: flex-start; padding-bottom: 16pt; border-bottom: 1.5pt solid #1a1a1a; }
  #printSheet .ps-brand { font-family: var(--display); font-weight: 800; font-size: 20pt; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 4pt; }
  #printSheet .ps-meta { text-align: right; }
  #printSheet .ps-title { font-family: var(--display); font-weight: 700; font-size: 26pt; line-height: 1; margin-bottom: 8pt; }
  #printSheet .ps-meta span, #printSheet .ps-label { color: #666; }
  #printSheet .ps-label { font-size: 9pt; margin-bottom: 3pt; }
  #printSheet .ps-to { margin: 18pt 0; }
  #printSheet table { width: 100%; border-collapse: collapse; }
  #printSheet th { text-align: left; font-size: 9pt; color: #666; font-weight: 600; padding: 6pt 0; border-bottom: .75pt solid #999; }
  #printSheet td { padding: 8pt 0; border-bottom: .5pt solid #ddd; vertical-align: top; }
  #printSheet .num { text-align: right; white-space: nowrap; padding-left: 14pt; font-variant-numeric: tabular-nums; }
  #printSheet tr { break-inside: avoid; }
  #printSheet .ps-sum { margin: 14pt 0 0 auto; width: 46%; break-inside: avoid; }
  #printSheet .ps-sum div { display: flex; justify-content: space-between; padding: 4pt 0; }
  #printSheet .ps-sum .grand { border-top: .75pt solid #999; margin-top: 4pt; padding-top: 7pt; }
  #printSheet .ps-sum .due { border-top: 1.5pt solid #1a1a1a; margin-top: 4pt; padding-top: 7pt; font-size: 13pt; font-weight: 700; }
  #printSheet .ps-notes { margin-top: 26pt; padding-top: 12pt; border-top: .5pt solid #ddd; break-inside: avoid; }
}

@media (max-width: 520px) {
  .queue li, .shelf li { grid-template-columns: 72px minmax(0, 1fr); }
  .queue li img, .shelf li img { width: 72px; height: 72px; }
  .row-fields { grid-template-columns: 1fr; }
  .studio .brand span { display: inline; font-size: .95rem; }
  .studio .brand svg { display: none; }
}
