:root {
  --primary: #b71e23;
  --navy: #130f34;
  --text: #4d4d4d;
  --green: #0cac40;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
}

a {
  color: #000;
  text-decoration: none;
}

a:hover {
  color: #f00;
}

button,
input,
table {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: relative;
  z-index: 20;
  height: 86px;
  border-top: 4px solid var(--primary);
  background: #fff;
}

.header-inner {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 1180px;
  height: 82px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  width: 40%;
  height: 82px;
}

.brand img {
  display: block;
  width: 342px;
  max-width: 100%;
  height: auto;
}

.main-nav {
  width: 60%;
  padding-top: 20px;
  text-align: right;
}

.main-nav > ul {
  display: inline-flex;
  padding: 0;
  margin: 0;
  list-style: none;
}

.nav-item {
  position: relative;
}

.nav-item > a {
  display: block;
  padding: 0 20px;
  color: #000;
  font-size: 16px;
  line-height: 40px;
  text-align: center;
  white-space: nowrap;
}

.nav-item > a:hover,
.nav-item > a:focus-visible,
.nav-item > a.active {
  color: #fff;
  background: var(--primary);
  outline: none;
}

.submenu {
  position: absolute;
  top: 40px;
  left: 0;
  display: none;
  width: 150px;
  padding: 7px 0 0;
  margin: 0;
  list-style: none;
}

.submenu::before {
  position: absolute;
  top: 0;
  left: 21px;
  width: 0;
  height: 0;
  content: "";
  border-right: 6px solid transparent;
  border-bottom: 7px solid var(--primary);
  border-left: 6px solid transparent;
}

.nav-item:hover .submenu,
.nav-item:focus-within .submenu {
  display: block;
}

.submenu li {
  border-bottom: 1px solid #c9151e;
  background: var(--primary);
}

.submenu a {
  position: relative;
  display: block;
  width: 150px;
  padding: 0 20px 0 25px;
  color: #fff;
  font-size: 14px;
  line-height: 40px;
  text-align: left;
}

.submenu a::before {
  position: absolute;
  top: 17px;
  left: 12px;
  width: 5px;
  height: 5px;
  content: "";
  border-top: 1px solid #fff;
  border-right: 1px solid #fff;
  transform: rotate(45deg);
}

.submenu a:hover,
.submenu a:focus-visible {
  color: #fff;
  background: #9f171c;
}

.menu-toggle {
  display: none;
}

.page-main {
  width: 1180px;
  min-height: calc(100vh - 376px);
  padding: 2% 0;
  margin: 0 auto;
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border-bottom: 2px solid var(--primary);
}

.section-name {
  padding: 10px 0;
  color: var(--primary);
  font-size: 18px;
  line-height: 20px;
}

.section-name:hover {
  color: var(--primary);
}

.breadcrumb {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #666;
  line-height: 40px;
}

.breadcrumb a {
  color: #666;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.query-section {
  min-height: 200px;
  margin-top: 2%;
  overflow: hidden;
}

.query-intro {
  padding: 20px;
  color: #fff;
  background: var(--navy);
  line-height: 22px;
}

.query-intro h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 2;
  text-align: center;
}

.query-intro p {
  margin: 0;
  line-height: 2;
}

.query-intro hr {
  margin: 22px 0 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

.certificate-form {
  width: 400px;
  margin: 60px auto;
}

.certificate-label {
  display: block;
  height: 36px;
  padding-left: 50px;
  color: #fff;
  line-height: 36px;
  background: url("/certificate-icon.jpg") no-repeat left top;
  border-bottom: 1px solid #ccc;
}

.field-row {
  padding-right: 10px;
  line-height: 60px;
}

.field-row input {
  width: 100%;
  height: 30px;
  padding: 0 5px;
  color: #333;
  background: #fff;
  border: 1px solid #a9a9a9;
  outline: none;
}

.field-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(183, 30, 35, 0.12);
}

.certificate-form button {
  min-width: 78px;
  height: 40px;
  padding: 0 20px;
  color: #fff;
  cursor: pointer;
  background: var(--green);
  border: 0;
  border-radius: 10px;
}

.certificate-form button:hover,
.certificate-form button:focus-visible {
  background: #078f33;
  outline: 2px solid rgba(12, 172, 64, 0.25);
  outline-offset: 2px;
}

.certificate-form button:disabled,
.primary-admin-button:disabled,
.admin-inline-field button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-message {
  min-height: 21px;
  margin: 8px 0 0;
  color: var(--primary);
  font-size: 13px;
}

