* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 15px;
  color: #111827;
  background: #f4f6f8;
}
.hidden {
  display: none !important;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(22, 119, 255, 0.08), rgba(16, 185, 129, 0.08)),
    #f4f6f8;
}
.login-panel {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.login-logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #1677ff;
  font-size: 22px;
  font-weight: 700;
}
.login-brand h1 {
  margin: 0;
  font-size: 24px;
}
.login-brand p {
  margin: 6px 0 0;
  color: #4b5563;
  font-size: 14px;
}
.login-form {
  display: grid;
  gap: 14px;
}
.login-form label {
  display: grid;
  gap: 7px;
  color: #374151;
  font-size: 14px;
}
.login-form input {
  width: 100%;
  height: 42px;
}
.login-verification {
  display: grid;
  gap: 10px;
}
.login-slider-row {
  display: grid;
  gap: 7px;
}
.login-slider-row input[type="range"] {
  accent-color: #1677ff;
  cursor: pointer;
}
.login-slider-row strong {
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
}
.login-captcha {
  display: grid;
  gap: 7px;
}
.login-captcha strong {
  color: #1677ff;
  letter-spacing: 2px;
}
.login-submit {
  width: 100%;
  height: 42px;
  margin-top: 4px;
  font-size: 15px;
}
.login-error {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #b42318;
  background: #fff7f7;
}
.ghost {
  color: #374151;
  background: #fff;
}
.realname-usage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 13px;
  white-space: nowrap;
}
.realname-usage-badge .link-btn {
  min-height: 24px;
  padding: 0 6px;
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #fff;
  font-size: 13px;
}
.app-shell {
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 190px;
  background: #263238;
  color: #fff;
  padding: 18px 12px;
  overflow-y: auto;
}
.brand {
  padding: 8px 10px 18px;
  font-size: 18px;
  font-weight: 700;
}
.sidebar button {
  display: block;
  width: 100%;
  height: 38px;
  margin: 4px 0;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #eef2f7;
  background: transparent;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.sidebar button.active,
.sidebar button:hover {
  color: #fff;
  background: #3b4a52;
}
.main {
  min-height: 100vh;
  margin-left: 190px;
}
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid #dfe4ea;
}
#title {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}
.login,
.toolbar,
.tabs,
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
input,
button,
select,
textarea {
  height: 34px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}
textarea {
  min-height: 86px;
  padding: 8px 10px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}
