:root {
  --square-ground: #edf1f5;
  --square-surface: #ffffff;
  --square-soft: #f6f9fc;
  --square-line: #dce4eb;
  --square-rule: #eaf0f4;
  --square-ink: #20303e;
  --square-muted: #5f7081;
  --square-blue: #245aa7;
  --square-blue-deep: #1f4c8d;
  --square-blue-tint: #edf4fd;
  --square-green: #24724e;
  --square-green-tint: #eaf6ef;
  --square-amber: #845e13;
  --square-amber-tint: #fff7df;
  --square-red: #a62f46;
  --square-red-tint: #fff1ee;
}

[hidden] {
  display: none !important;
}

.square-body {
  min-height: 100vh;
  margin: 0;
  color: var(--square-ink);
  background: var(--square-ground);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.square-back-link {
  margin-right: 12px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 12px;
}

.square-back-link:hover {
  color: #fff;
}

.square-user-button {
  min-height: 30px;
  padding: 0 10px;
  color: #244b75;
  background: #fff;
  border: 0;
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
}

.square-container {
  width: 1120px;
  max-width: calc(100% - 24px);
  margin-inline: auto;
}

.square-main {
  padding: 14px 0 28px;
}

.square-intro {
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  color: #fff;
  background: var(--square-blue);
  border-radius: 5px;
}

.square-intro h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.square-intro p:last-child {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}

.square-primary,
.square-secondary {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border-radius: 3px;
  font-size: 12px;
}

.square-primary {
  color: #fff;
  background: #1f4f91;
  border: 1px solid #1f4f91;
}

.square-intro .square-primary {
  flex: none;
  color: #245aa7;
  background: #fff;
  border-color: #fff;
}

.square-primary:hover {
  background: var(--square-blue-deep);
}

.square-secondary {
  color: #315779;
  background: #fff;
  border: 1px solid #cbd8e5;
}

.square-primary svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.square-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 10px;
  background: var(--square-line);
  border: 1px solid var(--square-line);
  border-radius: 4px;
}

.square-metrics > div {
  padding: 10px 14px;
  background: #fff;
}

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

.square-metrics strong {
  display: block;
  margin-top: 2px;
  color: #294a68;
  font-size: 20px;
  font-weight: 600;
}

.square-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

.square-primary-column,
.square-rail {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.square-panel {
  overflow: hidden;
  background: var(--square-surface);
  border: 1px solid var(--square-line);
  border-radius: 4px;
}

.square-panel-head {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--square-rule);
}

.square-panel-head h2,
.square-guide h2 {
  margin: 0;
  color: #253f56;
  font-size: 16px;
}

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

.square-panel-head > span {
  color: var(--square-muted);
  font-size: 11px;
  white-space: nowrap;
}

.square-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--square-rule);
}

.square-search {
  display: flex;
  width: 250px;
  min-width: 190px;
  height: 32px;
  overflow: hidden;
  border: 1px solid #ccd8e3;
  border-radius: 3px;
}

.square-search input {
  min-width: 0;
  flex: 1;
  padding: 0 9px;
  color: var(--square-ink);
  background: #fff;
  border: 0;
  outline: 0;
  font: inherit;
}

.square-search button {
  width: 42px;
  color: #315f94;
  background: #f5f9fe;
  border: 0;
  border-left: 1px solid #dbe4ed;
  font-size: 11px;
}

.square-category-tabs {
  display: flex;
  min-width: 0;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.square-category-tabs::-webkit-scrollbar {
  display: none;
}

.square-category-tabs button {
  flex: none;
  min-height: 30px;
  padding: 0 9px;
  color: #53697d;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 11px;
}

.square-category-tabs button.active {
  color: #245aa7;
  background: var(--square-blue-tint);
  border-color: #d2e2f4;
  font-weight: 600;
}

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

.club-card {
  display: flex;
  min-width: 0;
  min-height: 178px;
  flex-direction: column;
  padding: 11px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--square-line);
  border-radius: 4px;
}

