:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e2a3a;
  --muted: #6b7a90;
  --line: #e3e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #0f9d58;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(23, 43, 77, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

.hidden { display: none !important; }

button, input, select { font: inherit; }

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 20%, #dbeafe, transparent 55%),
              radial-gradient(circle at 80% 80%, #cffafe, transparent 55%),
              var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: 0 18px 50px rgba(23, 43, 77, 0.14);
}

.login-card .brand { margin-bottom: 26px; }

.login-card form { display: flex; flex-direction: column; gap: 16px; }

.login-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }

.login-card input {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--text);
  background: #fbfcfe;
}

.login-card input:focus { border-color: var(--primary); background: #fff; }

.error-text { color: var(--danger); min-height: 18px; margin: 0; font-size: 13px; }

.download-app {
  display: block;
  margin-top: 16px;
  text-align: center;
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
  padding: 10px;
  border-radius: 9px;
  background: #eff4ff;
}
.download-app:hover { background: #e2ebff; }

/* 品牌 */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}
.brand h1 { font-size: 18px; margin: 0; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.brand.small .brand-logo { width: 36px; height: 36px; font-size: 16px; border-radius: 10px; }
.brand.small h1 { font-size: 16px; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-chip {
  background: #eff4ff; color: var(--primary);
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
}

/* 按钮 */
.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all .15s ease;
  background: #eef2f8;
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { filter: brightness(0.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: #cfd8e6; }
.btn.success { background: var(--success); color: #fff; }
.btn.danger { background: #fdecec; color: var(--danger); }
.btn.block { width: 100%; padding: 11px; font-size: 15px; }
.btn.tiny { padding: 4px 10px; font-size: 12px; border-radius: 7px; }

/* 标签页 */
.tabs {
  display: flex; gap: 6px;
  padding: 14px 28px 0;
  max-width: 1280px; margin: 0 auto;
}
.tab {
  border: none; background: transparent; cursor: pointer;
  padding: 9px 16px; border-radius: 9px 9px 0 0;
  color: var(--muted); font-size: 14px;
}
.tab.active { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

main { max-width: 1280px; margin: 0 auto; padding: 18px 28px 60px; }

.panel { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* 筛选 */
.filters {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
}
.filters label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.filters input, .filters select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: #fbfcfe; color: var(--text); min-width: 140px; outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--primary); background: #fff; }
.filters-actions { display: flex; gap: 8px; margin-left: auto; }

.list-head {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--muted); font-size: 13px;
}

.list-head-actions { display: flex; gap: 8px; }

.invite-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--primary);
  background: #eff4ff;
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 6px;
}

/* 照片网格 */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.photo-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
}
.photo-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(23, 43, 77, 0.12); }

.photo-card img {
  width: 100%; height: 150px; object-fit: cover; display: block; background: #e8edf5;
}

.photo-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.photo-info .title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-info .sub { color: var(--muted); font-size: 12px; }

.photo-delete {
  position: absolute; top: 8px; right: 8px;
  background: rgba(15, 23, 42, 0.62); color: #fff; border: none;
  border-radius: 8px; padding: 5px 9px; font-size: 12px; cursor: pointer;
  opacity: 0; transition: opacity .15s ease;
}
.photo-card:hover .photo-delete { opacity: 1; }
.photo-delete:hover { background: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--muted); }

/* 表格 */
.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th, .data-table td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px;
}
.data-table th { background: #f8fafd; color: var(--muted); font-weight: 600; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafcff; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.tag.on { background: #e7f7ee; color: var(--success); }
.tag.off { background: #f3f4f6; color: var(--muted); }
.tag.admin { background: #eff4ff; color: var(--primary); }

.member-list { color: var(--muted); font-size: 12px; }

/* 对话框 */
.dialog-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px;
}
.dialog {
  width: 100%; max-width: 440px; background: #fff; border-radius: 16px; padding: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}
.dialog h3 { margin: 0 0 16px; font-size: 16px; }
.dialog label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.dialog input, .dialog select, .dialog textarea {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: #fbfcfe; color: var(--text); outline: none;
  font-family: inherit; resize: vertical;
}
.dialog input:focus, .dialog select:focus, .dialog textarea:focus { border-color: var(--primary); background: #fff; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.checkbox-group {
  display: flex; flex-wrap: wrap; gap: 8px;
  border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: #fbfcfe;
}
.checkbox-item { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }

/* 预览 */
.viewer {
  position: fixed; inset: 0; background: rgba(9, 14, 24, 0.92);
  display: flex; flex-direction: column; z-index: 80;
}
.viewer-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; color: #e2e8f0; font-size: 13px;
}
.viewer img {
  flex: 1; object-fit: contain; max-width: 100%; min-height: 0; padding: 0 20px 20px;
}

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13px; z-index: 100; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .brand h1 { font-size: 16px; }
  .brand p { display: none; }
  .topbar-right { width: 100%; justify-content: flex-end; }
  .user-chip { font-size: 12px; padding: 5px 10px; }

  .tabs {
    padding: 10px 12px 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .tab { white-space: nowrap; padding: 8px 13px; font-size: 13px; }

  main { padding: 12px 12px 40px; }

  .filters { gap: 10px; }
  .filters label { flex: 1 1 46%; min-width: 0; }
  .filters input,
  .filters select { width: 100%; min-width: 0; }
  .filters-actions {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }
  .filters-actions .btn { flex: 1 1 40%; }

  .list-head {
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
  }
  .list-head-actions { width: 100%; flex-wrap: wrap; }
  .list-head-actions .btn { flex: 1 1 auto; }

  .card { padding: 12px; }

  .panel { overflow-x: auto; }
  .data-table { min-width: 680px; }
  .data-table th,
  .data-table td { padding: 9px 10px; font-size: 12px; }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  .photo-card img { height: 120px; }

  .dialog { padding: 16px; border-radius: 14px; }
  .dialog h3 { font-size: 15px; }
  .viewer-bar { padding: 10px 12px; }
  .pagination { flex-wrap: wrap; gap: 10px; }
}

