/* 鱼刺记录站 - 视觉系统
 * 配色（来自 uisdc 高级感配色 - 搪瓷食盒）：
 *   奶油 #F5F0EB   / 潮蓝 #558CE6   / 暖红 #FA321E   / 深墨 #1B1B1F
 * 移动优先响应式：≤640 单列，641–1024 平板，>1024 桌面
 */

:root {
  --c-cream:   #F5F0EB;
  --c-blue:    #558CE6;
  --c-red:     #FA321E;
  --c-ink:     #1B1B1F;
  --c-paper:   #FFFFFF;
  --c-line:    #E8E2D9;
  --c-muted:   #7A746E;
  --c-blue-soft: #E8F0FB;
  --c-red-soft:  #FFE7E2;
  --c-cream-soft:#FBF6F0;
  --radius:    14px;
  --shadow:    0 8px 24px rgba(27,27,31,.06), 0 2px 6px rgba(27,27,31,.04);
  --shadow-lg: 0 18px 40px rgba(27,27,31,.10), 0 4px 12px rgba(27,27,31,.06);
  --font:      'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  --tap:       44px; /* 最小触控目标 */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--c-ink);
  background: var(--c-cream);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }

/* ========== 布局 ========== */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ========== 顶栏 ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--c-paper);
  border-bottom: 1px solid var(--c-line);
  position: sticky; top: 0; z-index: 50;
  gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 16px; letter-spacing: .3px;
  min-width: 0;
}
.brand-logo {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--c-red); color: #fff;
  border-radius: 8px; font-weight: 900; font-size: 16px;
  flex-shrink: 0;
}
.brand-name {
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topnav {
  display: flex; align-items: center; gap: 14px;
  font-size: 13px;
  flex-shrink: 0;
}
.topnav a {
  color: var(--c-muted);
  padding: 8px 4px;
  min-height: var(--tap);
  display: inline-flex; align-items: center;
  transition: color .2s;
}
.topnav a:hover, .topnav a:focus-visible { color: var(--c-ink); }
.badge-user {
  padding: 4px 10px;
  background: var(--c-cream-soft);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  font-size: 12px; color: var(--c-ink);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-quit { color: var(--c-red) !important; }

/* ========== 主区 ========== */
.app-main {
  flex: 1;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  min-width: 0;
}
.app-footer {
  padding: 20px 16px;
  text-align: center;
  color: var(--c-muted);
  font-size: 13px;
  border-top: 1px solid var(--c-line);
}

/* ========== Flash 提示 ========== */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid;
}
.flash-success { background: #E6F7EC; border-color: #B7E5C6; color: #1F6E3A; }
.flash-error   { background: var(--c-red-soft); border-color: #F5BDB3; color: #8A2412; }
.flash-info    { background: var(--c-blue-soft); border-color: #BFD6F1; color: #2A4E83; }

/* ========== 通用排版 ========== */
h1, h2, h3 { margin: 0 0 10px; letter-spacing: .3px; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }

.page-head {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 12px;
  margin-bottom: 20px;
}
.page-head > div { min-width: 0; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--c-muted); font-size: 13px; margin-top: -4px; }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 0 18px;
  min-height: var(--tap);
  border: none; cursor: pointer;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
  font-family: inherit;
  transition: transform .15s, box-shadow .2s, background .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--c-blue-soft); outline-offset: 2px; }
.btn-primary { background: var(--c-ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-blue { background: var(--c-blue); color: #fff; }
.btn-blue:hover { background: #4577CC; }
.btn-red { background: var(--c-red); color: #fff; }
.btn-red:hover { background: #DC2712; }
.btn-ghost {
  background: transparent; color: var(--c-ink);
  border: 1px solid var(--c-line);
}
.btn-ghost:hover { background: var(--c-cream-soft); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ========== 表单 ========== */
.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--c-line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 16px; /* iOS 防止缩放 */
  color: var(--c-ink);
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus, .textarea:focus, .select:focus,
.input:focus-visible, .textarea:focus-visible, .select:focus-visible {
  outline: none;
  border-color: var(--c-blue);
  box-shadow: 0 0 0 3px var(--c-blue-soft);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
label { display: block; font-size: 13px; color: var(--c-muted); margin-bottom: 6px; font-weight: 600; }
.field { margin-bottom: 14px; }

/* ========== 卡片 ========== */
.card {
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* 文件夹卡片 */
.folder-card {
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: block;
}
.folder-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--c-blue);
  opacity: .85;
}
.folder-card:active { transform: scale(.98); }
.folder-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-blue);
}
.folder-card .icon {
  width: 40px; height: 40px;
  background: var(--c-blue-soft);
  color: var(--c-blue);
  border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 12px;
  font-size: 20px;
}
.folder-card .name {
  font-weight: 700; font-size: 16px;
  margin-bottom: 2px;
  word-break: break-word;
}
.folder-card .desc { color: var(--c-muted); font-size: 13px; word-break: break-word; }
.folder-card .meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px;
  font-size: 12px; color: var(--c-muted);
}

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
.table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  background: var(--c-paper);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--c-line);
}
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--c-line);
  font-size: 13px;
  word-break: break-word;
}
.table th {
  background: var(--c-cream-soft);
  font-weight: 700;
  color: var(--c-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  white-space: nowrap;
}
.table tr:last-child td { border-bottom: none; }

/* ========== 状态徽章 ========== */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-pending { background: #FFF4DC; color: #8A6B14; }
.tag-ok      { background: #E6F7EC; color: #1F6E3A; }
.tag-no      { background: var(--c-red-soft); color: #8A2412; }
.tag-stop    { background: #E8E8E8; color: #555; }

/* ========== 登录/注册 ========== */
.auth-wrap {
  min-height: calc(100vh - 56px);
  min-height: calc(100dvh - 56px);
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--c-paper);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--c-line);
}
.auth-card h1 { text-align: center; margin-bottom: 4px; font-size: 22px; }
.auth-card .sub { text-align: center; color: var(--c-muted); font-size: 13px; margin-bottom: 20px; }
.auth-card .btn { width: 100%; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--c-muted); }
.auth-foot a { color: var(--c-blue); font-weight: 600; }

/* ========== 翻页器 ========== */
.pagination {
  display: flex; align-items: center; gap: 8px;
  margin-top: 20px; justify-content: center;
  flex-wrap: wrap;
}

/* 翻页按钮 */
.page-btn {
  --color: #fff;
  --bg: var(--c-ink);
  --hover: var(--c-red);
  background: var(--bg);
  color: var(--color);
  border: none;
  width: var(--tap); height: var(--tap);
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 18px;
  transition: background .25s, transform .15s;
  text-decoration: none;
}
.page-btn:hover:not(:disabled):not(.is-disabled) { background: var(--hover); transform: scale(1.05); }
.page-btn:focus-visible { outline: 3px solid var(--c-blue-soft); outline-offset: 2px; }
.page-btn.is-disabled {
  background: var(--c-line);
  color: var(--c-muted);
  cursor: not-allowed;
}
.page-info {
  font-size: 13px;
  color: var(--c-muted);
  padding: 0 12px;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}

/* 返回按钮 */
.back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 14px;
  min-height: 36px;
  background: transparent;
  border: 1.5px solid var(--c-ink);
  color: var(--c-ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, color .2s;
  text-decoration: none;
}
.back-btn:hover, .back-btn:focus-visible { background: var(--c-ink); color: #fff; }
.back-btn .arr { display: inline-block; transition: transform .2s; }
.back-btn:hover .arr,
.back-btn:focus-visible .arr { transform: none; }

/* ========== 空状态 ========== */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--c-muted);
  background: var(--c-paper);
  border: 1px dashed var(--c-line);
  border-radius: var(--radius);
}
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ========== 详情页 ========== */
.detail-head {
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--c-red);
}
.detail-head-top {
  display: flex; flex-direction: column; gap: 14px;
}
.detail-head-info { min-width: 0; }
.detail-head-actions {
  display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px;
}
.detail-head-actions .btn,
.detail-head-actions .back-btn {
  min-height: var(--tap);
  padding: 0 16px;
  flex: 0 1 auto;
}
.detail-head-actions .btn-red { flex: 1 1 auto; min-width: 120px; }
.detail-head-actions > * { margin: 0; }
.folder-delete-form { margin: 0; }
.record-delete-form { margin: 0; }
.detail-head h1 { font-size: 20px; word-break: break-word; }
.detail-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--c-muted);
  margin-top: 8px;
}
.detail-meta strong { color: var(--c-ink); }

