@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700;800&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
  --bg-top: #f6f5ee;
  --bg-bottom: #eef4f8;
  --card: #ffffff;
  --ink: #192228;
  --muted: #5d6970;
  --line: #d7e0e4;
  --brand: #0f6b5e;
  --brand-strong: #0c5349;
  --accent: #cf7c2f;
  --ok: #0d8f63;
  --warn: #c18422;
  --error: #b63b2a;
  --shadow: 0 14px 35px rgba(10, 36, 53, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: 'Manrope', sans-serif;
  background:
    radial-gradient(1200px 600px at 90% -20%, rgba(207, 124, 47, 0.15), transparent 60%),
    radial-gradient(900px 700px at -10% 20%, rgba(15, 107, 94, 0.12), transparent 60%),
    linear-gradient(170deg, var(--bg-top), var(--bg-bottom));
}

.page-wrap {
  width: min(1220px, calc(100% - 2rem));
  margin: 1.4rem auto 2.4rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.1vw, 2rem);
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 0.7rem;
  font-size: 1.2rem;
}

h3 {
  margin: 1rem 0 0.5rem;
  font-size: 1rem;
}

.muted {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.4rem;
  color: var(--brand-strong);
  font-weight: 700;
  text-decoration: none;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  min-width: 360px;
}

.code-search {
  display: grid;
  grid-template-columns: auto 140px auto;
  gap: 0.45rem;
  align-items: center;
}

.code-search label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.compact-input {
  margin: 0;
  padding: 0.5rem 0.55rem;
}

.tag {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tag-ok {
  background: #e9f6f2;
  color: var(--brand-strong);
}

.tag-warning {
  background: #fff7e9;
  color: #915415;
}

.card,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card {
  padding: 0.5rem;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
}

.products-table th,
.products-table td {
  text-align: left;
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid #edf1f4;
  vertical-align: top;
}

.products-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #4e5d65;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.26rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-unprocessed {
  background: #f3f6f8;
  border-color: #dbe4e8;
}

.status-processed {
  background: #fff6e8;
  border-color: #f0d5a4;
}

.status-saved {
  background: #e9f7f1;
  border-color: #b8decf;
  color: #125642;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid #c8d6dc;
  background: #fdfefe;
  color: #17313c;
  padding: 0.55rem 0.8rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  filter: brightness(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-small {
  padding: 0.42rem 0.65rem;
  font-size: 0.8rem;
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #f9fffd;
}

.btn-success {
  border-color: transparent;
  background: linear-gradient(135deg, #167f5e, #0c5c42);
  color: #f2fff9;
}

.btn-structure {
  border-color: #dcb56d;
  background: linear-gradient(135deg, #fff3d2, #ffe6a8);
  color: #6d4b13;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.btn-structure:hover:not(:disabled) {
  filter: brightness(0.97);
}

.btn-structure:disabled {
  background: #f3f6f8;
  border-color: #d4dee4;
  color: #7a8b95;
  opacity: 0.95;
}

.panel {
  padding: 1rem;
}

.control-panel {
  margin-bottom: 1rem;
}

.control-panel-compact {
  padding: 0.8rem;
}

.three-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: stretch;
}

.grid-col-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  padding: 0.15rem 0.05rem;
}

.pair-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.pair-card h3 {
  margin-top: 0;
}

.html-row .html-content {
  min-height: 280px;
}

.score-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.4rem;
  background: #f9fbfc;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.score-row strong {
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.score-card {
  display: flex;
  flex-direction: column;
}

.score-summary {
  margin-top: 0.3rem;
  margin-bottom: 0.35rem;
  color: #394b55;
  line-height: 1.28;
  min-height: calc(1.28em * 3);
  max-height: calc(1.28em * 3);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 0.9rem;
}

.score-legend {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #5b6b74;
}

.conversion-line {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  color: #1f313a;
}

.conv-green {
  color: #0d8f63;
}

.conv-yellow {
  color: #a36f1a;
}

.conv-red {
  color: #b63b2a;
}

.score-green {
  border-color: #b7e5cf;
  background: #ecfaf2;
}

.score-yellow {
  border-color: #ebd6a0;
  background: #fff8e8;
}

.score-red {
  border-color: #e59c92;
  background: #ffecea;
}

.score-card.score-green .score-row strong {
  color: #0a6f4f;
}

.score-card.score-yellow .score-row strong {
  color: #9b6618;
}

.score-card.score-red .score-row strong {
  color: #b12f1f;
}

.is-loading {
  position: relative;
}

.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 10%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 90%
  );
  animation: shimmer 1.3s linear infinite;
  border-radius: inherit;
  pointer-events: none;
}

