/* =========================================================
   西联素材库 · 样式
   配色取自三枚 logo：
     校徽金（昆明西南联大研究院附属学校）
     学生会紫（西联学生会圆形徽章）
     向日葵黄（西联小电视）
   设计取向：纸感底色 + 墨色文字 + 金/紫双强调，低干扰、信息优先
   ========================================================= */

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #fbf9f4;
  --tile: #f1ece2;
  --ink: #1a1815;
  --ink-2: #56503f;
  --ink-3: #8b8474;
  --line: #e6e1d4;
  --line-2: #d5cdb9;

  /* 品牌色 */
  --gold: #e3b23c;
  --gold-deep: #b8860b;
  --accent: #91660e;
  --accent-ink: #7a5307;
  --accent-soft: #faf0d7;
  --purple: #6f5ba8;
  --purple-soft: #efecf9;

  --ok: #2f6b4f;
  --warn: #8a6416;
  --danger: #9c4438;
  --danger-soft: #f7eae7;

  --radius: 4px;
  --topbar: 62px;
  --font: "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans SC",
    "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent-ink);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.01em;
}

p {
  margin: 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

img,
video {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--accent-soft);
}

/* --------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 2px 0 var(--gold);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 36px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand:hover {
  color: inherit;
}

/* 校徽：使用单独裁好的莲花图形，保持完整比例 */
.brand-mark {
  height: 34px;
  width: auto;
  display: block;
  mix-blend-mode: multiply;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.brand-text em {
  font-style: normal;
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 13px;
  color: var(--ink-2);
}

.nav a {
  position: relative;
  padding: 4px 0;
}

.nav a:hover {
  color: var(--ink);
}

.nav a.is-active {
  color: var(--ink);
}

.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--gold);
}

.nav .nav-count {
  display: inline-block;
  margin-left: 5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  vertical-align: 1px;
}

.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-3);
}

.account .who {
  color: var(--ink-2);
}

.account .who b {
  font-weight: 500;
  color: var(--ink);
}

/* --------------------------------------------------------- 通用布局 */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px 72px;
}

.page.narrow {
  max-width: 820px;
  padding-top: 8px;
}

.page-head {
  padding: 38px 0 26px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}

.page-head h1 {
  font-size: 25px;
  font-weight: 500;
}

.page-head .lede {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 13px;
}

.facts {
  display: flex;
  gap: 22px;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
  white-space: nowrap;
}

.facts b {
  color: var(--ink-2);
  font-weight: 500;
}

.layout {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 46px;
  align-items: start;
}

/* --------------------------------------------------------- 侧边筛选 */
.sidebar {
  position: sticky;
  top: calc(var(--topbar) + 26px);
  font-size: 13px;
}

.side-block + .side-block {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.side-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.side-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% + 16px);
  margin: 0 -8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  line-height: 1.6;
}

.side-item:hover {
  background: #f0ebdf;
  color: var(--ink);
}

.side-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.side-item .count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}

.side-item.is-active .count {
  color: var(--accent-ink);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 2px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--ink-2);
  cursor: pointer;
}

.tag-chip:hover {
  border-color: var(--line-2);
  color: var(--ink);
}

.tag-chip.is-active {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.side-note {
  margin-top: 26px;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.7;
}

/* --------------------------------------------------------- 内容区顶部 */
.content-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.search {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.search input {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
}

.search input::placeholder {
  color: var(--ink-3);
}

.search input:focus {
  border-color: var(--line-2);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.search svg {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.result-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-3);
}

.select-quiet {
  height: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px;
  padding: 0 6px;
  font-size: 12px;
  color: var(--ink-2);
  font-family: inherit;
}

/* --------------------------------------------------------- 画廊 */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 26px 22px;
}

.card {
  min-width: 0;
}

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  background: var(--tile);
  overflow: hidden;
  border-radius: 2px;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

.thumb:hover img {
  opacity: 0.94;
}

.thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-3);
}

.thumb-fallback .glyph {
  width: 30px;
  height: 30px;
  opacity: 0.75;
}

