:root {
  --teal: #0f4c5c;
  --deep: #08343f;
  --teal-soft: #dcefeb;
  --orange: #f26b4b;
  --orange-soft: #f9ddd4;
  --mint: #7cc7a8;
  --mint-soft: #e5f3ec;
  --cream: #f7f0e3;
  --paper: #fff;
  --surface: #fff;
  --surface-soft: #f7faf9;
  --text: #1f2933;
  --muted: #6d7b80;
  --line: #dfe8e5;
  --shadow: 0 15px 40px rgba(8, 52, 63, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: #eef3f1;
  color: var(--text);
  font-family: "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

button,
a {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.shell[hidden] {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: var(--deep);
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand img {
  width: 45px;
  height: 45px;
  border-radius: 12px;
}

.brand strong {
  display: block;
  font-size: 19px;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
}

.side-label {
  margin: 27px 10px 10px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 12px 13px;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  text-align: left;
  font-size: 13px;
}

.side-nav button:hover {
  background: rgba(255, 255, 255, 0.07);
}

.side-nav button.active {
  background: rgba(255, 255, 255, 0.13);
  color: white;
  font-weight: 700;
}

.side-nav i {
  width: 20px;
  font-style: normal;
  text-align: center;
}

.side-foot {
  position: absolute;
  right: 18px;
  bottom: 22px;
  left: 18px;
}

.side-foot a {
  display: block;
  border-radius: 13px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 12px;
  text-align: center;
  text-decoration: none;
}

.workspace {
  min-width: 0;
  padding: 24px 30px 50px;
}

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

.project-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 10px 14px;
  background: white;
}

.project-switch .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mint);
}

.project-switch strong {
  font-size: 13px;
}

.project-switch span {
  color: var(--muted);
  font-size: 11px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 11px;
}

.demo-badge {
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--orange-soft);
  color: #a83f29;
  font-size: 11px;
  font-weight: 700;
}

.operator {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
}

.operator-avatar {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  font-weight: 700;
}

.page[hidden] {
  display: none;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 28px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.button-primary,
.button-outline,
.button-ghost,
.button-danger {
  border-radius: 11px;
  padding: 10px 15px;
  font-size: 12px;
  font-weight: 700;
}

.button-primary {
  border: 0;
  background: var(--orange);
  color: white;
}

.button-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: white;
  color: var(--teal);
  text-decoration: none;
}

.button-ghost {
  border: 0;
  background: var(--teal-soft);
  color: var(--teal);
}

.button-danger {
  border: 0;
  background: #fdeae5;
  color: #b0472f;
}

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

.kpi {
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 18px;
  background: white;
  box-shadow: 0 8px 24px rgba(8, 52, 63, 0.035);
}

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

.kpi strong {
  display: block;
  margin: 10px 0 7px;
  color: var(--teal);
  font-size: 28px;
}

.kpi small {
  color: var(--mint);
  font-size: 11px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 19px;
  background: white;
  box-shadow: 0 8px 24px rgba(8, 52, 63, 0.035);
}

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

.panel-head h2 {
  margin: 0;
  color: var(--teal);
  font-size: 18px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.progress-list {
  display: grid;
  gap: 16px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 12px;
}

.progress-head span:last-child {
  color: var(--muted);
}

.track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f0;
}

.track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.track.orange > span {
  background: var(--orange);
}

.track.mint > span {
  background: var(--mint);
}

.activity-list {
  display: grid;
  gap: 13px;
}

.activity-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: start;
  font-size: 12px;
}

.activity-item::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--orange);
}

.activity-item span {
  color: var(--muted);
  font-size: 10px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.filter-bar input,
.filter-bar select {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  background: white;
  outline: 0;
}

.filter-bar input {
  flex: 1;
  min-width: 210px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 12px;
}

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

th {
  background: #f3f7f5;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

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

td code {
  border-radius: 7px;
  padding: 4px 7px;
  background: var(--cream);
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--mint-soft);
  color: var(--teal);
  font-size: 10px;
  font-weight: 700;
}

.status.available {
  background: var(--cream);
  color: #85612d;
}

.status.frozen {
  background: #f1f1f1;
  color: var(--muted);
}

.status.revoked {
  background: #fdeae5;
  color: #b0472f;
}

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

.wechat-readonly-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-soft);
}

