:root {
  color-scheme: light;
  --blue: #1847b8;
  --blue-dark: #0a2e8a;
  --blue-soft: #eaf3ff;
  --blue-line: #cfe0f7;
  --green: #1f9d63;
  --green-soft: #eaf8f0;
  --gold: #f5a623;
  --danger: #d83b46;
  --danger-soft: #fff0f1;
  --ink: #172033;
  --muted: #64748b;
  --line: #dbe5f0;
  --paper: #f5f8fc;
  --white: #ffffff;
  --shadow: 0 10px 28px rgba(15, 40, 80, .08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

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

a {
  color: var(--blue);
}

.wrap {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.mobile-wrap {
  width: min(560px, 100%);
}

.topbar,
.report-topbar {
  background:
    linear-gradient(135deg, rgba(10, 46, 138, .96), rgba(24, 71, 184, .92)),
    radial-gradient(circle at 82% 18%, rgba(47, 128, 237, .34), transparent 28%);
  color: white;
  padding: 24px 18px 30px;
}

.topbar h1,
.report-topbar h1 {
  margin: 4px 0 8px;
  font-size: 23px;
  line-height: 1.22;
  letter-spacing: 0;
}

.topbar p,
.report-topbar p {
  margin: 0;
  opacity: .9;
  font-size: 14px;
}

.report-brand,
.admin-brand {
  font-size: 13px;
  font-weight: 800;
  color: rgba(255, 255, 255, .88);
}

.admin-page {
  background:
    linear-gradient(180deg, #eef5ff 0%, #f7fafc 45%, #f5f8fc 100%);
}

.admin-hero {
  padding: 26px 0 18px;
  color: white;
  background:
    linear-gradient(135deg, #0a2e8a, #1847b8 58%, #157f72),
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .25), transparent 30%);
}

.admin-hero-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.admin-hero h1 {
  margin: 8px 0;
  font-size: 26px;
  line-height: 1.18;
}

.admin-hero p {
  margin: 0;
  color: rgba(255, 255, 255, .84);
}

.admin-home-link {
  flex: 0 0 auto;
}

.admin-main {
  margin-top: -10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.stat-card {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15);
}

.stat-card span {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, .78);
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  line-height: 1;
}

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

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.nested-panel {
  margin-top: 16px;
  background: #fbfdff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.form-grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.full-label {
  margin-top: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(24, 71, 184, .12);
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(24, 71, 184, .16);
}

.btn.secondary {
  background: #e8f0fb;
  color: var(--blue-dark);
}

.btn.green {
  background: var(--green);
}

.btn.danger {
  background: var(--danger);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.table-actions {
  align-items: flex-start;
}

.account-result {
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid rgba(31, 157, 99, .25);
  border-radius: 8px;
  background: var(--green-soft);
  color: #0d5f40;
  font-size: 14px;
  line-height: 1.7;
}

.account-result a,
.table-link {
  color: var(--blue-dark);
  word-break: break-all;
}

.muted {
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #e8f7ef;
  color: #08734a;
}

.status.revoked {
  background: var(--danger-soft);
  color: #b72a35;
}

.status.updated {
  background: #fff4d7;
  color: #8a5b00;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.section-title h2,
.nested-panel h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  color: var(--blue-dark);
}

.section-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.table-title {
  margin-top: 22px;
}

.search-box {
  width: min(280px, 100%);
}

.switch-line input {
  width: auto;
  margin-right: 6px;
}

.list {
  display: grid;
  gap: 12px;
}

.card {
  padding: 15px;
}

.report-card {
  border-color: #d7e6f8;
}

.report-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.report-card-head strong {
  display: block;
  margin-top: 3px;
  color: var(--blue-dark);
  font-size: 16px;
  word-break: break-all;
}

.report-actions .btn {
  flex: 1 1 46%;
}

.kv {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  margin: 8px 0;
  font-size: 14px;
}

.kv span:first-child {
  color: var(--muted);
}

.detail-title {
  margin: 14px 0 10px;
  color: var(--blue-dark);
  font-size: 18px;
}

.report-img {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef3f8;
  display: block;
}

.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(9, 18, 34, .86);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}

.image-viewer.open {
  display: flex;
}

.image-viewer img {
  max-width: 100%;
  max-height: 94vh;
  border-radius: 8px;
  background: white;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 800;
  background: #f8fbff;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.tab.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.hidden {
  display: none !important;
}

.empty-state {
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--blue-line);
  border-radius: 8px;
  background: #fbfdff;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100vw - 28px);
  background: rgba(20, 30, 48, .94);
  color: white;
  border-radius: 8px;
  padding: 11px 14px;
  z-index: 30;
  display: none;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .18);
}

.toast.show {
  display: block;
}

.page-footer {
  padding: 10px 0 26px;
  text-align: center;
}

.site-icp {
  display: block;
  margin-top: 7px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
  text-decoration: none;
}

.site-icp:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.mobile-page-bg {
  min-height: 100vh;
  width: 100%;
  background-image:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.88) 0%,
      rgba(255, 255, 255, 0.78) 38%,
      rgba(255, 255, 255, 0.66) 68%,
      rgba(255, 255, 255, 0.82) 100%
    ),
    url("/static/images/mobile-cotton-bg.webp");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  overflow-x: hidden;
}

.mobile-glass-card {
  width: calc(100% - 32px);
  margin: 24px auto;
  padding: 24px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(20, 88, 170, 0.16);
  box-shadow: 0 14px 36px rgba(19, 72, 130, 0.16);
  backdrop-filter: blur(10px);
}

