:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #1f252b;
  --muted: #68727d;
  --line: #dfe4e8;
  --accent: #176b87;
  --accent-2: #8b5e34;
  --good: #20725d;
  --warn: #a14932;
  --shadow: 0 12px 34px rgba(31, 37, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.appHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brandMark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
  flex: none;
}

h1 {
  margin: 0 0 7px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

p {
  margin: 0;
}

#sourceMeta {
  color: var(--muted);
  font-size: 13px;
}

.userCard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  min-width: 220px;
  justify-content: flex-end;
}

.toolbar input,
.toolbar select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  outline: none;
}

.userCard span {
  color: var(--muted);
  font-size: 12px;
}

.userCard strong {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
}

.quickActions {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.quickActions button,
.activation button {
  height: 38px;
  white-space: nowrap;
  border: 0;
  border-radius: 6px;
  padding: 0 13px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

.quickActions button:nth-child(2) {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(120px, 0.7fr) minmax(140px, 0.8fr) minmax(120px, 0.6fr) 160px;
  gap: 12px;
  align-items: end;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.toolbar span {
  font-size: 12px;
  color: var(--muted);
}

.checkline {
  grid-template-columns: 18px 1fr;
  align-items: center;
  height: 38px;
  gap: 8px !important;
}

.checkline input {
  width: 16px;
  height: 16px;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.pill {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 14px;
  min-height: calc(100vh - 220px);
}

.list,
.detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 520px;
}

.list {
  overflow: auto;
  max-height: calc(100vh - 218px);
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.row:hover,
.row.active {
  background: #eef6f7;
}

.row-title {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.serial {
  color: var(--accent);
  font-weight: 700;
  flex: none;
}

.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.row-sub {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  align-self: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  color: #fff;
  background: var(--accent-2);
}

.tag.place {
  background: var(--good);
}

.detail {
  padding: 18px;
  overflow: auto;
  max-height: calc(100vh - 218px);
}

.empty {
  color: var(--muted);
  padding: 24px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail h2 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: 0;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

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

.field {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
  min-width: 0;
}

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

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.field-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.contact-hidden {
  color: var(--warn);
}

.copy-btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
}

.reveal-btn {
  border: 0;
  border-radius: 6px;
  padding: 7px 11px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 37, 43, 0.42);
  z-index: 10;
}

.modalBackdrop[hidden] {
  display: none;
}

.modal {
  width: min(680px, 100%);
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 24px 80px rgba(31, 37, 43, 0.24);
  padding: 18px;
}

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

.modalHead h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.modalHead p,
.modalNote {
  color: var(--muted);
  font-size: 13px;
}

.iconBtn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

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

.plan {
  display: grid;
  gap: 7px;
  min-height: 126px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 13px;
  cursor: pointer;
}

.plan.featured {
  border-color: var(--accent);
  background: #eef6f7;
}

.plan span {
  font-weight: 700;
}

.plan strong {
  font-size: 28px;
  color: var(--accent);
}

.plan small {
  color: var(--muted);
  line-height: 1.4;
}

.activation {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.activation input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

mark {
  background: #ffe8a3;
  color: inherit;
  padding: 0 2px;
}

@media (max-width: 980px) {
  .shell {
    width: min(100vw - 16px, 760px);
    padding-top: 12px;
  }

  .appHeader {
    display: grid;
    align-items: stretch;
    gap: 12px;
  }

  .userCard {
    min-width: 0;
    align-items: flex-start;
  }

  .quickActions {
    display: grid;
  }

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

  .toolbar label:first-child,
  .checkline {
    grid-column: 1 / -1;
  }

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

  .list,
  .detail {
    max-height: none;
    min-height: auto;
  }

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

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

@media (min-width: 981px) {
  .quickActions {
    display: flex;
    justify-content: flex-end;
  }
}
