:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d6dde6;
  --line-strong: #b7c2d0;
  --primary: #1f6feb;
  --primary-dark: #174ea6;
  --danger: #b42318;
  --success: #16803c;
  --warning: #9a6700;
  --shadow: 0 10px 26px rgba(17, 24, 39, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.boot-body {
  background: #ffffff;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.secondary-button {
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--text);
}

.secondary-button:hover:not(:disabled) {
  background: #eef2f7;
  border-color: #98a2b3;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.brand,
.session {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand h1,
.brand p,
.results-toolbar h2,
.results-toolbar p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.15;
}

.brand p,
.results-toolbar p,
.session {
  color: var(--muted);
  font-size: 14px;
}

.app-nav {
  display: flex;
  gap: 6px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.app-nav a {
  border-radius: 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  text-decoration: none;
}

.app-nav a:hover,
.app-nav a.active {
  background: #eef2f7;
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 18px;
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: 18px 24px 32px;
}

.query-panel,
.results-panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.query-panel {
  align-self: start;
  position: sticky;
  top: 18px;
}

.keyword-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.keyword-form label,
.login-panel label {
  font-size: 13px;
  font-weight: 700;
  color: #344054;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  min-height: 260px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus,
button:focus-visible,
.thumb-link:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.25);
  outline-offset: 2px;
}

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

.results-panel {
  overflow: visible;
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.results-toolbar h2 {
  font-size: 18px;
}

.pagination {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 14px;
}

.table-pagination {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.empty-keywords {
  margin: 12px 16px 0;
  color: var(--warning);
  font-size: 14px;
}

.error-message {
  margin: 12px 16px 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.review-table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
}

.review-table th,
.review-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.review-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
  text-transform: uppercase;
}

.review-table tbody tr:nth-child(even) > th,
.review-table tbody tr:nth-child(even) > td {
  background: #fbfcfe;
}

.review-table tbody th {
  width: 260px;
  max-width: 320px;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.market-cell {
  width: 90px;
  color: #344054;
  font-weight: 700;
}

.gallery-cell {
  min-width: 520px;
  overflow: visible;
}

.checks-cell {
  min-width: 520px;
  overflow: visible;
}

.gallery-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 166px;
  padding: 8px 0;
  overflow: visible;
}

.gallery-row + .gallery-row {
  border-top: 1px solid #e6ebf2;
}

.gallery-label {
  min-height: 28px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.thumb-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 150px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0 0 12px;
}

.checks-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 190px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0 0 12px;
}

.thumb-link {
  position: relative;
  display: block;
  flex: 0 0 150px;
  width: 150px;
  height: 150px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #eef2f7;
  color: var(--danger);
  text-align: center;
  line-height: 150px;
  text-decoration: none;
  overflow: visible;
}

.thumb {
  position: relative;
  z-index: 1;
  display: block;
  width: 150px;
  height: 150px;
  border-radius: 6px;
  object-fit: cover;
  transition: box-shadow 140ms ease;
}

.thumb-link:hover {
  z-index: 2;
}

.thumb-link:hover .thumb,
.thumb-link:focus-visible .thumb {
  box-shadow: var(--shadow);
}

.image-preview {
  position: fixed;
  z-index: 1000;
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.26);
  overflow: hidden;
  pointer-events: none;
}

.image-preview-media {
  height: min(360px, calc(100vh - 24px));
  background: #ffffff;
}

.image-preview.has-caption .image-preview-media {
  height: min(320px, calc(100vh - 180px));
}

.image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-preview-caption {
  max-height: 150px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  color: #344054;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.thumb-error {
  border-color: rgba(180, 35, 24, 0.45);
  background: #fff3f2;
  font-size: 13px;
  font-weight: 700;
}

.gallery-empty,
.checks-empty,
.placeholder {
  color: var(--muted);
  font-size: 14px;
}

.gallery-empty,
.checks-empty {
  align-self: center;
}

.classifier-table {
  min-width: 760px;
}

.classifier-check {
  display: flex;
  flex: 0 0 150px;
  flex-direction: column;
  gap: 8px;
}

.status-pill {
  align-self: flex-start;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 8px;
}

.status-compliant {
  background: #dcfce7;
  color: #166534;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.check-error {
  color: var(--danger);
  display: block;
  font-size: 12px;
  line-height: 1.25;
  max-width: 150px;
  overflow-wrap: anywhere;
}

.placeholder {
  height: 160px;
  text-align: center;
  vertical-align: middle;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #ffffff;
}

.login-shell {
  width: min(420px, calc(100vw - 48px));
}

.login-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
}

.login-panel button {
  width: 100%;
  min-height: 42px;
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.login-panel button:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #ffffff;
}

.login-panel button:disabled {
  background: #6b9df4;
  border-color: #6b9df4;
  color: #ffffff;
  opacity: 1;
}

.login-panel.has-error input {
  border-color: rgba(180, 35, 24, 0.72);
}

.login-error {
  display: none;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .query-panel {
    position: static;
  }

  textarea {
    min-height: 190px;
  }
}

@media (max-width: 720px) {
  .app-header,
  .app-nav,
  .results-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .session,
  .pagination,
  .form-actions {
    width: 100%;
  }

  .session {
    justify-content: space-between;
  }

  .pagination {
    justify-content: flex-start;
  }

  .gallery-row {
    grid-template-columns: 1fr;
    min-height: 190px;
  }
}
