/* Jay's Focus Media – client gallery. Minimal, modern, WCAG 2.2 AA. */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #161616;
  --muted: #5c5a55;
  --border: #dcd9d2;
  --accent: #161616;
  --accent-text: #ffffff;
  --focus: #1f5fd6;
  --danger: #b3261e;
  --success: #1e6b3a;
  --warn-bg: #fff3d6;
  --warn-text: #6b4a00;
  --info-bg: #e8f0fe;
  --info-text: #17407f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px rgb(0 0 0 / .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1180px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212; --surface: #1b1b1b; --surface-2: #242424; --text: #f2f1ee; --muted: #b0aea8;
    --border: #34332f; --accent: #f2f1ee; --accent-text: #121212; --focus: #8ab4ff; --danger: #ff8a80;
    --success: #81c995; --warn-bg: #3d3214; --warn-text: #ffe3a3; --info-bg: #1c2a44; --info-text: #c6dafc;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; outline: none; }
img, video { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); font-weight: 600; }
h2 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { font-size: 1.075rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--muted); margin-bottom: .5rem; }
.danger-text { color: var(--danger) !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 100; background: var(--accent); color: var(--accent-text); padding: .75rem 1rem; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem clamp(1rem, 3vw, 2rem); background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 600; }
.brand-logo { height: 40px; width: auto; display: block; flex: none; }
.logo-on-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-on-light { display: none; } .logo-on-dark { display: block; } }
@media (max-width: 640px) { .brand-logo { height: 32px; } }
@media (forced-colors: active) { .brand-logo { forced-color-adjust: none; background: #fff; border-radius: 6px; padding: 2px 4px; } .logo-on-dark { display: none; } .logo-on-light { display: block; } }
.brand-sub { color: var(--muted); font-weight: 400; padding-left: .6rem; border-left: 1px solid var(--border); }
.nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.nav-link { text-decoration: none; padding: .5rem .75rem; border-radius: 999px; color: var(--muted); }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav-user { color: var(--muted); font-size: .875rem; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .brand-sub, .nav-user { display: none; } }

.footer { padding: 2rem; text-align: center; color: var(--muted); font-size: .8125rem; }

/* ---------- layout ---------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem); }
.page.wide { max-width: 1440px; }
.page.narrow { max-width: 640px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.loading { display: flex; gap: .75rem; align-items: center; justify-content: center; padding: 5rem 1rem; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.back-link { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); text-decoration: none; margin-bottom: 1rem; font-size: .9rem; min-height: 44px; }
.back-link:hover { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .6rem 1.15rem;
  font: inherit; font-weight: 550; font-size: .95rem; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-link { background: none; border: none; color: var(--text); text-decoration: underline; min-height: 44px; }
.btn-sm { min-height: 36px; padding: .35rem .8rem; font-size: .875rem; }
.btn-block { width: 100%; }
.btn-provider { width: 100%; background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-provider:hover { border-color: var(--text); }
.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon-lg { width: 36px; height: 36px; }
.icon-xl { width: 48px; height: 48px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; border: none;
  background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.fav[aria-pressed="true"] { color: #e0245e; }
.fav[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- segmented control ---------- */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-btn {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 38px; padding: .3rem .85rem; border: none; border-radius: 999px;
  background: transparent; color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer;
}
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-btn .count { font-size: .75rem; color: var(--muted); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field label { font-weight: 550; font-size: .9rem; }
.field.grow { flex: 1; }
.input {
  width: 100%; min-height: 44px; padding: .6rem .8rem; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
textarea.input { resize: vertical; }
.input:focus-visible { border-color: var(--focus); }
.input:user-invalid { border-color: var(--danger); }
.hint { font-size: .8125rem; color: var(--muted); margin: 0; }
.check { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex: none; }
.check-label { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline-form .input { flex: 1; min-width: 200px; }
.filters { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }

/* ---------- alerts, badges, toasts ---------- */
.alert { padding: .85rem 1rem; border-radius: var(--radius-sm); margin: 0 0 1rem; }
.alert-error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.alert-info { background: var(--info-bg); color: var(--info-text); }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 550; background: var(--surface-2); color: var(--text); }
.badge-ready { background: color-mix(in srgb, var(--success) 16%, var(--surface)); color: var(--success); }
.badge-awaiting, .badge-neutral { background: var(--surface-2); color: var(--muted); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.toasts { position: fixed; bottom: 1rem; right: 1rem; left: 1rem; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; z-index: 200; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 420px; padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-text);
  box-shadow: var(--shadow); animation: toast-in .25s ease-out; transition: opacity .3s, transform .3s;
}
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--success); color: #fff; }
.toast-out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - 160px); display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 460px; background: var(--surface); border-radius: 20px; padding: clamp(1.5rem, 5vw, 2.75rem); box-shadow: var(--shadow); }
.auth-actions { display: flex; flex-direction: column; gap: .65rem; margin: 1.5rem 0; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.fine-print { font-size: .8125rem; color: var(--muted); margin: 0; }

/* ---------- invoice cards ---------- */
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.card { display: flex; flex-direction: column; height: 100%; text-decoration: none; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-3px); }
.card-media { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-placeholder { height: 100%; display: grid; place-content: center; justify-items: center; gap: .5rem; color: var(--muted); }
.card-body { padding: 1rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.card-title { font-size: 1.05rem; margin: 0; }
.card-meta { color: var(--muted); font-size: .875rem; margin: 0; }
.card-foot { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: auto; padding-top: .6rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.table th, .table td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.table tbody tr:last-child > * { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.media-table .filename { word-break: break-all; }
.media-table tr.is-selected { background: color-mix(in srgb, var(--focus) 10%, var(--surface)); }
.mini-thumb { width: 56px; height: 56px; padding: 0; border: none; border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-thumb .tile-file-name { display: none; }

/* ---------- gallery ---------- */
.gallery-head { margin-bottom: 1.5rem; }
.toolbar {
  position: sticky; top: 61px; z-index: 10; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem;
  padding: .6rem .75rem; margin-bottom: 1rem; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px); border-radius: var(--radius); box-shadow: var(--shadow);
}
.toolbar-group { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.selection-count { font-size: .9rem; color: var(--muted); min-width: 6ch; }
.job-status { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; margin-bottom: 1rem; border-radius: var(--radius); background: var(--info-bg); color: var(--info-text); }
progress { width: 100%; height: 6px; appearance: none; border: none; border-radius: 999px; background: var(--surface-2); overflow: hidden; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); }

.masonry { list-style: none; margin: 0; padding: 0; columns: 4 260px; column-gap: 12px; }
.tile { position: relative; break-inside: avoid; margin-bottom: 12px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); --ratio: 4 / 3; }
.tile-open { display: block; width: 100%; padding: 0; border: none; background: none; cursor: zoom-in; aspect-ratio: var(--ratio); }
.tile-open img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, filter .3s; }
.tile:hover .tile-open img { transform: scale(1.03); }
.tile-video, .tile-file { width: 100%; height: 100%; min-height: 160px; display: grid; place-content: center; justify-items: center; gap: .5rem; color: var(--muted); padding: 1rem; }
.tile-file-name { font-size: .8rem; word-break: break-all; text-align: center; }
.tile-badge { position: absolute; left: 10px; bottom: 10px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: rgb(0 0 0 / .55); color: #fff; }
.tile-check, .tile-fav { position: absolute; top: 8px; opacity: 0; transition: opacity .15s; }
.tile-check { left: 8px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; background: rgb(255 255 255 / .9); cursor: pointer; }
.tile-fav { right: 8px; background: rgb(255 255 255 / .9); color: #222; }
.tile-fav[aria-pressed="true"] { color: #e0245e; }
.tile:hover .tile-check, .tile:hover .tile-fav, .tile:focus-within .tile-check, .tile:focus-within .tile-fav,
.tile.is-selected .tile-check, .tile-fav[aria-pressed="true"] { opacity: 1; }
@media (hover: none) { .tile-check, .tile-fav { opacity: 1; } }
.tile.is-selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.tile.is-selected .tile-open img { filter: brightness(.85); }

/* ---------- viewer ---------- */
.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: none;
  background: rgb(10 10 10 / .97); color: #f5f5f5; display: grid; grid-template-rows: auto 1fr auto;
}
.viewer::backdrop { background: rgb(0 0 0 / .8); }
.viewer:not([open]) { display: none; }
.viewer-top { display: flex; justify-content: space-between; align-items: center; padding: .5rem 1rem; }
.viewer-tools { display: flex; align-items: center; gap: .5rem; }
.viewer .icon-btn { color: #f5f5f5; }
.viewer .icon-btn:hover { background: rgb(255 255 255 / .1); }
.viewer .btn-secondary { background: transparent; color: #f5f5f5; border-color: rgb(255 255 255 / .35); }
.viewer-counter { font-size: .9rem; color: #c8c8c8; }
.viewer-stage { display: grid; place-items: center; min-height: 0; padding: 0 4rem; }
.viewer-stage img, .viewer-stage video { max-height: calc(100dvh - 140px); max-width: 100%; object-fit: contain; border-radius: 4px; }
.viewer-file { text-align: center; color: #c8c8c8; display: grid; justify-items: center; gap: 1rem; }
.viewer-caption { text-align: center; font-size: .875rem; color: #c8c8c8; padding: .75rem 1rem 1rem; margin: 0; word-break: break-all; }
.viewer-nav {
  position: fixed; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 999px; border: none;
  background: rgb(255 255 255 / .12); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.viewer-nav:hover:not(:disabled) { background: rgb(255 255 255 / .22); }
.viewer-nav:disabled { opacity: .25; cursor: default; }
.viewer-nav.prev { left: 1rem; }
.viewer-nav.next { right: 1rem; }
@media (max-width: 640px) { .viewer-stage { padding: 0 .5rem; } .viewer-nav { top: auto; bottom: 3.5rem; transform: none; } }

/* ---------- dialogs ---------- */
.dialog { width: min(520px, calc(100vw - 2rem)); border: none; border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgb(0 0 0 / .3); }
.dialog-lg { width: min(720px, calc(100vw - 2rem)); }
.dialog::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
.dialog-body { padding: 1.75rem; }
.dialog-title { font-size: 1.35rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 4rem 1rem; max-width: 520px; margin: 0 auto; }
.empty-art { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }

/* ---------- admin ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat-value { font-size: 1.6rem; font-weight: 600; }
.stat-label { color: var(--muted); font-size: .85rem; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.5rem; align-items: start; }
@media (max-width: 1000px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-main, .admin-side { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.panel-title { font-size: 1.05rem; margin-bottom: .75rem; }
.panel-head .panel-title { margin: 0; }
.panel-actions { display: flex; justify-content: flex-end; margin-top: .5rem; }
.panel-danger { border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.dropzone {
  display: grid; justify-items: center; gap: .4rem; text-align: center; padding: 2.25rem 1rem; border: 2px dashed var(--border);
  border-radius: var(--radius); color: var(--muted); transition: border-color .15s, background .15s;
}
.dropzone.is-over { border-color: var(--accent); background: var(--surface-2); }
.dropzone-title { color: var(--text); font-weight: 600; margin: .25rem 0 0; }
.upload-queue { list-style: none; padding: 0; margin: .75rem 0 0; display: flex; flex-direction: column; gap: .5rem; max-height: 320px; overflow: auto; }
.upload-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 140px 110px 44px; align-items: center; gap: .75rem; font-size: .875rem; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row.done { color: var(--success); }
.upload-row.failed { color: var(--danger); }
@media (max-width: 640px) { .upload-row { grid-template-columns: minmax(0, 1fr) 90px 44px; } .upload-row > :nth-child(2), .upload-row > :nth-child(4) { display: none; } }
.admin-media { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.admin-tile { display: flex; flex-direction: column; gap: .15rem; }
.admin-thumb { aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-tile.status-processing .admin-thumb, .admin-tile.status-uploading .admin-thumb { animation: pulse 1.4s ease-in-out infinite; }
.admin-tile.status-failed .admin-thumb { outline: 2px solid var(--danger); }
@keyframes pulse { 50% { opacity: .55; } }
.admin-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.admin-tile .check-label { min-height: 36px; }
.admin-tile p { margin: 0; }
.admin-tile-actions { display: flex; justify-content: space-between; align-items: center; }
.member-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.member-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.member-email { display: inline-flex; gap: .5rem; align-items: center; word-break: break-all; }
.member-actions { display: flex; gap: .25rem; }
.activity { list-style: none; padding: 0; margin: 0; max-height: 360px; overflow: auto; display: flex; flex-direction: column; gap: .75rem; font-size: .875rem; }
.activity li { display: flex; flex-direction: column; }

.noscript { padding: 2rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .seg-btn, .tile-check, .icon-btn { border: 1px solid ButtonText; }
  .tile.is-selected { outline-color: Highlight; }
}

/* ---------- privacy / GDPR ---------- */
.badge-danger { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.stat-alert .stat-value { color: var(--danger); }
.table-wrap.flat { box-shadow: none; border: 1px solid var(--border); }
.subject { margin-top: 1.25rem; border-top: 1px solid var(--border); padding-top: 1.25rem; }
.subject-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.subject-head h3 { margin: 0; font-size: 1.1rem; word-break: break-all; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.summary-block { background: var(--surface-2); border-radius: var(--radius-sm); padding: .85rem 1rem; }
.summary-block h4, .action-card h4 { margin: 0 0 .4rem; font-size: .9rem; }
.summary-block ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.link-request { max-width: 520px; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.action-card { display: flex; flex-direction: column; gap: .25rem; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; }
.action-card p { flex: 1; }
.action-danger { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem 1rem; margin: 0 0 1rem; }
.fieldset legend { font-weight: 600; font-size: .9rem; padding: 0 .25rem; }
.secret { display: block; font-size: 1.4rem; letter-spacing: .08em; padding: 1rem; text-align: center; background: var(--surface-2); border-radius: var(--radius-sm); user-select: all; }
.label { font-weight: 550; font-size: .9rem; }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; margin-bottom: 1rem; }
.btn-link { background: none; border: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.footer a { color: inherit; }

/* ---------- resilience ---------- */
.offline-banner { position: sticky; top: 0; z-index: 60; padding: .6rem 1rem; text-align: center; background: var(--warn-bg); color: var(--warn-text); font-weight: 550; }

/* ---------- admin tools ---------- */
.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.tool-card {
  position: relative; display: flex; align-items: center; gap: 1.1rem; height: 100%; padding: 1.25rem 1.4rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--text); transition: transform .2s ease, border-color .2s ease;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--text); }
.tool-art { flex: none; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 16px; background: var(--surface-2); color: var(--text); }
.tool-art svg { width: 48px; height: 48px; }
.tool-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; padding-right: 1.5rem; }
.tool-title { font-weight: 650; font-size: 1.1rem; }
.tool-desc { color: var(--muted); }
.tool-host { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-open { position: absolute; top: .9rem; right: .9rem; width: 18px; height: 18px; color: var(--muted); }
.tool-open svg { width: 100%; height: 100%; }
@media (prefers-reduced-motion: reduce) { .tool-card { transition: none; } .tool-card:hover { transform: none; } }

/* ---------- phone header: logo on one line, menu wraps underneath ---------- */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: .25rem; }
  .brand-name { white-space: nowrap; }
  .nav { width: 100%; justify-content: flex-start; gap: .25rem; margin-left: -.5rem; }
}

/* =====================================================================
   Invoice lifecycle states (admin)
   ===================================================================== */
:root { --state-open: #1e6b3a; --state-closed: #1f4f8f; --state-archived: #6b6862; --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; }
@media (prefers-color-scheme: dark) { :root { --state-open: #6fd39a; --state-closed: #8db8ff; --state-archived: #b3afa6; } }
.badge-state-open { background: color-mix(in srgb, var(--state-open) 14%, var(--surface)); color: var(--state-open); }
.badge-state-closed { background: color-mix(in srgb, var(--state-closed) 14%, var(--surface)); color: var(--state-closed); }
.badge-state-archived { background: var(--surface-2); color: var(--state-archived); }

.state-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.state-tab {
  --c: var(--text);
  display: inline-flex; align-items: center; gap: .55rem; min-height: 44px; padding: .45rem .55rem .45rem .95rem;
  font: inherit; font-weight: 550; color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; transition: border-color .15s, color .15s, box-shadow .15s;
}
.state-tab:hover { color: var(--text); border-color: color-mix(in srgb, var(--c) 40%, var(--border)); }
.state-tab[aria-pressed="true"] { color: var(--text); border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.state-tab-open { --c: var(--state-open); } .state-tab-closed { --c: var(--state-closed); } .state-tab-archived { --c: var(--state-archived); }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.state-tab-all .state-dot { background: conic-gradient(var(--state-open) 0 33%, var(--state-closed) 0 66%, var(--state-archived) 0); }
.state-count { min-width: 2rem; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: .82rem; font-variant-numeric: tabular-nums; text-align: center; }
.state-tab[aria-pressed="true"] .state-count { background: var(--c); color: var(--surface); }

.bulk-bar {
  position: sticky; top: 64px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .5rem .75rem .5rem 1rem; margin-bottom: .75rem; border-radius: var(--radius); background: var(--accent); color: var(--accent-text); box-shadow: var(--shadow);
}
.bulk-bar[hidden] { display: none; }
.bulk-label { font-weight: 600; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.bulk-bar .btn-secondary { background: var(--surface); color: var(--text); border-color: transparent; }
.bulk-bar .btn-ghost { color: var(--accent-text); }
.col-check { width: 48px; }
.table tr.is-selected > * { background: color-mix(in srgb, var(--focus) 8%, var(--surface)); }
.empty-row { text-align: center !important; color: var(--muted); padding: 2rem 1rem !important; }

.state-panel {
  --c: var(--state-open);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  margin: 0 0 1.5rem; padding: 1rem 1.15rem; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); border-left: 4px solid var(--c);
}
.state-panel-closed { --c: var(--state-closed); } .state-panel-archived { --c: var(--state-archived); }
.state-panel-text { flex: 1 1 320px; }
.state-panel-text p { margin: 0; }
.state-panel-title { font-weight: 600; }
.state-switch { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.state-opt {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .4rem .9rem; font: inherit; font-size: .9rem; font-weight: 550;
  border: none; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}
.state-opt svg { width: 16px; height: 16px; }
.state-opt:hover { color: var(--text); }
.state-opt[aria-pressed="true"] { background: var(--surface); color: var(--c, var(--text)); box-shadow: var(--shadow); cursor: default; }
.state-opt-open { --c: var(--state-open); } .state-opt-closed { --c: var(--state-closed); } .state-opt-archived { --c: var(--state-archived); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }

/* =====================================================================
   Client galleries – showcase
   ===================================================================== */
.display, .hero-title, .gallery-hero-title, .album-title { font-family: var(--display); font-weight: 500; letter-spacing: -.015em; }
.client-home .page-head h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.2rem); }

.pill {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: rgb(255 255 255 / .92); color: #1d1d1b; backdrop-filter: blur(6px); white-space: nowrap;
}
.pill svg { width: 14px; height: 14px; }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ready { color: #17592f; } .pill-closed { color: #1a447b; } .pill-awaiting { color: #57544e; } .pill-archived { color: #57544e; }
.pill-warn { background: #fff3d6; color: #6b4a00; }
.pill-glass { background: rgb(0 0 0 / .38); color: #fff; border: 1px solid rgb(255 255 255 / .28); }
.table .pill { background: var(--surface-2); }

.cover-placeholder {
  width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: .6rem; color: var(--muted);
  background: radial-gradient(120% 90% at 20% 10%, color-mix(in srgb, var(--surface) 70%, transparent), transparent 60%),
              linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 70%, var(--border)));
  font-size: .9rem; text-align: center; padding: 1rem;
}
.cover-placeholder svg { width: 34px; height: 34px; opacity: .7; }
.cover-placeholder.is-big { color: #ece9e2; background: linear-gradient(135deg, #2b2a27, #45423c 55%, #2f3a44); }

/* Featured gallery */
.hero-card {
  position: relative; display: block; overflow: hidden; isolation: isolate; text-decoration: none; color: #fff;
  border-radius: calc(var(--radius) + 8px); min-height: clamp(340px, 52vw, 560px); background: #222; box-shadow: 0 30px 60px -30px rgb(0 0 0 / .45);
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.hero-media, .hero-media img, .hero-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-media img { object-fit: cover; transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
.hero-card:hover .hero-media img, .hero-card:focus-visible .hero-media img { transform: scale(1.035); }
.hero-shade { background: linear-gradient(to top, rgb(0 0 0 / .78) 0%, rgb(0 0 0 / .35) 45%, rgb(0 0 0 / 0) 75%), linear-gradient(to right, rgb(0 0 0 / .35), transparent 60%); }
.hero-content { position: absolute; left: 0; right: 0; bottom: 0; padding: clamp(1.25rem, 4vw, 2.75rem); max-width: 780px; display: flex; flex-direction: column; gap: .6rem; }
.hero-pills { display: flex; flex-wrap: wrap; gap: .45rem; }
.hero-title { font-size: clamp(1.9rem, 1.1rem + 3.4vw, 3.6rem); line-height: 1.05; margin: .2rem 0 0; color: #fff; text-wrap: balance; }
.hero-meta { margin: 0; color: rgb(255 255 255 / .85); font-size: .98rem; }
.hero-cta {
  align-self: flex-start; display: inline-flex; align-items: center; gap: .55rem; margin-top: .6rem; padding: .7rem 1.25rem; min-height: 44px;
  border-radius: 999px; background: #fff; color: #161616; font-weight: 600; transition: gap .2s ease;
}
.hero-card:hover .hero-cta { gap: .85rem; }
.hero-strip { position: absolute; right: clamp(1rem, 3vw, 2rem); bottom: clamp(1rem, 3vw, 2rem); display: flex; gap: .5rem; align-items: flex-end; }
.hero-strip img, .hero-strip-more { width: clamp(64px, 7vw, 96px); aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 2px solid rgb(255 255 255 / .9); box-shadow: 0 8px 20px rgb(0 0 0 / .35); }
.hero-strip img:nth-child(2) { transform: translateY(-10px); }
.hero-strip-more { display: grid; place-items: center; background: rgb(0 0 0 / .5); backdrop-filter: blur(6px); color: #fff; font-weight: 600; }
@media (max-width: 760px) { .hero-strip { display: none; } }

/* Album sections */
.album-section { margin-bottom: clamp(2rem, 5vw, 3rem); }
.album-section-head { margin-bottom: 1.1rem; }
.section-title { display: flex; align-items: center; gap: .6rem; font-size: 1.35rem; margin: 0 0 .2rem; }
.section-count { font-family: var(--font); font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.albums { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: clamp(1.5rem, 3vw, 2.25rem) clamp(1rem, 2.5vw, 1.75rem); }
.album { display: flex; flex-direction: column; gap: .9rem; text-decoration: none; color: inherit; padding-top: 14px; }
.album-stack { position: relative; aspect-ratio: 4 / 3; }
.album-sheet { position: absolute; inset: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
.sheet-1 { transform: translateY(-7px) scale(.95); opacity: .9; }
.sheet-2 { transform: translateY(-14px) scale(.9); opacity: .6; }
.album:hover .sheet-1, .album:focus-visible .sheet-1 { transform: translateY(-11px) rotate(-2deg) scale(.95); }
.album:hover .sheet-2, .album:focus-visible .sheet-2 { transform: translateY(-20px) rotate(2.5deg) scale(.9); }
.album-cover { position: absolute; inset: 0; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); box-shadow: 0 18px 40px -22px rgb(0 0 0 / .5); }
.album-cover > img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.album:hover .album-cover > img { transform: scale(1.05); }
.album-pills { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: .35rem; }
.album-thumbs { position: absolute; right: 10px; bottom: 10px; display: flex; }
.album-thumbs img { width: 42px; height: 42px; object-fit: cover; border-radius: 9px; border: 2px solid #fff; box-shadow: 0 4px 10px rgb(0 0 0 / .3); }
.album-thumbs img + img { margin-left: -12px; }
.album-body { padding: 0 .15rem; }
.album-title { font-size: 1.25rem; margin: 0 0 .2rem; text-wrap: balance; }
.album:hover .album-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.album-meta { margin: 0; color: var(--muted); font-size: .88rem; }
.album.is-completed .album-cover > img { filter: saturate(.85); }
.album:focus-visible, .hero-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

/* Gallery page hero */
.gallery-hero {
  position: relative; overflow: hidden; isolation: isolate; color: #fff; background: #26251f;
  border-radius: calc(var(--radius) + 8px); min-height: clamp(300px, 40vw, 460px); margin-bottom: 1.25rem; display: flex; align-items: flex-end;
}
.gallery-hero.no-cover { min-height: 0; background: linear-gradient(135deg, #2b2a27, #45423c 55%, #2f3a44); }
.gallery-hero-media, .gallery-hero-media img, .gallery-hero-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.gallery-hero-media img { object-fit: cover; animation: hero-in 1.4s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes hero-in { from { transform: scale(1.06); opacity: .4; } to { transform: none; opacity: 1; } }
.gallery-hero-shade { background: linear-gradient(to top, rgb(0 0 0 / .8), rgb(0 0 0 / .25) 55%, rgb(0 0 0 / .1)); }
.gallery-hero-content { position: relative; width: 100%; padding: clamp(1.25rem, 4vw, 2.5rem); display: flex; flex-direction: column; gap: .55rem; }
.hero-back { align-self: flex-start; display: inline-flex; align-items: center; gap: .3rem; min-height: 40px; padding: .35rem .85rem .35rem .6rem; margin-bottom: auto;
  border-radius: 999px; background: rgb(0 0 0 / .35); border: 1px solid rgb(255 255 255 / .25); color: #fff; text-decoration: none; font-size: .9rem; backdrop-filter: blur(6px); }
.hero-back:hover { background: rgb(0 0 0 / .55); }
.gallery-hero .hero-back { position: absolute; z-index: 1; top: clamp(1rem, 3vw, 1.5rem); left: clamp(1rem, 3vw, 1.5rem); margin: 0; }
.gallery-hero.no-cover { flex-direction: column; align-items: stretch; }
.gallery-hero.no-cover .hero-back { position: static; margin: clamp(1rem, 3vw, 1.5rem) 0 0 clamp(1rem, 3vw, 1.5rem); }
.hero-eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .16em; font-size: .75rem; color: rgb(255 255 255 / .8); }
.gallery-hero-title { font-size: clamp(1.9rem, 1.1rem + 3vw, 3.3rem); line-height: 1.06; margin: 0; color: #fff; text-wrap: balance; max-width: 22ch; }
.facts { list-style: none; margin: .2rem 0 .3rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; color: rgb(255 255 255 / .9); font-size: .95rem; }
.fact { display: inline-flex; align-items: center; gap: .4rem; }
.fact svg { width: 17px; height: 17px; opacity: .85; }
.preview-note strong { font-weight: 650; }

@media (prefers-reduced-motion: reduce) {
  .hero-media img, .album-cover > img, .album-sheet, .gallery-hero-media img { transition: none; animation: none; }
  .hero-card:hover .hero-media img, .album:hover .album-cover > img { transform: none; }
}
@media (forced-colors: active) {
  .hero-card, .album-cover, .gallery-hero, .state-tab, .state-opt { border: 1px solid CanvasText; }
  .hero-shade, .gallery-hero-shade { display: none; }
}

/* Video tiles: poster frame + play badge with running time */
.tile-badge.has-time { width: auto; padding: 0 .7rem 0 .55rem; gap: .3rem; grid-auto-flow: column; font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-badge svg { width: 16px; height: 16px; }
