:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f6;
  color: #17202b;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7f9fb 0, #edf2f6 100%);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.brand {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 760;
  letter-spacing: -0.04em;
  color: #163a5f;
}

.subtitle {
  margin-top: 4px;
  color: #667484;
  font-size: 14px;
}

.service-state {
  padding: 8px 12px;
  border: 1px solid #cad4de;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: #5c6977;
  font-size: 12px;
  white-space: nowrap;
}

.service-state.ok {
  border-color: #a8d4be;
  color: #1f6b47;
  background: #edf9f2;
}

.service-state.failed {
  border-color: #e2b9b9;
  color: #9a3232;
  background: #fff2f2;
}

.panel {
  margin-top: 16px;
  border: 1px solid #d5dee7;
  border-radius: 16px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 12px 30px rgba(35,52,70,.06);
  padding: 22px;
}

.dropzone {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed #9db0c2;
  border-radius: 13px;
  background: #f8fafc;
  cursor: pointer;
  outline: none;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: #326b9f;
  background: #f1f7fc;
  transform: translateY(-1px);
}

.dropzone-title {
  font-size: 20px;
  font-weight: 680;
  color: #234664;
}

.dropzone-note,
.file-meta,
.label {
  color: #718090;
  font-size: 13px;
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f5f8fa;
}

.file-name {
  font-weight: 650;
  word-break: break-all;
}

.file-meta {
  margin-top: 3px;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.status-code {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.status-badge {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #cad4de;
  color: #5e6b78;
  background: #f7f9fb;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.valid {
  border-color: #9bcdb3;
  color: #1b6b45;
  background: #eaf8f0;
}

.status-badge.standard {
  border-color: #b8c7d5;
  color: #51687e;
  background: #f1f5f8;
}

.status-badge.invalid {
  border-color: #e0aaaa;
  color: #9e2e2e;
  background: #fff0f0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.summary-item {
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid #e0e6ec;
  border-radius: 10px;
  background: #fbfcfd;
}

.summary-item .value {
  margin-top: 7px;
  font-weight: 680;
  word-break: break-word;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button {
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 630;
  transition: transform .12s ease, opacity .12s ease, background .12s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .52;
}

.button.primary {
  background: #1f5f93;
  color: #fff;
}

.button.secondary {
  border-color: #bac7d3;
  background: #fff;
  color: #32485b;
}

.button.compact {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.section-title {
  font-size: 17px;
  font-weight: 720;
  color: #243b50;
  margin-bottom: 14px;
}

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

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

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #e5eaf0;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #6b7987;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.payload-name {
  font-weight: 650;
  word-break: break-all;
}

.state-ok {
  color: #197045;
  font-weight: 700;
}

.state-failed {
  color: #a22e2e;
  font-weight: 700;
}

.error-box {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #e5b8b8;
  border-radius: 9px;
  background: #fff3f3;
  color: #8e2d2d;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.json-output {
  margin: 0;
  max-height: 520px;
  overflow: auto;
  padding: 15px;
  border-radius: 10px;
  background: #17212b;
  color: #dce8f2;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.busy-layer {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(239,244,248,.82);
  backdrop-filter: blur(3px);
  z-index: 20;
  color: #2a465e;
  font-weight: 650;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #c9d8e5;
  border-top-color: #2a6798;
  animation: spin .8s linear infinite;
}

.hidden {
  display: none !important;
}

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

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1040px);
    padding-top: 20px;
  }

  .topbar,
  .file-info,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .service-state {
    align-self: flex-start;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel {
    padding: 16px;
    border-radius: 12px;
  }
}

@media (max-width: 460px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }
}
