:root {
  --bg: #f6f7f9;
  --panel: #fff;
  --line: #e2e5ea;
  --text: #1c2024;
  --muted: #6b7280;
  --accent: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

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

h1 { font-size: 18px; margin: 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

button, .toolbar a {
  font: inherit;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

button:hover, .toolbar a:hover { border-color: #c3c8d0; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: var(--err); border-color: var(--err); color: #fff; }
button.link { border: 0; color: var(--muted); }

.progress, .notice {
  margin: 12px 24px 0;
  padding: 10px 14px;
  border-radius: 6px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

.notice.error { background: #fef2f2; border-color: #fecaca; color: var(--err); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 16px 24px 0; }

.tabs button { border-radius: 999px; padding: 5px 12px; }
.tabs button.active { background: var(--text); border-color: var(--text); color: #fff; }

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 24px;
}

input, textarea, select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  width: 100%;
}

.controls input { max-width: 360px; }
.summary { color: var(--muted); white-space: nowrap; }

table { width: calc(100% - 48px); margin: 0 24px; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }

th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fafbfc; font-weight: 600; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }

.col-img { width: 76px; }
td img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; background: #eee; }

.desc { color: var(--muted); max-width: 420px; }
.url { color: var(--muted); font-size: 12px; word-break: break-all; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef0f3; }
.badge.parsed { background: #dbeafe; color: #1e40af; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.rejected { background: #f3f4f6; color: #4b5563; }
.badge.error { background: #fee2e2; color: #991b1b; }
.badge.parsing, .badge.queued { background: #fef3c7; color: #92400e; }

.pager { display: flex; gap: 8px; align-items: center; padding: 16px 24px; }

.modal { position: fixed; inset: 0; background: rgba(15, 20, 30, .5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal-box { position: relative; width: min(900px, 100%); background: var(--panel); border-radius: 10px; padding: 24px; }
.modal-close { position: absolute; top: 12px; right: 12px; border: 0; font-size: 22px; line-height: 1; background: none; }

.modal-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.modal-grid img.main { width: 100%; border-radius: 6px; background: #eee; }
.candidates { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.candidates img { width: 52px; height: 52px; object-fit: cover; border-radius: 4px; border: 2px solid transparent; cursor: pointer; }
.candidates img.selected { border-color: var(--accent); }

.modal textarea { min-height: 260px; resize: vertical; font-family: inherit; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.logs { margin-top: 16px; font-size: 12px; color: var(--muted); }
.logs div { padding: 2px 0; }
.error { color: var(--err); }

.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login form { background: var(--panel); padding: 28px; border-radius: 10px; border: 1px solid var(--line); width: 320px; display: grid; gap: 12px; }
