:root {
  --ink: #141817;
  --muted: #656565;
  --line: #111;
  --paper: #fffdf6;
  --panel: #fffefa;
  --green: #28703b;
  --green-2: #2d7a42;
  --coral: #f06f95;
  --peach: #ffe7ef;
  --system-blue: #0643b8;
  --system-blue-dark: #052b86;
  --yellow: #f3cf64;
  --blue: #0b55c7;
  --red: #b7473b;
  --shadow: 8px 8px 0 #111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  overflow-x: hidden;
  background: var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

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

button {
  cursor: pointer;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.74)),
    linear-gradient(90deg, rgba(5, 43, 134, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(5, 43, 134, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #8fc8ff 0%, #eef6ff 62%, #77bf54 62%, #4a9a37 100%);
  background-size: auto, 18px 18px, 18px 18px, auto;
}

.auth-screen.hidden,
.admin-only.hidden,
.modal-backdrop.hidden,
.metrics.hidden,
.sync-banner.hidden,
.hidden {
  display: none;
}

.auth-card {
  width: min(460px, 100%);
  border: 3px solid #111;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.windowbar.mini {
  height: 42px;
}

.auth-body {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.auth-body p {
  color: var(--muted);
}

.auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: 38px minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--paper);
  box-shadow: none;
}

.windowbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 10px 0 18px;
  border-bottom: 3px solid #111;
  background: linear-gradient(180deg, var(--system-blue) 0%, var(--system-blue-dark) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
}

.retro-star,
.mark span {
  clip-path: polygon(50% 0, 62% 35%, 100% 50%, 62% 65%, 50% 100%, 38% 65%, 0 50%, 38% 35%);
}

.retro-star {
  width: 28px;
  height: 28px;
  margin-left: -8px;
  background: #ffe13c;
  filter: drop-shadow(2px 2px 0 #111);
}

.window-controls {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.window-controls b {
  position: relative;
  width: 24px;
  height: 21px;
  border: 2px solid #111;
  background: linear-gradient(180deg, #fff, #d8d8d8);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.9);
}

.window-controls b:nth-child(1)::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 6px;
  height: 3px;
  background: #111;
}

.window-controls b:nth-child(2)::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid #111;
}

.window-controls b:nth-child(3)::before,
.window-controls b:nth-child(3)::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  width: 14px;
  height: 3px;
  background: #9f2424;
}

.window-controls b:nth-child(3)::before {
  transform: rotate(45deg);
}

.window-controls b:nth-child(3)::after {
  transform: rotate(-45deg);
}

.side {
  display: flex;
  flex-direction: column;
  gap: 26px;
  grid-row: 2;
  padding: 18px 12px;
  border-right: 3px solid #111;
  background: #f1f5fb;
  color: var(--ink);
}

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

.mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid #111;
  border-radius: 0;
  background: #fff;
  box-shadow: 3px 3px 0 #111;
}

