* { box-sizing: border-box; }
.hidden { display: none; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f4f6f7;
  margin: 0;
  color: #223;
}
.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}
h1 { margin-bottom: 4px; }
.subtitle { color: #667; margin-top: 0; }

.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}
button {
  background: #1a9c7c;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}
button:disabled {
  background: #a9c9c1;
  cursor: not-allowed;
}
#status { color: #444; font-style: italic; }
.refresh-btn {
  background: #667;
}

.usage-panel {
  background: #fff;
  border: 1px solid #d7dee0;
  border-left: 4px solid #1a9c7c;
  border-radius: 4px;
  padding: 14px 16px;
  margin: 16px 0;
}
.usage-title {
  font-weight: 700;
  font-size: 14px;
  color: #1a9c7c;
  margin-bottom: 10px;
}
.usage-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.usage-table th,
.usage-table td {
  border: 1px solid #e2e8ea;
  padding: 6px 10px;
  text-align: right;
}
.usage-table th:first-child,
.usage-table td:first-child {
  text-align: left;
}
.usage-table th {
  background: #f4f6f7;
  color: #445;
  font-weight: 600;
}
.usage-table tr.usage-total td {
  font-weight: 700;
  background: #f8fbfa;
}
.usage-note {
  margin-top: 10px;
  font-size: 12px;
  color: #667;
  line-height: 1.5;
}
.refresh-btn:hover {
  background: #445;
}

.image-list {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.image-item {
  background: #fff;
  border: 1px solid #dde3e2;
  border-radius: 6px;
  padding: 10px;
  width: 260px;
}
.image-item .item-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.image-item .remove-img {
  background: #d9534f;
  padding: 2px 8px;
  font-size: 11px;
}
.preview-pair {
  display: flex;
  gap: 8px;
}
.preview-pair .preview-box {
  flex: 1;
  text-align: center;
}
.preview-pair .preview-box h4 {
  margin: 0 0 4px;
  font-size: 11px;
  color: #667;
  font-weight: 600;
}
.preview-pair canvas {
  max-width: 100%;
  max-height: 160px;
  border: 1px solid #eee;
}
.image-item .badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #eef3f2;
  color: #557;
}
.image-item .badge.done {
  background: #d8f3e9;
  color: #1a9c7c;
}

.transcription-panel {
  background: #fff;
  border: 1px solid #dde3e2;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
}
.transcription-panel.hidden { display: none; }
.transcription-panel label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}
.transcription-panel textarea {
  width: 100%;
  font-family: "Noto Sans", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid #cfd6d5;
  border-radius: 4px;
  resize: vertical;
}
.transcription-columns {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.transcription-col {
  flex: 1;
  min-width: 280px;
}
.legibility-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
.legibility-badge.ok {
  background: #d8f3e9;
  color: #1a9c7c;
}
.legibility-badge.warn {
  background: #fde8e6;
  color: #c0392b;
}

.card {
  background: #fff;
  border-radius: 6px;
  border: 1px solid #dde3e2;
  overflow: hidden;
}
.tabs {
  display: flex;
  border-bottom: 1px solid #dde3e2;
}
.tab {
  padding: 14px 22px;
  cursor: pointer;
  font-weight: 600;
  color: #334;
}
.tab.active {
  color: #1a9c7c;
  border-bottom: 3px solid #1a9c7c;
}
.tab-panel { padding: 20px; }
.tab-panel.hidden { display: none; }

.field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}
.field label { font-weight: 600; font-size: 14px; }
.field .req { color: #e33; }
.field input,
.field select {
  padding: 8px 10px;
  border: 1px solid #cfd6d5;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
}
.field-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.add-btn { height: 38px; margin-bottom: 14px; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
th, td {
  border: 1px solid #dde3e2;
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
}
th { background: #1a9c7c; color: #fff; }
.empty { text-align: center; color: #888; }
.remove-btn {
  background: #d9534f;
  padding: 4px 10px;
  font-size: 12px;
}
