/* 昆图 / QUINTACK 品牌色 */
:root {
  --brand-red: #ee1d23;
  --brand-navy: #030e2c;
  --white: #ffffff;
  --bg: #f4f5f8;
  --bg-subtle: linear-gradient(165deg, #eef0f4 0%, #f8f9fb 45%, #ffffff 100%);
  --card: #ffffff;
  --text: #030e2c;
  --muted: #4a5568;
  --accent: #ee1d23;
  --accent-hover: #d41920;
  --border: rgba(3, 14, 44, 0.1);
  --radius: 12px;
  --shadow: 0 8px 40px rgba(3, 14, 44, 0.08);
  --shadow-red: 0 12px 36px rgba(238, 29, 35, 0.15);
  font-family: "Noto Sans SC", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-subtle);
  color: var(--text);
  line-height: 1.55;
}

/* —— 全局顶栏 —— */
.site-header {
  background: var(--brand-navy);
  color: var(--white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 3px solid var(--brand-red);
  box-shadow: 0 4px 24px rgba(3, 14, 44, 0.35);
}

.site-header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.site-header .logo {
  height: 42px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-links a:hover {
  color: var(--brand-red);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

main.wide {
  max-width: 1100px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  border: 1px solid var(--border);
}

.card h2 {
  margin: 0 0 20px;
  font-size: 1.2rem;
  color: var(--brand-navy);
  padding-bottom: 10px;
  border-bottom: 3px solid var(--brand-red);
  display: inline-block;
  width: 100%;
}

.form-grid {
  display: grid;
  gap: 16px;
}

label {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(238, 29, 35, 0.45);
  box-shadow: 0 0 0 3px rgba(238, 29, 35, 0.12);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.dim-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  font-weight: 500;
}

.btn-primary {
  background: var(--brand-red);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: var(--white);
  color: var(--brand-navy);
  border: 2px solid var(--brand-navy);
}

.btn-outline:hover {
  background: var(--brand-navy);
  color: var(--white);
}

.btn-danger {
  background: var(--white);
  color: var(--brand-red);
  border: 1px solid rgba(238, 29, 35, 0.35);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.msg {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.msg.ok {
  background: rgba(3, 14, 44, 0.06);
  color: var(--brand-navy);
  border-left: 4px solid var(--brand-red);
}

.msg.err {
  background: #fff5f5;
  color: #b71c1c;
  border-left: 4px solid var(--brand-red);
}

/* —— 质保证书页（广告行业风格） —— */
.page-cert {
  --cert-font-display: "Noto Serif SC", "Songti SC", "SimSun", serif;
}

.page-cert .site-header {
  background: var(--brand-navy);
}

.cert-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 18px 56px;
}

.cert-shell {
  position: relative;
}

/* 装饰：背景大字号水印感 */
.cert-shell::before {
  content: "QUINTACK";
  position: absolute;
  right: -8px;
  top: 120px;
  font-size: clamp(4rem, 18vw, 8rem);
  font-weight: 700;
  color: rgba(3, 14, 44, 0.04);
  pointer-events: none;
  line-height: 1;
  letter-spacing: 0.08em;
  z-index: 0;
}

.cert-paper {
  position: relative;
  z-index: 1;
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px rgba(3, 14, 44, 0.06);
}

/* 顶部品牌带：深蓝 + 底部红条 */
.cert-masthead {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #030e2c 0%, #0a1f4a 55%, #030e2c 100%);
  color: var(--white);
  padding: 22px 28px 20px;
  position: relative;
}

.cert-masthead::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-red) 0%, #ff4d52 50%, var(--brand-red) 100%);
}

.cert-masthead__left {
  flex: 1;
  min-width: 200px;
}

.cert-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 8px;
}

.cert-title-main {
  font-family: var(--cert-font-display);
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: 0.04em;
}

.cert-title-sub {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 400;
}

.cert-masthead__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.cert-masthead__logo {
  height: 52px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.cert-code-pill {
  text-align: right;
}

.cert-code-pill__label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 4px;
}

.cert-code-pill__value {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--white);
  background: rgba(238, 29, 35, 0.25);
  border: 1px solid rgba(238, 29, 35, 0.55);
  padding: 8px 14px;
  border-radius: 8px;
}

/* 斜向装饰条（广告展板感） */
.cert-sash {
  position: absolute;
  top: 18px;
  right: -48px;
  width: 180px;
  height: 28px;
  background: var(--brand-red);
  transform: rotate(42deg);
  box-shadow: 0 4px 12px rgba(238, 29, 35, 0.4);
  pointer-events: none;
  opacity: 0.9;
}

.cert-body {
  padding: 28px 28px 32px;
}

