:root {
  --primary-600: #0f766e;
  --primary-700: #115e59;
  --accent: #7c3aed;
  --warn: #f97316;
  --danger: #dc2626;
  --success: #15803d;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-500: #6c757d;
  --gray-700: #495057;
  --gray-900: #212529;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--white);
  color: var(--gray-900);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
}

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-size: 1.15rem;
  line-height: 1.35;
}

.page-shell {
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 15px;
}

.navbar {
  align-items: center;
  background: #e3f2fd;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 8px;
  min-height: 66px;
  padding: 8px 16px;
}

.navbar-brand {
  align-items: center;
  color: var(--gray-900);
  display: inline-flex;
  font-size: 1.1rem;
  font-weight: 600;
  gap: 10px;
}

.navbar-brand:hover {
  text-decoration: none;
}

.brand-icon {
  align-items: center;
  background: var(--primary-600);
  border-radius: 8px;
  color: var(--white);
  display: inline-flex;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.nav-links a {
  color: var(--gray-700);
  font-size: 0.95rem;
}

.intro-card,
.card {
  background: var(--gray-50);
  border: 1px solid #d8ecfb;
}

.intro-card {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
}

.intro-card p,
.sub-title {
  color: var(--gray-500);
  margin-bottom: 0;
}

.card,
.seo-copy {
  margin-top: 0.85rem;
}

.card-body {
  padding: 1rem;
}

.section-head {
  align-items: baseline;
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card h2,
.seo-copy h2 {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 0.45rem;
  margin-bottom: 0;
}

.badge {
  background: var(--accent);
  border-radius: 0.25rem;
  color: var(--white);
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.25em 0.45em;
}

.settings-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: minmax(320px, 2fr) minmax(160px, 1fr) minmax(180px, 1fr);
}

label {
  display: grid;
  min-width: 0;
}

label > span,
.result-box > span {
  color: var(--gray-700);
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input,
select,
textarea,
output {
  background: var(--white);
  border: 1px solid var(--gray-300);
  color: var(--gray-900);
  display: block;
  font: inherit;
  min-height: 38px;
  min-width: 0;
  padding: 0.4rem 0.65rem;
  width: 100%;
}

textarea {
  min-height: 318px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #5eead4;
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.16);
  outline: 0;
}

.single-row {
  align-items: end;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: minmax(220px, 1.15fr) auto minmax(170px, 0.8fr) minmax(230px, 1.1fr);
}

.single-actions,
.button-row,
.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.single-result output,
.single-detected output {
  color: var(--primary-700);
  font-weight: 700;
  min-height: 38px;
}

.single-detected output {
  color: var(--gray-700);
  font-weight: 500;
}

button {
  background: var(--primary-600);
  border: 1px solid var(--primary-600);
  border-radius: 0.25rem;
  color: var(--white);
  cursor: pointer;
  font: inherit;
  min-height: 38px;
  padding: 0.375rem 0.95rem;
  white-space: nowrap;
}

button:hover {
  background: var(--primary-700);
  border-color: var(--primary-700);
}

.button-light {
  background: #ecfdf5;
  border-color: #b7e4d8;
  color: var(--primary-700);
}

.button-light:hover {
  background: #ccfbf1;
  border-color: #99f6e4;
  color: var(--primary-700);
}

.button-secondary {
  background: var(--warn);
  border-color: var(--warn);
}

.button-secondary:hover {
  background: #ea580c;
  border-color: #ea580c;
}

.batch-workspace {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(340px, 0.75fr) minmax(0, 1.25fr);
}

.batch-input-pane,
.batch-result-pane {
  min-width: 0;
}

.batch-options {
  align-items: end;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: minmax(150px, 1fr) auto auto;
  margin-top: 0.75rem;
}

.check-field {
  align-content: end;
  display: flex;
  gap: 0.4rem;
  min-height: 38px;
}

.check-field input {
  min-height: auto;
  width: auto;
}

.check-field span {
  margin-bottom: 0;
}

.button-row {
  padding-top: 0.75rem;
}

.result-toolbar {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}

.summary-strip {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-300);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  min-height: 38px;
}

.summary-strip span {
  color: var(--gray-500);
  font-size: 0.92rem;
  padding: 0.35rem 0.7rem;
  white-space: nowrap;
}

.summary-strip span + span {
  border-left: 1px solid var(--gray-300);
}

.summary-strip strong {
  color: var(--primary-700);
  font-size: 1.05rem;
  margin-left: 0.25rem;
}

.export-row {
  justify-content: flex-end;
}

.export-row button {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.table-wrap {
  max-height: 376px;
  overflow: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  background: var(--white);
  border: 1px solid var(--gray-300);
  padding: 0.48rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--gray-200);
  color: var(--gray-700);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr.is-error td {
  background: #fff7ed;
}

tr.is-ambiguous td {
  background: #fefce8;
}

.status-success {
  color: var(--success);
  font-weight: 700;
}

.status-error {
  color: var(--danger);
  font-weight: 700;
}

.status-ambiguous {
  color: #a16207;
  font-weight: 700;
}

.seo-copy {
  color: var(--gray-700);
  font-size: 0.95rem;
}

.seo-copy p {
  margin-bottom: 0;
}

.format-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.format-grid span {
  background: var(--white);
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  padding: 0.5rem 0.65rem;
}

.toast {
  background: var(--gray-900);
  border-radius: 0.25rem;
  bottom: 18px;
  color: var(--white);
  left: 50%;
  opacity: 0;
  padding: 0.65rem 0.9rem;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%);
  transition: opacity 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
}

@media (max-width: 1100px) {
  .single-row,
  .batch-workspace,
  .settings-grid,
  .format-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .result-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  textarea {
    min-height: 220px;
  }

  .table-wrap {
    max-height: none;
  }
}

@media (max-width: 700px) {
  .navbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .button-row,
  .single-actions,
  .export-row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

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

  .summary-strip span + span {
    border-left: 0;
  }
}