.club-card:hover,
.club-card:focus-visible {
  background: #f8fbfe;
  border-color: #adc3da;
}

.club-card-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.club-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  color: #fff;
  background: #315f94;
  border-radius: 4px;
  font-size: 18px;
  font-weight: 700;
  place-items: center;
}

.club-card-title {
  min-width: 0;
}

.club-card-title strong {
  display: block;
  overflow: hidden;
  color: #294a68;
  font-size: 14px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.club-kind {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 5px;
  color: #315f94;
  background: var(--square-blue-tint);
  border: 1px solid #d2e3f6;
  border-radius: 2px;
  font-size: 10px;
  line-height: 16px;
}

.club-card-intro {
  display: -webkit-box;
  min-height: 38px;
  margin: 9px 0 7px;
  overflow: hidden;
  color: #4f6475;
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.club-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  color: var(--square-muted);
  font-size: 10px;
}

.club-card-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.club-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--square-rule);
  color: #647688;
  font-size: 10px;
}

.club-card-footer b {
  color: #315f94;
  font-weight: 600;
}

.square-loading-card {
  min-height: 178px;
  background: #f3f6f9;
  border: 1px solid var(--square-rule);
  border-radius: 4px;
}

.square-empty {
  grid-column: 1 / -1;
  min-height: 150px;
  padding: 40px 18px;
  color: var(--square-muted);
  text-align: center;
}

.square-empty strong {
  display: block;
  margin-bottom: 6px;
  color: #40576c;
  font-size: 14px;
}

.square-my-club {
  border-left: 3px solid var(--square-blue);
}

.my-club-summary {
  padding: 12px 13px;
}

.my-club-summary h3 {
  margin: 0;
  color: #294a68;
  font-size: 15px;
}

.my-club-summary p {
  margin: 5px 0 0;
  color: var(--square-muted);
  font-size: 11px;
  line-height: 1.55;
}

.my-club-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
}

.square-status {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 10px;
  line-height: 17px;
  white-space: nowrap;
}

.square-status.visible,
.square-status.approved {
  color: var(--square-green);
  background: var(--square-green-tint);
}

.square-status.pending {
  color: var(--square-amber);
  background: var(--square-amber-tint);
}

.square-status.rejected,
.square-status.hidden {
  color: var(--square-red);
  background: var(--square-red-tint);
}

.square-update-list {
  display: grid;
}

.square-update-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 9px;
  padding: 10px 12px;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--square-rule);
}

.square-update-row:last-child {
  border-bottom: 0;
}

.square-update-row:hover {
  background: #f8fbfe;
}

.square-update-kind {
  height: 20px;
  color: #315f94;
  background: var(--square-blue-tint);
  border: 1px solid #d2e3f6;
  border-radius: 2px;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
}

.square-update-copy {
  min-width: 0;
}

.square-update-copy strong {
  display: block;
  overflow: hidden;
  color: #294a68;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.square-update-copy p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--square-muted);
  font-size: 10px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.square-update-copy small {
  display: block;
  margin-top: 4px;
  color: #758593;
  font-size: 10px;
}

.square-guide {
  padding: 12px 13px;
}

.square-guide h2 {
  font-size: 14px;
}

.square-guide ol {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--square-muted);
  font-size: 11px;
  line-height: 1.7;
}

.square-footer {
  padding: 16px 0;
  color: var(--square-muted);
  background: #f8fafc;
  border-top: 1px solid var(--square-line);
  font-size: 11px;
}

.square-footer .square-container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.square-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  color: var(--square-ink);
  background: #fff;
  border: 0;
  border-radius: 6px;
}

.square-dialog::backdrop {
  background: rgba(18, 35, 51, 0.55);
}

.square-dialog form,
.square-club-dialog {
  padding: 0;
}

.square-dialog form > header,
.square-club-dialog > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--square-rule);
}

.square-dialog h2 {
  margin: 0;
  color: #253d51;
  font-size: 19px;
}