.wechat-readonly-row code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wechat-readonly-row button,
.wechat-secret-row button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

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

.wechat-secret-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface);
}

.wechat-secret-row strong,
.wechat-secret-row span {
  display: block;
}

.wechat-secret-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

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

.wechat-toggle-grid label {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
  font-size: 13px;
}

.wechat-toggle-grid input {
  width: 17px;
  height: 17px;
  accent-color: var(--teal);
}

.wechat-check-list {
  display: grid;
  gap: 9px;
}

.wechat-check-item {
  display: grid;
  grid-template-columns: 120px 80px 1fr;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
  font-size: 12px;
}

.wechat-check-item:last-child {
  border-bottom: 0;
}

.wechat-check-item code {
  color: var(--muted);
}

@media (max-width: 900px) {
  .wechat-secret-grid,
  .wechat-toggle-grid {
    grid-template-columns: 1fr;
  }

  .wechat-check-item {
    grid-template-columns: 1fr auto;
  }

  .wechat-check-item code {
    grid-column: 1 / -1;
  }
}

.row-actions button {
  border: 0;
  padding: 5px 7px;
  background: transparent;
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
}

.row-actions .danger {
  color: var(--orange);
}

.card-stat-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

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

.campaign-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: white;
}

.campaign-card header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 18px;
}

.campaign-card h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.campaign-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.campaign-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 17px;
}

.campaign-stats div {
  border-radius: 12px;
  padding: 10px;
  background: #f5f8f7;
}

.campaign-stats b {
  display: block;
  color: var(--teal);
  font-size: 16px;
}

.campaign-stats span {
  color: var(--muted);
  font-size: 10px;
}

.chart {
  display: flex;
  align-items: end;
  gap: 12px;
  height: 180px;
  padding: 15px 8px 0;
  border-bottom: 1px solid var(--line);
}

.bar {
  position: relative;
  flex: 1;
  min-height: 12px;
  border-radius: 9px 9px 0 0;
  background: var(--teal);
}

.bar.orange {
  background: var(--orange);
}

.bar.mint {
  background: var(--mint);
}

.bar span {
  position: absolute;
  right: 0;
  bottom: -25px;
  left: 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 52, 63, 0.48);
  backdrop-filter: blur(3px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 22px;
  padding: 24px;
  background: white;
  box-shadow: 0 30px 90px rgba(8, 52, 63, 0.28);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
  color: var(--teal);
  font-size: 21px;
}

.modal-close {
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #edf2f0;
  color: var(--muted);
  font-size: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

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

.field label {
  color: var(--muted);
  font-size: 11px;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  outline: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

.detail-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--line);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 13px;
  background: white;
  font-size: 12px;
}

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

.empty-state {
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 26px;
  z-index: 70;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--deep);
  color: white;
  font-size: 12px;
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1000px) {
  .shell {
    grid-template-columns: 78px 1fr;
  }

  .brand div,
  .side-label,
  .side-nav button span,
  .side-foot a {
    display: none;
  }

  .brand {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
  }

  .side-nav button {
    justify-content: center;
  }

  .kpi-grid,
  .card-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-grid,
  .campaign-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    display: flex;
    height: auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
  }

  .brand {
    padding: 0;
    border: 0;
  }

  .brand img {
    width: 38px;
    height: 38px;
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
    margin-left: auto;
  }

  .side-nav button {
    width: 42px;
    padding: 9px;
  }

  .side-foot {
    display: none;
  }

  .workspace {
    padding: 18px 14px 40px;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
  }

  .project-switch span,
  .demo-badge {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .operator > span:last-child {
    display: none;
  }

  .kpi-grid,
  .card-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .field.full {
    grid-column: auto;
  }

  .workspace,
  .page,
  .panel,
  .form-grid,
  .field {
    min-width: 0;
  }

  .row-actions {
    flex-wrap: wrap;
  }

  .wechat-readonly-row {
    align-items: flex-start;
  }

  .wechat-readonly-row code {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .wechat-check-item {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}
