/* Shared components. workspace.css owns page layout; photo-editor.css owns the editor. */
.af-site {
  margin: 0;
  background: var(--af-bg);
  color: var(--af-ink);
  font-family: var(--af-font);
  font-size: var(--af-text-base);
  line-height: var(--af-leading);
}
.af-site :is(button, input, select, textarea) { font: inherit; }
.af-site :is(h1, h2, h3, p) { margin: 0; }
.af-site h1, .af-site .af-heading-page { font-size: var(--af-text-2xl); font-weight: var(--af-weight-medium); line-height: var(--af-leading-tight); letter-spacing: -.8px; }
.af-site h2, .af-site .af-heading-section { font-size: var(--af-text-xl); font-weight: var(--af-weight-medium); line-height: 1.3; letter-spacing: -.3px; }
.af-site h3, .af-site .af-heading-subsection { font-size: var(--af-text-lg); font-weight: var(--af-weight-medium); line-height: 1.4; }
.af-site strong { font-weight: var(--af-weight-medium); }
.af-site .af-text-body { font-size: var(--af-text-base); line-height: var(--af-leading); }
.af-site :is(.af-note, .af-text-small) { font-size: var(--af-text-sm); line-height: 1.6; }
.af-site :is(.af-note, .af-muted) { color: var(--af-muted); }
.af-site :is(.af-small, .af-text-meta) { font-size: var(--af-text-xs); }
.af-site .af-overline { font-size: var(--af-text-xs); font-weight: var(--af-weight-medium); color: var(--af-muted); }
.af-site a { text-decoration: none; }
.af-site :is(img, svg, video) { display: block; }
.af-site .af-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.af-site .af-link { color: var(--af-green); }
.af-site :is(.af-note a, .af-link):hover { color: var(--af-ink); }
.af-site :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--af-focus); outline-offset: 3px; }

/* Brand: the same vector mark in navigation, login, offline and export. */
.af-site .af-brand { display: inline-flex; align-items: center; gap: var(--af-space-2); font-size: 17px; font-weight: var(--af-weight-medium); letter-spacing: 1.2px; white-space: nowrap; }
.af-site .af-brandmark { display: block; width: 28px; height: 28px; flex: 0 0 28px; }

/* Boot splash: static markup in index.html before the bundle runs, then the
   same nodes stay mounted under React while the session check completes. */
.af-site.af-boot { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--af-space-5); animation: af-boot-in var(--af-duration) var(--af-ease) both; }
.af-site .af-boot-mark { width: 56px; height: 56px; }
.af-site .af-boot-name { font-size: 17px; font-weight: var(--af-weight-medium); letter-spacing: 1.2px; color: var(--af-ink); }
.af-site .af-boot-track { width: 160px; height: 3px; border-radius: 2px; background: var(--af-line); overflow: hidden; }
.af-site .af-boot-track .af-progress-indeterminate { display: block; height: 100%; background: var(--af-accent); }
.af-site .af-boot-label { font-size: var(--af-text-sm); color: var(--af-muted); }
@keyframes af-boot-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .af-site.af-boot { animation: none; } }