.thumb-fallback .ext {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.thumb-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 1px 7px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 10px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}

.thumb-badge.is-link {
  left: auto;
  right: 8px;
  color: var(--ok);
  border-color: #cfe3d7;
  background: rgba(233, 243, 236, 0.96);
  letter-spacing: 0.06em;
}

.card-body {
  padding: 9px 1px 0;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-3);
}

.card-meta .dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--line-2);
}

.card-meta .mono {
  font-family: var(--mono);
  font-size: 10px;
}

/* --------------------------------------------------------- 空状态 / 加载 */
.empty {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 62px 24px;
  text-align: center;
  color: var(--ink-3);
}

.empty strong {
  display: block;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 6px;
}

.empty p {
  font-size: 13px;
  margin-bottom: 18px;
}

.empty .btn-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.loading-text {
  padding: 40px 0;
  color: var(--ink-3);
  font-size: 13px;
}

.load-more {
  margin-top: 34px;
  text-align: center;
}

/* --------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 15px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.btn.primary:hover {
  background: #2b2926;
  border-color: #2b2926;
  color: #fff;
}

.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.accent:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
  color: #fff;
}

.btn.danger {
  color: var(--danger);
  border-color: #e2cbc6;
  background: #fff;
}

.btn.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn.small {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
}

.btn.ghost:hover {
  color: var(--ink);
  border-color: var(--line-2);
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-ink);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------- 表单/面板 */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}

.panel + .panel {
  margin-top: 18px;
}

.panel-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* .field 的 display:flex 会覆盖浏览器默认的 [hidden]，这里显式还原 */
.field[hidden] {
  display: none;
}

.field.full {
  grid-column: 1 / -1;
}

.field > label {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.field .required {
  color: var(--accent);
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}

.input,
.select {
  height: 36px;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--line-2);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.help {
  font-size: 11px;
  color: var(--ink-3);
}

.form-actions {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-error {
  color: var(--danger);
  font-size: 12px;
  min-height: 18px;
}

/* --------------------------------------------------------- 拖拽上传 */
.dropzone {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 38px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--gold-deep);
  background: #fdfaf1;
}

.dropzone .dz-main {
  font-size: 14px;
  color: var(--ink-2);
}

.dropzone .dz-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-3);
}

.dropzone .dz-icon {
  color: var(--ink-3);
  margin-bottom: 12px;
}

.file-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 176px 56px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.file-row:first-child {
  border-top: 0;
}

.file-name {
  min-width: 0;
}

.file-name .name {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-name .sub {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--mono);
}

.file-row .title-input {
  height: 30px;
  font-size: 12px;
}

.progress {
  height: 3px;
  background: #ece7db;
  border-radius: 2px;
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

#link-progress {
  margin-top: 10px;
  height: 5px;
}

.batch-fail {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-3);
}

.file-status {
  font-size: 11px;
  color: var(--ink-3);
  text-align: right;
  font-family: var(--mono);
  cursor: pointer;
}

.file-status.is-done {
  color: var(--ok);
}

.file-status.is-error {
  color: var(--danger);
}

.file-remove {
  border: 0;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
}

.file-remove:hover {
  color: var(--accent-ink);
}

/* --------------------------------------------------------- 详情页 */
.back-link {
  display: inline-block;
  margin: 26px 0 18px;
  font-size: 12px;
  color: var(--ink-3);
}

.back-link:hover {
  color: var(--ink);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 40px;
  align-items: start;
}

.preview {
  border: 1px solid var(--line);
  background: #eae5d9;
  border-radius: 2px;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview img {
  max-width: 100%;
  max-height: 74vh;
  object-fit: contain;
}

.preview video {
  width: 100%;
  max-height: 74vh;
  background: #121110;
}

.preview audio {
  width: min(520px, 90%);
}

.preview iframe {
  width: 100%;
  height: 74vh;
  border: 0;
  background: #fff;
}

.preview .preview-file {
  padding: 60px 30px;
  text-align: center;
  color: var(--ink-2);
}

.preview .preview-file .glyph {
  margin: 0 auto 14px;
  color: var(--ink-3);
}

.preview .preview-file .fname {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  word-break: break-all;
  margin-bottom: 18px;
}

.detail-side {
  padding-top: 2px;
}

.unit-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 2px;
}