.mobile-home {
  min-height: 100vh;
  padding: 28px 0 40px;
  display: flex;
  align-items: flex-start;
}

.brand-name {
  font-size: 22px;
  font-weight: 800;
  color: #0a4fa3;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.mobile-glass-card h1 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.22;
  font-weight: 900;
  color: #073b88;
}

.mobile-glass-card p {
  margin: 0 0 22px;
  font-size: 15px;
  line-height: 1.75;
  color: #2c4d72;
}

.mobile-glass-card button {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #0754b8, #0b7bdc);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
}

.home-page {
  min-height: 100vh;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, .88) 0%,
      rgba(234, 243, 255, .78) 42%,
      rgba(247, 250, 252, .96) 78%
    ),
    url("/static/images/mobile-cotton-bg.webp?v=20260705");
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}

.home-shell {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.home-hero {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
}

.home-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
}

.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--blue-dark);
  font-weight: 900;
}

.home-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, var(--blue-dark), var(--blue));
  box-shadow: 0 10px 22px rgba(10, 46, 138, .2);
}

.home-login-link {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid rgba(24, 71, 184, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: var(--blue-dark);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  backdrop-filter: blur(10px);
}

.home-hero-content {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(300px, .86fr);
  align-items: center;
  gap: 24px;
  padding: 36px 0 28px;
}

.home-copy {
  padding: 8px 0;
}

.home-eyebrow {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid rgba(24, 71, 184, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.home-copy h1 {
  margin: 16px 0 12px;
  color: var(--blue-dark);
  font-size: 44px;
  line-height: 1.08;
  letter-spacing: 0;
}

.home-copy p {
  width: min(620px, 100%);
  margin: 0;
  color: #36536f;
  font-size: 16px;
  line-height: 1.85;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.home-visual {
  min-height: 380px;
  display: grid;
  place-items: center;
}

.scan-card {
  width: min(360px, 100%);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, .76);
  box-shadow: 0 22px 48px rgba(10, 46, 138, .16);
  backdrop-filter: blur(14px);
}

.scan-top,
.signal-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.scan-top span,
.signal-row span {
  color: var(--muted);
  font-size: 13px;
}

.scan-top b,
.signal-row strong {
  color: var(--blue-dark);
  font-size: 13px;
}

.field-map {
  position: relative;
  height: 220px;
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid #d6e5f8;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(24, 71, 184, .08) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(180deg, rgba(24, 71, 184, .08) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(155deg, rgba(234, 243, 255, .95), rgba(255, 255, 255, .82));
}

.field-map i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(31, 157, 99, .12);
  animation: pulsePoint 2.4s infinite ease-in-out;
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(47, 128, 237, .88), transparent);
  box-shadow: 0 0 18px rgba(47, 128, 237, .45);
  animation: scanMove 3s infinite ease-in-out;
}

.signal-row {
  min-height: 38px;
  border-top: 1px solid #e4edf8;
}

.home-panel,
.home-note {
  margin-top: 16px;
  border: 1px solid rgba(219, 229, 240, .9);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(10px);
}

.flow-grid,
.entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.flow-card,
.entry-card {
  border: 1px solid #dbe8f7;
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
  text-decoration: none;
  color: var(--ink);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.flow-card.active,
.entry-card:hover {
  transform: translateY(-2px);
  border-color: rgba(24, 71, 184, .38);
  box-shadow: 0 12px 26px rgba(24, 71, 184, .1);
}

.flow-card span,
.entry-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.flow-card strong,
.entry-card strong {
  display: block;
  color: var(--blue-dark);
  font-size: 16px;
}

.flow-card p,
.entry-card p,
.home-note p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.verify-inline {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.verify-inline input {
  min-width: 0;
}

.verify-inline .btn {
  flex: 0 0 auto;
}

.home-note strong {
  display: block;
  color: var(--blue-dark);
  font-size: 15px;
}

@keyframes scanMove {
  0% { top: 12%; opacity: .35; }
  50% { top: 84%; opacity: 1; }
  100% { top: 12%; opacity: .35; }
}

@keyframes pulsePoint {
  0%, 100% { transform: scale(1); opacity: .75; }
  50% { transform: scale(1.18); opacity: 1; }
}

@media (max-width: 760px) {
  .wrap {
    padding: 12px;
  }

  .admin-hero-row {
    display: block;
  }

  .admin-home-link {
    margin-top: 14px;
  }

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

  .section-title {
    display: block;
  }

  .search-box {
    margin-top: 12px;
    width: 100%;
  }

  .panel,
  .card {
    padding: 13px;
  }

  .kv {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .btn {
    flex: 1 1 auto;
  }

  .report-actions .btn {
    flex-basis: 100%;
  }

  .home-page {
    background-attachment: scroll;
  }

  .home-shell {
    padding: 14px;
  }

  .home-hero {
    min-height: auto;
  }

  .home-hero-content {
    display: block;
    padding: 24px 0 14px;
  }

  .home-copy h1 {
    font-size: 34px;
  }

  .home-copy p {
    font-size: 15px;
  }

  .home-visual {
    min-height: 320px;
    margin-top: 18px;
  }

  .field-map {
    height: 180px;
  }

  .flow-grid,
  .entry-grid {
    grid-template-columns: 1fr;
  }

  .verify-inline {
    display: grid;
  }

  .verify-inline .btn {
    width: 100%;
  }
}
