/* ─── Lens of Frey — Dark Portal Stylesheet ─────────────────────────────── */

:root {
  --bg:          #0a0a0b;
  --bg-surface:  #111114;
  --bg-raised:   #18181d;
  --bg-hover:    #1f1f26;
  --border:      #2a2a35;
  --border-subtle: #1e1e26;

  --text-primary:   #e8e6f0;
  --text-secondary: #9997aa;
  --text-muted:     #5c5a6b;

  --accent:       #c9a96e;
  --accent-dim:   #8a6e3f;
  --accent-glow:  rgba(201, 169, 110, 0.12);

  --red:    #c96e6e;
  --green:  #6eb88a;
  --blue:   #6e9ec9;
  --amber:  #c9a96e;
  --purple: #9e6ec9;

  --radius-sm:  4px;
  --radius:     8px;
  --radius-lg:  12px;
  --radius-xl:  20px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text-primary); }

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-mark {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.logo-mark.large {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}

.logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
}

.nav-logout {
  margin-left: 8px;
  color: var(--text-muted);
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  min-height: calc(100vh - 60px - 56px);
}

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 16px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Messages ───────────────────────────────────────────────────────────── */

.messages { margin-bottom: 24px; }

.message {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-glow);
  color: var(--text-primary);
}

.message--error { border-left-color: var(--red); background: rgba(201,110,110,0.1); }
.message--success { border-left-color: var(--green); background: rgba(110,184,138,0.1); }

/* ─── Auth Screen ─────────────────────────────────────────────────────────── */

.auth-screen {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  text-align: center;
  margin-bottom: 36px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-form { display: flex; flex-direction: column; gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-input,
input[type="text"].form-input,
input[type="password"].form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-errors { margin-top: -4px; }
.form-error { color: var(--red); font-size: 13px; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
}

.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--accent);
  color: #0a0a0b;
}

.btn--full { width: 100%; }

/* ─── Page Headers ────────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.page-header-meta { padding-top: 4px; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge--role {
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
}

.badge--client {
  background: rgba(110,158,201,0.12);
  border: 1px solid #3e6e8a;
  color: var(--blue);
}

/* ─── Stats Row ───────────────────────────────────────────────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ─── Sections ────────────────────────────────────────────────────────────── */

.section { margin-bottom: 48px; }

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

/* ─── Data Table ──────────────────────────────────────────────────────────── */

.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--bg-raised); }

.td-title { font-weight: 500; }