/* Button hierarchy: primary, accent, secondary (default), quiet, text, danger. */
.af-site :is(.af-btn, .af-iconbtn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--af-space-2);
  min-height: var(--af-control-height);
  padding: 8px var(--af-space-4);
  border: 1px solid var(--af-control-line);
  border-radius: var(--af-radius-control);
  background: var(--af-surface);
  color: var(--af-ink);
  font-size: var(--af-text-sm);
  font-weight: var(--af-weight-medium);
  line-height: 1.4;
  text-decoration: none;
  text-align: center;
  white-space: normal;
  cursor: pointer;
  transition: background-color var(--af-duration) var(--af-ease), border-color var(--af-duration) var(--af-ease), color var(--af-duration) var(--af-ease), transform var(--af-duration) var(--af-ease);
}
.af-site :is(.af-btn, .af-iconbtn):hover { background: var(--af-soft); border-color: var(--af-muted); }
.af-site :is(.af-btn, .af-iconbtn):active { background: var(--af-line); transform: scale(.98); }
.af-site .af-btn-primary { background: var(--af-dark); color: var(--af-on-dark); border-color: var(--af-dark); }
.af-site .af-btn-primary:hover { background: var(--af-dark-hover); color: var(--af-on-dark); border-color: var(--af-dark-hover); }
.af-site .af-btn-lime { background: var(--af-lime); border-color: var(--af-lime); color: var(--af-on-lime); }
.af-site .af-btn-lime:hover { background: var(--af-lime-hover); border-color: var(--af-lime-hover); color: var(--af-on-lime); }
.af-site .af-btn-quiet { background: transparent; border-color: transparent; color: var(--af-muted); }
.af-site .af-btn-quiet:hover { background: var(--af-soft); border-color: transparent; color: var(--af-ink); }
.af-site .af-btn-text { background: transparent; border-color: transparent; color: var(--af-green); padding-inline: var(--af-space-2); }
.af-site .af-btn-text:hover { background: transparent; border-color: transparent; color: var(--af-ink); }
.af-site .af-btn-danger { color: var(--af-red); }
.af-site .af-btn-danger:hover { color: var(--af-red); background: var(--af-red-bg); border-color: var(--af-red); }
.af-site .af-iconbtn { width: var(--af-control-height); min-width: var(--af-control-height); height: var(--af-control-height); padding: var(--af-space-2); flex-shrink: 0; }
.af-site .af-btn-sm { min-height: var(--af-control-sm); padding: 7px var(--af-space-3); }
.af-site .af-iconbtn.af-btn-sm { width: var(--af-control-sm); min-width: var(--af-control-sm); height: var(--af-control-sm); padding: 6px; }
.af-site .af-btn-lg { min-height: var(--af-control-lg); padding: 12px var(--af-space-5); }
.af-site .af-btn-block { width: 100%; }
.af-site :is(.af-btn, .af-iconbtn)[aria-pressed=true] { background: var(--af-green-bg); border-color: var(--af-green); color: var(--af-green); }
.af-site :is(.af-btn, .af-iconbtn)[aria-busy=true] { cursor: progress; }
.af-site :is(.af-btn, .af-iconbtn)[aria-busy=true]::before { content: ""; width: 16px; height: 16px; flex-shrink: 0; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: af-spin .85s linear infinite; }
.af-site :is(.af-btn, .af-iconbtn):is(:disabled, [aria-disabled=true]), .af-site button:disabled { opacity: .5; cursor: not-allowed; }
.af-site :is(.af-btn, .af-iconbtn):is(:disabled, [aria-disabled=true]) { pointer-events: none; }

/* Forms: visible labels, shared control heights, associated help/error text. */
.af-site .af-field { display: flex; flex-direction: column; gap: var(--af-space-2); min-width: 0; color: var(--af-ink); font-size: var(--af-text-sm); }
.af-site .af-field.full { grid-column: 1 / -1; }
.af-site .af-input { width: 100%; min-width: 0; min-height: var(--af-control-height); height: var(--af-control-height); padding: 10px var(--af-space-3); border: 1px solid var(--af-control-line); border-radius: var(--af-radius-control); background: var(--af-surface); color: var(--af-ink); font-size: var(--af-text-base); line-height: var(--af-leading); transition: border-color var(--af-duration) var(--af-ease); }
.af-site .af-input::placeholder { color: var(--af-muted); opacity: 1; }
.af-site .af-input:hover { border-color: var(--af-muted); }
.af-site .af-input:focus { border-color: var(--af-focus); }
.af-site .af-input:disabled { background: var(--af-soft); color: var(--af-muted); cursor: not-allowed; }
.af-site .af-input[readonly] { background: var(--af-bg); }
.af-site textarea.af-input { min-height: 112px; height: auto; resize: vertical; }
.af-site .af-input-wrap { position: relative; flex: 1; min-width: 0; }
.af-site .af-input-wrap .af-input { padding-left: 38px; }
.af-site .af-input-wrap > svg { position: absolute; top: 14px; left: 12px; width: 16px; height: 16px; color: var(--af-muted); pointer-events: none; }
.af-site .af-input[aria-invalid=true] { border-color: var(--af-red); }
.af-site .af-field-error { display: block; color: var(--af-red); font-size: var(--af-text-sm); line-height: 1.5; }
.af-site :is(.af-check, .af-radio) { display: flex; align-items: center; gap: var(--af-space-2); min-height: var(--af-control-height); font-size: var(--af-text-sm); cursor: pointer; }
.af-site input:is([type=checkbox], [type=radio]) { width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--af-green); }