button {
  cursor: pointer;
}
.primary,
.login button {
  color: #fff;
  border-color: #1677ff;
  background: #1677ff;
}
.danger {
  color: #fff;
  border-color: #d92d20;
  background: #d92d20;
}
.content {
  padding: 22px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.dashboard-section,
.analytics-section {
  margin-bottom: 18px;
}
.dashboard-section h3,
.analytics-section h3 {
  margin: 0 0 10px;
}
.metric,
.empty,
.loading,
.error,
.hint {
  background: #fff;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  padding: 14px;
}
.metric {
  text-align: center;
}
.metric .label {
  color: #4b5563;
  font-size: 15px;
}
.metric .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
}
.toolbar {
  margin-bottom: 12px;
}
.ops-filters input {
  width: 132px;
}
.ops-filters #keyword {
  width: 180px;
}
.analytics-filters input {
  width: 142px;
}
.analytics-filters #analyticsCommunityKeyword {
  width: 220px;
}
.analytics-filters #analyticsKeyword {
  width: 190px;
}
.analytics-community-matches {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}
.analytics-community-match {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1f2937;
  border-color: #b6c6d8;
  background: #fff;
}
.analytics-community-match.selected {
  color: #0f5ec7;
  border-color: #1677ff;
  background: #eef6ff;
}
.analytics-community-match small {
  color: #4b5563;
  font-size: 13px;
}
.analytics-business-section table,
.analytics-detail-section table {
  margin-top: 10px;
}
.analytics-detail-toolbar button.active {
  color: #fff;
  border-color: #1677ff;
  background: #1677ff;
}
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.analytics-grid div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}
.analytics-grid span {
  display: block;
  margin-bottom: 6px;
  color: #4b5563;
  font-size: 14px;
}
.analytics-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 22px;
}
.analytics-business-section .table-wrap th,
.analytics-business-section .table-wrap td {
  text-align: center;
}
.region-overview-table table {
  min-width: 1360px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.analytics-region-table table {
  min-width: 1320px;
}
.region-overview-table th,
.region-overview-table td {
  border-right: 1px solid #edf1f5;
  vertical-align: middle;
}
.region-overview-table th:last-child,
.region-overview-table td:last-child {
  border-right: 0;
}
.region-overview-table th {
  text-align: center;
  white-space: nowrap;
}
.region-overview-table th:first-child,
.region-overview-table td:first-child {
  width: 260px;
}
.region-name-cell {
  min-width: 220px;
  text-align: left;
}
.region-indent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: calc(var(--region-depth, 0) * 18px);
}
.region-toggle,
.region-toggle-placeholder {
  width: 24px;
  min-width: 24px;
  height: 24px;
}
.region-toggle {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 6px;
  color: #1677ff;
  font-weight: 700;
  line-height: 1;
  background: #f8fbff;
}
.region-toggle:hover {
  background: #e8f2ff;
}
.region-toggle-placeholder {
  display: inline-block;
}
.region-level-badge {
  min-width: 36px;
  padding: 2px 6px;
  border-radius: 6px;
  color: #374151;
  background: #eef2f6;
  font-size: 12px;
  text-align: center;
}
.region-level-province .region-level-badge {
  color: #0b5cad;
  background: #e8f2ff;
}
.region-level-street .region-level-badge {
  color: #0f766e;
  background: #e6f7f4;
}
.region-level-community .region-level-badge {
  color: #7c2d12;
  background: #fff4e6;
}
.region-number {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.strong-number {
  font-weight: 700;
}
.analytics-grid-small {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.financial-overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  gap: 12px;
}
.formula-list {
  display: grid;
  gap: 10px;
}
.formula-row {
  padding: 12px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}
.formula-title {
  margin-bottom: 8px;
  color: #1f2937;
  font-weight: 700;
  text-align: left;
}
.formula-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: #4b5563;
  line-height: 1.35;
}
.formula-op {
  color: #1f2937;
  font-size: 18px;
  line-height: 48px;
}
.formula-term {
  min-width: 118px;
  padding: 9px 10px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
  white-space: normal;
}
.formula-term-label {
  display: block;
  margin-bottom: 5px;
  color: #4b5563;
  font-size: 14px;
}
.formula-term-value {
  display: block;
  color: #111827;
  font-size: 22px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.formula-total {
  border-color: #b7d7ff;
  background: #f2f8ff;
}
.clickable-card {
  cursor: pointer;
}
.clickable-card:hover {
  border-color: #1677ff;
}
@media (max-width: 820px) {
  .financial-overview-layout {
    grid-template-columns: 1fr;
  }
}
.tabs {
  margin-bottom: 12px;
}
.promotion-tabs {
  gap: 6px;
}
.promotion-toolbar {
  margin-top: -2px;
}
.promotion-toolbar button,
.tabs button {
  white-space: nowrap;
}
.tabs button.active {
  color: #fff;
  border-color: #1677ff;
  background: #1677ff;
}
.hint {
  margin-bottom: 12px;
  color: #374151;
}
.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
}
table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}
th,
td {
  padding: 10px;
  border-bottom: 1px solid #edf1f5;
  font-size: 15px;
  text-align: left;
  vertical-align: top;
}
th {
  color: #374151;
  background: #f8fafc;
  font-weight: 700;
}
.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.sort-header:hover,
.sort-header.active {
  color: #2563eb;
  background: transparent;
}
.sort-marks {
  color: #64748b;
  font-size: 11px;
  letter-spacing: 0;
}
.sort-header.active .sort-marks.asc,
.sort-header.active .sort-marks.desc {
  color: #2563eb;
}
td button {
  margin: 0 4px 4px 0;
}
td button:disabled {
  color: #64748b;
  background: #f1f5f9;
  cursor: not-allowed;
}
.config-image-cell {
  display: grid;
  gap: 8px;
  min-width: 260px;
}
.config-upload-btn {
  width: fit-content;
  padding: 7px 12px;
  color: #1f2937;
  background: #f8fafc;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.config-file-input {
  display: none;
}
.config-image-preview .image-thumbs-large {
  margin-top: 0;
}
.config-image-preview .image-thumb img {
  width: 96px;
  height: 96px;
  object-fit: cover;
}
.community-group-qr-preview {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.community-group-qr-preview .image-thumbs-large {
  margin-top: 0;
}
.community-group-link-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}
.community-group-link-status .status-ok {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 14px;
  font-weight: 700;
}
.pager {
  margin-top: 12px;
  color: #374151;
}
.error {
  color: #b42318;
  white-space: pre-wrap;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}