.record-block {
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.record-block .title {
  font-weight: 700; font-size: 15px;
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 8px;
  word-break: break-word;
}
.record-block .title > span { word-break: break-word; }
.record-block .title form { align-self: flex-start; margin: 0; }
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.thumbs a {
  aspect-ratio: 1/1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--c-cream-soft);
  border: 1px solid var(--c-line);
  display: block;
}
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ========== 后台 ========== */
.admin-shell {
  display: flex; flex-direction: column;
  gap: 16px;
  width: 100%;
  padding: 0;
}
.admin-side {
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 14px;
}
.admin-side h3 {
  font-size: 11px;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 12px 0 6px;
}
.admin-side h3:first-child { margin-top: 0; }
.admin-side a {
  display: flex; align-items: center;
  padding: 10px 12px;
  min-height: var(--tap);
  border-radius: 8px;
  font-size: 14px;
  color: var(--c-ink);
}
.admin-side a:hover, .admin-side a.active {
  background: var(--c-cream-soft);
  color: var(--c-red);
}
.admin-side .spacer { height: 8px; }
.admin-main { min-width: 0; }
.admin-main h2 { margin-top: 24px; }
.admin-main h2:first-child { margin-top: 0; }

.admin-search { display: flex; flex-direction: column; gap: 8px; }
.admin-search > * { width: 100%; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.stat {
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 14px;
}
.stat .num { font-size: 22px; font-weight: 800; color: var(--c-ink); }
.stat .lbl { font-size: 12px; color: var(--c-muted); margin-top: 2px; }
.stat.blue .num { color: var(--c-blue); }
.stat.red  .num { color: var(--c-red); }

/* ========== 模态框 ========== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(27,27,31,.55);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 100; padding: 0;
}
.modal-mask.open { display: flex; }
.modal {
  background: var(--c-paper);
  border-radius: 16px 16px 0 0;
  padding: 22px 18px;
  width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.modal h2 { margin-bottom: 14px; font-size: 18px; }
.modal-actions {
  display: flex; gap: 10px;
  margin-top: 16px;
  flex-direction: column-reverse;
}
.modal-actions .btn { width: 100%; }

/* ========== 文件上传 ========== */
.file-drop {
  border: 2px dashed var(--c-line);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  color: var(--c-muted);
  background: var(--c-cream-soft);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  min-height: 100px;
  display: flex; align-items: center; justify-content: center;
}
.file-drop:hover, .file-drop.drag {
  border-color: var(--c-blue);
  background: var(--c-blue-soft);
  color: var(--c-blue);
}
.file-preview {
  width: 100%;
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: center;
}
.file-preview .file-hint { font-size: 13px; padding: 14px 0; }
.file-preview .preview-item {
  position: relative;
  width: 96px; height: 96px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--c-line);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.file-preview .preview-item img,
.file-preview .preview-item .preview-file {
  width: 100%; height: 100%;
  object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--c-muted);
}
.file-preview .preview-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(27,27,31,.72);
  color: #fff;
  font-size: 10px;
  padding: 3px 6px;
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-preview .preview-remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: rgba(27,27,31,.72); color: #fff;
  cursor: pointer; font-size: 14px; line-height: 1;
  display: grid; place-items: center;
}
.file-preview .preview-remove:hover { background: var(--c-red); }

