/* SiteProof "Share to computer". No build step, no web fonts: system UI. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #16191d;
  --muted: #5d6673;
  --line: #d9dee5;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --accent-soft: #dbe7fb;
  --danger: #b3261e;
  --warn-bg: #fff4d6;
  --warn-text: #5c4300;
  --radius: 8px;
  --sidebar: 280px;
  --panel: 400px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1e24;
    --surface-2: #232830;
    --text: #e6e9ee;
    --muted: #9aa4b2;
    --line: #313843;
    --accent: #7eaaf0;
    --accent-text: #0b1830;
    --accent-soft: #22344f;
    --danger: #f2b8b5;
    --warn-bg: #3b300f;
    --warn-text: #f5dd9b;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
button {
  font: inherit;
  color: inherit;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.quiet { background: transparent; }
button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pro-note { margin: 12px 8px; }
.pro-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 6px; }

/* ---- Full-screen states ---- */
.screen { min-height: 100%; padding: 24px; }
.center { display: flex; align-items: center; justify-content: center; }
.pair-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  max-width: 460px;
  width: 100%;
  text-align: center;
}
.pair-card h1 { font-size: 22px; margin: 0 0 8px; }
.notice { background: var(--warn-bg); color: var(--warn-text); padding: 8px 12px; border-radius: var(--radius); }
.code-boxes { display: flex; gap: 8px; justify-content: center; margin: 24px 0 8px; }
.code-boxes input {
  width: 48px;
  height: 60px;
  font: 600 28px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
  text-align: center;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.code-boxes input:nth-child(3) { margin-right: 12px; }
.code-boxes.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.pair-message { min-height: 1.5em; color: var(--danger); }
.pair-message.muted { color: var(--muted); }

/* ---- App shell ---- */
#app { display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; }
.job-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.toolbar, .toolbar-ext { display: flex; gap: 8px; align-items: center; }
.icon-button { padding: 4px 10px; }
.narrow-only { display: none; }

.layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: var(--sidebar);
  flex: none;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 12px 8px;
}
.archived-toggle { display: flex; gap: 6px; align-items: center; padding: 0 8px 8px; color: var(--muted); }
.tree-project { margin-bottom: 4px; }
.tree-project-row > button {
  flex: 1;
  min-width: 0;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  font-weight: 600;
  padding: 6px 8px;
  display: flex;
  gap: 6px;
}
.tree-project-row > button .chevron { width: 1em; color: var(--muted); }
.tree-jobs { list-style: none; margin: 0; padding: 0 0 0 18px; }
.tree-jobs button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 5px 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.tree-jobs button[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.tree-jobs .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.tree-empty { padding: 4px 8px 4px 26px; color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

.content { flex: 1; min-width: 0; overflow-y: auto; padding: 16px; }
.job-header h2 { margin: 0; font-size: 20px; }
.job-header p { margin: 2px 0 0; }
.album-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.album-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.tag-filter { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -4px 0 12px; }
.tag-filter:empty { display: none; }
.tag-filter button { font-size: 13px; padding: 2px 8px; }
.tag-filter button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.panel-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 12px 0 6px; }
.panel-tags .tag { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 12px; padding: 1px 4px 1px 10px; }
.panel-tags .tag button { border: none; background: none; padding: 0 4px; cursor: pointer; color: var(--muted); }
.tag-add { display: flex; gap: 6px; margin-bottom: 12px; }
.tag-add input { flex: 1; min-width: 0; }
.selection-bar {
  position: sticky;
  top: -16px;
  z-index: 2;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 12px;
}
#selection-count { font-weight: 600; margin-right: auto; }
.toast { background: var(--surface-2); border-radius: var(--radius); padding: 8px 12px; }
.empty { text-align: center; padding: 48px 0; }

/* ---- Grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.tile {
  position: relative;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 1;
  display: block;
  width: 100%;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  padding: 8px;
  text-align: center;
}
.tile .caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 6px 4px;
  font-size: 12px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.tile .badges {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  gap: 4px;
}
.tile .badge {
  font-size: 11px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  border-radius: 4px;
  padding: 0 5px;
}
.tile .check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, .35);
  display: none;
}
.grid.selecting .tile .check { display: block; }
.tile[aria-selected="true"] { border-color: var(--accent); }
.tile[aria-selected="true"] .check { display: block; background: var(--accent); }
.tile.current { border-color: var(--text); }

/* ---- Panel ---- */
.panel {
  width: var(--panel);
  flex: none;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 12px 16px 24px;
}
.panel-nav { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.panel-nav .spacer { flex: 1; }
.panel-image {
  width: 100%;
  background: var(--surface-2);
  border-radius: var(--radius);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.panel-image a { display: block; width: 100%; }
.panel-image img { width: 100%; height: auto; display: block; border-radius: var(--radius); }
.panel h3 { margin: 12px 0 4px; font-size: 18px; word-break: break-word; }
.panel .notes { white-space: pre-wrap; word-break: break-word; margin: 0 0 12px; }
.panel dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 12px 0; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; word-break: break-word; }
.panel .warn { color: var(--danger); }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; }
.downloads a {
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius);
  padding: 6px 12px;
}
.downloads a.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }

/* ---- Editing (panel) ---- */
.editor { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.editor label { color: var(--muted); font-size: 12px; margin-top: 6px; }
.editor input, .editor textarea, .dialog input[type="text"], .dialog textarea, .dialog select, .search-box {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 8px;
  width: 100%;
}
.editor input { font-size: 16px; font-weight: 600; }
.editor textarea, .dialog textarea { resize: vertical; min-height: 4.5em; }
.save-status { min-height: 1.4em; font-size: 12px; }
.conflict { background: var(--warn-bg); color: var(--warn-text); border-radius: var(--radius); padding: 8px 12px; }
.conflict p { margin: 0 0 6px; font-weight: 600; }
.conflict dl { margin: 0 0 8px; }
.conflict dd { white-space: pre-wrap; }
.conflict-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* S4: "Translate with Google" under Name and Notes - read-only, attributed. */
.translate-button { align-self: flex-start; font-size: 12px; padding: 2px 8px; }
.translation { background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; }
.translation-meta { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.translation-text { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.translation-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.translation-actions button { font-size: 12px; padding: 2px 8px; }

/* ---- Organizing ---- */
.sidebar-ext { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 8px 10px; }
.tree-project-row { display: flex; align-items: center; }
.job-title-row { display: flex; align-items: center; gap: 8px; }
.menu { position: relative; }
.menu summary {
  list-style: none;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 700;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--surface-2); color: var(--text); }
.menu-items {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  padding: 4px;
}
.menu-items button { background: transparent; border: none; text-align: left; padding: 6px 10px; }
.menu-items button:hover { background: var(--surface-2); }
.danger-text { color: var(--danger); }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 20px;
  width: min(440px, calc(100vw - 32px));
}
.dialog::backdrop { background: rgba(0, 0, 0, .4); }
.dialog h2 { margin: 0 0 8px; font-size: 18px; }
.dialog-field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.dialog-field label { color: var(--muted); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---- Search ---- */
.search-box { width: 220px; padding: 5px 8px; }
.content.searching #grid, .content.searching #album-tabs, .content.searching #tag-filter, .content.searching #empty { display: none !important; }
.search-area { margin-bottom: 12px; }
.search-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.search-scopes { display: flex; gap: 6px; flex-wrap: wrap; }
.search-scopes button[aria-checked="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.search-summary { margin: 8px 0; }
.search-results { list-style: none; margin: 0; padding: 0; }
.search-hit {
  display: flex;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  margin-bottom: 6px;
  padding: 8px;
}
.search-thumb { flex: none; width: 64px; height: 64px; border-radius: 6px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.search-thumb img { width: 64px; height: 64px; object-fit: cover; }
.search-thumb-empty { font-size: 10px; color: var(--muted); text-align: center; }
.search-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.search-name { font-weight: 600; }
.search-snippet { color: var(--text); }
.search-where { font-size: 12px; }
mark { background: #ffe08a; color: #16191d; border-radius: 2px; }
.badge-inline { font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 6px; color: var(--muted); font-weight: 400; }

/* ---- Reports ---- */
.report-dialog { width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.report-head, .report-foot, .report-photos-head { display: flex; align-items: center; gap: 8px; }
.report-head { justify-content: space-between; }
.report-foot { justify-content: flex-end; margin-top: 12px; }
.report-photos-head .report-count { flex: 1; font-weight: 600; }
.report-body { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 20px; }
.report-column { min-width: 0; }
.report-label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.report-field select, .report-dialog #report-title { width: 100%; }
.report-fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0; padding: 6px 10px; }
.report-check { display: flex; gap: 6px; align-items: center; padding: 2px 0; }
.report-dialog input[type="checkbox"] { width: auto; flex: none; margin: 0; }
.report-photos { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.report-photo { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-top: 1px solid var(--line); background: var(--surface); }
.report-photo:first-child { border-top: none; }
.report-photo.off { opacity: .55; }
.report-photo.drop-target { box-shadow: inset 0 3px 0 var(--accent); }
.report-handle { cursor: grab; color: var(--muted); user-select: none; }
.report-thumb { flex: none; width: 48px; height: 48px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.report-thumb img { width: 48px; height: 48px; object-fit: cover; }
.report-photo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.report-photo-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-progress { margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }
.report-progress p { margin: 0 0 6px; }
.report-progress progress { width: 100%; margin-bottom: 6px; }
.report-detail { max-height: 200px; overflow: auto; font-size: 11px; white-space: pre-wrap; }
.button-link { display: inline-block; text-decoration: none; background: var(--accent); color: var(--accent-text); border-radius: var(--radius); padding: 6px 12px; }
.report-recent-title { font-size: 15px; margin: 16px 0 6px; }
.report-recent { list-style: none; margin: 0; padding: 0; }
.report-recent li { display: flex; gap: 10px; align-items: center; padding: 4px 0; border-top: 1px solid var(--line); }
.report-recent-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Uploads ---- */
.content.drop-active { outline: 3px dashed var(--accent); outline-offset: -8px; background: var(--accent-soft); }
.drop-hint {
  position: sticky;
  top: 0;
  z-index: 3;
  text-align: center;
  padding: 24px;
  font-weight: 600;
  color: var(--accent);
}
.upload-area {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.upload-banner { background: var(--warn-bg); color: var(--warn-text); padding: 8px 12px; border-radius: var(--radius); margin: 0 0 8px; }
.upload-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.upload-head .summary { flex: 1; font-weight: 600; }
.upload-list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; }
.upload-list li { display: flex; gap: 8px; align-items: center; padding: 3px 0; border-top: 1px solid var(--line); }
.upload-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-list .state { color: var(--muted); white-space: nowrap; }
.upload-list .state.failed { color: var(--danger); }
.upload-list .state.imported { color: var(--accent); }

/* ---- Narrow screens ---- */
@media (max-width: 900px) {
  .narrow-only { display: inline-block; }
  .brand { display: none; }
  .sidebar {
    position: fixed;
    top: 49px;
    bottom: 0;
    left: 0;
    z-index: 5;
    width: min(320px, 85vw);
    transform: translateX(-100%);
    transition: transform .15s, visibility .15s;
    visibility: hidden;
  }
  .sidebar.open { transform: none; visibility: visible; box-shadow: 0 0 24px rgba(0, 0, 0, .25); }
  .panel {
    position: fixed;
    inset: 0;
    z-index: 6;
    width: auto;
  }
  .job-title { display: none; }
  .topbar { gap: 8px; padding: 8px; }
  .toolbar { flex: 1; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .toolbar button { padding: 6px 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .search-box { width: 140px; }
  .report-body { grid-template-columns: 1fr; }
}

/* ---- Checklists (checklists.js) ---- */
.checklists { margin: 10px 0 4px; }
.checklists-title { margin: 0 0 4px; font-size: 14px; }
.checklist-run { margin: 6px 0 10px; max-width: 720px; }
.checklist-toggle { font-weight: 600; padding: 2px 0; text-align: left; }
.checklist-bar { display: block; width: 100%; max-width: 360px; height: 8px; }
.checklist-items { margin: 6px 0 0; padding-left: 22px; }
.checklist-item { margin: 6px 0; }
.checklist-item.flagged .checklist-item-text { font-weight: 600; }
.checklist-item .warn { color: var(--danger); }
.checklist-thumbs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.checklist-thumb { padding: 0; border: 1px solid var(--line); background: none; cursor: pointer; width: 56px; height: 56px; }
.checklist-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.panel-checklist { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