.square-dialog header p {
  margin: 4px 0 0;
  color: var(--square-muted);
  font-size: 11px;
}

.square-dialog-close {
  display: grid;
  width: 32px;
  height: 32px;
  flex: none;
  color: #607383;
  background: #f5f8fa;
  border: 1px solid #dfe6ed;
  border-radius: 3px;
  font-size: 20px;
  place-items: center;
}

.square-dialog form > label,
.square-form-grid,
.square-form-error,
.square-dialog form > footer {
  margin-right: 16px;
  margin-left: 16px;
}

.square-dialog form > label,
.square-form-grid {
  margin-top: 11px;
}

.square-dialog label {
  display: grid;
  gap: 5px;
  color: #40576c;
  font-size: 12px;
  font-weight: 600;
}

.square-form-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 10px;
}

.square-dialog input,
.square-dialog select,
.square-dialog textarea {
  width: 100%;
  padding: 8px 9px;
  color: var(--square-ink);
  background: #fff;
  border: 1px solid #ccd8e3;
  border-radius: 3px;
  font: inherit;
  font-weight: 400;
  outline: 0;
}

.square-dialog input,
.square-dialog select {
  height: 36px;
}

.square-dialog textarea {
  min-height: 90px;
  line-height: 1.6;
  resize: vertical;
}

.square-dialog input:focus,
.square-dialog select:focus,
.square-dialog textarea:focus {
  border-color: #7da3cd;
}

.square-form-error {
  min-height: 17px;
  margin-top: 8px;
  color: var(--square-red);
  font-size: 11px;
}

.square-dialog form > footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0 16px;
}

.square-club-dialog > header {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #fff;
}

.club-detail-cover {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--square-soft);
  border-bottom: 1px solid var(--square-rule);
}

.club-detail-cover .club-avatar {
  width: 54px;
  height: 54px;
  font-size: 25px;
}

.club-detail-cover p {
  margin: 4px 0 0;
  color: var(--square-muted);
  font-size: 11px;
}

.club-detail-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--square-rule);
}

.club-detail-section:last-child {
  border-bottom: 0;
}

.club-detail-section h3 {
  margin: 0 0 7px;
  color: #294a68;
  font-size: 13px;
}

.club-detail-section p {
  margin: 4px 0;
  color: #4f6475;
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.club-detail-post {
  padding: 9px 0;
  border-bottom: 1px solid var(--square-rule);
}

.club-detail-post:last-child {
  border-bottom: 0;
}

.club-detail-post h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #294a68;
  font-size: 12px;
}

.club-detail-post p {
  margin-top: 5px;
}

.club-detail-post small {
  color: var(--square-muted);
  font-size: 10px;
}

.square-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--square-rule);
}

.square-toast {
  position: fixed;
  z-index: 150;
  right: 20px;
  bottom: 20px;
  padding: 9px 14px;
  color: #fff;
  background: #293e50;
  border-radius: 3px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

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

@media (max-width: 940px) {
  .square-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

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

  .square-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .square-search {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .square-container {
    max-width: calc(100% - 16px);
  }

  .square-main {
    padding-top: 8px;
  }

  .square-intro {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .square-intro h1 {
    font-size: 24px;
  }

  .square-intro .square-primary {
    width: 100%;
    min-height: 42px;
  }

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

  .square-layout {
    grid-template-columns: 1fr;
  }

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

  .club-card {
    min-height: 0;
  }

  .square-category-tabs {
    padding-bottom: 2px;
  }

  .square-category-tabs button {
    min-height: 38px;
  }

  .square-back-link {
    display: none;
  }

  .square-user-button {
    min-height: 34px;
  }

  .square-dialog {
    width: calc(100% - 12px);
    max-height: calc(100vh - 12px);
  }

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

  .square-dialog form > footer .square-primary,
  .square-dialog form > footer .square-secondary,
  .square-dialog-actions .square-primary,
  .square-dialog-actions .square-secondary {
    min-height: 42px;
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