.cert-lead {
  font-size: 0.95rem;
  line-height: 1.85;
  color: #2d3748;
  margin: 0 0 18px;
  text-indent: 2em;
}

.cert-body ol {
  margin: 0 0 24px;
  padding: 16px 20px 16px 36px;
  background: linear-gradient(180deg, rgba(3, 14, 44, 0.03) 0%, rgba(255, 255, 255, 0) 100%);
  border-left: 4px solid var(--brand-red);
  border-radius: 0 10px 10px 0;
}

.cert-body ol li {
  font-size: 0.92rem;
  color: #2d3748;
  margin-bottom: 8px;
  padding-left: 4px;
}

.cert-body ol li:last-child {
  margin-bottom: 0;
}

.cert-section-title {
  font-family: var(--cert-font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-navy);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cert-section-title::before {
  content: "";
  width: 4px;
  height: 1.1em;
  background: var(--brand-red);
  border-radius: 2px;
}

.cert-kv {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px 16px;
  font-size: 0.9rem;
  margin: 0 0 8px;
}

.cert-kv dt {
  color: var(--muted);
  font-weight: 600;
}

.cert-kv dd {
  margin: 0;
  color: var(--text);
  border-bottom: 1px dashed rgba(3, 14, 44, 0.12);
  padding-bottom: 8px;
}

.cert-kv dd:last-of-type {
  border-bottom: none;
}

.cert-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.cert-photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--white);
  box-shadow: 0 6px 20px rgba(3, 14, 44, 0.12);
  outline: 1px solid rgba(3, 14, 44, 0.08);
}

.cert-disclaimer {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 28px 0 0;
  padding: 14px 16px;
  background: rgba(3, 14, 44, 0.04);
  border-radius: 10px;
  border-left: 4px solid var(--brand-navy);
  line-height: 1.65;
}

.cert-verify {
  margin-top: 28px;
  padding: 22px 20px;
  text-align: center;
  background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
}

.cert-verify::before,
.cert-verify::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--brand-red);
  opacity: 0.6;
}

.cert-verify::before {
  top: 10px;
  left: 10px;
  border-right: none;
  border-bottom: none;
}

.cert-verify::after {
  bottom: 10px;
  right: 10px;
  border-left: none;
  border-top: none;
}

.cert-verify__label {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 10px;
}

.cert-verify #qrcode {
  display: inline-block;
  min-height: 176px;
  min-width: 176px;
}

.cert-verify #qrcode img,
.cert-verify #qrcode canvas {
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(3, 14, 44, 0.1);
}

.cert-verify #qrcode table {
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
}

.cert-qr-fallback {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  max-width: 100%;
  word-break: break-all;
  line-height: 1.5;
}

.cert-qr-fallback a {
  color: var(--brand-red);
  font-weight: 600;
}

.cert-meta {
  font-size: 0.88rem;
  color: var(--muted);
}

/* Admin table */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: rgba(3, 14, 44, 0.06);
  color: var(--brand-navy);
  font-weight: 600;
}

tr:hover td {
  background: rgba(238, 29, 35, 0.04);
}

.table-wrap a {
  color: var(--brand-red);
  font-weight: 600;
  text-decoration: none;
}

.table-wrap a:hover {
  text-decoration: underline;
}

.admin-login {
  max-width: 400px;
  margin: 40px auto;
}

.req {
  color: var(--brand-red);
  font-weight: 700;
}

.page-form-links {
  text-align: center;
  margin-top: 24px;
  font-size: 0.88rem;
  color: var(--muted);
}

.page-form-links a {
  color: var(--brand-navy);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.page-form-links a:hover {
  color: var(--brand-red);
  border-bottom-color: var(--brand-red);
}

.page-form-links__sep {
  margin: 0 10px;
  opacity: 0.5;
}

@media print {
  body {
    background: #fff;
  }

  .site-header,
  .nav-links,
  .no-print {
    display: none !important;
  }

  .cert-page {
    padding: 0;
    max-width: none;
  }

  .cert-paper {
    box-shadow: none;
    border-radius: 0;
  }

  .cert-shell::before {
    display: none;
  }

  .cert-sash {
    display: none;
  }
}

@media (max-width: 600px) {
  .cert-masthead {
    padding: 18px 18px 16px;
  }

  .cert-masthead__right {
    align-items: flex-start;
    width: 100%;
  }

  .cert-code-pill {
    text-align: left;
  }

  .cert-kv {
    grid-template-columns: 1fr;
  }

  .cert-kv dt {
    margin-top: 6px;
  }

  .cert-kv dt:first-child {
    margin-top: 0;
  }
}
