/* 星联 · 深蓝星空主题 + 白色内容卡片：以真实观测照片为主，少装饰 */

:root {
  --bg: #070d1c;
  --bg-alt: #0d1630;
  --panel: #101c39;
  --panel-soft: #16264b;
  --card: #ffffff;
  --ink: #1a2340;
  --ink-soft: #5b6a8d;
  --ink-faint: #8a97b8;
  --brand: #4f8cff;
  --brand-deep: #2f6ae0;
  --accent: #ffcc66;
  --danger: #e05260;
  --ok: #2fae76;
  --line: #e2e8f4;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(4, 10, 26, 0.35);
  --shadow-sm: 0 2px 10px rgba(20, 35, 70, 0.08);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 12% -8%, #1a2b58 0%, rgba(26, 43, 88, 0) 62%),
    radial-gradient(900px 520px at 88% 4%, #16305c 0%, rgba(22, 48, 92, 0) 60%),
    linear-gradient(180deg, #070d1c 0%, #080f22 55%, #060a18 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 14, 32, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(120, 150, 210, 0.18);
}

.site-header .bar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.brand .logo {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(140deg, #4f8cff, #8b5cf6);
  font-size: 16px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }

.site-nav a {
  padding: 8px 13px;
  border-radius: 999px;
  color: #c3d0ee;
  font-size: 15px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.site-nav a:hover { background: rgba(120, 150, 220, 0.16); color: #fff; }
.site-nav a.active { background: rgba(79, 140, 255, 0.22); color: #fff; font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.user-chip {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.user-chip:hover,
.user-chip:focus-visible {
  background: rgba(32, 54, 106, 0.95);
  border-color: var(--brand);
  outline: none;
}
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(23, 40, 80, 0.9);
  border: 1px solid rgba(120, 150, 210, 0.28);
  color: #dce6fb;
  font-size: 13px;
  white-space: nowrap;
}
/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 9px; }
.btn-ghost { background: rgba(255, 255, 255, 0.08); border-color: rgba(150, 180, 236, 0.35); color: #e6eeff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.15); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: var(--danger); }
.btn-block { width: 100%; }

/* ---------- 页面主体 ---------- */
main { padding: 26px 0 64px; }

.hero {
  color: #fff;
  padding: 6px 0 20px;
}
.hero h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: 0.5px; }
.hero p { margin: 0; color: #a9bade; font-size: 14.5px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.stat {
  background: rgba(19, 33, 66, 0.75);
  border: 1px solid rgba(120, 150, 210, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #fff;
}
.stat b { display: block; font-size: 22px; line-height: 1.3; }
.stat span { color: #9fb0d6; font-size: 12.5px; }

/* ---------- 卡片与筛选 ---------- */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: #b9c6e6; }
.field select,
.field input[type="text"],
.field input[type="datetime-local"],
.field input[type="password"],
.field input[type="number"],
.field textarea {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { min-height: 78px; resize: vertical; }
.field select:focus,
.field input:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.14);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
}

.card-link { display: block; color: inherit; }

.obs-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s, box-shadow 0.16s;
  display: flex;
  flex-direction: column;
}
.obs-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.thumb-wrap {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #0d1730;
  overflow: hidden;
}
.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb-wrap .target-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(8, 14, 32, 0.72);
  color: #fff;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
.thumb-wrap .photo-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(8, 14, 32, 0.72);
  color: #fff;
  font-size: 12px;
}

.obs-card .body { padding: 12px 14px 14px; }
.obs-card .school { font-weight: 700; font-size: 15px; margin: 0 0 2px; }
.obs-card .observed { color: var(--ink-soft); font-size: 13px; }
.obs-card .uploaded { color: var(--ink-faint); font-size: 12px; margin-top: 3px; }
.obs-card .note {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 详情页 ---------- */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

.gallery-main {
  background: #0b1428;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  min-height: 240px;
}
.gallery-main img { width: 100%; max-height: 74vh; object-fit: contain; background: #050a18; }

.thumbs {
  display: flex;
  gap: 9px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.thumbs button {
  width: 84px;
  height: 60px;
  padding: 0;
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
}
.thumbs button img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button.active { border-color: var(--brand); }

.meta-list { margin: 0; }
.meta-list div {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.meta-list div:last-child { border-bottom: none; }
.meta-list dt { width: 88px; flex: none; color: var(--ink-faint); margin: 0; }
.meta-list dd { margin: 0; color: var(--ink); word-break: break-word; }

.question-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fbfcff;
}
.question-card .q-body { font-weight: 600; font-size: 14.5px; }
.question-card .q-hint {
  margin-top: 8px;
  padding: 9px 11px;
  border-left: 3px solid var(--brand);
  background: #eef3ff;
  border-radius: 0 8px 8px 0;
  color: #37507f;
  font-size: 13.5px;
  display: none;
}
.question-card.open .q-hint { display: block; }

.safety-banner {
  border: 1px solid #f4d9b0;
  background: #fff8ec;
  color: #7a4a12;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

/* ---------- 上传页 ---------- */
.form-card { max-width: 780px; margin: 0 auto; }
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 22px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--brand);
}

.dropzone {
  border: 2px dashed #c3d0ea;
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  color: var(--ink-soft);
  background: #fbfcff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--brand); background: #eef4ff; }
.dropzone b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

.preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.preview-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f4f7fd;
  border: 1px solid var(--line);
}
.preview-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.preview-item .bar {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: rgba(79, 140, 255, 0.25);
}
.preview-item .bar i { display: block; height: 100%; background: var(--brand); width: 0; transition: width 0.2s; }
.preview-item .del {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(8, 14, 32, 0.66);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}
.preview-item .state {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 4px 8px;
  font-size: 11.5px;
  color: #fff;
  background: rgba(8, 14, 32, 0.6);
}
.preview-item.failed { border-color: var(--danger); }
.preview-item.failed .state { background: rgba(224, 82, 96, 0.85); }

.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: #fff;
}
.check-item:hover { border-color: var(--brand); }
.check-item.checked { border-color: var(--brand); background: #f2f7ff; }
.check-item input { margin-top: 3px; accent-color: var(--brand); }
.check-item .text { font-size: 14px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th, table.data td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data th { color: var(--ink-faint); font-weight: 600; font-size: 12.5px; }
table.data tbody tr:hover { background: #f8fafd; }
table.data td.wrap { white-space: normal; min-width: 260px; }

/* ---------- 通用状态 ---------- */
.empty {
  text-align: center;
  padding: 46px 20px;
  color: #9fb0d6;
}
.empty .icon { font-size: 34px; }
.empty p { margin: 8px 0 0; font-size: 14px; }

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.skeleton-card { background: rgba(20, 35, 70, 0.6); border-radius: var(--radius); height: 268px; animation: pulse 1.3s infinite ease-in-out; }
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.9; } }

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(92vw, 380px);
}
.toast {
  padding: 12px 15px;
  border-radius: 11px;
  background: #12203f;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--brand);
  animation: slide-in 0.2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok); }
@keyframes slide-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 22, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 80;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  width: min(100%, 440px);
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 12px; font-size: 17px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* 登录页 */
.auth-wrap {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 30px 20px;
}
.auth-card {
  width: min(100%, 400px);
  background: var(--card);
  border-radius: 18px;
  padding: 28px 26px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 4px; font-size: 21px; }
.auth-card .sub { color: var(--ink-faint); font-size: 13.5px; margin-bottom: 20px; }
.form-err {
  display: none;
  padding: 9px 12px;
  border-radius: 9px;
  background: #fdecee;
  color: #a32b39;
  font-size: 13.5px;
  margin-bottom: 12px;
}
.form-err.show { display: block; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef3ff;
  color: #4d6bb0;
}
.tag.admin { background: #f3ecff; color: #7a53c9; }
.tag.off { background: #f1f2f6; color: #8b93a7; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--ink-faint); font-size: 13px; }
.nowrap { white-space: nowrap; }

/* 响应式 */
@media (max-width: 980px) {
  .detail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-header .bar { height: auto; flex-wrap: wrap; padding: 10px 0; gap: 10px; }
  .site-nav { order: 3; width: 100%; }
  .header-actions { margin-left: auto; }
  .grid, .skeleton-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .field { width: 100%; }
  .hero h1 { font-size: 21px; }
  .btn { min-height: 46px; }
}