/* Surfaces and feedback. Shadows belong to floating elements only. */
.af-site :is(.af-card, .af-form-section) { min-width: 0; padding: var(--af-space-6); border: 1px solid var(--af-line); border-radius: var(--af-radius-card); background: var(--af-surface); }
.af-site .af-form-section { margin-bottom: var(--af-space-5); }
.af-site .af-form-section > h2 { margin-bottom: var(--af-space-2); }
.af-site .af-form-section > h3 { margin-bottom: var(--af-space-2); }
.af-site .af-form-section > p { font-size: var(--af-text-sm); color: var(--af-muted); margin-bottom: var(--af-space-5); }
.af-site :is(.af-badge, .af-fact-status) { display: inline-flex; width: max-content; align-items: center; gap: var(--af-space-1); padding: 4px var(--af-space-2); border-radius: var(--af-radius-sm); background: var(--af-green-bg); color: var(--af-green); font-size: var(--af-text-xs); line-height: 1.5; font-weight: var(--af-weight-medium); white-space: nowrap; }
.af-site :is(.af-badge.pending, .af-fact-status[data-status=conflict]) { background: var(--af-alert-bg); color: var(--af-alert); }
.af-site :is(.af-badge.neutral, .af-fact-status) { background: var(--af-soft); color: var(--af-muted); }
.af-site .af-fact-status[data-status=found] { background: var(--af-green-bg); color: var(--af-green); }
.af-site .af-badge.danger { background: var(--af-red-bg); color: var(--af-red); }
.af-site :is(.af-alert, .af-flash, .af-subscription-notice) { padding: var(--af-space-4); border: 1px solid var(--af-line); border-radius: var(--af-radius-control); background: var(--af-soft); color: var(--af-ink); font-size: var(--af-text-sm); line-height: 1.6; }
.af-site .af-flash { margin-bottom: var(--af-space-5); }
.af-site :is(.af-alert-success, .af-flash.success) { color: var(--af-green); background: var(--af-green-bg); }
.af-site :is(.af-alert-warning, .af-flash.warning, .af-subscription-notice) { color: var(--af-alert); background: var(--af-alert-bg); }
.af-site :is(.af-alert-danger, .af-flash.danger) { color: var(--af-red); background: var(--af-red-bg); }
.af-site .af-toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(480px, calc(100% - 48px)); padding: var(--af-space-4) var(--af-space-5); background: var(--af-dark); color: var(--af-on-dark); border-radius: var(--af-radius-card); font-size: var(--af-text-sm); box-shadow: var(--af-shadow-float); animation: af-toast-in .2s var(--af-ease-out); }
.af-site .af-toast-error { background: var(--af-red); }
.af-site .af-toast:empty { display: none; }
.af-site .af-menu-item { display: flex; align-items: center; gap: var(--af-space-2); width: 100%; min-height: var(--af-control-height); padding: 10px var(--af-space-4); text-align: left; font-size: var(--af-text-sm); color: var(--af-ink); background: transparent; border: 0; cursor: pointer; }
.af-site .af-menu-item:hover { background: var(--af-soft); }
.af-site .af-menu-item-danger { color: var(--af-red); }
.af-site .af-menu-item-danger:hover { background: var(--af-red-bg); }
.af-site .af-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--af-space-2); }
.af-site .af-pagination [aria-current=page] { background: var(--af-dark); color: var(--af-on-dark); border-color: var(--af-dark); }
.af-site .af-pagination-gap { padding: var(--af-space-2); color: var(--af-muted); }
.af-site .af-form-stack { display: grid; gap: var(--af-space-5); }
/* Native disclosure keeps optional explanations reachable without a script. */
.af-site .af-disclosure { border-top: 1px solid var(--af-line); padding-top: var(--af-space-3); font-size: var(--af-text-sm); }
.af-site .af-disclosure > summary { position: relative; display: block; min-height: var(--af-control-height); padding: var(--af-space-3) var(--af-space-10) var(--af-space-3) var(--af-space-3); border-radius: var(--af-radius-control); list-style: none; cursor: pointer; font-weight: var(--af-weight-medium); overflow-wrap: anywhere; transition: background-color var(--af-duration) var(--af-ease), color var(--af-duration) var(--af-ease); }
.af-site .af-disclosure > summary::-webkit-details-marker { display: none; }
/* Anchored to the first line box, not the summary box: a wrapped title must not push the chevron
   down to the middle of the paragraph. */
