/* HEU 服务器广场 · 独立页面样式
 * 颜色取值自社区 SPA 的设计令牌 qingjiu_flutter/lib/design_system/tokens/qj_colors.dart，
 * 以保持与社区站点一致的观感（品牌色 #3CC9A4）。
 * 纯静态、零依赖、零外部资源：本目录下的任何资源都必须同源自带。
 */

:root {
  --brand: #3cc9a4;
  --brand-pressed: #0d8f70;
  --brand-container: #ddf8f0;
  --accent: #ff6175;
  --accent-container: #ffe2e7;
  --link: #3d7eff;
  --success: #18b566;
  --warning: #e58200;
  --warning-container: #ffe7c2;
  --error: #d92d45;
  --error-container: #ffe2e7;

  --page: #f7f7f7;
  --surface: #ffffff;
  --surface-muted: #fafafa;
  --input: #f1f1f1;
  --border: #e3e6e5;
  --divider: #eef1f0;
  --text: #181e1c;
  --text-2: #4b5652;
  --text-3: #6d7874;
  --disabled: #9aa39f;
  --shadow: 0 1px 2px rgba(21, 32, 28, 0.06), 0 8px 24px rgba(21, 32, 28, 0.06);
  --radius: 14px;
  --radius-sm: 9px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-container: #153f36;
    --accent-container: #612431;
    --page: #101513;
    --surface: #171d1b;
    --surface-muted: #212926;
    --input: #212926;
    --border: #2b3431;
    --divider: #232b28;
    --text: #f2f6f5;
    --text-2: #c4ceca;
    --text-3: #9ba7a2;
    --disabled: #68736f;
    --warning-container: #402d10;
    --error-container: #40131c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--page);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px 72px; }
.wrap--narrow { max-width: 860px; }

/* ---------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
  margin-bottom: 26px;
}
.masthead__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.logo {
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-pressed));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.masthead__title { font-size: 16px; font-weight: 650; letter-spacing: .2px; }
.masthead__sub { font-size: 12.5px; color: var(--text-3); }
.masthead__spacer { flex: 1 1 auto; }

/* ------------------------------------------------------------------ blocks */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card--flush { padding: 0; overflow: hidden; }
.card__title { font-size: 16px; font-weight: 650; margin: 0 0 4px; }
.card__hint { font-size: 13px; color: var(--text-3); margin: 0 0 18px; }
.card__head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--divider);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card__body { padding: 20px 22px; }

.page-title { font-size: 24px; font-weight: 700; margin: 4px 0 6px; }
.page-lede { color: var(--text-2); font-size: 14px; margin: 0 0 22px; max-width: 74ch; }

/* ------------------------------------------------------------------ fields */

.field { margin-bottom: 18px; }
.field__label {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13.5px; font-weight: 600; margin-bottom: 6px;
}
.field__req { color: var(--error); font-weight: 700; }
.field__optional { color: var(--text-3); font-weight: 400; font-size: 12px; }
.field__counter { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.field__counter--warn { color: var(--warning); font-weight: 600; }
.field__counter--over { color: var(--error); font-weight: 600; }
.field__help { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }
.field__error { font-size: 12.5px; color: var(--error); margin-top: 5px; font-weight: 500; }
.field--invalid input, .field--invalid textarea { border-color: var(--error); background: var(--error-container); }

/* ---- 图标上传（申请页） ---- */
.icon-drop {
  display: flex; align-items: center; justify-content: center;
  min-height: 132px; padding: 16px;
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--input); color: var(--text-3);
  cursor: pointer; text-align: center;
  transition: border-color .12s ease, background .12s ease;
}
.icon-drop:hover, .icon-drop:focus-visible { border-color: var(--brand); color: var(--text); }
.icon-drop--over { border-color: var(--brand); background: var(--surface-muted); color: var(--text); }
.field--invalid .icon-drop { border-color: var(--error); background: var(--error-container); }
.icon-preview-wrap { display: flex; align-items: center; gap: 14px; text-align: left; }
.icon-preview-wrap img {
  width: 96px; height: 96px; object-fit: contain;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
}
.icon-meta { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

input[type="text"], input[type="number"], input[type="url"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: var(--brand);
  background: var(--surface);
}
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--disabled); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------------- buttons */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 20px;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #06231c;
  transition: filter .15s ease, background .15s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { background: var(--brand-pressed); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-muted); }