/* ========== Lightbox 图片悬浮查看 ========== */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(27,27,31,.92);
  z-index: 200;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  -webkit-tap-highlight-color: transparent;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%; max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
  background: #fff;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  border: none; cursor: pointer;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  display: grid; place-items: center;
  font-size: 22px; line-height: 1;
  transition: background .2s;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,.3); }
.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }
.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-caption {
  position: absolute; left: 0; right: 0; bottom: 16px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  padding: 0 16px;
  word-break: break-all;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ========== Skip Link ========== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 16px;
  background: var(--c-ink);
  color: #fff;
  border-radius: 0 0 8px 0;
  font-size: 13px;
  z-index: 999;
}
.skip-link:focus, .skip-link:focus-visible {
  left: 0;
  outline: 3px solid var(--c-blue);
}

/* ========== 工具 ========== */
button, .btn, a.btn, .folder-card, .back-btn, .page-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
input, .textarea, .select { font-variant-numeric: tabular-nums; }

/* ========== 无障碍：减少动效 ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .folder-card:hover,
  .folder-card:active,
  .btn:active,
  .page-btn:hover:not(:disabled):not(.is-disabled),
  .back-btn:hover .arr { transform: none !important; }
}

/* ========== 平板（≥641px） ========== */
@media (min-width: 641px) {
  .topbar { padding: 14px 20px; }
  .app-main { padding: 20px; }
  h1 { font-size: 26px; }
  .page-head {
    flex-direction: row; align-items: end; justify-content: space-between;
  }
  .page-head h1 { font-size: 26px; }
  .card-row { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .modal-mask { align-items: center; padding: 20px; }
  .modal {
    border-radius: 16px;
    padding: 28px;
  }
  .modal-actions { flex-direction: row; justify-content: flex-end; }
  .modal-actions .btn { width: auto; }
  .admin-shell {
    flex-direction: row;
    gap: 20px;
    padding: 0 20px;
  }
  .admin-side { width: 200px; flex-shrink: 0; }
  .admin-search { flex-direction: row; align-items: center; }
  .admin-search > * { width: auto; }
  .admin-search input.input { flex: 1; min-width: 180px; }
  .admin-search select.select { width: 140px; flex-shrink: 0; }
  .admin-search .btn-block { width: auto; }
  .detail-head-top {
    flex-direction: row; align-items: start; justify-content: space-between;
    gap: 16px;
  }
  .detail-head-actions {
    flex-direction: row; flex-wrap: wrap; align-items: center;
    width: auto;
  }
  .detail-head-actions > * { flex: 0 0 auto; }
  .detail-head-actions .btn,
  .detail-head-actions .back-btn {
    width: auto;
  }
  .record-block .title {
    flex-direction: row; justify-content: space-between; align-items: center;
  }
  .record-block .title form { align-self: center; }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  .profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
}

/* ========== 桌面（≥1025px） ========== */
@media (min-width: 1025px) {
  .topbar { padding: 18px 32px; }
  .app-main { max-width: 1200px; padding: 32px; }
  h1 { font-size: 28px; }
  .card-row { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
  .admin-shell { padding: 0; }
  .admin-side { width: 220px; }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}