.mark span {
  width: 18px;
  height: 18px;
  background: #ffe13c;
  filter: drop-shadow(1px 1px 0 #111);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
  font-weight: 900;
}

.brand p,
.side-foot span,
.hint {
  color: var(--muted);
  line-height: 1.7;
}

.brand p,
.side-foot span {
  color: var(--muted);
  font-size: 12px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 0;
  padding: 0 14px;
  color: #303030;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav.active,
.nav:hover {
  border-color: #111;
  color: #fff;
  background: var(--system-blue);
  box-shadow: 3px 3px 0 #111;
}

.nav.soon {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav.soon:hover {
  border-color: transparent;
  color: #303030;
  background: transparent;
  box-shadow: none;
}

.soon-tag {
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid #999;
  border-radius: 0;
  font-size: 10px;
  font-weight: 900;
  color: #777;
  background: #efefef;
}

.nav svg,
.btn svg {
  width: 18px;
  height: 18px;
}

.side-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 14px;
  border: 2px solid #111;
  border-radius: 0;
  background: #fff9d8;
  box-shadow: 4px 4px 0 #111;
}

.main {
  grid-row: 2;
  padding: 18px 22px;
  min-width: 0;
  overflow: auto;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px dashed #111;
}

.label {
  margin-bottom: 4px;
  color: var(--system-blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}

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

.period-card {
  border: 2px solid #111;
  background: #fff9d8;
  padding: 14px;
  box-shadow: 3px 3px 0 #111;
}

.period-card:nth-child(2) {
  background: #e8f5ff;
}

.period-card:nth-child(3) {
  background: #ffe7ef;
}

.period-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.period-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 34px;
  color: var(--system-blue);
}

.period-card small {
  color: var(--muted);
}

.format-bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 82px 1fr 42px;
  gap: 10px;
  align-items: center;
  font-weight: 900;
}

.bar-track {
  height: 18px;
  border: 2px solid #111;
  background: #fff;
}

.bar-fill {
  height: 100%;
  background: var(--system-blue);
}

.bar-row:nth-child(2) .bar-fill {
  background: var(--green);
}

.metrics article,
.panel {
  border: 2px solid #111;
  border-radius: 0;
  background: var(--panel);
  box-shadow: 3px 3px 0 #111;
}

.metrics article {
  position: relative;
  padding: 9px 10px;
  min-height: 66px;
  background: linear-gradient(180deg, #fff 0%, #f5f9ff 100%);
}

.metrics article svg {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 16px;
  height: 16px;
  color: var(--system-blue);
}

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

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  line-height: 1;
  color: var(--system-blue);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 10px;
}

.panel {
  padding: 12px 14px;
}

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

.upload-box,
.account-import-box,
.actions,
.bulk {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.account-import-box textarea {
  flex: 1 1 520px;
}

.account-import-panel {
  background: #fff9d8;
}

.bulk {
  align-items: center;
  margin-bottom: 10px;
}

.bulk input {
  flex: 0 1 200px;
  min-width: 150px;
}

.bulk-label {
  align-self: center;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 3px 8px;
  border: 2px solid #111;
  background: #f3f3f3;
  white-space: nowrap;
}

.bulk.filters {
  margin-bottom: 8px;
}

.quick-status {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.chip {
  border: 2px solid #111;
  background: #fff;
  box-shadow: 2px 2px 0 #111;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
}

.chip.active {
  color: #fff;
  background: var(--system-blue);
}

.bulk.actions {
  border-top: 2px solid #ececec;
  padding-top: 10px;
}

.sel-count {
  align-self: center;
  font-size: 12px;
  font-weight: 900;
  color: var(--system-blue);
  white-space: nowrap;
}

.sel-count:empty {
  display: none;
}

.btn.ghost.active {
  color: #fff;
  background: var(--green);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.35);
}

.bulk select {
  flex: 0 1 150px;
  min-width: 130px;
}

.compact-results {
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid #111;
  border-radius: 0;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 2px 2px 0 #e9e9e9;
}

.drop {
  flex: 1;
  min-width: 360px;
  border: 2px dashed #111;
  border-radius: 0;
  padding: 22px;
  place-items: center;
  text-align: center;
  background: #eef6ff;
}

.drop.dragging {
  background: #fff9d8;
  box-shadow: inset 0 0 0 4px #ffe13c;
}

.drop input {
  border: 0;
  padding: 0;
}

.drop svg {
  width: 34px;
  height: 34px;
  color: var(--system-blue);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border: 2px solid #111;
  border-radius: 0;
  padding: 0 12px;
  font-weight: 900;
}

.btn.primary {
  color: #fff;
  background: var(--system-blue);
  box-shadow: 3px 3px 0 #111;
}

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

.btn.ghost {
  border: 2px solid #111;
  color: var(--ink);
  background: #fff;
  box-shadow: 3px 3px 0 #111;
}

.btn.danger {
  color: #fff;
  background: var(--red);
  box-shadow: 3px 3px 0 #111;
}

.table-wrap {
  overflow: auto;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.pager label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.pager select {
  width: 80px;
}

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

td a {
  color: var(--system-blue);
  font-weight: 900;
  text-decoration: underline;
}

.copy-email {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--system-blue);
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  box-shadow: none;
}

.copy-email.copied {
  color: var(--green);
  text-decoration: none;
}

.people-table {
  min-width: 760px;
}

th,
td {
  padding: 7px 8px;
  border-bottom: 2px solid #e5e5e5;
  text-align: left;
  font-size: 13px;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

th {
  color: var(--muted);
  font-size: 12px;
  background: #eaf2ff;
}

.tag {
  display: inline-flex;
  margin: 2px 4px 2px 0;
  border: 2px solid #111;
  border-radius: 0;
  padding: 3px 7px;
  background: #e3f0ff;
  color: var(--system-blue);
  font-size: 12px;
  font-weight: 900;
}

.format-cpa {
  background: #fff0bd;
  color: #6b5100;
}

.format-sub2api {
  background: #dff0ff;
  color: var(--system-blue);
}

.format-rt {
  background: #ede9fe;
  color: #6d28d9;
}

button.tag.copy-rt {
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

button.tag.copy-rt.copied {
  background: #ddf5df;
  color: var(--green);
}

.tag.jiema-yes {
  background: #ddf5df;
  color: var(--green);
}

.tag.jiema-no {
  background: #efefef;
  color: #777;
}

.sync-ok {
  background: #ddf5df;
  color: var(--green);
}

.sync-wait {
  background: #fff0bd;
  color: #6b5100;
}

.row-check,
.relay-check {
  width: 22px;
  height: 22px;
  accent-color: var(--system-blue);
  box-shadow: none;
}

.select-all {
  border: 2px solid #111;
  background: #fff;
  box-shadow: 2px 2px 0 #111;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

tbody tr:has(.row-check:checked),
tbody tr:has(.relay-check:checked) {
  background: #fff9d8;
}

.tag.warn {
  background: #fff0bd;
  color: #6b5100;
}

.tag.danger {
  background: #ffe0dc;
  color: var(--red);
}

.tag.st-ok {
  background: #d8f3da;
  color: #1f7a32;
}

.tag.st-sold {
  background: #d7e6ff;
  color: #1452c8;
}

.tag.st-self {
  background: #ece0ff;
  color: #6a2bd6;
}

.tag.st-test {
  background: #ffe8c2;
  color: #8a5a00;
}

.tag.st-void {
  background: #e4e4e4;
  color: #595959;
}

.tag.st-after {
  background: #ccecef;
  color: #0a6b73;
}

.tag.st-bad {
  background: #ffe0dc;
  color: var(--red);
}

.tiny {
  border: 2px solid #111;
  border-radius: 0;
  padding: 5px 8px;
  background: #fff;
  box-shadow: 2px 2px 0 #111;
  font-size: 12px;
  font-weight: 900;
}

.result-list {
  display: grid;
  gap: 8px;
}

.result {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 2px solid #111;
  border-radius: 0;
  padding: 10px 12px;
  background: #fffefa;
  box-shadow: 3px 3px 0 #111;
}

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

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

.toast-ok {
  border: 2px solid #111;
  background: #ddf5df;
  color: var(--green);
  box-shadow: 3px 3px 0 #111;
  padding: 10px 12px;
  font-weight: 900;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 16, 28, 0.32);
  backdrop-filter: blur(2px);
}

.modal-window {
  width: min(460px, 100%);
  border: 3px solid #111;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.modal-close {
  margin-left: auto;
  width: 28px;
  height: 24px;
  border: 2px solid #111;
  background: linear-gradient(180deg, #fff, #d8d8d8);
  color: #9f2424;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.9);
  font-size: 20px;
  font-weight: 900;
  line-height: 18px;
}

.modal-body {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 14px 16px;
  align-items: start;
  padding: 22px;
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid #111;
  background: #fff0bd;
  color: var(--system-blue);
  box-shadow: 3px 3px 0 #111;
  font-size: 24px;
  font-weight: 900;
}

.modal-body p {
  line-height: 1.7;
  font-weight: 700;
  min-height: 42px;
  padding-top: 6px;
  color: var(--ink);
}

.modal-body input {
  grid-column: 1 / -1;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.compare-input {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.compare-input textarea {
  flex: 1 1 auto;
}

.compare-summary {
  margin-bottom: 10px;
  font-weight: 800;
  color: var(--ink);
}

.compare-summary.empty {
  color: var(--muted);
  font-weight: 700;
}

.compare-summary b {
  color: var(--system-blue);
}

.row-missing {
  opacity: 0.5;
}

.note-cell {
  border: 1px dashed transparent;
  background: transparent;
  padding: 3px 6px;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  max-width: 180px;
  white-space: normal;
  word-break: break-all;
  cursor: text;
}

.note-cell:hover {
  border-color: var(--system-blue);
  background: #fff;
}

.note-cell:empty::before {
  content: "＋ 备注";
  color: var(--muted);
}

.sync-banner {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 3px solid #111;
  background: var(--system-blue);
  color: #fff;
  font-weight: 900;
  box-shadow: 4px 4px 0 #111;
}

@media (max-width: 980px) {
  .layout,
  .metrics {
    grid-template-columns: 1fr;
  }

  .layout {
    width: calc(100vw - 24px);
    margin-top: 12px;
  }

  .main,
  .side {
    padding: 16px;
  }

  .drop {
    min-width: 100%;
  }
}

/* ===== 接码平台（后台总览卡片 + 生成区）===== */
.relay-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.relay-board article {
  border: 2px solid #111;
  background: linear-gradient(180deg, #fff 0%, #f5f9ff 100%);
  box-shadow: 3px 3px 0 #111;
  padding: 8px 10px;
}
.relay-board span {
  color: var(--muted);
  font-size: 12px;
}
.relay-board strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1;
  color: var(--system-blue);
}
.relay-board .mode-mock {
  color: var(--coral);
}
.relay-board .mode-live {
  color: var(--green);
}
.relay-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.relay-inline input {
  width: 140px;
}
.relay-inline input[type="number"] {
  width: 72px;
}
@media (max-width: 760px) {
  .relay-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 接码平台兑换码表：8 列，去掉全局 min-width:1420 的横向滚动，填满面板（和库存/看板一致，不左偏） */
#jiemaPlatformView table {
  min-width: 0;
  table-layout: auto;
}
#jiemaPlatformView th:first-child,
#jiemaPlatformView td:first-child {
  width: 44px;
  text-align: center;
}
#jiemaPlatformView td:first-child input {
  margin: 0;
}
/* 进行中会话的倒计时 */
.relay-left {
  color: var(--system-blue);
  font-weight: 900;
  white-space: nowrap;
}

/* 余额低于阈值变红 */
#rbBalance.low { color: var(--red); }
