:root {
  --paper: #f5efe5;
  --sand: #e8dcc7;
  --ink: #15231d;
  --muted: #5d685f;
  --panel: rgba(255, 250, 242, 0.88);
  --line: rgba(21, 35, 29, 0.12);
  --forest: #22493b;
  --forest-soft: #2f6653;
  --olive: #8ea06f;
  --danger: #a44731;
  --warning: #b67c24;
  --success: #2d6c54;
  --shadow: 0 24px 60px rgba(31, 45, 39, 0.14);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(142, 160, 111, 0.3), transparent 28%),
    radial-gradient(circle at bottom right, rgba(34, 73, 59, 0.18), transparent 30%),
    linear-gradient(180deg, #f6f1e8 0%, #efe6d8 100%);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.hidden {
  display: none !important;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 8px 22px;
}

.topbar h1,
.hero-card h2,
.login-card h2,
.panel h3,
.dialog-header h3,
.account-card h4,
.target-card h4 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.01em;
}

.topbar h1 {
  font-size: clamp(32px, 5vw, 52px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--forest-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar-actions,
.hero-actions,
.card-actions,
.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.health-pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.health-pill[data-state="ok"],
.status-chip[data-tone="success"] {
  color: var(--success);
  border-color: rgba(45, 108, 84, 0.18);
  background: rgba(45, 108, 84, 0.08);
}

.health-pill[data-state="error"],
.status-chip[data-tone="danger"] {
  color: var(--danger);
  border-color: rgba(164, 71, 49, 0.18);
  background: rgba(164, 71, 49, 0.08);
}

.status-chip[data-tone="warning"] {
  color: var(--warning);
  border-color: rgba(182, 124, 36, 0.18);
  background: rgba(182, 124, 36, 0.08);
}

.ghost-button,
.primary-button,
.small-ghost-button,
.small-primary-button,
.icon-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
  font: inherit;
}

.ghost-button,
.small-ghost-button {
  color: var(--forest);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(34, 73, 59, 0.12);
}

.ghost-button {
  min-height: 40px;
  padding: 10px 16px;
}

.small-ghost-button,
.small-primary-button {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 13px;
}

.primary-button,
.small-primary-button {
  color: #f8f3ea;
  background: linear-gradient(135deg, var(--forest), var(--forest-soft));
  box-shadow: 0 14px 30px rgba(34, 73, 59, 0.18);
}

.icon-button {
  width: 36px;
  height: 36px;
  color: var(--forest);
  background: rgba(34, 73, 59, 0.08);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-panel,
.dashboard {
  width: 100%;
}

.login-card,
.hero-card,
.panel,
.metric-card,
.account-card,
.target-card,
.notice,
.qr-dialog {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login-card {
  width: min(540px, 100%);
  margin: 70px auto 0;
  padding: 32px;
  border-radius: 30px;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

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

.login-form label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--ink);
  border: 1px solid rgba(21, 35, 29, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  font: inherit;
}

input:focus {
  outline: 2px solid rgba(34, 73, 59, 0.18);
  border-color: rgba(34, 73, 59, 0.32);
}

.notice {
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.notice[data-type="info"] {
  color: var(--forest);
}

.notice[data-type="success"] {
  color: var(--success);
}

.notice[data-type="warning"] {
  color: var(--warning);
}

.notice[data-type="danger"] {
  color: var(--danger);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 28px;
  border-radius: 28px;
}

.hero-card h2 {
  font-size: clamp(28px, 4vw, 42px);
}

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

.metric-card {
  display: grid;
  gap: 10px;
  min-height: 150px;
  padding: 20px;
  border-radius: 24px;
}

.metric-card p,
.metric-card span {
  margin: 0;
}

.metric-card p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 30px;
  line-height: 1.1;
}

.metric-card span {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
}

.metric-card[data-tone="success"] {
  background: linear-gradient(180deg, rgba(45, 108, 84, 0.12), rgba(255, 250, 242, 0.88));
}

.metric-card[data-tone="warning"] {
  background: linear-gradient(180deg, rgba(182, 124, 36, 0.12), rgba(255, 250, 242, 0.88));
}

.metric-card[data-tone="danger"] {
  background: linear-gradient(180deg, rgba(164, 71, 49, 0.12), rgba(255, 250, 242, 0.88));
}

.content-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
}

.panel {
  padding: 24px;
  border-radius: 28px;
}

.panel-header {
  justify-content: space-between;
  margin-bottom: 18px;
}

.account-list,
.target-list {
  display: grid;
  gap: 14px;
}

.account-card,
.target-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
}

.account-meta,
.target-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.account-role,
.target-brand {
  margin: 0 0 8px;
  color: var(--forest-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.kv-grid div {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
}

.kv-grid dt,
.kv-grid dd {
  margin: 0;
}

.kv-grid dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.kv-grid dd {
  font-size: 14px;
  font-weight: 600;
}

.target-copy h4,
.target-copy p {
  margin: 0;
}

.target-image {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(21, 35, 29, 0.08);
}

.empty-block {
  padding: 20px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed rgba(21, 35, 29, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.35);
}

.empty-block.compact {
  min-height: 180px;
  display: grid;
  place-items: center;
}

.qr-dialog {
  width: min(920px, calc(100vw - 28px));
  padding: 0;
  border-radius: 30px;
}

.qr-dialog::backdrop {
  background: rgba(17, 25, 22, 0.46);
}

.dialog-header,
.dialog-body {
  padding: 22px 24px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.dialog-body {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
}

.qr-preview {
  min-height: 320px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  place-items: center;
  overflow: hidden;
}

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

.dialog-json {
  margin: 0;
  padding: 18px;
  border-radius: 20px;
  background: #17211d;
  color: #f5efe5;
  font-size: 12px;
  line-height: 1.6;
  overflow: auto;
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .topbar,
  .hero-card,
  .account-meta,
  .target-main,
  .dialog-body,
  .panel-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar-actions,
  .hero-actions,
  .card-actions {
    flex-wrap: wrap;
  }

  .stats-grid,
  .kv-grid {
    grid-template-columns: 1fr;
  }

  .target-image {
    width: 100%;
    height: 220px;
  }
}