.certificate-result {
  margin: -20px 0 60px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dedde7;
  box-shadow: 0 16px 40px rgba(19, 15, 52, 0.1);
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid #e7e6ed;
}

.result-heading h2 {
  margin: 8px 0 5px;
  color: #25213f;
  font-size: 20px;
}

.result-heading p {
  margin: 0;
  color: #777386;
}

.result-heading > a {
  padding: 10px 18px;
  color: #fff;
  background: var(--primary);
  border-radius: 4px;
}

.result-heading > a:hover {
  background: #96171c;
}

.result-badge {
  display: inline-flex;
  padding: 4px 9px;
  color: #087731;
  font-size: 12px;
  background: #e9f8ef;
  border-radius: 99px;
}

.document-preview {
  min-height: 520px;
  padding: 18px;
  text-align: center;
  background: #f3f3f6;
}

.document-preview iframe {
  width: 100%;
  height: 680px;
  background: #fff;
  border: 0;
}

.document-preview img {
  max-width: 100%;
  height: auto;
  max-height: 900px;
  object-fit: contain;
}

.admin-page {
  min-height: 100vh;
  padding-bottom: 70px;
  background: #f5f4f8;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  padding: 0 max(24px, calc((100% - 1180px) / 2));
  background: #fff;
  border-top: 4px solid var(--primary);
  box-shadow: 0 2px 12px rgba(19, 15, 52, 0.06);
}

.admin-brand img {
  display: block;
  width: min(342px, 60vw);
}

.admin-header > a:last-child {
  color: var(--primary);
}

.admin-hero {
  padding: 54px max(24px, calc((100% - 1180px) / 2)) 82px;
  color: #fff;
  background: var(--navy);
}

.eyebrow {
  margin: 0 0 10px;
  color: #6acc8b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.admin-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 44px);
}

.admin-hero p:last-child {
  max-width: 680px;
  margin: 0;
  color: #cfccd9;
  line-height: 1.8;
}

.admin-grid,
.records-card {
  width: min(1180px, calc(100% - 32px));
  margin-right: auto;
  margin-left: auto;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 22px;
  margin-top: -42px;
}

.admin-card {
  padding: 28px;
  background: #fff;
  border: 1px solid #e6e4eb;
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(19, 15, 52, 0.08);
}

.admin-card h2 {
  margin: 0 0 22px;
  color: #28243f;
  font-size: 21px;
}

.admin-card label,
.admin-form-grid label {
  display: grid;
  gap: 8px;
  color: #555064;
  font-weight: 600;
}

.admin-card input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: #2b273d;
  background: #fff;
  border: 1px solid #cbc8d3;
  border-radius: 4px;
  outline: none;
}

.admin-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(183, 30, 35, 0.1);
}

.admin-inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.admin-inline-field button,
.primary-admin-button {
  padding: 0 18px;
  color: #fff;
  cursor: pointer;
  background: var(--primary);
  border: 0;
  border-radius: 4px;
}

.admin-message {
  min-height: 40px;
  margin: 16px 0 0;
  color: #716c7d;
  font-size: 13px;
  line-height: 1.6;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.file-field {
  grid-column: 1 / -1;
}

.admin-card input[type="file"] {
  height: auto;
  min-height: 44px;
  padding: 9px;
}

.primary-admin-button {
  height: 42px;
  margin-top: 20px;
}

.upload-hint {
  margin: 10px 0 0;
  color: #8b8795;
  font-size: 12px;
}

.records-card {
  margin-top: 22px;
}

.records-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.records-heading h2 {
  margin-bottom: 0;
}

.records-heading > span {
  padding: 5px 11px;
  color: var(--primary);
  background: #fae9ea;
  border-radius: 99px;
}

.empty-records {
  padding: 54px 20px;
  color: #8b8795;
  text-align: center;
  border: 1px dashed #cbc8d3;
  border-radius: 5px;
}

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

.records-table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
}

.records-table th,
.records-table td {
  padding: 13px 12px;
  text-align: left;
  border-bottom: 1px solid #eceaf0;
}

.records-table th {
  color: #777285;
  font-size: 12px;
  letter-spacing: 0.04em;
  background: #f8f7fa;
}

.records-table td:first-child {
  color: #25213f;
  font-weight: 700;
}

.records-table td:last-child {
  white-space: nowrap;
}

