* {
  box-sizing: border-box;
}

:root {
  --bg: #edf3f5;
  --surface: #ffffff;
  --surface-alt: #f6fafb;
  --primary: #153e50;
  --primary-accent: #0f7080;
  --text: #1f3440;
  --muted: #596f7b;
  --border: #cfdee3;
  --copycat-bg: #fce8e6;
  --copycat-border: #e57373;
  --copycat-text: #b71c1c;
  --not-bg: #e8f5e9;
  --not-border: #81c784;
  --not-text: #1b5e20;
  --warn-bg: #fff8e1;
  --warn-border: #ffd54f;
  --warn-text: #8d6e00;
}

body {
  font: 15px/1.65 system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
  margin: 0;
}

a {
  color: var(--primary-accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}
a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

/* App Shell & Left Sidebar Navigation */
.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  padding: 0 8px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 20px;
}

.sidebar-brand .brand-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #7ad7e4;
  display: block;
}

.sidebar-brand .brand-title {
  margin: 4px 0 0;
  font-size: 19px;
  color: #ffffff;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.sidebar-menu-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  padding: 0 10px 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.menu-item.active {
  background: var(--primary-accent);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.menu-icon {
  width: 22px;
  height: 22px;
  flex: none;
}

.menu-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.menu-title {
  font-size: 15px;
  font-weight: 700;
}

.menu-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 2px;
}

.menu-badge {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 99px;
}

.sidebar-footer {
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reviewer-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.reviewer-box input {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-size: 13px;
  width: 100%;
}

.language-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.language-toggle button {
  font: inherit;
  font-size: 13px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.language-toggle button[aria-pressed="true"] {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
}

/* Main Layout */
.app-main {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  color: var(--primary);
}

.page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.report-date-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}

.report-date-bar select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  font-size: 14px;
  background: var(--surface-alt);
  color: var(--primary);
  font-weight: 600;
}

.text-input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  font-size: 14px;
  background: #fff;
}

.modal-dialog {
  border: 0;
  border-radius: 14px;
  padding: 24px;
  width: min(640px, 94vw);
  box-shadow: 0 20px 60px rgba(15, 38, 48, 0.35);
}

.modal-dialog::backdrop {
  background: rgba(15, 38, 48, 0.65);
}

.modal-dialog .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(440px, calc(100vw - 32px));
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(15, 38, 48, 0.32);
}

.toast.is-error {
  background: var(--copycat-text);
}

.toast a {
  color: #fff;
  text-decoration: underline;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 0;
  font-size: 19px;
  color: var(--primary);
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
}

.stat-card .stat-of {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.stat-card-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.stat-card-primary .stat-label {
  color: rgba(255, 255, 255, 0.8);
}

.stat-card-primary .stat-value {
  color: #fff;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.btn-sm {
  font-size: 13px;
  padding: 5px 11px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: #0f2f3d;
  text-decoration: none;
}

.btn-secondary {
  background: #e5eff2;
  color: var(--primary);
  border-color: #c3d7dd;
}
.btn-secondary:hover {
  background: #d5e6eb;
  text-decoration: none;
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--surface-alt);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.is-busy,
.export-btn.is-busy {
  opacity: 0.6;
  cursor: progress;
}

.nowrap,
.badge-colour,
.badge[class*="status-"] {
  white-space: nowrap;
}

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font: 600 11px/16px ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  opacity: 0.65;
}

:focus-visible {
  outline: 2px solid var(--primary-accent);
  outline-offset: 2px;
}

.app-sidebar :focus-visible {
  outline-color: #fff;
}

.btn-danger {
  background: var(--copycat-bg);
  color: var(--copycat-text);
  border-color: var(--copycat-border);
}

/* Filter Controls & Table */
.filter-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-controls input,
.filter-controls select {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
}

.filter-controls input {
  min-width: 240px;
}

.product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.product-table th,
.product-table td {
  border-bottom: 1px solid #e3edf0;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.product-table th {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--surface-alt);
}

.prod-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}

.badge-colour {
  background: #eef4f6;
  color: #264352;
  border: 1px solid #cddce2;
}

.status-pending,
.status-collecting,
.status-assessing,
.status-ready_for_assessment {
  background: #fff8e1;
  color: #795500;
  border: 1px solid #ffe082;
}

.status-ready_for_review {
  background: #e1f5fe;
  color: #01579b;
  border: 1px solid #81d4fa;
}

.status-complete {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
}

.status-partial,
.status-blocked,
.status-failed {
  background: #fce8e6;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
}

/* Upload Form & Issues */
.upload-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

.form-group input[type="file"],
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  background: var(--surface-alt);
}

.form-group textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.issues-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 10px;
}

.issues-table th,
.issues-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.issues-table th {
  background: var(--surface-alt);
}

.sev-error {
  background: var(--copycat-bg);
  color: var(--copycat-text);
}

.sev-warning {
  background: var(--warn-bg);
  color: var(--warn-text);
}

/* Report Detail & Candidate Cards */
.export-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.cycle-export-header {
  align-items: center;
  margin-bottom: 0;
}

