:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --soft: #f6f8fb;
  --panel: #ffffff;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #0f9f6e;
  --amber: #d97706;
  --red: #dc2626;
  --purple: #7c3aed;
  --shadow: 0 12px 36px rgba(23, 32, 51, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.site-header,
.admin-shell-header,
.engineer-shell-header,
.site-footer,
.section,
.hero,
.workspace {
  padding-left: max(24px, calc((100vw - 1180px) / 2));
  padding-right: max(24px, calc((100vw - 1180px) / 2));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.admin-shell-header,
.engineer-shell-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-shell-header .brand-mark {
  background: #172033;
}

.engineer-shell-header .brand-mark {
  background: var(--green);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
}

.site-nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.site-nav a:hover {
  color: var(--blue);
}

.header-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
  align-items: center;
}

.btn,
button,
input,
select,
textarea {
  font: inherit;
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.btn-primary {
  color: #fff;
  background: var(--blue);
}

.btn-primary:hover {
  background: var(--blue-dark);
}

.btn-light {
  color: var(--blue);
  background: #eef4ff;
  border-color: #cfe0ff;
}

.btn-ghost {
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
}

.btn-danger {
  color: #fff;
  background: var(--red);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 40px;
  align-items: center;
  padding-top: 56px;
  padding-bottom: 46px;
  background:
    linear-gradient(90deg, rgba(246,248,251,0.98), rgba(246,248,251,0.82)),
    url("../images/hero-workbench.png") center/cover no-repeat;
}

.hero h1,
.page-title h1 {
  margin: 0 0 16px;
  font-size: 42px;
  line-height: 1.16;
}

.hero p,
.page-title p {
  color: var(--muted);
  max-width: 720px;
  margin: 0 0 22px;
}

.hero-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.about-intro {
  margin-bottom: 18px;
}

.about-intro p,
.about-pillar p,
.about-summary-grid p {
  color: var(--muted);
  line-height: 1.85;
}

.about-trust-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.about-pillar {
  min-width: 0;
}

.about-pillar h2 {
  color: var(--blue);
}

.about-one-liner {
  color: var(--ink) !important;
  font-weight: 700;
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}

.legal-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.legal-section h2 {
  margin-top: 0;
  color: var(--blue);
}

.legal-section h3 {
  margin: 18px 0 8px;
  font-size: 16px;
}

.legal-section p {
  color: var(--muted);
  line-height: 1.85;
}

.legal-list {
  margin: 10px 0 16px;
  padding-left: 24px;
  color: var(--muted);
  line-height: 1.85;
}

.legal-note {
  padding: 12px 14px;
  border-left: 4px solid var(--blue);
  background: #eef4ff;
  border-radius: 8px;
}

.legal-side-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 8px;
}

.legal-side-panel h2 {
  margin: 10px 0 4px;
  font-size: 16px;
}

.legal-side-panel a {
  display: block;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
}

.legal-side-panel a:hover {
  color: var(--blue);
  border-color: #cfe0ff;
  background: #eef4ff;
}

.legal-side-panel span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.legal-entry,
.modal-rule-links {
  color: var(--muted);
  font-size: 13px;
}

.legal-entry a,
.modal-rule-links a {
  color: var(--blue);
}

.search-row,
.filter-bar,
.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.search-row input,
.filter-bar input,
.filter-bar select,
.form-control,
textarea,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  min-width: 0;
}

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

.section,
.workspace {
  padding-top: 34px;
  padding-bottom: 34px;
}

.section-header,
.page-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.section-header h2,
.page-title h1,
.compact-title {
  margin-top: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

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

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

.card,
.table-wrap,
.form-card,
.stat,
.admin-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(23, 32, 51, 0.04);
  min-width: 0;
}

.card {
  overflow: hidden;
}

.card-body,
.form-card,
.admin-panel {
  padding: 18px;
}

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

.case-card p {
  margin: 8px 0;
}

