:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #b42318;
  --soft: #eef6f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
}

.topbar nav {
  display: flex;
  gap: 18px;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 18px;
}

.panel.compact {
  padding: 18px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2 {
  margin: 0 0 6px;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 19px;
}

p,
.muted,
small {
  color: var(--muted);
}

.analysis-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  font-weight: 650;
}

textarea,
input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 12px;
  font: inherit;
}

textarea:focus,
input[type="file"]:focus {
  outline: 3px solid var(--soft);
  border-color: var(--accent);
}

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.primary-button {
  width: fit-content;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--accent-strong);
}

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

.primary-button.secondary {
  background: #e8f4f2;
  color: var(--accent-strong);
}

.messages {
  margin-bottom: 16px;
}

.message {
  border-radius: 8px;
  padding: 12px 14px;
  background: #ecfdf3;
  color: #05603a;
  border: 1px solid #abefc6;
}

.message.error,
.form-errors {
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #fecdca;
  border-radius: 8px;
  padding: 12px 14px;
}

.status-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.status-grid > div,
.stats-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.label,
.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.progress {
  height: 10px;
  background: #e5e9f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 16px;
}

.progress > div {
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.text-cell {
  min-width: 340px;
  max-width: 540px;
}

.quick-analysis textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.55;
}

.quick-actions {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.request-status {
  color: var(--muted);
  font-size: 14px;
}

.button-spinner {
  display: none;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: button-spin 0.75s linear infinite;
  vertical-align: -3px;
}

.primary-button.is-loading .button-spinner {
  display: inline-block;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

.async-progress {
  padding-block: 16px;
}

.progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-heading {
  margin-bottom: 8px;
}

.result-count {
  color: var(--muted);
  font-size: 14px;
}

.result-table td:nth-child(3) {
  min-width: 190px;
}

.empty-result {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 16px;
  }

  .topbar nav {
    gap: 10px;
  }

  .panel-header.row,
  .status-grid,
  .stats-grid {
    grid-template-columns: 1fr;
    display: grid;
    align-items: stretch;
  }

  .primary-button {
    width: 100%;
    text-align: center;
  }

  .quick-actions {
    display: grid;
  }

  .request-status {
    text-align: center;
  }
}
