/* ==========================================================================
    Methodical — 分析型 / 编辑型设计语言
    暖纸底 · 烧橙强调 · 发丝线 · 3px 控件几何 · Inter 字系
   ========================================================================== */
:root {
  /* 纸面 */
  --paper: #F9F4E7;
  --paper-deep: #EFE9D5;
  --surface: #FBF9F1;
  --surface-2: #F5EFDF;
  --surface-3: #EFE7D3;

  /* 墨色 */
  --ink: #211C16;
  --ink-2: #4A4238;
  --ink-3: #6E6455;
  --muted: #8A8071;

  /* 线 */
  --line: #E1D7C2;
  --line-2: #CFC1A4;

  /* 唯一强调色 */
  --accent: #CD3C12;
  --accent-deep: #A5300D;
  --accent-soft: #F7E3D9;

  /* 语义色，仅在表达真实状态时出现 */
  --ok: #3D6A4E;      --ok-soft: #E7EFE4;
  --warn: #8A5A12;    --warn-soft: #F6EBD3;
  --danger: #AE3A20;  --danger-soft: #F8E3DB;

  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 12px;

  --shadow-1: 0 1px 2px rgba(33, 28, 22, .045);
  --shadow-2: 0 12px 34px rgba(33, 28, 22, .12);

  --ease: cubic-bezier(.22, .68, .3, 1);
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --num: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 极低对比纸纹：只落在纸面上，卡片/控件保持干净不透明 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
::selection { background: var(--accent-soft); color: var(--accent-deep); }

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

/* ==========================================================================
   骨架
   ========================================================================== */
.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper-deep);
  border-right: 1px solid var(--line-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line-2);
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}
.brand-text strong { display: block; font-size: 13.5px; font-weight: 600; letter-spacing: .01em; }
.brand-text small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .04em; }

.rail-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.rail-label {
  display: block;
  padding: 6px 10px 8px;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin-bottom: 1px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 13px;
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.rail-nav a::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 2px; height: 0;
  background: var(--accent);
  transform: translateY(-50%);
  transition: height .2s var(--ease);
}
.rail-nav a:hover { background: rgba(255, 255, 255, .55); color: var(--ink); transform: translateX(2px); }
.rail-nav a.is-active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.rail-nav a.is-active::before { height: 16px; }
.rail-nav .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .38;
}
.rail-nav a.is-active .dot { background: var(--accent); opacity: 1; }

.rail-foot {
  border-top: 1px solid var(--line-2);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.who { flex: 1; min-width: 0; line-height: 1.35; }
.who b { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.logout-btn:hover { color: var(--danger); border-color: var(--line-2); background: var(--surface); }

/* ==========================================================================
   主区 / 页头
   ========================================================================== */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 22px 32px 16px;
  background: rgba(249, 244, 231, .86);
  backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  margin: 0 0 6px;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.topbar h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.25;
}
.topbar .sub { margin: 5px 0 0; font-size: 12.5px; color: var(--ink-3); }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.content { padding: 22px 32px 64px; max-width: 1480px; width: 100%; }

/* ==========================================================================
   通用组件
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  margin-bottom: 16px;
}
.card.flat { box-shadow: none; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.card-head .hint { font-size: 11.5px; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }
.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-size: 12px;
  color: var(--ink-3);
}

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }

.hint { color: var(--ink-3); font-size: 12px; }
.mono { font-family: var(--num); font-variant-numeric: tabular-nums; }
.req { color: var(--accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 33px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: .01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              color .16s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: #E3BFAE; background: var(--surface); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.small { height: 27px; padding: 0 10px; font-size: 12px; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.row-actions .btn { white-space: nowrap; }
.btn.block { width: 100%; }
.btn[disabled], .btn.is-disabled {
  opacity: .45; pointer-events: none; cursor: not-allowed;
}
.btn-link {
  border: none; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--accent);
}
.btn-link:hover { text-decoration: underline; }

/* 状态标签 */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 7px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.6;
  letter-spacing: .02em;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}
