@charset "UTF-8";
:root {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #d9e1ec;
  --primary: #146c94;
  --green: #0f8f72;
  --red: #c2410c;
}

* {
  box-sizing: border-box;
}

body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px;
  background: #102033;
  color: #ffffff;
}

.sidebar h1 {
  margin: 0 0 22px;
  font-size: 20px;
  white-space: nowrap;
}

.sidebar button {
  display: block;
  width: 100%;
  height: 40px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 6px;
  text-align: left;
  padding: 0 12px;
  font-size: 14px;
  color: #cbd5e1;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar button.active,
.sidebar button:hover {
  color: #ffffff;
  background: #1f3a5a;
}

main {
  padding: 20px;
}

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

.header p {
  margin: 0 0 4px;
  color: var(--primary);
}

.header h2 {
  margin: 0;
}

.header label {
  min-width: 180px;
}

.header input {
  width: 220px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.community-registration p {
  word-break: break-all;
}

.secondary {
  color: var(--text);
  background: #e5e7eb;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
button {
  min-height: 36px;
  border-radius: 6px;
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid #cbd5e1;
  padding: 7px 10px;
  background: #ffffff;
}

textarea {
  min-height: 90px;
  border-radius: 6px;
  font: inherit;
  resize: vertical;
}

button {
  border: 0;
  padding: 0 14px;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 14px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.cards article {
  padding: 14px;
}

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

.cards strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.panel {
  padding: 16px;
}

.mode-panel {
  margin-bottom: 14px;
}

.package-mapping-panel {
  margin-top: 14px;
}

.settings-panel {
  margin-top: 14px;
}

.payment-admin-panel {
  margin-top: 14px;
}

.sync-toolbar {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 10px;
  margin-bottom: 10px;
}

.link-panel {
  margin-bottom: 14px;
}

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

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

.compact-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.settings-row,
.settings-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}

.settings-list {
  align-items: center;
  min-height: 48px;
}

.ownership-list {
  display: grid;
  gap: 10px;
}

.ownership-list p {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #f8fafc;
}

.db-status {
  display: grid;
  gap: 10px;
}

.db-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.db-table-grid span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.link-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
}

.link-box a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 6px;
  color: #ffffff;
  text-decoration: none;
  background: var(--green);
}

.prototype-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prototype-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  color: #ffffff;
  text-decoration: none;
  background: var(--primary);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  color: #ffffff;
  text-decoration: none;
  background: var(--green);
}

.check-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--primary);
}

.check-summary strong,
.check-summary span {
  display: block;
}

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

.check-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.check-item.done {
  border-color: #b7e3d7;
}

.check-item.todo {
  border-color: #f0c7b4;
}

.check-item p {
  margin: 5px 0;
  color: var(--muted);
}

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

.check-item > span {
  justify-self: end;
  color: var(--green);
}

.check-item.todo > span {
  color: var(--red);
}

.check-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.check-actions button,
.check-actions a {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  background: #f8fafc;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.check-actions button:hover,
.check-actions a:hover {
  background: #edf7fb;
  border-color: var(--primary);
}

.mode-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.mode-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mode-card.active {
  border-color: var(--primary);
  background: #edf7fb;
}

.mode-card strong,
.mode-card small {
  display: block;
}

.mode-card p {
  min-height: 42px;
  margin: 8px 0;
  color: var(--muted);
}

.mode-card small {
  color: var(--primary);
}

h3 {
  margin: 0 0 12px;
}

.subhead {
  margin-top: 18px;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item strong {
  display: block;
  margin-bottom: 5px;
}

.item p {
  margin: 0 0 5px;
  color: var(--muted);
}

.table {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 110px 110px 160px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.module-row {
  grid-template-columns: minmax(180px, 1.4fr) 102px 102px 102px 132px 92px 92px 76px;
}

.wechat-row {
  grid-template-columns: minmax(180px, 1fr) 110px 100px 100px minmax(200px, 300px);
}

.package-row {
  grid-template-columns: minmax(220px, 1.4fr) 110px 100px 150px 130px;
}

.small-input {
  min-width: 0;
}

.receiver-input {
  width: 100%;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.receiver-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

.receiver-input-wrap {
  flex: 1;
  min-width: 0;
}

.small-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

.sync-failed {
  border-color: #f5b85b;
  background: #fff8ec;
}

.failed-reason {
  padding: 6px 10px;
  border-radius: 4px;
  color: #c2410c;
  background: #fef2f2;
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.4;
}

.reset-btn {
  font-size: 13px;
  background: #c2410c;
}

.reset-btn:hover {
  background: #9a3412;
}

.item-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.row small {
  display: block;
  color: var(--muted);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.digital-switch {
  align-self: end;
  min-height: 36px;
}

.digital-expert-list {
  margin-top: 14px;
}

.switch input {
  min-height: auto;
}

.ok {
  color: var(--green);
}

.warn {
  color: var(--red);
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }

  .sidebar h1 {
    display: none;
  }

  .sidebar button {
    width: auto;
    min-width: 110px;
  }

  .two,
  .three,
  .row,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel-title,
  .check-summary,
  .check-item,
  .mode-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

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