/* YiMatch 人工校准站（eval-site）
   浅色、简洁、手机优先。本轮只调整信息层级与响应式布局，不改变任何业务流程。 */

:root {
  --green: #174d3b;
  --green2: #26745b;
  --cream: #f7f5ee;
  --ink: #1e2925;
  --muted: #69736f;
  --line: #dce2dd;
  --white: #fff;
  --red: #b33b35;
  --amber: #8a6d1f;
  --radius: 14px;
  --tap: 44px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: break-word;
}

img { max-width: 100%; }

.hidden { display: none !important; }

/* 仅供屏幕阅读器 / 隐藏原生控件使用（不用 display:none，保证 label 点击仍能唤起文件选择） */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ 顶栏 */

header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 56px;
  padding: 6px max(14px, calc((100% - 1100px) / 2));
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 800; color: var(--green); text-decoration: none; font-size: 17px; white-space: nowrap; }
.brand span { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 6px; }

.header-right { display: flex; align-items: center; gap: 6px; min-width: 0; }

.role {
  font-size: 12px;
  font-weight: 650;
  color: var(--green2);
  background: #eef4f0;
  border-radius: 999px;
  padding: 4px 10px;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ 基础排版 */

main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 14px 48px; }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

h1, h2, p { margin-top: 0; }
h1 { font-size: 22px; margin-bottom: 10px; }
h2 { font-size: 16px; margin-bottom: 0; }

.muted { color: var(--muted); }
.muted.small { font-size: 12px; }
.eyebrow { color: var(--green2); font-size: 12px; font-weight: 700; letter-spacing: .06em; margin-bottom: 4px; }

.error { color: var(--red); font-size: 13px; margin: 10px 0 0; }
.state { color: var(--muted); font-size: 13px; margin: 10px 0 0; min-height: 0; }
.count { color: var(--muted); font-size: 13px; font-weight: 500; margin-left: 4px; }
.only-mobile { display: none; }
.break { word-break: break-all; }

/* ------------------------------------------------------------------ 表单控件 */

label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0; }

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border: 1px solid #cad2cc;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px; /* iOS Safari 不自动放大 */
  font-weight: 400;
  line-height: 1.3;
}

select { min-height: var(--tap); }

.field-quiet { font-weight: 500; color: var(--muted); }
.field-quiet input { font-weight: 400; }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 10px 16px;
  border: 1px solid #cbd3cd;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

button:hover { border-color: var(--green2); }
button:disabled { opacity: .45; cursor: not-allowed; }

