* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

header {
  margin-bottom: 24px;
}

header h1 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #ddd;
}

.tab {
  padding: 8px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: #666;
}

.tab:hover {
  color: #333;
}

.tab.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  font-weight: 500;
}

.tab-content {
  display: none;
  padding-top: 20px;
}

.tab-content.active {
  display: block;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

button {
  padding: 8px 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

button:hover:not(:disabled) {
  background: #e8e8e8;
}

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

#btn-download-selected {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

#btn-download-selected:hover:not(:disabled) {
  background: #1557b0;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #fafafa;
  font-weight: 500;
  font-size: 0.85rem;
  color: #666;
}

td {
  font-size: 0.9rem;
}

tr:hover {
  background: #f8f9ff;
}

th:first-child, td:first-child {
  width: 40px;
  text-align: center;
}

#vacancy-table a {
  color: #1a73e8;
  text-decoration: none;
}

#vacancy-table a:hover {
  text-decoration: underline;
}

/* Progress */
.progress-bar-container {
  width: 100%;
  height: 24px;
  background: #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: #1a73e8;
  transition: width 0.3s ease;
  border-radius: 12px;
}

#progress-stats {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: #555;
}

#btn-stop-download {
  background: #c62828;
  color: #fff;
  border-color: #c62828;
  margin-bottom: 12px;
}

#btn-stop-download:hover:not(:disabled) {
  background: #a01a1a;
}

#progress-log {
  max-height: 400px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 12px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
}

.log-downloaded { color: #2e7d32; }
.log-updated { color: #00838f; }
.log-skipped { color: #f57f17; }
.log-failed { color: #c62828; }
.log-info { color: #1565c0; }
.log-scored { color: #6a1b9a; }

/* Summary */
#summary-box {
  margin-top: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#summary-box h3 {
  margin-bottom: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.9rem;
}

/* Settings form */
#settings-form {
  max-width: 480px;
  background: #fff;
  padding: 24px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 4px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-actions button {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

.form-actions button:hover {
  background: #1557b0;
}

#settings-status {
  font-size: 0.85rem;
  color: #2e7d32;
}

#vacancies-status {
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #555;
}

/* Scoring prompt area */
#scoring-prompt-area {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 16px;
}

#scoring-prompt-area label {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 8px;
  font-weight: 500;
}

#scoring-prompt {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
}

.prompt-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

#btn-start-download {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
  font-weight: 500;
}

#btn-start-download:hover:not(:disabled) {
  background: #1557b0;
}

#btn-cancel-download {
  background: #fff;
  color: #666;
}

/* Phase label */
#phase-label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  padding: 4px 0;
}

.phase-download {
  color: #1a73e8;
}

.phase-scoring {
  color: #6a1b9a;
}

/* Scoring results table */
#scoring-results {
  margin-top: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#scoring-results h3 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

#scoring-table {
  margin-top: 8px;
  font-size: 0.85rem;
}

#scoring-table th {
  font-size: 0.78rem;
  white-space: nowrap;
}

#scoring-table td {
  font-size: 0.85rem;
}

.score-cell {
  font-size: 1rem !important;
  color: #1a73e8;
}

/* TOP 3 highlights */
#scoring-table tr.top-1 td { border-left: 4px solid #ffd700; }
#scoring-table tr.top-2 td { border-left: 4px solid #c0c0c0; }
#scoring-table tr.top-3 td { border-left: 4px solid #cd7f32; }

#scoring-table tr.top-1 td:first-child { font-weight: 700; color: #b8860b; }
#scoring-table tr.top-2 td:first-child { font-weight: 700; color: #808080; }
#scoring-table tr.top-3 td:first-child { font-weight: 700; color: #cd7f32; }

/* Detail row (expandable) */
.detail-row td {
  background: #f8f9ff;
  padding: 12px 16px;
  border-left: 3px solid #1a73e8;
}

.detail-content p {
  margin-bottom: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.detail-content p:last-child {
  margin-bottom: 0;
}

/* Settings divider and section title */
.settings-divider {
  border-top: 1px solid #e0e0e0;
  margin: 20px 0;
}

.settings-section-title {
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 16px;
}

.form-hint {
  display: block;
  font-size: 0.78rem;
  color: #999;
  margin-top: 4px;
}

/* File action buttons in scoring table */
.file-btns {
  white-space: nowrap;
  text-align: center;
}

.file-btn {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 2px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid;
  line-height: 1.4;
}

.file-btn-pdf {
  color: #c62828;
  border-color: #c62828;
  background: #fff;
}

.file-btn-pdf:hover {
  background: #c62828;
  color: #fff;
}

.file-btn-test {
  color: #1565c0;
  border-color: #1565c0;
  background: #fff;
}

.file-btn-test:hover {
  background: #1565c0;
  color: #fff;
}

/* Test results in detail row */
.test-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #ccc;
}

.test-section h4 {
  font-size: 0.85rem;
  margin: 0 0 6px;
  color: #1565c0;
}

.test-header {
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: #333;
}

.test-questions {
  margin: 0;
  padding-left: 20px;
  font-size: 0.8rem;
  line-height: 1.6;
}

.test-q {
  margin-bottom: 4px;
}

.test-q-text {
  color: #555;
}

.test-answer {
  display: block;
  padding-left: 12px;
  color: #1a73e8;
  font-weight: 500;
}

.test-answer::before {
  content: '\2192 ';
}

.test-open {
  font-style: italic;
}

.test-none {
  color: #999;
  font-size: 0.82rem;
  font-style: italic;
}
