/* chatmed 文件收集 —— 纸面 / 墨线 / 舟青
   设计意图：像一张收件台账，而不是一张 SaaS 落地页。 */

:root {
  --paper: #f3f0e8;
  --paper-2: #faf8f2;
  --card: #fffdf8;
  --ink: #161a18;
  --ink-2: #3f4642;
  --muted: #7b786d;
  --line: #ddd7c9;
  --line-soft: #e9e4d9;
  --accent: #0d4f4a;
  --accent-2: #14665e;
  --accent-soft: rgba(13, 79, 74, 0.08);
  --signal: #b4552d;
  --ok: #2c6b3f;
  --warn: #a3512a;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", STSong, SimSun, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --shadow: 0 1px 2px rgba(22, 26, 24, 0.04), 0 12px 32px -18px rgba(22, 26, 24, 0.25);
}

* { box-sizing: border-box; }

/* 关键：部分容器设了 display，会盖掉 UA 的 [hidden]{display:none} */
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 纸面纹理：横向极淡的台账线 + 左上角光晕 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -12%, rgba(13, 79, 74, 0.10), transparent 62%),
    radial-gradient(700px 500px at 100% 0%, rgba(180, 85, 45, 0.05), transparent 55%);
  z-index: 0;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 47px,
    rgba(22, 26, 24, 0.028) 47px 48px
  );
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.25));
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3 { margin: 0; font-weight: 500; }

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--muted);
  opacity: 0.6;
}

.lede { color: var(--ink-2); margin: 0; max-width: 54ch; }

/* ---------- 品牌 ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: flex; line-height: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}
.brand-text em {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.34em;
  color: var(--muted);
}
.brand.big .brand-text strong { font-size: 18px; }
.brand.big .brand-text em { font-size: 12px; }

/* ---------- 登录 ---------- */
.gate {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
}

.gate-brand {
  position: relative;
  padding: clamp(36px, 6vw, 84px);
  padding-right: clamp(24px, 4vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.gate-brand h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 5.4vw, 76px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  margin: 8px 0 26px;
}

.gate-brand .lede { font-size: 15px; line-height: 1.85; max-width: 44ch; }

.gate-brand .brand { margin-bottom: clamp(48px, 8vh, 96px); }

.seal {
  position: absolute;
  right: clamp(18px, 4vw, 54px);
  top: clamp(24px, 7vh, 84px);
  width: 92px;
  height: 92px;
  border: 1px solid rgba(13, 79, 74, 0.45);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(9deg);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.24em;
  line-height: 1.5;
  text-align: center;
  opacity: 0.85;
}
.seal::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(13, 79, 74, 0.3);
  border-radius: 50%;
}

.gate-foot {
  margin-top: clamp(40px, 7vh, 76px);
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.gate-foot .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }

.gate-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 4vw, 56px);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.7), rgba(243, 240, 232, 0.2));
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 40px 36px 32px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
}
.login-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.card-label {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-transform: uppercase;
}
.login-card h2,
.modal-card h2 {
  font-family: var(--serif);
  font-size: 28px;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}
.card-sub { margin: 0 0 28px; color: var(--muted); font-size: 13px; }

.field { display: block; margin-bottom: 18px; }
.field span {
  display: block;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-2);
}
.field input {
  width: 100%;
  padding: 12px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.field input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  font-size: 14px;
  letter-spacing: 0.04em;
  transition: transform 0.15s, background 0.18s, border-color 0.18s, color 0.18s;
}
.btn.primary { background: var(--accent); color: var(--paper-2); }
.btn.primary:hover { background: var(--accent-2); }
.btn.primary:active { transform: translateY(1px); }
.btn.ghost { border-color: var(--line); color: var(--ink-2); background: transparent; }
.btn.ghost:hover { border-color: var(--ink-2); color: var(--ink); }
.btn.full { width: 100%; margin-top: 6px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.card-foot {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.form-error {
  margin: -4px 0 14px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--warn);
  background: rgba(180, 85, 45, 0.07);
  border-left: 2px solid var(--signal);
}

/* ---------- 主界面 ---------- */
.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(243, 240, 232, 0.78);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.mast-actions { display: flex; align-items: center; gap: 16px; }
.who {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.ghost {
  border: 0;
  background: transparent;
  padding: 6px 2px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color 0.18s, border-color 0.18s;
}
.ghost:hover { color: var(--ink); border-color: var(--ink); }

.desk {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) clamp(20px, 4vw, 48px) 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.page-head { margin-bottom: 32px; }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.2;
  letter-spacing: -0.005em;
  margin-bottom: 12px;
}
.page-head .lede { font-size: 14px; }

/* 拖拽区 */
.drop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 236px;
  padding: 36px 24px;
  background: var(--paper-2);
  border: 1px dashed var(--line);
  border-radius: 2px;
  text-align: center;
  outline: none;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.drop:hover,
.drop:focus-visible { border-color: var(--accent); background: #fff; }
.drop.over {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.drop.over .drop-title { color: var(--accent); }

.tick {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 0 solid var(--ink-2);
  opacity: 0.55;
  transition: border-color 0.2s, opacity 0.2s;
}
.tick.tl { top: 10px; left: 10px; border-top-width: 1px; border-left-width: 1px; }
.tick.tr { top: 10px; right: 10px; border-top-width: 1px; border-right-width: 1px; }
.tick.bl { bottom: 10px; left: 10px; border-bottom-width: 1px; border-left-width: 1px; }
.tick.br { bottom: 10px; right: 10px; border-bottom-width: 1px; border-right-width: 1px; }
.drop:hover .tick,
.drop.over .tick { border-color: var(--accent); opacity: 1; }

.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop-icon { color: var(--accent); opacity: 0.85; margin-bottom: 8px; }
.drop-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--ink);
  transition: color 0.2s;
}
.drop-sub { margin: 0; color: var(--muted); font-size: 12px; font-family: var(--mono); }

.note-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
}
.note-row label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  white-space: nowrap;
}
.note-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
}
.note-row input::placeholder { color: #a7a396; }

.hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-2);
  background: rgba(180, 85, 45, 0.06);
  border-left: 2px solid var(--signal);
}
.hint-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  flex: none;
}
.hint .link { margin-left: auto; }