.table-action {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* ─── Status Pills ────────────────────────────────────────────────────────── */

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.status-pill--lg { padding: 6px 16px; font-size: 13px; }

.status--draft                { background: rgba(92,90,107,0.3); border-color: #3a3845; color: var(--text-secondary); }
.status--proofing             { background: rgba(110,158,201,0.15); border-color: #3e6e8a; color: var(--blue); }
.status--selections_submitted { background: rgba(158,110,201,0.15); border-color: #6e3e8a; color: var(--purple); }
.status--editing              { background: rgba(201,169,110,0.15); border-color: var(--accent-dim); color: var(--accent); }
.status--ready_for_download   { background: rgba(110,184,138,0.15); border-color: #3e8a5e; color: var(--green); }
.status--delivered            { background: rgba(110,184,138,0.25); border-color: #4aaa74; color: #7ad9a0; }
.status--archived             { background: rgba(92,90,107,0.15); border-color: #2a2835; color: var(--text-muted); }

/* ─── Client Grid ─────────────────────────────────────────────────────────── */

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.client-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.client-name  { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.client-email { font-size: 13px; color: var(--text-secondary); margin-bottom: 2px; }
.client-meta  { font-size: 12px; color: var(--text-muted); }
.client-count { margin-top: 12px; font-size: 12px; color: var(--text-muted); font-style: italic; }

/* ─── Project Grid (client view) ─────────────────────────────────────────── */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.project-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.project-card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-raised);
  transform: translateY(-2px);
  color: inherit;
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.project-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.project-card-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.55;
}

.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-item {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
}

/* ─── Project Detail ──────────────────────────────────────────────────────── */

.back-nav { margin-bottom: 28px; }

.back-link {
  font-size: 13px;
  color: var(--text-secondary);
}

.back-link:hover { color: var(--text-primary); }

.project-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

@media (max-width: 640px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.detail-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.detail-list { display: flex; flex-direction: column; gap: 12px; }

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-row dt {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.detail-row dd {
  font-size: 14px;
  color: var(--text-primary);
}

/* ─── Status Timeline ─────────────────────────────────────────────────────── */

.status-timeline {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 90px;
  position: relative;
}

.timeline-step::before {
  content: "";
  position: absolute;
  top: 7px;
  left: -50%;
  right: 50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.timeline-step:first-child::before { display: none; }

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 2px solid var(--border);
  z-index: 1;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 8px;
}

.timeline-step--active .timeline-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.timeline-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

.timeline-step--active .timeline-label {
  color: var(--accent);
  font-weight: 600;
}

/* ─── Empty State ─────────────────────────────────────────────────────────── */

.empty-state {
  padding: 32px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state--centered {
  text-align: center;
  padding: 60px 32px;
}

.empty-icon {
  font-size: 40px;
  color: var(--accent-dim);
  margin-bottom: 16px;
}

/* ─── Error Screen ────────────────────────────────────────────────────────── */

.error-screen {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.error-card {
  max-width: 440px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 56px 40px;
}

.error-icon {
  font-size: 40px;
  color: var(--red);
  margin-bottom: 20px;
  opacity: 0.7;
}

.error-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.error-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 28px;
}

/* ─── Scrollbar ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Gallery Section ─────────────────────────────────────────────────────── */

.gallery-section {
  margin-top: 36px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 32px;
}

.gallery-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.gallery-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.gallery-status-badge--published {
  background: rgba(110,184,138,0.15);
  border: 1px solid #3e8a5e;
  color: var(--green);
}

.gallery-status-badge--draft {
  background: rgba(92,90,107,0.2);
  border: 1px solid #3a3845;
  color: var(--text-muted);
}

.gallery-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.gallery-count-badge {
  display: inline-block;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 8px;
  color: var(--text-secondary);
  font-weight: 600;
  vertical-align: middle;
  margin-left: 4px;
}

/* Gallery create prompt */
.gallery-create-prompt {
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
}

.gallery-create-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Gallery settings card */
.gallery-settings-card,
.gallery-upload-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}

.gallery-settings-row {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-group--flex { flex: 1; min-width: 200px; }

.form-textarea {
  resize: vertical;
  min-height: 64px;
  font-family: var(--font);
}

.form-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}

/* Publish toggle */
.gallery-publish-wrap { padding-bottom: 2px; }

.publish-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.publish-check { display: none; }

.publish-track {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.publish-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}

.publish-check:checked + .publish-track {
  background: var(--green);
  border-color: #3e8a5e;
}

.publish-check:checked + .publish-track .publish-thumb {
  transform: translateX(18px);
  background: #fff;
}

.publish-label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 70px;
}

/* Upload zone */
.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.upload-dropzone:hover {
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}

.upload-file-input { display: none; }

.upload-icon {
  font-size: 24px;
  color: var(--accent);
  display: block;
}

.upload-primary {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.upload-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.upload-selected {
  font-size: 13px;
  color: var(--accent);
  min-height: 18px;
  margin-bottom: 8px;
}

/* Owner photo grid */
.owner-gallery-header { margin: 24px 0 12px; }

.owner-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.owner-photo-item {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.owner-photo-item:hover { border-color: var(--accent-dim); }

.owner-photo-item--hidden { opacity: 0.5; }

.owner-photo-link {
  display: block;
  position: relative;
}

.owner-photo-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.photo-hidden-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(10,10,11,0.8);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.photo-actions {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.photo-btn {
  flex: 1;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.photo-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.photo-btn--danger { color: var(--red); border-color: rgba(201,110,110,0.3); }
.photo-btn--danger:hover { background: rgba(201,110,110,0.12); }

/* Client gallery grid */
.client-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.client-photo-item {
  display: block;
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.client-photo-item:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.client-photo-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.client-photo-caption {
  display: block;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.gallery-client-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.gallery-client-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Gallery pending (client, unpublished) */
.gallery-pending {
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
}

.gallery-pending-icon {
  font-size: 32px;
  color: var(--accent-dim);
  margin-bottom: 14px;
}

.gallery-pending-msg {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ─── Client Selections ────────────────────────────────────────────────────── */

/* Favourite button on gallery photos */
.fav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  letter-spacing: 0.03em;
}

.fav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.fav-btn--active {
  background: rgba(201, 148, 110, 0.12);
  color: var(--accent);
  border-color: rgba(201, 148, 110, 0.3);
}

.fav-btn--active:hover {
  background: rgba(201, 148, 110, 0.18);
}

.fav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.fav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fav-icon { font-size: 13px; }

.fav-selected-submitted {
  display: block;
  text-align: center;
  padding: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  background: rgba(201, 148, 110, 0.08);
  border-top: 1px solid rgba(201, 148, 110, 0.2);
}

.client-photo-item--favourited {
  border-color: rgba(201, 148, 110, 0.4) !important;
  box-shadow: 0 0 0 1px rgba(201, 148, 110, 0.2);
}

/* Selection bar */
.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.selection-bar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.selection-bar__right { flex-shrink: 0; }

.selection-bar__count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.selection-count-num {
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

.selection-bar__limit-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* Limit warning */
.limit-warning {
  padding: 10px 14px;
  background: rgba(201, 148, 110, 0.1);
  border: 1px solid rgba(201, 148, 110, 0.3);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 12px;
}

/* Favourite error toast */
.fav-error-toast {
  padding: 10px 14px;
  background: rgba(201, 110, 110, 0.1);
  border: 1px solid rgba(201, 110, 110, 0.3);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
}

/* Owner selections section */
.owner-selections-section { margin-top: 8px; }

.selections-empty {
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.selections-empty-text {
  color: var(--text-secondary);
  font-size: 14px;
}

.selections-meta-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.selections-meta-item { display: flex; flex-direction: column; gap: 3px; }

.selections-meta-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.selections-meta-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.owner-selections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.owner-selection-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.owner-selection-link { display: block; }

.owner-selection-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.owner-selection-filename {
  display: block;
  padding: 5px 7px;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--border-subtle);
}

/* Reopen section */
.reopen-section {
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: var(--radius);
  margin-top: 16px;
}

.reopen-info {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Selection status pills */
.selection-status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.selection-status--draft {
  background: rgba(92, 90, 107, 0.2);
  border: 1px solid #3a3845;
  color: var(--text-muted);
}

.selection-status--submitted {
  background: rgba(110, 184, 138, 0.15);
  border: 1px solid #3e8a5e;
  color: var(--green);
}

/* Selection limit form */
.gallery-limit-form { }
.gallery-limit-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-input--sm { max-width: 140px; }

/* Review page */
.review-page { max-width: 900px; }

.review-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.review-submitted-banner {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 20px 24px;
  background: rgba(110, 184, 138, 0.08);
  border: 1px solid #3e8a5e;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
}

.review-submitted-icon {
  font-size: 28px;
  color: var(--green);
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.review-submitted-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
  display: block;
  margin-bottom: 4px;
}

.review-submitted-date,
.review-reopened-note {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 2px 0;
}

.review-readonly-note {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.6;
}

.review-draft-header {
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.review-draft-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.review-limit {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.review-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.review-photo-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.review-photo-link { display: block; }

.review-photo-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.review-photo-meta {
  padding: 8px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.review-filename {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-caption {
  font-size: 12px;
  color: var(--text-secondary);
}

.review-remove-form { border-top: 1px solid var(--border-subtle); }

.review-remove-btn {
  width: 100%;
  padding: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-raised);
  border: none;
  color: var(--red);
  cursor: pointer;
  transition: background 0.15s;
}
.review-remove-btn:hover { background: rgba(201, 110, 110, 0.1); }
.review-remove-btn:focus-visible { outline: 2px solid var(--accent); }

.review-submit-section {
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.review-submit-info {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.review-submit-warning {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.review-back-link { margin-top: 8px; }

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn--ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn--accent { background: var(--accent); color: var(--bg-base); }
.btn--accent:hover { background: var(--accent-dim); }
.btn--sm { padding: 6px 14px; font-size: 12px; }
.btn--lg { padding: 12px 28px; font-size: 15px; }


.selection-limit-active {
  margin-top: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

/* ─── Proof Watermark Settings ───────────────────────────────────────────── */

.section-heading-row,
.watermark-gallery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-help {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: -4px;
}

.watermark-settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.watermark-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr) minmax(120px, 0.5fr);
  gap: 16px;
  align-items: end;
}

.watermark-form-wide { min-width: 0; }

.watermark-check-row {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.check-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

.check-option input {
  accent-color: var(--accent);
}

.opacity-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.opacity-suffix {
  color: var(--text-muted);
  font-size: 13px;
}

.watermark-choice-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.watermark-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.watermark-state {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.watermark-state--on {
  color: var(--green);
  border: 1px solid #3e8a5e;
  background: rgba(110, 184, 138, 0.12);
}

.watermark-state--off {
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-raised);
}

.watermark-gallery-card { margin-bottom: 16px; }
.watermark-gallery-header { margin-bottom: 14px; }

@media (max-width: 820px) {
  .watermark-form-grid {
    grid-template-columns: 1fr;
  }
}

.nav-logout-form { display: inline-flex; margin: 0; }
.nav-button {
  font: inherit;
  border: 0;
  cursor: pointer;
  background: transparent;
}

/* ─── Stage 2D — Client invitations and password setup ─────────────────── */
.btn--small { padding: 8px 12px; font-size: 0.78rem; }
.btn--secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn--secondary:hover { border-color: var(--accent-dim); color: var(--accent); }
.btn--success {
  background: rgba(110, 184, 138, 0.14);
  border: 1px solid rgba(110, 184, 138, 0.62);
  color: var(--green);
}
.btn--success:hover {
  background: rgba(110, 184, 138, 0.22);
  border-color: var(--green);
  color: #a7dfbb;
}
.btn--warning {
  background: rgba(211, 166, 79, 0.14);
  border: 1px solid rgba(211, 166, 79, 0.68);
  color: #e2b965;
}

.btn--warning:hover {
  background: rgba(211, 166, 79, 0.22);
  border-color: #e2b965;
  color: #f0cb7c;
}

.btn--danger {
  background: transparent;
  border: 1px solid rgba(201, 110, 110, 0.55);
  color: var(--red);
}
.btn--danger:hover { background: rgba(201, 110, 110, 0.08); }

.compact-page-header { margin-bottom: 28px; }
.back-link {
  display: inline-block;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 18px;
  font-size: 0.86rem;
}
.back-link:hover { color: var(--accent); }
.invite-form-card { max-width: 680px; margin: 0; }
.invite-form-card .section-help { margin: 8px 0 26px; }
.invite-form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.invitation-list { display: grid; gap: 14px; }
.invitation-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.invitation-main,
.invitation-actions,
.invitation-link-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.invitation-main { justify-content: space-between; }
.invitation-email { font-weight: 700; color: var(--text-primary); }
.invitation-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 5px;
}
.local-time-relative,
.local-time-exact {
  display: block;
}
.local-time-exact {
  margin-top: 2px;
  opacity: 0.85;
}
.invitation-link-row { margin-top: 15px; }
.invitation-link-input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 0.72rem; }
.invitation-actions { margin-top: 14px; }
.invitation-actions form { margin: 0; }
.invite-status {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.invite-status--pending { color: var(--blue); border-color: rgba(110, 158, 201, .5); }
.invite-status--accepted { color: var(--green); border-color: rgba(110, 184, 138, .5); }
.invite-status--expired { color: var(--amber); border-color: rgba(201, 169, 110, .5); }
.invite-status--revoked { color: var(--red); border-color: rgba(201, 110, 110, .5); }

.invitation-screen { padding-top: 40px; padding-bottom: 40px; }
.invitation-accept-card { max-width: 580px; }
.invitation-summary {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 24px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.invite-name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-secondary-link {
  display: block;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-top: 14px;
  text-decoration: none;
}
.auth-secondary-link:hover { color: var(--accent); }
.status-card { text-align: center; }
.status-card .auth-subtitle { margin: 14px 0 24px; line-height: 1.55; }
.status-card .section-help { margin-bottom: 24px; }
.status-icon-error { color: var(--red); }

@media (max-width: 700px) {
  .invitation-main,
  .invitation-link-row { align-items: stretch; flex-direction: column; }
  .invitation-main { gap: 10px; }
  .invite-status { align-self: flex-start; }
  .invitation-link-row .btn { width: 100%; }
  .invite-name-grid { grid-template-columns: 1fr; gap: 0; }
}

/* ─── Stage 2E — Platform-admin organization invitations ──────────────── */
.platform-stats { margin-bottom: 34px; }
.platform-invite-form { max-width: 720px; }
.platform-table td { vertical-align: middle; }
.platform-table form { margin: 0; }
.invitation-note {
  color: var(--text-secondary);
  font-size: 0.86rem;
  margin-top: 10px;
  white-space: pre-wrap;
}
.personal-note {
  margin-top: 14px;
  padding: 14px;
  border-left: 3px solid var(--accent);
  background: var(--bg-surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.personal-note p { margin: 7px 0 0; white-space: pre-wrap; }
.organization-accept-card { max-width: 640px; }
.terms-box {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 18px 0;
}
.terms-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.5;
}
.terms-checkbox { margin-top: 3px; accent-color: var(--accent); }
.muted { color: var(--text-muted); }

@media (max-width: 900px) {
  .platform-table { min-width: 900px; }
}
.page-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .page-header-actions { justify-content: flex-start; width: 100%; }
  .page-header-actions .btn { flex: 1; text-align: center; }
}
/* ─── Mobile Header and Owner Project Cards ─────────────────────────────── */
@media (max-width: 768px) {
  .header-inner {
    height: auto;
    min-height: 60px;
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .logo {
    justify-content: center;
    min-width: 0;
  }

  .logo-text {
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }

  .header-nav {
    justify-content: center;
    flex-wrap: wrap;
  }

  .nav-logout {
    margin-left: 0;
  }

  .main-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .owner-projects-table {
    border: 0;
    overflow: visible;
  }

  .owner-projects-table .data-table,
  .owner-projects-table tbody,
  .owner-projects-table tr,
  .owner-projects-table td {
    display: block;
    width: 100%;
  }

  .owner-projects-table thead {
    display: none;
  }

  .owner-projects-table tbody {
    display: grid;
    gap: 14px;
  }

  .owner-projects-table tr {
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
  }

  .owner-projects-table .data-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    text-align: right;
  }

  .owner-projects-table .data-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
  }

  .owner-projects-table .data-table .td-title {
    display: block;
    padding-top: 0;
    padding-bottom: 12px;
    font-size: 17px;
    text-align: left;
  }

  .owner-projects-table .data-table .td-title::before {
    display: none;
  }

  .owner-projects-table .data-table .owner-project-action {
    display: block;
    padding-top: 14px;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .owner-projects-table .owner-project-action::before {
    display: none;
  }

  .owner-projects-table .table-action {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #111;
    font-weight: 700;
    text-align: center;
  }
}