.chip.approved, .chip.open { color: var(--ok); border-color: #BFD3BE; background: var(--ok-soft); }
.chip.submitted, .chip.collecting { color: var(--warn); border-color: #DFC79A; background: var(--warn-soft); }
.chip.returned { color: var(--danger); border-color: #E3BFAE; background: var(--danger-soft); }
.chip.draft, .chip.missing, .chip.closed, .chip.reviewing { color: var(--ink-3); background: var(--surface-2); }

/* 分段选择器（月份切换） */
.seg {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}
.seg a, .seg button {
  padding: 5px 12px;
  border: none;
  border-right: 1px solid var(--line);
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg a:last-child, .seg button:last-child { border-right: none; }
.seg a:hover, .seg button:hover { background: var(--surface-2); color: var(--ink); }
.seg .is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* 提示条 */
.notice {
  display: flex;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--ink-3);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.notice.warn { border-left-color: var(--warn); background: var(--warn-soft); color: #6F4A0E; }
.notice.info { border-left-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }
.notice.ok { border-left-color: var(--ok); background: var(--ok-soft); color: #2E4F3B; }

.flashes { padding: 14px 32px 0; }
.flash {
  position: relative;
  padding: 10px 14px 10px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--line-2);
  border-left-width: 2px;
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
  animation: flashIn .34s var(--ease) both;
}
.flash.success { border-left-color: var(--ok); background: var(--ok-soft); color: #2E4F3B; }
.flash.error { border-left-color: var(--danger); background: var(--danger-soft); color: #7E2A17; }
.flash.is-hiding { animation: flashOut .3s var(--ease) forwards; }

/* ==========================================================================
   表格
   ========================================================================== */
.table-wrap, .table-scroll { width: 100%; overflow-x: auto; scrollbar-width: thin; }
.table-wrap::-webkit-scrollbar, .table-scroll::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb, .table-scroll::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 4px;
}
.table-wrap::-webkit-scrollbar-track, .table-scroll::-webkit-scrollbar-track { background: transparent; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
tfoot td { background: var(--surface-2); border-top: 1px solid var(--line-2); font-size: 12.5px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-family: var(--num); font-size: 12.5px; }

/* ==========================================================================
   录入矩阵
   ========================================================================== */
.entry-table { min-width: 960px; table-layout: fixed; font-size: 12.5px; }
.entry-table th {
  padding: 8px 6px;
  text-align: center;
  letter-spacing: .04em;
  font-size: 10.5px;
}
.entry-table td {
  padding: 3px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.entry-table td:last-child, .entry-table th:last-child { border-right: none; }
.entry-table td.idx {
  width: 34px;
  text-align: center;
  color: var(--muted);
  font-family: var(--num);
  font-size: 11px;
}
.entry-table input, .entry-table select {
  width: 100%;
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  transition: background .14s, border-color .14s;
}
.entry-table input:hover, .entry-table select:hover {
  background: #fff; border-color: var(--line);
}
.entry-table input:focus, .entry-table select:focus {
  background: #fff; border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px rgba(205, 60, 18, .1);
}
.entry-table input[readonly] {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  cursor: default;
}
.entry-table input[readonly]:hover { background: transparent; border-color: transparent; }
.entry-table .cell-off { opacity: .42; }
.entry-table .del {
  width: 100%;
  border: none;
  background: none;
  color: var(--line-2);
  font-size: 14px;
  line-height: 1;
  padding: 4px 0;
  cursor: pointer;
  transition: color .14s;
}
.entry-table .del:hover { color: var(--danger); }

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.table-toolbar .meta { font-size: 12px; color: var(--ink-3); }
.table-toolbar .meta b { color: var(--ink); font-family: var(--num); }

/* 开关 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative;
  width: 32px; height: 18px;
  border-radius: 10px;
  background: var(--line-2);
  transition: background .18s var(--ease);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(33, 28, 22, .2);
  transition: transform .18s var(--ease);
}
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   表单
   ========================================================================== */
.field { display: block; margin-bottom: 13px; }
.field > span {
  display: block;
  margin-bottom: 5px;
  font-size: 11.5px;
  letter-spacing: .03em;
  color: var(--ink-3);
}
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: #FFFDF7;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #B0A692; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(205, 60, 18, .1);
}
input[readonly], input[disabled], select[disabled], textarea[disabled] {
  background: var(--surface-2);
  color: var(--ink-3);
}
textarea { resize: vertical; min-height: 66px; line-height: 1.55; }

.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.form-row label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--ink-3); }

fieldset { border: none; margin: 0; padding: 0; min-width: 0; }

/* 底部操作条 */
.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding: 14px 20px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: rgba(251, 249, 241, .94);
  backdrop-filter: blur(8px);
  box-shadow: 0 -2px 16px rgba(33, 28, 22, .06);
}
.promise { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-2); }
.promise input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
.promise.is-invalid { color: var(--danger); }
.promise.is-invalid input[type=checkbox] { outline: 2px solid var(--danger); outline-offset: 2px; }

/* ==========================================================================
   分数 / 指标
   ========================================================================== */
.score-strip {
  display: flex;
  gap: 26px;
  align-items: stretch;
  flex-wrap: wrap;
  padding: 18px 20px;
}
.score-hero {
  min-width: 148px;
  padding-right: 26px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.score-hero .cap {
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.score-hero .big {
  margin: 2px 0 1px;
  font-size: 42px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.045em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.score-hero .big.is-na { font-size: 19px; letter-spacing: 0; color: var(--muted); }
.score-hero .hint { font-size: 11.5px; }

.metric-grid {
  flex: 1;
  min-width: 300px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.metric-tile {
  background: var(--surface);
  padding: 10px 12px 11px;
  transition: background .15s;
}
.metric-tile:hover { background: #FFFDF7; }
.mt-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mt-name {
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mt-score {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mt-score i { font-style: normal; font-size: 10.5px; color: var(--muted); font-weight: 400; margin-left: 1px; }
.mt-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tile-bar { height: 2px; margin-top: 7px; background: var(--line); overflow: hidden; }
.tile-bar i {
  display: block; height: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: growX .7s var(--ease) both;
}

/* 侧栏评分卡 */
.score-panel { position: sticky; top: 104px; }
.score-total {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.score-total .cap {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.score-total .big {
  font-size: 38px; font-weight: 600; line-height: 1.05;
  letter-spacing: -.045em; font-variant-numeric: tabular-nums;
}
.timeline-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 18px; font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.timeline-row:last-child { border-bottom: none; }

/* 月份卡 */
.month-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.month-card .m {
  font-size: 21px; font-weight: 600; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.month-card .m small { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 3px; letter-spacing: 0; }
.month-card .foot { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }

/* ==========================================================================
   空态 / 杂项
   ========================================================================== */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}
.empty strong { display: block; color: var(--ink-2); font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.error-page { padding: 72px 24px; text-align: center; }
.error-page h1 {
  margin: 0 0 8px;
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -.05em;
  color: var(--accent);
}
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
ul.plain { margin: 0; padding-left: 17px; font-size: 13px; color: var(--ink-2); }
ul.plain li { margin-bottom: 6px; }
ul.plain li::marker { color: var(--accent); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ==========================================================================
   登录页
   ========================================================================== */
.auth {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 56px 24px;
}
.auth-card {
  width: 100%;
  max-width: 384px;
  padding: 34px 34px 28px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: 0 1px 0 rgba(60, 40, 20, .03), 0 18px 40px -32px rgba(60, 40, 20, .35);
  animation: riseIn .42s var(--ease) both;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.auth-card h1 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.025em;
}
.auth-card .sub { margin: 0 0 24px; font-size: 12.5px; color: var(--ink-3); }
.auth-card .btn { width: 100%; height: 38px; margin-top: 4px; }
.auth-foot { font-size: 11px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.auth-help {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px dashed var(--line-2);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}

/* ==========================================================================
   动效：入场 / 离场 / 进度 / 遮罩
   ========================================================================== */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@keyframes flashOut {
  to { opacity: 0; transform: translateY(-6px); margin-bottom: -6px; }
}
@keyframes growX {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideBar {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(340%); }
}

.content > * {
  animation: riseIn .42s var(--ease) both;
}
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .06s; }
.content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(4) { animation-delay: .13s; }
.content > *:nth-child(5) { animation-delay: .16s; }
.content > *:nth-child(n+6) { animation-delay: .18s; }
.topbar > * { animation: fadeIn .34s var(--ease) both; }

/* 离场：整页轻微上浮淡出 */
.shell, .auth { transition: opacity .18s var(--ease), transform .18s var(--ease); }
body.is-leaving .shell,
body.is-leaving .auth { opacity: 0; transform: translateY(-6px); }

/* 顶部进度条 */
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 200;
  opacity: 0;
  transition: opacity .2s var(--ease);
  pointer-events: none;
}
.progress.is-on { opacity: 1; }
.progress i {
  display: block;
  width: 34%;
  height: 100%;
  background: var(--accent);
  animation: slideBar 1.05s var(--ease) infinite;
}

/* 提交遮罩 */
.busy {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: rgba(249, 244, 231, .74);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease);
}
.busy.is-on { opacity: 1; pointer-events: auto; }
.busy .ring {
  width: 26px; height: 26px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .68s linear infinite;
}
.busy .label {
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* 确认弹窗 */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(33, 28, 22, .32);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s var(--ease);
}
.modal-layer.is-on { opacity: 1; pointer-events: auto; }
.modal {
  width: min(430px, 100%);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  transform: translateY(10px) scale(.99);
  transition: transform .22s var(--ease);
}
.modal-layer.is-on .modal { transform: none; }
.modal-head {
  padding: 18px 20px 0;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.modal-body { padding: 9px 20px 20px; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 212px minmax(0, 1fr); }
  .content { padding: 20px 22px 56px; }
  .topbar { padding: 18px 22px 14px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .score-panel { position: static; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; }
  .rail-nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px; }
  .rail-nav a { white-space: nowrap; }
  .rail-label { display: none; }
  .rail-foot { border-top: none; }
  .auth { padding: 32px 18px; }
  .auth-card { padding: 26px 22px 22px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-hero { border-right: none; padding-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .rail, .topbar-actions, .action-bar, .progress, .busy, .modal-layer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
  .content { padding: 0; }
}

/* 录入矩阵的细节修正：只读态与禁用格不显示占位符、不显示删除按钮 */
.entry-table th { font-size: 10px; letter-spacing: .02em; padding: 8px 5px; }
.entry-table select { font-size: 12px; }
fieldset[disabled] .entry-table .del { visibility: hidden; }
fieldset[disabled] .entry-table input::placeholder,
fieldset[disabled] .entry-table textarea::placeholder { color: transparent; }
.entry-table input.cell-off::placeholder { color: transparent; }

/* 录入矩阵优先级修正（覆盖通用表单规则） */
.entry-table input, .entry-table select {
  width: 100%;
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
}
.entry-table select { font-size: 12px; }
.entry-table input[type=date] { background: transparent; }
.entry-table input[type=date]::-webkit-calendar-picker-indicator {
  opacity: 0;
  transition: opacity .15s var(--ease);
  cursor: pointer;
}
.entry-table input[type=date]:hover::-webkit-calendar-picker-indicator,
.entry-table input[type=date]:focus::-webkit-calendar-picker-indicator { opacity: .45; }
.entry-table input:hover, .entry-table select:hover { background: #fff; border-color: var(--line); }
.entry-table input:focus, .entry-table select:focus {
  background: #fff;
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(205, 60, 18, .1);
}

[hidden] { display: none !important; }