.records-table td a,
.danger-link {
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: 0;
}

.danger-link {
  margin-left: 14px;
  color: #777285;
}

.site-footer {
  height: 290px;
  padding-top: 30px;
  overflow: hidden;
  background: var(--navy);
}

.footer-inner {
  width: 1180px;
  margin: 0 auto;
}

.footer-top {
  display: flex;
  min-height: 178px;
  padding-bottom: 1%;
  border-bottom: 1px solid #4e4e4e;
}

.footer-nav {
  display: flex;
  width: 70%;
  overflow: hidden;
}

.footer-column {
  display: flex;
  flex-direction: column;
  width: 16.6%;
  min-width: 112px;
}

.footer-title {
  height: 40px;
  padding: 0 1%;
  color: #ccc;
  font-size: 16px;
  line-height: 40px;
}

.footer-link {
  height: 30px;
  padding: 0 1%;
  color: #999;
  line-height: 30px;
}

.footer-title:hover,
.footer-link:hover {
  color: #fff;
}

.footer-map {
  width: 30%;
  min-height: 170px;
  background: url("/footer-mark.png") no-repeat center;
}

.copyright {
  padding: 15px;
  color: #999;
  text-align: right;
}

.copyright p {
  margin: 0;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .site-header {
    height: auto;
    min-height: 76px;
  }

  .header-inner,
  .page-main,
  .footer-inner {
    width: calc(100% - 32px);
  }

  .header-inner {
    align-items: center;
    height: auto;
    min-height: 72px;
  }

  .brand {
    width: calc(100% - 58px);
    height: 72px;
  }

  .brand img {
    width: min(342px, 100%);
  }

  .menu-toggle {
    display: grid;
    width: 42px;
    height: 38px;
    padding: 8px;
    cursor: pointer;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
  }

  .menu-toggle span:not(.sr-only) {
    display: block;
    height: 2px;
    background: var(--primary);
  }

  .main-nav {
    position: absolute;
    top: 72px;
    right: 0;
    display: none;
    width: 260px;
    padding: 0;
    background: #fff;
    border-top: 2px solid var(--primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }

  .main-nav.is-open {
    display: block;
  }

  .main-nav > ul {
    display: block;
  }

  .nav-item > a {
    padding: 0 18px;
    text-align: left;
    border-bottom: 1px solid #eee;
  }

  .submenu {
    position: static;
    display: none;
    width: 100%;
    padding-top: 0;
  }

  .submenu::before {
    display: none;
  }

  .nav-item:focus-within .submenu,
  .nav-item:hover .submenu {
    display: block;
  }

  .submenu a {
    width: 100%;
    padding-left: 36px;
  }

  .submenu a::before {
    left: 22px;
  }

  .page-main {
    min-height: auto;
    padding: 28px 0;
  }

  .footer-nav {
    width: 72%;
  }

  .footer-map {
    width: 28%;
  }

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

@media (max-width: 640px) {
  .section-heading {
    align-items: flex-start;
  }

  .breadcrumb {
    gap: 5px;
    font-size: 12px;
  }

  .query-section {
    margin-top: 18px;
  }

  .query-intro {
    padding: 20px 18px;
  }

  .query-intro h1 {
    font-size: 22px;
  }

  .certificate-form {
    width: 100%;
    margin: 42px auto 54px;
  }

  .certificate-result {
    margin-top: -12px;
  }

  .result-heading {
    align-items: flex-start;
    gap: 18px;
  }

  .document-preview {
    min-height: 300px;
    padding: 8px;
  }

  .document-preview iframe {
    height: 520px;
  }

  .admin-header {
    padding: 0 16px;
  }

  .admin-hero {
    padding: 42px 16px 72px;
  }

  .admin-card {
    padding: 22px 18px;
  }

  .admin-form-grid,
  .admin-inline-field {
    grid-template-columns: 1fr;
  }

  .admin-inline-field button {
    height: 42px;
  }

  .site-footer {
    height: auto;
    min-height: 290px;
    padding: 28px 0 18px;
  }

  .footer-top {
    min-height: 0;
  }

  .footer-nav {
    flex-wrap: wrap;
    gap: 20px 0;
    width: 100%;
    padding-bottom: 24px;
  }

  .footer-column {
    width: 33.333%;
    min-width: 0;
  }

  .footer-map {
    display: none;
  }

  .copyright {
    padding: 14px 0 0;
    font-size: 12px;
    text-align: center;
  }
}