/* 主体标识：学生会用 logo 紫，小电视用 logo 金 */
.unit-tag[data-unit="union"] {
  color: var(--purple);
  background: var(--purple-soft);
}

.unit-tag[data-unit="tv"] {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.detail-title {
  font-size: 22px;
  line-height: 1.45;
  margin: 12px 0 6px;
  font-weight: 500;
  word-break: break-word;
}

.detail-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 22px;
}

.meta-list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.meta-list div {
  display: flex;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.meta-list dt {
  width: 64px;
  flex: none;
  color: var(--ink-3);
}

.meta-list dd {
  margin: 0;
  color: var(--ink-2);
  word-break: break-word;
}

.note-block {
  margin-top: 20px;
}

.note-block h3 {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.note-block p {
  font-size: 13px;
  color: var(--ink-2);
  white-space: pre-wrap;
  line-height: 1.75;
}

.detail-actions {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-row .tag {
  font-size: 11px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  padding: 1px 7px;
  border-radius: 2px;
}

/* --------------------------------------------------------- 管理后台 */
.tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
  font-size: 13px;
}

.tab {
  border: 0;
  background: none;
  padding: 10px 0;
  color: var(--ink-3);
  cursor: pointer;
  position: relative;
}

.tab:hover {
  color: var(--ink-2);
}

.tab.is-active {
  color: var(--ink);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.tab .count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-left: 4px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 15px;
  font-weight: 500;
}

.table-wrap {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

table.data th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover {
  background: var(--surface-2);
}

table.data td .cell-title {
  color: var(--ink);
  font-size: 13px;
}

table.data td.actions {
  text-align: right;
  white-space: nowrap;
}

table.data .mono {
  font-family: var(--mono);
  font-size: 11px;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-3);
}

.status.pending::before {
  background: var(--warn);
}

.status.approved::before {
  background: var(--ok);
}

.status.rejected::before {
  background: var(--line-2);
}

/* 投稿卡片 */
.submission-list {
  display: grid;
  gap: 16px;
}

.submission {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
}

.submission .sub-thumb {
  width: 132px;
  height: 99px;
  border: 1px solid var(--line);
  background: var(--tile);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  border-radius: 2px;
}

.submission .sub-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.submission h3 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.submission .sub-meta {
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
  font-family: var(--mono);
}

.submission .sub-desc {
  font-size: 12px;
  color: var(--ink-2);
  white-space: pre-wrap;
  margin-bottom: 12px;
}

.submission .sub-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.submission.is-approved {
  opacity: 0.72;
}

/* --------------------------------------------------------- 登录页 */
.auth-wrap {
  min-height: calc(100vh - var(--topbar));
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 24px;
}

.auth-card {
  width: 100%;
  max-width: 384px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}

/* 登录 / 注册页顶部的三枚 logo */
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.auth-brand .auth-school {
  width: 208px;
  height: auto;
  mix-blend-mode: multiply;
}

.auth-orgs {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 11px;
  color: var(--ink-3);
}

.auth-orgs span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth-orgs img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
}

.auth-card h1 {
  font-size: 19px;
  margin-bottom: 6px;
  text-align: center;
}

.auth-card .sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 24px;
  text-align: center;
}

.auth-card .field + .field {
  margin-top: 14px;
}

.auth-card .btn {
  width: 100%;
  margin-top: 20px;
}

.auth-foot {
  margin-top: 18px;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.8;
}

