:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --panel-soft: #f1f7f4;
  --ink: #202421;
  --muted: #69736d;
  --line: #dce3dd;
  --accent: #13795b;
  --accent-strong: #0e5c45;
  --warn: #a65f00;
  --danger: #b23535;
  --shadow: 0 18px 55px rgba(30, 36, 32, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(19, 121, 91, 0.11), transparent 34%),
    linear-gradient(315deg, rgba(166, 95, 0, 0.08), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft YaHei UI",
    "Segoe UI",
    system-ui,
    sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.topbar-right,
.auth-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 22px;
  letter-spacing: 0;
}

.tabs {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.tab,
.ghost,
.primary,
.danger,
.icon,
.button-link {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  text-decoration: none;
}

.tab {
  min-width: 106px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 22px;
  padding: 14px 16px;
  border: 1px solid rgba(19, 121, 91, 0.24);
  border-radius: 8px;
  background: rgba(241, 247, 244, 0.88);
  color: #294039;
}

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

.auth-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 12px 0 16px;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary:hover,
.tab.active:hover {
  background: var(--accent-strong);
}

.danger {
  border-color: rgba(178, 53, 53, 0.25);
  background: #fff;
  color: var(--danger);
}

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

.account-card,
.import-panel,
.table-wrap,
.dialog-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.account-card {
  min-height: 206px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title h3 {
  margin: 0;
  font-size: 20px;
  word-break: break-all;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.badge.pending {
  background: #fff5df;
  color: var(--warn);
}

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

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

.actions button {
  flex: 1 1 112px;
}

.empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
}

.import-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  margin-bottom: 18px;
}

.import-panel label {
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 121, 91, 0.14);
}

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

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

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

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

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

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

td {
  color: var(--ink);
}

tr:last-child td {
  border-bottom: 0;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  font-size: 32px;
}

.login-copy,
.login-status {
  color: var(--muted);
}

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

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.dev-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(19, 121, 91, 0.22);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel-soft);
  color: var(--muted);
}

.dev-code[hidden] {
  display: none;
}

.dev-code strong {
  color: var(--accent-strong);
  font-size: 20px;
  letter-spacing: 0.08em;
}

.login-status {
  min-height: 20px;
  margin: 0;
}

.login-status.error {
  color: var(--danger);
}

.back-link {
  display: inline-flex;
  margin-top: 18px;
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

dialog {
  width: min(560px, calc(100% - 32px));
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(25, 29, 27, 0.42);
}

.dialog-card {
  padding: 18px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.dialog-head h2 {
  margin-bottom: 0;
}

.icon {
  width: 38px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.launch-status {
  margin-bottom: 14px;
  color: var(--muted);
}

.credential-row {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.credential-row label {
  color: var(--muted);
  font-weight: 800;
}

code {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8faf8;
  color: #121714;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-dialog {
  display: grid;
  gap: 14px;
}

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

.payment-summary div {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8faf8;
}

.payment-summary span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.payment-summary strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.payment-methods,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.payment-methods button,
.dialog-actions button {
  min-width: 132px;
}

.payment-qr-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.payment-qr-wrap[hidden] {
  display: none;
}

.payment-qr-wrap img {
  width: 240px;
  height: 240px;
  image-rendering: pixelated;
}

.payment-qr-wrap p {
  margin-bottom: 0;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .topbar,
  .section-head,
  .notice {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-right,
  .auth-actions {
    align-items: stretch;
    justify-content: stretch;
  }

  .auth-actions > * {
    flex: 1;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    min-width: 0;
  }

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

  .credential-row .copy {
    width: 100%;
  }

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