/* ============================================================
   东软签到控制台 · 点名册（Register）
   暖纸底 · 发丝线分隔 · 衬线报头 · 单一朱砂强调色
   ============================================================ */

:root {
  --paper:    #f3f1ec;   /* 页面底色 */
  --surface:  #fffefb;   /* 卡片纸面 */
  --ink:      #191813;   /* 正文 / 主按钮 */
  --ink-2:    #4a473f;   /* 次级文本 */
  --mute:     #77736a;   /* 弱化文本（对纸面 4.7:1） */
  --faint:    #a5a196;   /* 装饰 / 占位 */
  --line:     #ded9cf;   /* 主发丝线 */
  --line-2:   #eeeae1;   /* 次发丝线 */
  --field:    #f7f5f0;   /* 输入底 */
  --seal:     #b0402f;   /* 朱砂：强调 / 错误 */
  --moss:     #3f7a4e;   /* 成功 */
  --ochre:    #8a5d14;   /* 待处理 */
  --r:        4px;

  --sans:  'Manrope', -apple-system, BlinkMacSystemFont, "PingFang SC",
           "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --serif: Georgia, "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  --mono:  'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.sheet { max-width: 980px; margin: 0 auto; padding: 56px 24px 72px; }

::selection { background: rgba(176, 64, 47, .16); }

:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- 报头 ---------- */
.masthead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.masthead h1 {
  font-family: var(--serif); font-weight: 400; font-size: 30px;
  letter-spacing: .04em; line-height: 1.2;
}
.masthead h1 .seal {
  display: inline-block; width: 7px; height: 7px;
  background: var(--seal); margin-left: 10px; vertical-align: 9px;
}

.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--mute);
}

/* 状态点：颜色 + 文本双通道，不靠颜色单独表意 */
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--faint); flex-shrink: 0;
}
.dot.green { background: var(--moss); }
.dot.amber { background: var(--ochre); }
.dot.red   { background: var(--seal); }
.dot.live  { animation: live 2s ease-in-out infinite; }
@keyframes live {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 122, 78, .45); }
  60%      { box-shadow: 0 0 0 5px rgba(63, 122, 78, 0); }
}

/* 报头下的双细线 */
.rule {
  height: 3px; margin: 18px 0 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* ---------- 标签 ---------- */
.tabs { display: flex; gap: 26px; margin-bottom: 22px; }
.tab {
  position: relative; font-family: var(--sans); font-size: 14px;
  font-weight: 600; letter-spacing: .04em; color: var(--mute);
  background: none; border: none; padding: 0 0 9px; cursor: pointer;
  transition: color .18s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--seal); transform: scaleX(0); transform-origin: left;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.tab.active::after { transform: scaleX(1); }

/* ---------- 面板 / 纸面 ---------- */
.panel { display: none; }
/* align-items:start：右栏按内容收缩，不被左侧表单拉成空荡的长方块 */
.panel.active { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 800px) { .panel.active { grid-template-columns: 1fr; } }

.box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 22px 22px 24px;
}
.box-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-bottom: 14px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line-2);
}
.box-head h2 {
  font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--ink);
}
.logs-box { margin-top: 18px; }

.note { font-size: 12px; color: var(--mute); text-align: right; }
.note.ok  { color: var(--moss); }
.note.err { color: var(--seal); }

/* ---------- 表单 ---------- */
.stack { display: flex; flex-direction: column; gap: 20px; }
.f { display: block; }
.f-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; letter-spacing: .06em;
  color: var(--mute); margin-bottom: 7px;
}
.f-tools { display: inline-flex; gap: 12px; }