.auth-foot a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 注册时的身份切换（普通成员 / 管理员） */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.segmented label {
  position: relative;
  display: block;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(26, 24, 21, 0.1);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.segmented input:checked + span[data-role="admin"] {
  color: var(--accent-ink);
}

/* --------------------------------------------------------- 提示 / 弹窗 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 10px);
  background: #1d1c1a;
  color: #f5f2ec;
  font-size: 12px;
  padding: 9px 16px;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 100;
  max-width: 80vw;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  background: #7d2f27;
}

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  width: min(520px, calc(100vw - 48px));
  background: var(--surface);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(26, 25, 23, 0.42);
}

dialog h2 {
  font-size: 16px;
  margin-bottom: 18px;
}

dialog .dialog-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.notice {
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: var(--surface);
  padding: 14px 16px;
  font-size: 12px;
  color: var(--ink-2);
  border-radius: 2px;
  line-height: 1.8;
}

.notice b {
  color: var(--ink);
  font-weight: 500;
}

/* --------------------------------------------------------- 页脚 */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding: 22px 32px 30px;
  color: var(--ink-3);
  font-size: 11px;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 28px;
  font-family: var(--mono);
}

.footer-logos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-logos .footer-school {
  height: 24px;
  width: auto;
  opacity: 0.85;
  mix-blend-mode: multiply;
}

.footer-org {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-org img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  mix-blend-mode: multiply;
}

/* --------------------------------------------------------- 响应式（桌面优先，窄屏兜底） */
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .sidebar {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 18px 30px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
  }

  .side-block + .side-block {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .side-block {
    min-width: 150px;
    flex: 1;
  }

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

  .preview {
    min-height: 280px;
  }
}