.link {
  border: 0;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  transition: color 0.18s, border-color 0.18s;
}
.link:hover { color: var(--signal); border-color: var(--signal); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 40px 0 14px;
}
.section-head .eyebrow { margin: 0; }
.count { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* 上传队列 */
.queue { display: flex; flex-direction: column; border-top: 1px solid var(--line); }

.task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 18px;
  padding: 16px 2px 14px;
  border-bottom: 1px solid var(--line-soft);
  animation: rise 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.task-main { min-width: 0; }
.task-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.task-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.task-sub {
  display: flex;
  gap: 12px;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.task-sub .err { color: var(--warn); }

.task-actions { display: flex; align-items: center; gap: 12px; }
.task-actions .ghost { font-size: 12px; }

.tag {
  flex: none;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid rgba(13, 79, 74, 0.35);
  border-radius: 2px;
}

/* 进度：虚线轨道 + 实心进度 */
.track {
  grid-column: 1 / -1;
  position: relative;
  height: 3px;
  margin-top: 8px;
  background-image: linear-gradient(90deg, var(--line) 50%, transparent 50%);
  background-size: 6px 3px;
}
.fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}
.fill.active::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.35) 0 4px,
    transparent 4px 8px
  );
  animation: crawl 0.8s linear infinite;
}
@keyframes crawl { to { background-position: 11px 0; } }
.fill.done { background: var(--ok); }
.fill.failed { background: var(--signal); }

.pct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 历史 */
.hist-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.hist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 96px 64px;
  grid-template-rows: auto auto;
  gap: 2px 18px;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line-soft);
  animation: rise 0.3s ease both;
}
.hist-name {
  grid-column: 1;
  grid-row: 1;
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.hist-note {
  grid-column: 1;
  grid-row: 2;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.hist-note.empty { display: none; }
.hist-size,
.hist-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  align-self: center;
}
.hist-size { grid-column: 2; grid-row: 1; }
.hist-time { grid-column: 3; grid-row: 1; }
.hist-status {
  grid-column: 4;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ok);
  border: 1px solid rgba(44, 107, 63, 0.3);
  padding: 1px 6px;
  border-radius: 2px;
}
.empty-state {
  padding: 34px 2px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}

/* 右侧栏 */
.rail { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 18px; }
.rail-card {
  padding: 22px 22px 18px;
  background: var(--card);
  border: 1px solid var(--line);
}
.rail-card.quiet { background: transparent; }
.rail-label {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--muted);
  text-transform: uppercase;
}
.rules { margin: 0; padding: 0; list-style: none; }
.rules li {
  position: relative;
  padding: 0 0 12px 16px;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink-2);
}
.rules li:last-child { padding-bottom: 0; }
.rules li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 6px;
  height: 1px;
  background: var(--accent);
}
.rules strong { font-weight: 500; color: var(--ink); font-family: var(--mono); font-size: 11.5px; }

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12.5px;
}
.status-line:last-child { border-bottom: 0; }
.status-line span { color: var(--muted); }
.status-line strong { font-weight: 500; font-family: var(--mono); font-size: 11.5px; }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(20px, 4vw, 48px);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* 弹窗与提示 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(22, 26, 24, 0.34);
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 30px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -20px rgba(22, 26, 24, 0.4);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 80;
  padding: 11px 18px;
  background: var(--ink);
  color: var(--paper-2);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: min(90vw, 520px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--signal); }

/* ---------- 响应式 ---------- */
@media (max-width: 1020px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; flex-direction: row; flex-wrap: wrap; }
  .rail-card { flex: 1 1 260px; }
}

@media (max-width: 820px) {
  .gate { grid-template-columns: 1fr; min-height: 100svh; }
  .gate-brand {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 36px 24px 32px;
    justify-content: flex-start;
  }
  .gate-brand .brand { margin-bottom: 40px; }
  .gate-brand h1 { font-size: clamp(34px, 9vw, 48px); }
  .lede .wide { display: none; }
  .seal { width: 74px; height: 74px; font-size: 12px; top: 28px; right: 22px; }
  .gate-foot { margin-top: 32px; flex-wrap: wrap; }
  .gate-panel { padding: 32px 20px 48px; }
  .login-card { padding: 30px 24px 24px; max-width: none; }
  .hist-row { grid-template-columns: minmax(0, 1fr) 84px 64px; }
  .hist-name { grid-column: 1; grid-row: 1; }
  .hist-note { grid-column: 1; grid-row: 2; }
  .hist-size { grid-column: 1; grid-row: 3; text-align: left; }
  .hist-time { grid-column: 2; grid-row: 1; }
  .hist-status { grid-column: 3; grid-row: 1; }
  .masthead { padding: 16px 20px; }
  .who { display: none; }
  .task { grid-template-columns: minmax(0, 1fr); }
  .task-actions { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
