.crawl-page {
  padding-top: 28px;
}

.crawl-hero {
  min-height: 220px;
}

.source-rule-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
}

.source-rule {
  position: relative;
  min-height: 122px;
  padding: 18px 18px 16px;
  overflow: hidden;
  border: 1px solid rgba(220, 231, 227, 0.9);
  border-radius: 15px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.rule-index {
  position: absolute;
  top: 12px;
  right: 13px;
  color: #d6e7e2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 700;
}

.source-rule strong,
.source-rule p {
  position: relative;
  z-index: 1;
  display: block;
}

.source-rule strong {
  padding-right: 30px;
  font-size: 14px;
}

.source-rule p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.single-crawl-card,
.batch-crawl-card,
.crawl-note-card {
  margin-top: 20px;
}

.single-search-row {
  padding: 0 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 10px;
}

.single-title-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.single-title-field input,
.batch-text-field textarea {
  width: 100%;
  border: 1px solid #ceddd8;
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: #ffffff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.single-title-field input {
  height: 42px;
  padding: 0 12px;
}

.single-title-field input:focus,
.batch-text-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 127, 111, 0.12);
}

.single-hint {
  margin: 9px 22px 0;
}

.single-result-area {
  margin: 18px 22px 22px;
  min-height: 190px;
  position: relative;
  border: 1px dashed #d6e3df;
  border-radius: 15px;
  background: var(--surface-soft);
}

.single-empty,
.single-loading {
  min-height: 190px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.single-empty strong {
  color: var(--ink);
  font-size: 15px;
}

.single-empty span,
.single-loading {
  font-size: 12px;
}

.single-loading::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 1.1s ease-in-out infinite;
}

.single-preview {
  padding: 20px;
}

.single-preview h3 {
  margin: 0 0 9px;
  font-size: 20px;
  line-height: 1.45;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.preview-badge {
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-weight: 800;
}

.preview-abstract {
  margin: 14px 0 0;
  color: #526762;
  font-size: 13px;
  line-height: 1.75;
}

.preview-keywords {
  margin-top: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preview-actions {
  margin-top: 17px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.existing-badge {
  color: #9a650e;
  background: #fff3d8;
}

.save-state {
  color: var(--primary-dark);
  font-weight: 700;
}

.crawl-state-badge {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.crawl-state-badge.idle {
  color: #667a75;
  background: #eef4f2;
}

.crawl-state-badge.loading {
  color: #9a650e;
  background: #fff3d8;
}

.crawl-state-badge.success {
  color: #087354;
  background: #e0f5e9;
}

.crawl-state-badge.error {
  color: #a33e2d;
  background: #ffebe6;
}

.batch-input-grid {
  padding: 0 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 16px;
}

.batch-text-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.batch-text-field textarea {
  min-height: 180px;
  padding: 11px 12px;
  resize: vertical;
}

.file-import-box {
  display: grid;
  align-content: start;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.file-drop {
  min-height: 104px;
  padding: 14px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  border: 1px dashed #bdd7d0;
  border-radius: 12px;
  color: var(--primary-dark);
  background: #f4faf8;
  cursor: pointer;
  text-align: center;
}

.file-drop strong {
  font-size: 14px;
}

.file-drop small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.file-import-box input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.download-template {
  width: fit-content;
  padding: 0;
  border: 0;
  color: var(--primary-dark);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.batch-actions {
  padding: 17px 22px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.batch-actions .button {
  text-decoration: none;
}

.batch-rule-note {
  margin: 10px 22px 0;
  color: var(--muted);
  font-size: 12px;
}

.batch-progress-panel {
  margin: 18px 22px 0;
  padding: 14px 15px;
  border-radius: 12px;
  background: #f4f8f7;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #526762;
  font-size: 12px;
}

.progress-track {
  height: 8px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dcebe6;
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #087f6f, #3e9f8c);
  transition: width 350ms ease;
}

.batch-stat-grid {
  margin: 18px 22px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.batch-stat-grid > div {
  padding: 12px 13px;
  border: 1px solid #e2ece9;
  border-radius: 11px;
  background: #fbfdfc;
}

.batch-stat-grid span,
.batch-stat-grid strong {
  display: block;
}

.batch-stat-grid span {
  color: var(--muted);
  font-size: 11px;
}

.batch-stat-grid strong {
  margin-top: 3px;
  font-size: 21px;
}

.batch-table-wrap {
  position: relative;
  min-height: 160px;
  margin: 18px 16px 20px;
  overflow-x: auto;
  border: 1px solid #e2ece9;
  border-radius: 14px;
}

.batch-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.batch-table th,
.batch-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #edf2f0;
  vertical-align: top;
  text-align: left;
  font-size: 11px;
}

.batch-table th {
  color: #4c615c;
  background: #f5f9f8;
  font-size: 10px;
  font-weight: 800;
}

.batch-table th:nth-child(1),
.batch-table td:nth-child(1) {
  width: 54px;
}

.batch-table th:nth-child(2),
.batch-table td:nth-child(2) {
  width: 300px;
}

.batch-table th:nth-child(3),
.batch-table td:nth-child(3) {
  width: 90px;
}

.batch-table th:nth-child(4),
.batch-table td:nth-child(4) {
  width: 100px;
}

.batch-table th:nth-child(5),
.batch-table td:nth-child(5) {
  width: 230px;
}

.batch-table th:nth-child(6),
.batch-table td:nth-child(6) {
  width: 115px;
}

.batch-status {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.batch-status.success {
  color: #087354;
  background: #e0f5e9;
}

.batch-status.duplicate {
  color: #9a650e;
  background: #fff3d8;
}

.batch-status.failed {
  color: #a33e2d;
  background: #ffebe6;
}

.batch-status.pending,
.batch-status.running {
  color: #576c67;
  background: #eef4f2;
}

.batch-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.94);
  font-size: 12px;
}

.batch-actions-cell {
  display: flex;
  gap: 5px;
}

.table-action {
  padding: 4px 7px;
  border: 1px solid #d7e5e1;
  border-radius: 7px;
  color: #536762;
  background: #ffffff;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.table-action:hover {
  border-color: #9ecdbd;
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.crawl-note-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(18, 39, 35, 0.42);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  border: 1px solid rgba(220, 231, 227, 0.95);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(13, 47, 40, 0.24);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: #667a75;
  background: #f0f5f3;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.modal-header {
  padding: 24px 56px 15px 24px;
  border-bottom: 1px solid #e7efec;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 0 24px 23px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.modal-detail h3 {
  margin: 0 0 9px;
  font-size: 19px;
}

.modal-detail p {
  color: #526762;
  font-size: 13px;
  line-height: 1.75;
}

@media (max-width: 980px) {
  .source-rule-grid,
  .crawl-note-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .batch-input-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .source-rule-grid,
  .batch-stat-grid,
  .crawl-note-grid {
    grid-template-columns: 1fr;
  }

  .single-search-row {
    grid-template-columns: 1fr;
  }

  .single-search-row .button {
    width: 100%;
  }

  .batch-actions .button {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
  }
}