.export-history {
  margin-top: 12px;
  font-size: 13px;
}

.export-history summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
}

.report-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: -28px -12px 18px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 14px rgba(15, 38, 48, 0.08);
}

.toolbar-title {
  white-space: nowrap;
  color: var(--primary);
}

.toolbar-title .muted {
  margin-left: 4px;
}

.progress-block {
  flex: 1;
  min-width: 200px;
}

.progress-label {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  line-height: 1.4;
}

.count-copycat {
  color: var(--copycat-text);
  font-weight: 600;
}

.count-not {
  color: var(--not-text);
  font-weight: 600;
}

.progress-track {
  height: 6px;
  margin-top: 4px;
  border-radius: 99px;
  background: #e3edf0;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--primary-accent);
  transition: width 0.2s;
}

.row-sub {
  font-size: 12px;
  margin-top: 4px;
}

.all-done {
  color: var(--not-text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.export-menu {
  position: relative;
}

.export-menu summary {
  list-style: none;
  white-space: nowrap;
}

.export-menu summary::-webkit-details-marker {
  display: none;
}

.export-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 38, 48, 0.18);
}

.export-btn {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.export-btn:hover {
  background: var(--surface-alt);
}

.reference-hero {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  align-items: start;
}

.hero-photo {
  padding: 8px;
  border: 1px solid #e2ecef;
  border-radius: 8px;
  background: #fff;
  cursor: zoom-in;
}

.hero-photo img {
  display: block;
  width: 100%;
  height: 132px;
  object-fit: contain;
}

.brand-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary-accent);
}

.hero-title {
  margin: 2px 0 8px;
  font-size: 17px;
  line-height: 1.45;
  color: var(--primary);
}

.hero-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hero-text {
  margin: 8px 0 0;
  font-size: 14px;
}

.hero-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 13px;
}

.candidate-filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.shortcut-hint {
  font-size: 12px;
  color: var(--muted);
}

.shortcut-hint kbd + kbd {
  margin-left: 2px;
}

.shortcut-hint kbd:not(:first-child) {
  margin-left: 8px;
}

.shortcut-hint kbd + kbd:not(:first-child) {
  margin-left: 2px;
}

.section-heading {
  margin: 26px 0 12px;
}

.candidate-section:first-child .section-heading {
  margin-top: 0;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  color: var(--primary);
}

.section-count {
  display: inline-block;
  padding: 0 9px;
  border-radius: 99px;
  background: #dde9ec;
  font-size: 13px;
  vertical-align: 2px;
}

.empty-panel {
  text-align: center;
}

.loading-panel {
  color: var(--muted);
  text-align: center;
}

.candidate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  scroll-margin-top: 76px;
  outline: none;
  transition: box-shadow 0.15s, opacity 0.15s;
}

.candidate-card.is-current {
  box-shadow: 0 0 0 2px rgba(15, 112, 128, 0.35);
}

.candidate-card.is-saving .decision-bar {
  opacity: 0.6;
}

.candidate-card.decision-copycat {
  border-color: var(--copycat-border);
}

.candidate-card.decision-not_copycat {
  border-color: var(--not-border);
}

.candidate-header {
  margin-bottom: 10px;
}

.candidate-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.candidate-code {
  color: var(--primary-accent);
}

.candidate-title {
  margin: 6px 0 2px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--primary);
}

.candidate-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #526b77;
}

.badge-new {
  background: #e3f2fd;
  color: #0d47a1;
  border: 1px solid #90caf9;
}

.badge-seen {
  background: #f3e5f5;
  color: #4a148c;
  border: 1px solid #ce93d8;
}

.badge-score {
  background: #e3eef0;
  color: #0f5866;
  border: 1px solid #b6d4da;
}

.badge-featured {
  background: #e4f2f2;
  color: #096d7a;
}

.candidate-body {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}

.photo-views-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.photo-view-btn {
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
}

.photo-view-btn[aria-pressed="true"] {
  background: #e4f2f2;
  border-color: var(--primary-accent);
  color: #096d7a;
  font-weight: 600;
}

.photo-pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.photo-panel {
  border: 1px solid #dce6e9;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  min-width: 0;
}

.photo-panel-head {
  padding: 6px 10px;
  background: var(--surface-alt);
  border-bottom: 1px solid #e3ecef;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.photo-panel-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.photo-zoom-trigger {
  display: block;
  width: 100%;
  border: 0;
  background: #fff;
  padding: 8px;
  cursor: zoom-in;
}

.photo-zoom-trigger img {
  display: block;
  width: 100%;
  height: 250px;
  object-fit: contain;
}

.photo-zoom-trigger img.prod-thumb {
  width: 64px;
  height: 64px;
}

.photo-note-text:empty {
  display: none;
}

.candidate-findings {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.finding-box {
  background: #edf6f5;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.finding-box.diff {
  background: #f7f2e9;
}

.finding-box h4 {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--primary);
}

.finding-box p {
  margin: 0;
}

.listing-title {
  margin: 0;
  font-size: 12px;
}