.modal.hidden {
  display: none;
}
.modal-panel {
  width: min(1080px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #dfe4ea;
}
.modal-body {
  overflow: auto;
  padding: 16px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.detail-grid div {
  min-height: 58px;
  padding: 10px;
  border: 1px solid #edf1f5;
  border-radius: 6px;
  background: #f8fafc;
}
.detail-grid label {
  display: block;
  margin-bottom: 6px;
  color: #4b5563;
  font-size: 14px;
}
.detail-grid span {
  font-size: 15px;
  word-break: break-all;
}
.muted {
  color: #64748b;
}
.image-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 96px;
  max-width: 220px;
}
.image-thumb {
  width: 52px;
  height: 52px;
  min-width: 52px;
  max-width: 52px;
  max-height: 52px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
}
.image-thumb img {
  width: 100%;
  height: 100%;
  max-width: 52px;
  max-height: 52px;
  display: block;
  object-fit: cover;
}
.image-thumbs-large .image-thumb {
  width: 64px;
  height: 64px;
  min-width: 64px;
  max-width: 64px;
  max-height: 64px;
}
.image-thumbs-large .image-thumb img {
  max-width: 64px;
  max-height: 64px;
}
.detail-grid .detail-image-field {
  grid-column: 1 / -1;
}
.edit-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.edit-form label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-size: 13px;
}
.edit-form input,
.edit-form select,
.edit-form textarea {
  width: 100%;
}
.form-wide,
.form-actions {
  grid-column: 1 / -1;
}
.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.banner-target-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.banner-target-head,
.banner-region-search {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.banner-target-head span {
  font-weight: 700;
  color: #1f2937;
}
.banner-target-level-field {
  display: grid;
  grid-template-columns: 88px minmax(180px, 260px);
  gap: 8px;
  align-items: center;
  max-width: 380px;
}
.banner-target-level-field span {
  font-weight: 600;
  color: #334155;
}
.banner-selected-targets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 36px;
  padding: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
.banner-selected-target {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
}
.banner-selected-target button {
  padding: 3px 6px;
}
.banner-region-search input {
  min-width: 260px;
  flex: 1;
}
.banner-region-results {
  display: grid;
  gap: 8px;
}
.banner-region-result {
  display: grid;
  grid-template-columns: minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.banner-region-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: #1f2937;
  font-size: 13px;
}
.banner-region-check input {
  width: auto;
}
.banner-region-children {
  color: #475569;
  font-size: 12px;
  line-height: 1.5;
}
.image-preview {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.72);
}
.image-preview.hidden {
  display: none;
}
.image-preview-panel {
  position: relative;
  max-width: min(1100px, 94vw);
  max-height: 92vh;
}
.image-preview-panel img {
  max-width: 100%;
  max-height: 92vh;
  display: block;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}
.image-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
}
.modal-body h3 {
  margin: 18px 0 10px;
  font-size: 17px;
}
.room-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.room-stats div {
  padding: 10px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #f8fafc;
}
.room-stats span {
  display: block;
  color: #4b5563;
  font-size: 14px;
}
.room-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}
.room-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}
.room-cell {
  height: 64px;
  padding: 8px;
  display: grid;
  align-content: center;
  gap: 4px;
  text-align: left;
  border-radius: 6px;
}
.room-cell strong,
.room-cell span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-cell strong {
  font-size: 13px;
}
.room-cell span {
  color: #374151;
  font-size: 12px;
}
.room-white {
  border-color: #dfe4ea;
  background: #fff;
}
.room-yellow {
  border-color: #f6c85f;
  background: #fff8db;
}
.room-red {
  border-color: #f3a2a2;
  background: #fff1f1;
}
@media (max-width: 820px) {
  .sidebar {
    position: static;
    width: 100%;
  }
  .main {
    margin-left: 0;
  }
  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }
}