.issues-list {
  margin: 0.5rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.4rem;
}

.issues-list li {
  color: #3e4f56;
  font-size: 0.86rem;
  line-height: 1.35;
}

.issues-details {
  margin-top: auto;
}

.issues-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #33505d;
  font-size: 0.82rem;
}

.content-block {
  border: 1px solid #e2eaee;
  background: #fcfefe;
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 0.93rem;
  line-height: 1.45;
}

.html-content {
  max-height: 420px;
  overflow: auto;
}

.input {
  width: 100%;
  border: 1px solid #cad8df;
  border-radius: 10px;
  padding: 0.6rem;
  margin: 0.2rem 0 0.7rem;
  font-family: 'Manrope', sans-serif;
  color: var(--ink);
  font-size: 0.9rem;
  background: #fff;
}

.code-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
}

.actions-inline {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.generation-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
  font-size: 0.84rem;
  color: #2d4a57;
  background: #f1f8fb;
  border: 1px solid #c8deea;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
}

.spinner {
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid #b3d0dd;
  border-top-color: #2f718c;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.inline-label {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 700;
}

.inline-select {
  width: auto;
  min-width: 130px;
  margin: 0;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.note-block .input {
  margin-bottom: 0.45rem;
}

.top-meta-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(200px, 1fr) minmax(220px, 1fr);
  gap: 0.55rem;
  align-items: stretch;
}

.loading-inline,
.top-meta-grid .notice {
  margin: 0;
}

.versions-disclosure {
  margin-top: 0.55rem;
  border-top: 1px solid #e4ebef;
  padding-top: 0.5rem;
}

.versions-disclosure summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  color: #2c4b58;
}

.versions-disclosure[open] summary {
  margin-bottom: 0.45rem;
}

.versions-list {
  display: grid;
  gap: 0.55rem;
}

.version-item {
  border: 1px solid #dce7ec;
  border-radius: 12px;
  background: #fbfefe;
  padding: 0.7rem;
}

.version-item-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}

.version-preview {
  margin: 0.35rem 0 0.55rem;
  color: #3c4b53;
  font-size: 0.9rem;
  line-height: 1.38;
}

.doc-info {
  border: 1px solid #d9e5eb;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-size: 0.86rem;
  margin-top: 0;
}

.doc-info-ok {
  background: #ecf8f3;
  border-color: #c4e8d7;
  color: #205f4b;
}

.doc-info-muted {
  background: #f4f8fa;
  color: #4f6875;
}

.seo-panel {
  margin-top: 1rem;
}

.full-width {
  width: 100%;
}

.notice {
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  margin-top: 0.55rem;
  margin-bottom: 0;
  border: 1px solid transparent;
  font-size: 0.88rem;
}

.notice-success {
  background: #ecf9f3;
  border-color: #bfe8d4;
}

.notice-error {
  background: #fff0ef;
  border-color: #e9b5ae;
}

.notice-info {
  background: #edf6fb;
  border-color: #b8d9ec;
}

.small-text {
  font-size: 0.78rem;
}

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

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 980px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-tools {
    min-width: 0;
    align-items: stretch;
  }

  .code-search {
    grid-template-columns: 1fr auto;
  }

  .code-search label {
    grid-column: 1 / -1;
  }

  .top-meta-grid {
    grid-template-columns: 1fr;
  }

  .generation-progress {
    margin-left: 0;
  }

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

  .grid-col-title {
    font-size: 1.8rem;
  }

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

  .products-table {
    display: block;
    overflow-x: auto;
  }
}