input, select {
  width: 100%; font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  border-radius: 0; padding: 7px 0 8px; outline: none;
  transition: border-color .18s ease;
}
input[type="number"], input[type="datetime-local"], input[type="time"] {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
input:hover, select:hover { border-bottom-color: var(--faint); }
input:focus, select:focus { border-bottom-color: var(--seal); }
input:focus-visible, select:focus-visible { outline-offset: 3px; }

select {
  cursor: pointer; appearance: none; padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2377736a' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center;
}
select option { color: var(--ink); background: #fff; }

.unit { position: relative; display: block; }
.unit input { padding-right: 22px; }
.unit i {
  position: absolute; right: 0; bottom: 9px;
  font-style: normal; font-size: 12px; color: var(--mute);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid2 .span2 { grid-column: 1 / -1; }

/* ---------- 学生多选（可勾选名牌） ---------- */
.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 168px; overflow-y: auto; padding: 2px 2px 3px;
}
.chip { position: relative; cursor: pointer; }
.chip input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; margin: 0; cursor: pointer;
}
.chip span {
  display: block; font-size: 12.5px; line-height: 1;
  color: var(--ink-2); background: var(--field);
  border: 1px solid transparent; border-radius: var(--r);
  padding: 7px 10px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover span { border-color: var(--line); }
.chip input:checked + span { background: var(--ink); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--seal); outline-offset: 2px; }
.chips .empty { color: var(--faint); font-size: 12.5px; padding: 6px 2px; }

/* ---------- 分段 ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg-btn {
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--mute);
  background: transparent; border: none; padding: 8px 20px; cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--ink); color: #fff; }

/* ---------- 按钮 ---------- */
.acts { display: flex; gap: 10px; margin-top: 24px; }
.acts.col { flex-direction: column; }

.btn {
  position: relative; font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  letter-spacing: .06em; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 26px; cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .1s ease;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.block { width: 100%; }
.btn.loading span { opacity: 0; }
.btn.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 13px; height: 13px;
  border: 1.5px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link {
  font-family: var(--sans); font-size: 12px; color: var(--mute);
  background: none; border: none; padding: 0; cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}
.link:hover { color: var(--ink); border-bottom-color: var(--line); }
.link.danger:hover { color: var(--seal); border-bottom-color: var(--seal); }

/* ---------- 行列表（结果 / 任务） ---------- */
.rows { max-height: 330px; overflow-y: auto; margin: -4px -2px; padding: 4px 2px; }
.rows .empty { color: var(--faint); font-size: 13px; text-align: center; padding: 34px 0; }
.row {
  padding: 13px 0; border-bottom: 1px solid var(--line-2);
  animation: rowIn .3s ease both;
}
.row:first-child { padding-top: 2px; }
.row:last-child { border-bottom: none; padding-bottom: 2px; }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.row-name { font-size: 14px; font-weight: 600; }
.row-name em {
  font-style: normal; font-family: var(--mono); font-size: 11.5px;
  color: var(--faint); margin-left: 8px;
}
.row-note { font-size: 12px; color: var(--mute); white-space: nowrap; }
.row-note.err { color: var(--seal); white-space: normal; text-align: right; }

.row-items { list-style: none; margin-top: 9px; display: flex; flex-direction: column; gap: 6px; }
.row-items li {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink-2);
}
.row-items li span:last-child { min-width: 0; }

.row-bot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 8px;
}
.row-meta { font-size: 12.5px; color: var(--mute); }
.row-acts { display: inline-flex; gap: 14px; flex-shrink: 0; }

.row.editing { box-shadow: -12px 0 0 -11px var(--seal); padding-left: 10px; }

.time {
  font-family: var(--mono); font-size: 16px; font-weight: 500;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.tag {
  font-size: 11px; font-weight: 600; color: var(--mute);
  border: 1px solid var(--line); border-radius: 2px; padding: 1px 6px; margin-left: 9px;
}
.tag.daily { color: var(--seal); border-color: rgba(176, 64, 47, .35); }
.state { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--mute); }

/* ---------- 任务结果（行内展开） ---------- */
.link.on { color: var(--seal); border-bottom-color: var(--seal); }

.job-res {
  margin-top: 12px; padding: 12px 14px;
  background: var(--field); border-radius: var(--r);
  animation: rowIn .25s ease both;
}
.job-res .empty { padding: 10px 0; }
.job-res-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.res-date {
  width: auto; font-family: var(--mono); font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  padding: 3px 18px 3px 0; border-bottom-color: var(--line);
}

.res-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.res-list li {
  display: grid; grid-template-columns: 6px 5.5em 3.5em 1fr;
  align-items: baseline; gap: 9px; font-size: 12.5px;
}
.res-list .dot { align-self: center; }
/* 姓名一般 2-4 个汉字；异常长的截断，不要撑成两行把整行顶乱 */
.res-name {
  font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.res-verdict { color: var(--ink-2); }
.res-extra { color: var(--mute); min-width: 0; overflow-wrap: anywhere; }

/* ---------- 日志 ---------- */
.head-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.head-tools { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.seg.mini .seg-btn { font-size: 12px; padding: 4px 12px; }

.logs {
  height: 156px; overflow-y: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.9; color: var(--ink-2);
}
.logs .line { display: flex; gap: 12px; animation: rowIn .25s ease both; }
.logs .line .t { color: var(--faint); flex-shrink: 0; }
.logs .line .m { word-break: break-all; }
.logs:empty::before { content: "暂无日志"; color: var(--faint); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #ddd8cd; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c9c3b6; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 入场 ---------- */
.masthead, .rule, .tabs, .box {
  animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--d, 0) * .06s);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

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

@media (max-width: 560px) {
  .sheet { padding: 36px 18px 56px; }
  .masthead h1 { font-size: 25px; }
  .box { padding: 18px 18px 20px; }
  .grid2 { grid-template-columns: 1fr; }
}