.btn--danger { background: var(--error); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn--warn { background: var(--warning); color: #2b1a00; }
.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------- chips */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
}
.chip--brand { background: var(--brand-container); border-color: transparent; color: var(--brand-pressed); }
@media (prefers-color-scheme: dark) { .chip--brand { color: var(--brand); } }
.chip--pending { background: var(--warning-container); border-color: transparent; color: #7a4600; }
.chip--approved { background: #d8f5e4; border-color: transparent; color: #0b6b3c; }
.chip--rejected { background: var(--error-container); border-color: transparent; color: #8f1729; }
.chip--withdrawn, .chip--neutral { background: var(--surface-muted); color: var(--text-3); }
.chip--unpublished { background: #e9e2f7; border-color: transparent; color: #4c2f8f; }
@media (prefers-color-scheme: dark) {
  .chip--pending { color: #ffc46b; }
  .chip--approved { background: #103a26; color: #6ee0a4; }
  .chip--rejected { color: #ff8a9c; }
  .chip--unpublished { background: #2a2144; color: #b9a2f5; }
}
.chip--clickable { cursor: pointer; }
.chip--on { background: var(--brand-container); border-color: var(--brand); color: var(--brand-pressed); }
@media (prefers-color-scheme: dark) { .chip--on { color: var(--brand); } }
.chip-x { cursor: pointer; opacity: .7; font-weight: 700; }
.chip-x:hover { opacity: 1; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input);
  padding: 10px;
}
.chip-picker .btn { flex: none; white-space: nowrap; }
.chip-picker__label { font-size: 12px; color: var(--text-3); margin-bottom: 7px; }

/* ------------------------------------------------------------------- table */

table.queue { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.queue th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3);
  padding: 9px 12px; border-bottom: 1px solid var(--divider); white-space: nowrap;
}
table.queue td { padding: 11px 12px; border-bottom: 1px solid var(--divider); vertical-align: top; }
table.queue tr:last-child td { border-bottom: 0; }
table.queue tbody tr { cursor: pointer; }
table.queue tbody tr:hover { background: var(--surface-muted); }
table.queue tbody tr.is-active { background: var(--brand-container); }
table.queue tbody tr.is-active td { border-bottom-color: transparent; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ panels */

.note {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  margin-bottom: 16px;
}
.note--info { background: var(--brand-container); border-color: transparent; }
.note--warn { background: var(--warning-container); border-color: transparent; color: #6b3d00; }
.note--error { background: var(--error-container); border-color: transparent; color: #8f1729; }
.note--ok { background: #d8f5e4; border-color: transparent; color: #0b6b3c; }
@media (prefers-color-scheme: dark) {
  .note--warn { color: #ffc46b; }
  .note--error { color: #ff8a9c; }
  .note--ok { background: #103a26; color: #6ee0a4; }
}
.note__title { font-weight: 650; margin-bottom: 3px; }
.note ul { margin: 6px 0 0; padding-left: 20px; }

.kv { display: grid; grid-template-columns: 116px 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-all; }

.stat-row { display: flex; gap: 26px; flex-wrap: wrap; }
.stat { min-width: 84px; }
.stat__n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat__l { font-size: 12px; color: var(--text-3); }
.stat--pending .stat__n { color: var(--warning); }
.stat--approved .stat__n { color: var(--success); }
.stat--rejected .stat__n { color: var(--error); }

.pager { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-3); }

.spinner {
  width: 15px; height: 15px; flex: none;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

.empty { text-align: center; color: var(--text-3); padding: 34px 16px; font-size: 13.5px; }

/* ------------------------------------------------------------- admin layout */

.admin { display: grid; grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1040px) { .admin { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 16px; }
@media (max-width: 1040px) { .sticky { position: static; } }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input[type="text"] { width: 190px; }

.preview {
  border: 1px dashed var(--brand);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--brand-container);
  font-size: 13px;
}
.preview__t { font-weight: 650; margin-bottom: 6px; font-size: 12.5px; letter-spacing: .3px; }
.preview pre {
  margin: 8px 0 0; padding: 9px 11px; overflow-x: auto;
  background: var(--surface); border-radius: 7px; border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.55;
}

.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-card {
  flex: 1 1 220px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  background: var(--surface);
}
.radio-card:hover { border-color: var(--brand); }
.radio-card input { width: auto; margin-right: 8px; }
.radio-card__t { font-weight: 650; font-size: 14px; }
.radio-card__d { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.radio-card.is-on { border-color: var(--brand); background: var(--brand-container); }

.toast-host {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 9px; z-index: 50;
  pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  border-radius: 11px; padding: 11px 18px; font-size: 13.5px; font-weight: 500;
  background: #181e1c; color: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.28);
  animation: rise .18s ease both;
}
.toast--ok { background: #0f7a4a; }
.toast--err { background: #b32338; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--divider); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 9px 15px; font-size: 13.5px; font-weight: 600; color: var(--text-3);
  border-bottom: 2px solid transparent; cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.is-on { color: var(--brand-pressed); border-bottom-color: var(--brand); }
@media (prefers-color-scheme: dark) { .tab.is-on { color: var(--brand); } }

.landing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .landing-grid { grid-template-columns: 1fr; } }
.landing-card { display: block; color: inherit; text-decoration: none; }
.landing-card:hover { text-decoration: none; border-color: var(--brand); }
.landing-card__go { color: var(--brand-pressed); font-weight: 650; font-size: 13.5px; margin-top: 12px; display: inline-block; }
@media (prefers-color-scheme: dark) { .landing-card__go { color: var(--brand); } }

.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