.cert-group-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cert-group-head,
.cert-record {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.cert-group-head h2,
.cert-record p {
  margin: 0;
}

.cert-group-head .btn,
.cert-record .btn {
  flex: 0 0 auto;
}

.cert-record-list {
  display: grid;
  gap: 10px;
}

.cert-record {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.cert-record strong {
  display: block;
  margin-bottom: 8px;
}

.cert-empty {
  margin: 0;
}

.case-detail-grid {
  margin: 18px 0;
}

.case-detail-grid h2 {
  margin-top: 0;
  font-size: 16px;
}

.case-safety-note {
  margin: 22px 0;
  color: var(--muted);
}

.cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #e5edf7;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 4px 16px rgba(23, 32, 51, 0.16);
}

.engineer-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 14px;
  align-items: start;
}

.meta,
.muted,
.fineprint {
  color: var(--muted);
}

.fineprint {
  font-size: 13px;
}

.readonly-value {
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #f8fafc;
  color: var(--muted);
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.tag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 13px;
}

.status-ok {
  background: #e8f8f1;
  color: #08734e;
}

.status-warn {
  background: #fff7ed;
  color: #9a4c00;
}

.status-bad {
  background: #fee2e2;
  color: #a51616;
}

.price {
  color: var(--amber);
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
  min-width: 0;
}

.public-content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 24px;
  align-items: start;
}

.auth-content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 24px;
  align-items: start;
}

.public-main-panel {
  min-width: 0;
}

.auth-main-panel {
  min-width: 0;
}

.public-side-panel {
  position: sticky;
  top: 92px;
  align-self: start;
  min-width: 0;
}

.auth-side-panel {
  position: sticky;
  top: 92px;
  align-self: start;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
}

.side-nav a:hover,
.side-nav a.active {
  color: var(--blue);
  background: #eef4ff;
}

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: #f8fafc;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field label {
  color: #334155;
  font-weight: 700;
  font-size: 14px;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.stat {
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 28px;
}

.flash-stack {
  position: fixed;
  z-index: 50;
  top: 84px;
  right: 24px;
  display: grid;
  gap: 8px;
  max-width: min(420px, calc(100vw - 48px));
}

.flash,
.toast {
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  background: #fff;
  border: 1px solid var(--line);
}

.flash-success {
  border-color: #a7f3d0;
}

.flash-danger {
  border-color: #fecaca;
}

.flash-warning {
  border-color: #fde68a;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.48);
}

.modal {
  position: fixed;
  z-index: 70;
  top: 50%;
  left: 50%;
  width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 24px;
}

.modal-wide {
  width: min(680px, calc(100vw - 32px));
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.qr-image {
  width: 220px;
  height: 220px;
  object-fit: contain;
  margin: 18px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 32px;
  padding-top: 30px;
  padding-bottom: 34px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.sitemap-brand p {
  color: var(--muted);
  max-width: 360px;
}

.sitemap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.sitemap-grid h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.sitemap-grid a {
  display: block;
  color: var(--muted);
  margin: 6px 0;
  font-size: 14px;
}

.sitemap-grid a:hover {
  color: var(--blue);
}

.admin-login-body {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.10), rgba(15, 159, 110, 0.10)),
    #f6f8fb;
}

.admin-login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.admin-login-panel {
  width: min(430px, 100%);
  padding: 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.admin-login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-login-brand strong {
  display: block;
  font-size: 18px;
}

.admin-login-brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-login-panel h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.admin-login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.admin-login-check {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.admin-login-submit {
  width: 100%;
}

.admin-login-messages {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

@media (max-width: 920px) {
  .site-header {
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .admin-shell-header,
  .engineer-shell-header {
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .site-nav,
  .header-actions {
    width: 100%;
    overflow-x: auto;
    margin-left: 0;
  }

  .hero,
  .layout,
  .auth-content-layout,
  .public-content-layout,
  .legal-layout {
    grid-template-columns: 1fr;
  }

  .public-side-panel,
  .auth-side-panel,
  .legal-side-panel {
    position: static;
  }

  .grid,
  .grid-2,
  .grid-4,
  .stats-grid,
  .form-grid,
  .about-trust-grid {
    grid-template-columns: 1fr;
  }

  .cert-group-head,
  .cert-record {
    flex-direction: column;
  }

  .input-action {
    grid-template-columns: 1fr;
  }

  .hero h1,
  .page-title h1 {
    font-size: 32px;
  }

  .site-footer {
    grid-template-columns: 1fr;
  }

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