:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f5f7;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.shell {
  width: min(1080px, calc(100vw - 32px));
  margin: 36px auto;
}

.wide-shell {
  width: min(1440px, calc(100vw - 32px));
}

.tool,
.result {
  background: #ffffff;
  border: 1px solid #dbe1e8;
  border-radius: 8px;
  padding: 24px;
}

.result {
  margin-top: 18px;
}

.topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
}

h2 {
  font-size: 18px;
}

p {
  margin-top: 8px;
  color: #687381;
}

.nav {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0b63ce;
  text-decoration: none;
  font-size: 14px;
}

.nav-link.active {
  border-color: #1373e6;
  background: #eef6ff;
  color: #094fa8;
  font-weight: 650;
}

.url-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 650;
}

.url-input,
.file-input {
  width: 100%;
  height: 44px;
  border: 1px solid #c9d2dd;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 15px;
  outline: none;
}

.file-input {
  padding: 9px 12px;
  background: #ffffff;
}

.drop-zone {
  display: flex;
  min-height: 156px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed #a9b7c7;
  border-radius: 8px;
  background: #f8fafc;
  color: #182433;
  text-align: center;
  cursor: pointer;
  padding: 22px;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.drop-zone:hover,
.drop-zone:focus-within,
.drop-zone.is-dragging {
  border-color: #1373e6;
  background: #eef6ff;
  box-shadow: 0 0 0 3px rgba(19, 115, 230, 0.12);
}

.drop-zone.has-file {
  border-color: #2c7a4b;
  background: #f0fbf5;
}

.drop-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.drop-zone-title {
  font-size: 18px;
  font-weight: 700;
}

.drop-zone-help,
.drop-zone-file {
  max-width: 100%;
  color: #667282;
  font-size: 14px;
  line-height: 1.45;
}

.drop-zone-file {
  margin-top: 4px;
  color: #1f5d3a;
  font-weight: 650;
  word-break: break-all;
}

.url-input:focus,
.file-input:focus {
  border-color: #1373e6;
  box-shadow: 0 0 0 3px rgba(19, 115, 230, 0.14);
}

.primary-button {
  height: 42px;
  margin-top: 14px;
  border: 1px solid #0b63ce;
  border-radius: 6px;
  background: #1373e6;
  color: #ffffff;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  padding: 0 18px;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.secondary-button {
  flex: 0 0 auto;
  min-height: 40px;
  border: 1px solid #0b63ce;
  border-radius: 6px;
  background: #ffffff;
  color: #0b63ce;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  padding: 0 14px;
}

.secondary-button:hover:not(:disabled) {
  background: #eef6ff;
}

.secondary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.preset-button {
  min-height: 88px;
  border: 1px solid #ccd6e0;
  border-radius: 8px;
  background: #f8fafc;
  color: #182433;
  cursor: pointer;
  text-align: left;
  padding: 14px;
}

.preset-button:hover:not(:disabled) {
  border-color: #1373e6;
  background: #eef6ff;
}

.preset-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.preset-button span {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.preset-button small {
  display: block;
  color: #667282;
  line-height: 1.4;
}

.status {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 14px;
}

.status.idle {
  background: #eef3f8;
  color: #495665;
}

.status.busy {
  background: #fff7df;
  color: #795400;
}

.status.error {
  background: #fff0f0;
  color: #b42318;
  white-space: pre-wrap;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.result-url {
  display: block;
  color: #0b63ce;
  word-break: break-all;
  margin-bottom: 16px;
}

.result-link-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.result-link-row .result-url {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
  border: 1px solid #dbe1e8;
  border-radius: 6px;
  background: #f8fafc;
  color: #1c2733;
  padding: 10px 12px;
}

.history-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.history-filters label {
  display: grid;
  gap: 6px;
  color: #4f5d6d;
  font-size: 13px;
  font-weight: 650;
}

.history-filters select {
  min-width: 120px;
  height: 38px;
  border: 1px solid #c9d2dd;
  border-radius: 6px;
  background: #ffffff;
  color: #1c2733;
  padding: 0 10px;
}

.history-summary {
  margin: 6px 0 12px;
  color: #4f5d6d;
  font-size: 14px;
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid #dbe1e8;
  border-radius: 8px;
}

.history-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th,
.history-table td {
  border-bottom: 1px solid #e7ecf2;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.history-table th {
  background: #f8fafc;
  color: #4f5d6d;
  font-weight: 700;
  white-space: nowrap;
}

.history-table tr:last-child td {
  border-bottom: 0;
}

.history-source,
.history-url,
.history-error {
  max-width: 280px;
  word-break: break-all;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.pill {
  background: #eef3f8;
  color: #495665;
}

.status-pill.running {
  background: #fff7df;
  color: #795400;
}

.status-pill.success {
  background: #eaf8f0;
  color: #1f6a3c;
}

.status-pill.failed {
  background: #fff0f0;
  color: #b42318;
}

.muted-text {
  display: block;
  margin-top: 5px;
  color: #687381;
  font-size: 12px;
}

.empty-cell {
  color: #687381;
  text-align: center !important;
}

.pager {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.preview-wrap {
  border: 1px solid #dbe1e8;
  border-radius: 8px;
  padding: 12px;
  background-image:
    linear-gradient(45deg, #e8edf3 25%, transparent 25%),
    linear-gradient(-45deg, #e8edf3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8edf3 75%),
    linear-gradient(-45deg, transparent 75%, #e8edf3 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.preview {
  display: block;
  max-width: 100%;
  max-height: 520px;
  margin: 0 auto;
}

details {
  margin-top: 16px;
}

summary {
  cursor: pointer;
  color: #4f5d6d;
}

dl {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 14px;
  margin: 14px 0 0;
  font-size: 13px;
}

dt {
  color: #657283;
}

dd {
  margin: 0;
  color: #1c2733;
  word-break: break-all;
}

.hidden {
  display: none;
}

@media (max-width: 820px) {
  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .shell {
    width: calc(100vw - 20px);
    margin: 16px auto;
  }

  .tool,
  .result {
    padding: 16px;
  }

  .topline,
  .result-header {
    display: block;
  }

  .nav {
    margin-top: 12px;
  }

  .preset-grid {
    grid-template-columns: 1fr;
  }

  .result-link-row {
    display: block;
  }

  .result-link-row .secondary-button {
    width: 100%;
    margin-top: 10px;
  }

  .history-filters {
    display: grid;
  }

  .history-filters label,
  .history-filters select,
  .history-filters .secondary-button {
    width: 100%;
  }

  dl {
    grid-template-columns: 1fr;
  }
}