.af-site .af-disclosure > summary::after { content: ""; position: absolute; right: var(--af-space-3); top: var(--af-space-3); width: var(--af-icon-size); height: var(--af-icon-size); background: currentColor; mask: url('../img/chevron-down.svg') center / contain no-repeat; transform: translateY(calc(0.5lh - 50%)); transition: transform var(--af-duration) var(--af-ease); pointer-events: none; }
.af-site .af-disclosure > summary:hover { background: var(--af-soft); color: var(--af-green); }
.af-site .af-disclosure > summary:active { background: var(--af-line); }
.af-site .af-disclosure[open] > summary::after { transform: translateY(calc(0.5lh - 50%)) rotate(180deg); }
.af-site .af-disclosure[open] > summary { margin-bottom: var(--af-space-4); }
/* Dense information stays in native tables with a labelled scroll region. */
.af-site .af-table-scroll { position: relative; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; border: 1px solid var(--af-line); border-radius: var(--af-radius-card); background: var(--af-surface); }
.af-site .af-data-table { width: 100%; border-collapse: collapse; font-size: var(--af-text-base); text-align: left; }
.af-site .af-data-table :is(th, td) { padding: var(--af-space-4); vertical-align: middle; }
.af-site .af-data-table .af-btn { min-width: max-content; }
.af-site .af-data-table thead th { background: var(--af-bg); color: var(--af-muted); font-size: var(--af-text-sm); font-weight: var(--af-weight-medium); }
.af-site .af-data-table tbody th { font-weight: var(--af-weight-medium); }
.af-site .af-data-table tbody tr { border-top: 1px solid var(--af-line); }
.af-site .af-sort-control { display: inline-flex; align-items: center; gap: var(--af-space-2); min-height: var(--af-control-height); padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; }
.af-site .af-sort-control:hover { color: var(--af-green); }
.af-site .af-sort-control .af-icon { flex-shrink: 0; }
.af-site .af-table-hint { display: none; margin-bottom: var(--af-space-3); }
.af-site .af-summary-list { margin: 0; }
.af-site .af-summary-list > div { display: flex; justify-content: space-between; gap: var(--af-space-4); padding-block: var(--af-space-3); border-bottom: 1px solid var(--af-line); }
.af-site .af-summary-list dt { min-width: 0; overflow-wrap: anywhere; }
.af-site .af-summary-list dd { margin: 0; font-variant-numeric: tabular-nums; }
.af-site .af-menu-popover { position: fixed; z-index: 90; width: min(260px, calc(100vw - 32px)); max-height: 60dvh; overflow-y: auto; padding: var(--af-space-1); border: 1px solid var(--af-line); border-radius: var(--af-radius-control); background: var(--af-surface); box-shadow: var(--af-shadow-float); animation: af-popover-in .15s var(--af-ease-out); transform-origin: top right; }
.af-site .af-empty { display: grid; justify-items: center; gap: var(--af-space-3); padding: var(--af-space-8) var(--af-space-6); border: 1px dashed var(--af-line); border-radius: var(--af-radius-card); background: var(--af-surface); color: var(--af-ink); text-align: center; }
.af-site .af-empty > svg { width: 28px; height: 28px; color: var(--af-muted); }
.af-site .af-empty p { max-width: 60ch; font-size: var(--af-text-sm); color: var(--af-muted); }
.af-site .af-empty .af-actions { justify-content: center; margin-top: var(--af-space-2); }
.af-site .af-divider-line { border: 0; border-top: 1px solid var(--af-line); margin: var(--af-space-6) 0; }
/* Semantic helpers used by the existing administration layouts. */
.af-site .af-text-ink { color: var(--af-ink); }
.af-site .af-text-accent { color: var(--af-green); }
.af-site .af-text-danger { color: var(--af-red); }
.af-site .af-text-subsection { font-size: var(--af-text-lg); }
.af-site .af-text-metric { font-size: var(--af-text-metric); font-variant-numeric: tabular-nums; }
.af-site .af-surface { background: var(--af-surface); }
.af-site .af-surface-soft { background: var(--af-soft); }
.af-site .af-surface-success { background: var(--af-green-bg); }
.af-site .af-surface-danger { background: var(--af-red-bg); }
.af-site .af-panel { border: 1px solid var(--af-line); border-radius: var(--af-radius-card); box-shadow: none; }
.af-site .af-car-back { margin-bottom: var(--af-space-5); }
.af-site .af-subscription-notice { margin-bottom: var(--af-space-6); }
.af-site .af-prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.af-site .af-tabs { display: flex; align-items: center; gap: var(--af-space-5); }
.af-site .af-tabs button { min-height: var(--af-control-height); padding: var(--af-space-2) 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--af-muted); font-size: var(--af-text-sm); cursor: pointer; transition: color var(--af-duration) var(--af-ease), border-color var(--af-duration) var(--af-ease); }
.af-site .af-tabs button:hover { color: var(--af-ink); }
.af-site .af-tabs button.active { color: var(--af-ink); border-bottom-color: var(--af-ink); }
.af-site .af-tabs span { font-size: var(--af-text-xs); color: var(--af-muted); margin-left: var(--af-space-1); }
.af-site :is(.af-nav a, .af-settings-nav a) { min-height: var(--af-control-height); }
@media (max-width: 760px) {
  .af-site .af-table-hint { display: block; }
  .af-site h1, .af-site .af-heading-page { font-size: 1.625rem; }
  .af-site .af-input { font-size: 1rem; }
  .af-site :is(.af-card, .af-form-section) { padding: var(--af-space-4); }
}
@media (pointer: coarse) {
  .af-site .af-btn-sm { min-height: var(--af-control-height); }
  .af-site .af-iconbtn.af-btn-sm { width: var(--af-control-height); min-width: var(--af-control-height); height: var(--af-control-height); }
}
/* Motion: entrances only, all under 250ms (Emil Kowalski's UI motion rules).
   Press/hover stay on color transitions; nothing animates per keystroke. */
@keyframes af-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes af-popover-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes af-overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes af-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes af-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes af-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Loading placeholders: shimmer blocks sized by variant classes, no layout shift. */
.af-site .af-skeleton { display: block; border-radius: var(--af-radius-sm); background: linear-gradient(90deg, var(--af-soft) 25%, var(--af-line) 50%, var(--af-soft) 75%); background-size: 200% 100%; animation: af-shimmer 1.4s linear infinite; }
.af-site .af-skeleton-row { height: 56px; margin-bottom: var(--af-space-2); }
.af-site .af-skeleton-line { height: 14px; margin-bottom: var(--af-space-3); }
.af-site .af-skeleton-block { height: 140px; }
.af-site .af-skeleton-stage { position: absolute; inset: 0; border-radius: 0; }
.af-site .af-skeleton-rows > .af-skeleton-row:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .af-site *, .af-site *::before, .af-site *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
