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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: #0f3460;
  letter-spacing: -0.5px;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: #0f3460;
}

/* Input row */
.input-row {
  display: flex;
  gap: 10px;
}

.input-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-row input:focus {
  border-color: #0f3460;
}

.hint {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 8px;
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border: none;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary  { background: #0f3460; color: #fff; }
.btn-success  { background: #16a34a; color: #fff; }
.btn-secondary{ background: #2563eb; color: #fff; }
.btn-danger   { background: #dc2626; color: #fff; padding: 5px 10px; font-size: 0.8rem; }
.btn-ghost    { background: transparent; color: #6b7280; border: 1.5px solid #d1d5db; }

/* Actions card */
.actions-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Status badge */
.status-badge {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

#statusText {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
}

#statusText.running { background: #fef3c7; color: #92400e; }
#statusText.done    { background: #dcfce7; color: #166534; }
#statusText.failed  { background: #fee2e2; color: #991b1b; }

/* Progress */
.progress-bar-wrap {
  background: #e5e7eb;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0f3460, #2563eb);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-counts {
  font-size: 0.82rem;
  color: #6b7280;
  display: flex;
  gap: 16px;
}

.progress-counts span { font-weight: 600; }

/* Table */
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid #e5e7eb;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 10px 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }

.empty {
  text-align: center;
  color: #9ca3af;
  padding: 24px !important;
}

/* Status pills */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.pill-pending  { background: #f3f4f6; color: #6b7280; }
.pill-scraping { background: #fef3c7; color: #92400e; }
.pill-done     { background: #dcfce7; color: #166534; }
.pill-failed   { background: #fee2e2; color: #991b1b; }

/* URL cell truncation */
.url-cell {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Search results */
#searchResults {
  margin-top: 14px;
}

.bullet-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #1a1a2e;
}

.bullet-item:last-child { border-bottom: none; }
.bullet-item:hover { background: #f9fafb; }

mark {
  background: #fef3c7;
  color: #92400e;
  border-radius: 3px;
  padding: 0 2px;
}

.search-empty {
  text-align: center;
  color: #9ca3af;
  padding: 20px 0;
  font-size: 0.88rem;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a1a2e;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 100;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}