.primary { background: var(--green); border-color: var(--green); color: #fff; }
.primary:hover { background: var(--green2); }
.small { min-height: var(--tap); padding: 7px 14px; font-size: 14px; }
.text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  padding: 8px 10px;
  min-height: var(--tap);
  font-weight: 600;
}
.text-button:hover { background: #f0f5f1; border-radius: 10px; }
.danger { border-color: #e0c6c4; color: var(--red); }
.danger-text { color: var(--red); }
.block { display: flex; width: 100%; min-height: 48px; font-size: 16px; margin-top: 6px; }

/* ------------------------------------------------------------------ 登录 / 注册 */

.auth-panel { max-width: 420px; margin: 24px auto 0; padding: 20px; }
.auth-panel h1 { font-size: 22px; }
.auth-note { margin-bottom: 0; font-size: 14px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); margin: 16px 0 4px; }
.tabs button {
  flex: 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  min-height: 48px;
  font-size: 15px;
}
.tabs button.active { color: var(--green); border-bottom: 2px solid var(--green); }

.auth-form > .block { margin-top: 16px; }

/* ------------------------------------------------------------------ 评分者 */

.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.head-row h1 { margin-bottom: 6px; }
.head-row strong { font-size: 18px; color: var(--green); white-space: nowrap; }

.progress { height: 8px; background: #e2e7e3; border-radius: 8px; overflow: hidden; margin: 12px 0 20px; }
.progress i { display: block; height: 100%; width: 0; background: var(--green2); transition: width .2s; }

.task-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.image-wrap { height: 44vh; min-height: 200px; max-height: 340px; background: #eff1ed; display: flex; justify-content: center; align-items: center; }
.image-wrap img { width: 100%; height: 100%; object-fit: contain; }
.question-wrap { padding: 18px 16px; }
.question-wrap h2 { font-size: 19px; margin-bottom: 8px; }
.options { display: grid; gap: 10px; margin-top: 16px; }

/* option card：固定宽度 marker 列 + 弹性文字列；整张卡片撑满宽度，
   因此 7 个选项的 marker / 标题 / 说明都从同一 x 开始（旧写法里 button 会收缩居中）。 */
.option {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  min-height: 0;
  padding: 9px 12px;
  text-align: left;
}

.option-marker {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 0 auto;
  border-radius: 50%;
  background: #eef3ef;
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.option-text { min-width: 0; }
.option-title { display: block; font-size: 16px; font-weight: 650; line-height: 1.25; }
.option-desc { display: block; margin-top: 2px; font-size: 13px; line-height: 1.3; font-weight: 400; color: var(--muted); }

/* 选中态只用颜色 + 内阴影描边表达，不改变 border 宽度 / padding，
   因此卡片高度与文字位置在选中前后完全一致（无 layout shift）。 */
.option.selected { border-color: var(--green2); background: #f2f8f4; box-shadow: inset 0 0 0 1px var(--green2); }
.nav { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nav button { flex: 1; }
.nav span { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ------------------------------------------------------------------ 管理员 */

.admin-top { display: grid; gap: 14px; }
.progress-panel, .garment-panel { margin-top: 14px; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { font-size: 16px; }
.panel-head button { flex: 0 0 auto; }

.meta-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; min-width: 0; border-bottom: 1px solid var(--line); }
.meta-row:last-of-type { border-bottom: 0; }
.meta-key { color: var(--muted); font-size: 13px; flex: 0 0 auto; }
.meta-row strong { font-size: 15px; color: var(--green); min-width: 0; word-break: break-all; }
.meta-row .text-button { margin-left: auto; flex: 0 0 auto; padding: 8px 6px; min-height: var(--tap); }

#batch-row { margin: 8px 0 4px; }

.drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 132px;
  margin: 12px 0;
  padding: 14px;
  border: 1.5px dashed #c4cec7;
  border-radius: 12px;
  background: #fbfbf8;
  cursor: pointer;
}
.drop-zone:hover { border-color: var(--green2); background: #f7faf8; }
.drop-placeholder { text-align: center; color: var(--muted); font-size: 13px; }
.drop-placeholder b { display: block; margin-bottom: 4px; color: var(--green); font-size: 16px; font-weight: 650; }
#upload-preview { display: block; width: 100%; max-height: 240px; object-fit: contain; border-radius: 10px; }
#upload-preview.hidden { display: none !important; }

/* 评分邀请 */

.invite-list { list-style: none; margin: 0; padding: 0; }
.invite-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.invite-item:last-child { border-bottom: 0; }
.invite-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.invite-code { font-size: 15px; }
.invite-status { font-size: 13px; color: var(--muted); }
.invite-status.is-active { color: var(--green2); font-weight: 650; }
.invite-status.is-used { color: #3c5578; }
.invite-status.is-revoked { color: var(--amber); }
.invite-time { font-size: 12px; color: var(--muted); }
.invite-actions { display: flex; gap: 2px; margin-left: auto; }

/* 评分进度：桌面表格 / 手机卡片，同一份 DOM */

.rater-head, .rater-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) 84px minmax(0, 1.2fr) 48px;
  grid-template-areas: "code name account done bar pct";
  gap: 10px;
  align-items: center;
}

.area-code { grid-area: code; }
.area-name { grid-area: name; }
.area-account { grid-area: account; }
.area-done { grid-area: done; }
.area-bar { grid-area: bar; }
.area-pct { grid-area: pct; }

.rater-head { padding: 0 2px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.rater-row { padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.rater-row:last-child { border-bottom: 0; }
.rater-code { color: var(--muted); font-size: 13px; }
.rater-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rater-account { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rater-done { white-space: nowrap; }
.rater-bar { display: block; height: 6px; background: #e2e7e3; border-radius: 6px; overflow: hidden; }
.rater-bar i { display: block; height: 100%; width: 0; background: var(--green2); }
.rater-pct { text-align: right; font-size: 13px; color: var(--muted); }
.rater-pct.is-done { color: var(--green); font-weight: 700; }

/* 已上传衣物 */

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

.garment-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  min-width: 0;
}
.garment-card.is-inactive { background: #faf9f6; border-style: dashed; }
.garment-card .thumb { display: flex; align-items: center; justify-content: center; height: 160px; background: #eff1ed; overflow: hidden; }
.garment-card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb-missing { color: var(--muted); font-size: 12px; }

.garment-body { display: grid; gap: 4px; padding: 12px 12px 8px; min-width: 0; }
.sample-code { font-size: 17px; }
.batch-code { font-size: 12px; color: var(--muted); word-break: break-all; }
.garment-stat { font-size: 13px; }
.garment-note {
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.badge { justify-self: start; font-size: 12px; font-weight: 650; color: var(--amber); background: #f6f0ea; border: 1px solid #e5d9cd; border-radius: 999px; padding: 1px 9px; }
.edit-garment { margin: 8px 12px 12px; min-height: var(--tap); font-size: 14px; }

/* ------------------------------------------------------------------ 弹窗 */

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #101a1566;
}

.modal-card {
  width: min(440px, 100%);
  max-height: 88vh;
  max-height: 88dvh;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px #101a1533;
}
.modal-card h2 { font-size: 17px; margin-bottom: 12px; }

.modal-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: #eff1ed;
  overflow: hidden;
}
.modal-preview img { width: 100%; height: 100%; object-fit: contain; }

.facts { display: grid; gap: 8px; }
.fact { display: flex; align-items: baseline; gap: 10px; font-size: 14px; min-width: 0; }
.fact-key { flex: 0 0 56px; color: var(--muted); font-size: 13px; }
.fact-value { font-weight: 650; min-width: 0; word-break: break-all; }

.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.modal-actions .primary { flex: 1 1 auto; }
.modal-actions .text-button { flex: 0 0 auto; }

.invite-code-line { margin-bottom: 12px; font-size: 20px; color: var(--green); }

.warning {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #e5d9cd;
  border-radius: 10px;
  background: #fdf8f2;
  color: var(--amber);
  font-size: 13px;
  cursor: pointer;
}
.warning .why { text-decoration: underline; margin-left: 4px; }
#edit-integrity-detail { margin: 8px 0 0; }

/* ------------------------------------------------------------------ 断点 */

@media (min-width: 600px) {
  .garment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 640px) {
  body { font-size: 15px; }
  main { padding: 28px 24px 64px; }
  .panel { padding: 22px; }
  .auth-panel { margin-top: 56px; padding: 28px; }
  .brand { font-size: 20px; }
  .brand span { font-size: 13px; margin-left: 8px; }
  header { padding: 6px max(24px, calc((100% - 1100px) / 2)); }
  h1 { font-size: 26px; }
  .image-wrap { height: 360px; }
  .question-wrap { padding: 26px 30px; }
  .question-wrap h2 { font-size: 22px; }
  .garment-card .thumb { height: 176px; }
  .edit-garment { align-self: flex-start; width: auto; padding: 8px 18px; min-height: var(--tap); }
  #upload-preview { max-height: 280px; }
}

@media (min-width: 900px) {
  .admin-top { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .garment-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}

/* 手机：单列 + 评分进度卡片 + 底部弹层 */

@media (max-width: 639px) {
  .role { max-width: 32vw; }
  .head-row strong { font-size: 16px; }
  .panel-head { flex-wrap: wrap; }

  .garment-grid { grid-template-columns: 1fr; }
  .garment-card { flex-direction: row; align-items: stretch; flex-wrap: wrap; }
  .garment-card .thumb { width: 104px; height: auto; min-height: 104px; flex: 0 0 104px; }
  .garment-body { flex: 1 1 140px; }
  .edit-garment { flex: 1 1 100%; width: auto; }

  .rater-head { display: none !important; }
  .rater-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "code name"
      "done done"
      "bar  pct";
    gap: 6px 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fcfdfc;
  }
  .rater-row:last-child { margin-bottom: 0; }
  .area-account { display: none; }
  .rater-code::after { content: " ·"; }
  .rater-code { grid-area: code; align-self: center; }
  .rater-name { grid-area: name; }
  .only-mobile { display: inline; }
  .rater-done { color: var(--muted); font-size: 13px; }

  .modal { align-items: flex-end; padding: 0; }
  .modal-card {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
  }
  .modal-preview { height: min(30vh, 190px); }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions button { flex: 1 1 44%; }
  .modal-actions .text-button { flex: 1 1 100%; }
}

/* 很窄的屏幕（320–360px）再收紧一点，保证顶栏不换行溢出 */

@media (max-width: 359px) {
  .brand span { display: none; }
  .role { padding: 3px 8px; }
  main { padding: 14px 12px 40px; }
  .invite-actions { margin-left: 0; }
}

@media (max-width: 339px) {
  .role { display: none; }
}