@media (max-width: 720px) {
  .topbar-inner,
  .page {
    padding-left: 18px;
    padding-right: 18px;
  }

  .nav {
    gap: 16px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .file-row {
    grid-template-columns: 1fr 90px 48px;
    grid-template-rows: auto auto;
  }

  .file-row .title-input {
    grid-column: 1 / -1;
    grid-row: 2;
  }

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

  .submission .sub-thumb {
    width: 100%;
    height: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* =========================================================
   手机端适配（<=720px）
   ========================================================= */
@media (max-width: 720px) {
  .topbar-inner {
    padding: 0 14px;
    gap: 10px;
  }

  .brand-text em {
    display: none;
  }

  .brand-text strong {
    font-size: 13px;
    letter-spacing: 0.02em;
  }

  .brand-mark {
    height: 28px;
  }

  .nav {
    gap: 12px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    font-size: 13px;
    padding: 4px 0;
    white-space: nowrap;
  }

  .account {
    gap: 8px;
    flex: none;
  }

  .account .who {
    display: none;
  }

  .account .btn.small {
    padding: 5px 10px;
    font-size: 12px;
  }

  .page {
    padding: 0 14px 56px;
  }

  .page-head {
    padding: 22px 0 16px;
    margin-bottom: 18px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .page-head h1 {
    font-size: 20px;
  }

  .page-head .lede {
    font-size: 12px;
    line-height: 1.7;
  }

  .facts {
    font-size: 11px;
  }

  /* 筛选：横向胶囊，不再占半屏高度 */
  .sidebar {
    display: block;
    padding-bottom: 12px;
    margin-bottom: 16px;
  }

  .side-block,
  .side-block + .side-block {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    min-width: 0;
  }

  .side-block + .side-block {
    margin-top: 10px;
  }

  .side-title {
    font-size: 10px;
    margin-bottom: 6px;
  }

  #unit-filters,
  #category-filters,
  #time-filters,
  #folder-filters,
  .tag-cloud {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  #unit-filters::-webkit-scrollbar,
  #category-filters::-webkit-scrollbar,
  #time-filters::-webkit-scrollbar,
  .tag-cloud::-webkit-scrollbar {
    display: none;
  }

  .side-item {
    width: auto;
    margin: 0;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    white-space: nowrap;
    flex: none;
    font-size: 12px;
  }

  .side-item .count {
    margin-left: 5px;
    font-size: 10px;
  }

  .side-note {
    display: none;
  }

  .tag-cloud .tag-chip,
  .tag-cloud button {
    flex: none;
    white-space: nowrap;
  }

  /* 搜索与排序 */
  .content-head {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }

  .search {
    flex: 1 1 100%;
    max-width: none;
  }

  .search input {
    height: 38px;
    font-size: 16px;
  }

  .result-meta {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    font-size: 12px;
  }

  .select-quiet {
    font-size: 16px;
  }

  /* 素材卡片：两列 */
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }

  .card-title {
    font-size: 13px;
    line-height: 1.45;
  }

  .card-body {
    padding-top: 8px;
  }

  .card-meta {
    font-size: 10.5px;
    gap: 4px;
    flex-wrap: wrap;
  }

  .thumb-badge {
    font-size: 10px;
    padding: 2px 7px;
  }

  /* 详情 */
  .detail-grid {
    gap: 16px;
  }

  .preview {
    min-height: 220px;
  }

  .detail-title {
    font-size: 19px;
  }

  /* 表单控件统一 16px，避免 iOS 聚焦时页面缩放 */
  .field input,
  .field select,
  .field textarea,
  .file-row input {
    font-size: 16px;
  }

  .submission {
    gap: 12px;
  }

  .submission .sub-thumb {
    height: 180px;
  }

  .btn-row {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* 手机端：阻止筛选胶囊把网格列撑宽导致横向滚动 */
@media (max-width: 720px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
  }

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

  .sidebar,
  .content,
  .side-block,
  #unit-filters,
  #category-filters,
  #time-filters,
  #folder-filters,
  .tag-cloud,
  .content-head,
  .search,
  .result-meta,
  .gallery,
  .card {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  #unit-filters,
  #category-filters,
  #time-filters,
  #folder-filters,
  .tag-cloud {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* 手机端：筛选胶囊改为换行显示，避免最后一个被裁切 */
@media (max-width: 720px) {
  #unit-filters,
  #category-filters,
  #time-filters,
  #folder-filters,
  .tag-cloud {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
    gap: 8px;
  }
}

/* 让 hidden 属性始终生效（按钮/区块自身设置了 display 时也不会露出） */
[hidden] {
  display: none !important;
}

/* ---------- 文件夹 ---------- */
.side-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.side-title-row .link-btn {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- 文件夹说明条 ---------- */
.folder-banner {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-2);
}

.folder-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* 文件夹右键菜单 */
.ctx-menu {
  position: fixed;
  z-index: 80;
  min-width: 156px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: var(--paper, #fff);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 12px 30px rgba(26, 24, 21, 0.16);
}

.ctx-menu button {
  text-align: left;
  padding: 8px 10px;
  border: 0;
  background: none;
  border-radius: 3px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}

.ctx-menu button:hover {
  background: var(--surface);
  color: var(--ink);
}

.ctx-menu button.is-danger {
  color: #b3372c;
}

.ctx-menu button.is-danger:hover {
  background: rgba(179, 55, 44, 0.08);
  color: #b3372c;
}

.folder-banner b {
  font-weight: 500;
  color: var(--ink);
}

.folder-banner .folder-banner-note {
  color: var(--ink-3);
  font-size: 12px;
}

/* ---------- 上传页：上传文件 / 分享外部链接 切换 ---------- */
.mode-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 22px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
}

.mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mode-btn:hover {
  color: var(--ink);
}

.mode-btn.is-active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26, 24, 21, 0.16);
}

/* ---------- 外链素材标识 ---------- */
.source-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  background: var(--tile);
}

.source-tag.is-link {
  color: var(--ok);
  background: #e9f3ec;
}

/* ---------- 网盘推荐卡片 ---------- */
.tip-card {
  margin-top: 18px;
  padding: 24px 26px;
  border: 1px solid #e7dcc0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fdfaf2, #faf5e8);
}

.tip-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tip-badge {
  padding: 2px 7px;
  border-radius: 2px;
  background: #f3e3b9;
  color: var(--accent-ink);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.tip-head h2 {
  font-size: 15px;
  font-weight: 500;
}

.tip-desc {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-2);
}

.tip-list {
  margin: 14px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.95;
  color: var(--ink-2);
}

.tip-list strong {
  font-weight: 600;
  color: var(--ink);
}

.tip-warn {
  margin-top: 12px;
  padding: 8px 12px;
  border-left: 2px solid #d99a3d;
  border-radius: 2px;
  background: #fbeed8;
  font-size: 12px;
  color: #8a4a13;
}

.tip-link {
  display: inline-block;
  margin-top: 14px;
  padding-bottom: 1px;
  border-bottom: 1px solid rgba(145, 102, 14, 0.35);
  font-size: 13px;
  color: var(--accent-ink);
}

.tip-link:hover {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

/* ---------- 客户端推荐小卡片 ---------- */
.rec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.rec-item {
  padding: 12px 14px;
  border: 1px solid #eadfc4;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.66);
}

.rec-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.rec-tag {
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-3);
  white-space: nowrap;
}

.rec-item p {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-3);
}

.guide-sub {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.guide-sub:first-of-type {
  margin-top: 0;
}


@media (max-width: 720px) {
  .mode-switch {
    display: flex;
    width: 100%;
  }

  .mode-btn {
    flex: 1;
    padding: 10px 12px;
  }

  .tip-card {
    padding: 20px 18px;
  }

  .tip-head {
    align-items: center;
    flex-wrap: wrap;
  }

  .tip-badge {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .tip-head h2 {
    font-size: 14px;
    line-height: 1.6;
  }

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

  .form-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .form-actions .btn {
    width: 100%;
  }
}

/* ---------- 直链教程页 ---------- */
.guide-text {
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-2);
}

.guide-text strong {
  color: var(--ink);
  font-weight: 500;
}

.guide-check {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.guide-check li {
  position: relative;
  padding-left: 22px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-2);
}

.guide-check li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 13px;
  line-height: 1.8;
}

.guide-check li.ok::before {
  content: "✓";
  color: var(--ok);
}

.guide-check li.no::before {
  content: "✕";
  color: var(--danger);
}

.guide-check code {
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--tile);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
}

.guide-callout {
  margin-top: 16px;
  padding: 10px 14px;
  border-left: 2px solid var(--accent);
  border-radius: 2px;
  background: var(--accent-soft);
  font-size: 12px;
  line-height: 1.8;
  color: var(--accent-ink);
}

.guide-steps {
  margin: 0;
  padding-left: 20px;
  counter-reset: step;
}

.guide-steps li {
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink);
}

.guide-steps li:last-child {
  margin-bottom: 0;
}

.guide-steps strong {
  font-weight: 500;
}

.guide-steps p {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-3);
}

.guide-table-wrap {
  margin-top: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.guide-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.7;
}

.guide-table th,
.guide-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  color: var(--ink-2);
}

.guide-table th {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  background: var(--surface-2);
  white-space: nowrap;
}

.guide-table td strong {
  font-weight: 500;
  color: var(--ink);
}

.guide-faq {
  margin: 0;
}

.guide-faq dt {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.guide-faq dt:first-child {
  margin-top: 0;
}

.guide-faq dd {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-3);
}

/* 按月份分组的时间分隔标题 */
.time-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.time-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.time-divider:first-child {
  margin-top: 0;
}

/* 批量选择：卡片勾选 + 底部操作条 */
.card.is-selectable {
  cursor: pointer;
}

.card.is-selectable .thumb {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card.is-selectable:hover .thumb {
  border-color: var(--ink-3);
}

.card.is-selected .thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.card-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  background: rgba(26, 24, 21, 0.35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.card.is-selected .card-check {
  background: var(--accent);
  border-color: var(--accent);
}

.card.is-selected .card-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

.card {
  position: relative;
}

.select-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--paper, #fff);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 32px rgba(26, 24, 21, 0.16);
}

.select-bar .select-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  padding: 0 4px;
  white-space: nowrap;
}

#select-toggle.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 720px) {
  .select-bar {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
  }

  .select-bar .btn {
    padding: 6px 10px;
  }
}