.decision-bar {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 12px;
}

.carried-banner {
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #6d4c00;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.decision-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.decision-label {
  font-size: 13px;
}

.decision-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 7px;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.decision-btn.copycat:hover {
  border-color: var(--copycat-border);
  background: var(--copycat-bg);
}

.decision-btn.not-copycat:hover {
  border-color: var(--not-border);
  background: var(--not-bg);
}

.decision-btn.copycat.active {
  background: var(--copycat-text);
  border-color: var(--copycat-text);
  color: #fff;
}

.decision-btn.not-copycat.active {
  background: var(--not-text);
  border-color: var(--not-text);
  color: #fff;
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--primary-accent);
  text-decoration: underline;
  cursor: pointer;
}

.decision-note-input {
  flex: 1;
  min-width: 220px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
}

.note-status {
  font-size: 12px;
  color: var(--not-text);
}

.note-status:empty {
  display: none;
}

.history-details {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.history-details summary {
  cursor: pointer;
}

.history-list {
  margin: 6px 0 0;
  padding-left: 18px;
}


/* Zoom Dialog */
#photo-zoom-dialog {
  border: 0;
  border-radius: 12px;
  padding: 16px;
  max-width: 92vw;
  max-height: 92vh;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.35);
}

#photo-zoom-dialog::backdrop {
  background: rgba(15, 38, 48, 0.72);
}

.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.zoom-grid {
  display: grid;
  gap: 16px;
}

.zoom-grid.is-pair {
  grid-template-columns: 1fr 1fr;
}

.zoom-grid figure {
  margin: 0;
  min-width: 0;
}

.zoom-grid figcaption {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

#photo-zoom-dialog .dialog-top {
  justify-content: flex-end;
}

#photo-zoom-img,
#photo-zoom-img-b {
  display: block;
  max-width: 86vw;
  max-height: 76vh;
  object-fit: contain;
  margin: auto;
}

.zoom-grid.is-pair #photo-zoom-img,
.zoom-grid.is-pair #photo-zoom-img-b {
  width: 43vw;
  max-width: 100%;
  height: 72vh;
}

@media (max-width: 1180px) {
  .candidate-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .app-sidebar {
    position: static;
    height: auto;
    padding: 12px 16px;
    gap: 10px;
  }
  .sidebar-brand {
    padding: 0;
    margin: 0;
    border: 0;
  }
  .sidebar-brand .brand-title {
    font-size: 16px;
    margin: 0;
  }
  .sidebar-brand .brand-tag,
  .sidebar-menu-label,
  .menu-desc,
  .reviewer-box > label,
  #current-user-display {
    display: none;
  }
  .sidebar-menu {
    flex-direction: row;
  }
  .menu-item {
    padding: 8px 10px;
    gap: 8px;
  }
  .menu-title {
    font-size: 14px;
  }
  .sidebar-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 0;
    border: 0;
  }
  .app-main {
    padding: 16px;
  }
  .report-toolbar {
    margin: -16px -16px 14px;
    padding: 8px 16px;
    gap: 8px 10px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  .progress-block {
    order: 5;
    flex-basis: 100%;
  }
  .toolbar-title .muted,
  .shortcut-hint,
  kbd {
    display: none;
  }
  .candidate-card {
    scroll-margin-top: 110px;
    padding: 14px;
  }
  .reference-hero,
  .findings-grid,
  .upload-form .form-row,
  .modal-dialog .form-row {
    grid-template-columns: 1fr;
  }
  .hero-photo {
    width: 140px;
  }
  .photo-zoom-trigger img {
    height: 170px;
  }
  .zoom-grid.is-pair {
    grid-template-columns: 1fr;
  }
  .zoom-grid.is-pair #photo-zoom-img,
  .zoom-grid.is-pair #photo-zoom-img-b {
    width: 100%;
    height: 38vh;
  }
  .filter-controls input {
    min-width: 0;
    width: 100%;
  }
  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 700px) {
  .report-date-bar {
    flex-wrap: wrap;
    max-width: 100%;
  }
  .report-date-bar select {
    min-width: 0;
    max-width: 100%;
  }
  .summary-cards,
  #cycle-summary-cards {
    grid-template-columns: 1fr 1fr;
  }
  .product-table,
  .product-table tbody {
    display: block;
  }
  .product-table thead {
    display: none;
  }
  .product-table tr {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 6px 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }
  .product-table td {
    display: block;
    grid-column: 2;
    max-width: none !important;
    padding: 0;
    border: 0;
  }
  .product-table td:first-child {
    grid-column: 1;
    grid-row: 1 / span 3;
  }
  .product-table td:last-child {
    grid-column: 1 / -1;
  }
  .export-history {
    overflow-x: auto;
  }
  .report-toolbar .progress-block {
    order: 5;
    flex: 1 1 0;
    min-width: 130px;
  }
  .report-toolbar .export-menu,
  .report-toolbar > .btn-secondary {
    order: 6;
  }
  .report-toolbar .count-copycat,
  .report-toolbar .count-not {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
