/* M-COS · 智能制造成本系统
   视觉：深墨底 + 黄铜刻度 + 青玉状态；像一间成本控制室，而不是通用后台。 */

:root {
  --bg: #0c0f13;
  --bg-2: #0f141a;
  --panel: #141a21;
  --panel-2: #18212b;
  --panel-3: #1d2833;
  --line: #27313d;
  --line-soft: #1e2832;
  --text: #e8e4da;
  --text-2: #c6c2b8;
  --muted: #8c96a3;
  --faint: #5e6874;
  --brass: #c9a227;
  --brass-2: #e2c04d;
  --brass-soft: rgba(201, 162, 39, 0.12);
  --copper: #c47a52;
  --copper-soft: rgba(196, 122, 82, 0.13);
  --jade: #5aa88a;
  --jade-soft: rgba(90, 168, 138, 0.13);
  --amber: #d9a441;
  --amber-soft: rgba(217, 164, 65, 0.13);
  --red: #c4553e;
  --red-soft: rgba(196, 85, 62, 0.13);
  --indigo: #8393cf;
  --indigo-soft: rgba(131, 147, 207, 0.13);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --display: "Bahnschrift", "DIN Alternate", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "Consolas", "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 82% -10%, rgba(201, 162, 39, 0.07), transparent 60%),
    radial-gradient(900px 500px at 8% 110%, rgba(90, 168, 138, 0.05), transparent 55%),
    linear-gradient(180deg, #0c0f13 0%, #0b0e12 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(1200px 800px at 50% 0%, #000 40%, transparent 100%);
  z-index: 0;
}
a { color: var(--brass-2); text-decoration: none; }
a:hover { color: #fff; }
button { font-family: inherit; }
::selection { background: rgba(201, 162, 39, 0.3); }

/* ---------------- 启动 ---------------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 18px;
  text-align: center;
}
.boot-mark { display: flex; align-items: baseline; gap: 0.35em; font-family: var(--display); letter-spacing: 0.14em; }
.boot-mark span:first-child { font-size: 54px; color: var(--brass-2); }
.boot-mark span:last-child { font-size: 15px; color: var(--muted); }
.boot-text { color: var(--faint); font-size: 13px; letter-spacing: 0.18em; }

/* ---------------- 登录 ---------------- */
.login-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(460px, 1fr);
}
.login-side {
  padding: 58px 64px 40px;
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(160deg, rgba(201, 162, 39, 0.06), transparent 42%),
    linear-gradient(0deg, rgba(90, 168, 138, 0.03), transparent 55%);
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.brand-seal {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brass-2), var(--brass));
  color: #131008; font-family: var(--display); font-weight: 800; font-size: 22px;
  box-shadow: 0 8px 24px rgba(201, 162, 39, 0.25);
}
.login-brand h1 { margin: 0; font-size: 22px; font-family: var(--display); letter-spacing: 0.12em; }
.login-brand small { color: var(--muted); letter-spacing: 0.26em; font-size: 10px; text-transform: uppercase; }
.login-hero { margin: 64px 0 40px; max-width: 560px; }
.login-hero .kicker { color: var(--brass-2); font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; margin-bottom: 18px; }
.login-hero h2 {
  margin: 0 0 20px;
  font-family: var(--display);
  font-size: clamp(34px, 4.2vw, 56px);
  line-height: 1.08;
  letter-spacing: 0.02em;
}
.login-hero h2 em { color: var(--brass-2); font-style: normal; }
.login-hero p { color: var(--muted); line-height: 1.9; font-size: 14px; max-width: 480px; }
.login-stats { display: flex; gap: 34px; margin-top: 34px; }
.login-stat b { display: block; font-family: var(--display); font-size: 26px; color: var(--text); }
.login-stat span { color: var(--faint); font-size: 12px; letter-spacing: 0.08em; }
.login-side-foot { color: var(--faint); font-size: 11px; line-height: 1.9; letter-spacing: 0.04em; }
.login-main { padding: 46px 54px 40px; overflow: auto; max-height: 100vh; }
.login-main h3 { font-family: var(--display); font-size: 20px; margin: 0 0 6px; }
.login-main .login-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 26px; }
.login-form { display: grid; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 30px; }
.login-form .field { margin: 0; }
.login-hint { color: var(--faint); font-size: 11.5px; line-height: 1.8; }
.role-groups { display: grid; gap: 22px; }
.role-group h4 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 10px; font-size: 12px; color: var(--muted);
  letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600;
}
.role-group h4::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.role-card {
  text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 11px;
  padding: 12px 13px; background: var(--panel);
  color: var(--text); transition: 0.18s ease;
  display: grid; gap: 4px;
}
.role-card:hover { border-color: rgba(201, 162, 39, 0.5); background: var(--panel-2); transform: translateY(-1px); }
.role-card b { font-size: 14px; }
.role-card span { color: var(--muted); font-size: 11px; }
.role-card i {
  font-style: normal; font-size: 10px; letter-spacing: 0.08em;
  width: max-content; padding: 2px 7px; border-radius: 999px;
  background: var(--panel-3); color: var(--muted); margin-bottom: 3px;
}
.role-card.is-cost i { color: var(--jade); background: var(--jade-soft); }
.role-card.is-finance i { color: var(--red); background: var(--red-soft); }
.role-card.is-admin i { color: var(--muted); }

/* ---------------- 外壳 ---------------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 26px 18px 20px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(20, 26, 33, 0.92), rgba(11, 14, 18, 0.96));
  backdrop-filter: blur(12px);
}
.rail-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; border-bottom: 1px solid var(--line-soft); }
.rail-brand h1 { margin: 0; font-family: var(--display); font-size: 17px; letter-spacing: 0.08em; }
.rail-brand small { color: var(--faint); font-size: 9px; letter-spacing: 0.28em; }
.rail-nav { margin-top: 20px; display: flex; flex-direction: column; gap: 3px; overflow: auto; }
.nav-label { color: var(--faint); font-size: 9.5px; letter-spacing: 0.26em; text-transform: uppercase; padding: 0 10px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 13px;
  border: 1px solid transparent; transition: 0.16s ease;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.is-active { background: linear-gradient(90deg, var(--brass-soft), transparent); border-color: rgba(201, 162, 39, 0.25); color: var(--brass-2); }
.nav-index { font-family: var(--mono); font-size: 10px; color: var(--faint); width: 18px; }
.nav-item.is-active .nav-index { color: var(--brass); }
.nav-count { margin-left: auto; font-family: var(--mono); font-size: 10px; background: var(--red); color: #fff; border-radius: 999px; padding: 1px 6px; }
.rail-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.rail-user { display: flex; align-items: center; gap: 10px; padding: 0 6px 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(145deg, #2a3542, #1a222c);
  border: 1px solid var(--line);
  font-family: var(--display); font-size: 14px; color: var(--brass-2);
}
.rail-user-name { font-size: 13px; }
.rail-user-role { color: var(--faint); font-size: 10.5px; margin-top: 2px; }
.rail-logout {
  width: 100%; border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 7px; padding: 7px; font-size: 11.5px; cursor: pointer;
}
.rail-logout:hover { color: var(--text); border-color: var(--line); background: var(--panel); }
.rail-version { text-align: center; color: var(--faint); font-size: 9px; letter-spacing: 0.12em; margin-top: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 34px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 20;
  background: rgba(12, 15, 19, 0.82); backdrop-filter: blur(14px);
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.crumb b { color: var(--text); font-weight: 500; }
.crumb span { color: var(--faint); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.mode-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; color: var(--muted); font-size: 10.5px; letter-spacing: 0.06em;
}
.mode-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--jade); box-shadow: 0 0 8px var(--jade); }
.period-chip { font-family: var(--mono); font-size: 11px; color: var(--brass-2); border: 1px solid rgba(201, 162, 39, 0.3); padding: 4px 9px; border-radius: 6px; background: var(--brass-soft); }

.view { padding: 30px 34px 70px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; flex: 1 1 560px; }
.eyebrow { color: var(--brass-2); font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; margin-bottom: 9px; }
.page-title { font-family: var(--display); font-size: clamp(26px, 2.6vw, 36px); margin: 0; letter-spacing: 0.02em; line-height: 1.1; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 9px; line-height: 1.7; max-width: 720px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; justify-content: flex-end; }

/* ---------------- 通用 ---------------- */
.grid { display: grid; gap: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; }
.kpi {
  position: relative; overflow: hidden; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  padding: 18px 18px 15px;
}
.kpi::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--brass), transparent);
  opacity: 0.7;
}
.kpi.is-jade::after { background: linear-gradient(180deg, var(--jade), transparent); }
.kpi.is-amber::after { background: linear-gradient(180deg, var(--amber), transparent); }
.kpi.is-red::after { background: linear-gradient(180deg, var(--red), transparent); }
.kpi.is-indigo::after { background: linear-gradient(180deg, var(--indigo), transparent); }
.kpi-label { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; display: flex; justify-content: space-between; align-items: center; }
.kpi-value { font-family: var(--mono); font-size: clamp(19px, 1.7vw, 27px); margin-top: 9px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value small { font-size: 12px; color: var(--muted); margin-left: 4px; }
.kpi-foot { color: var(--faint); font-size: 10.5px; margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; }
.kpi-delta { color: var(--jade); }
.kpi-delta.is-up { color: var(--red); }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px 14px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { font-size: 14px; margin: 0; font-family: var(--display); letter-spacing: 0.06em; }
.panel-head h2 small { color: var(--faint); font-family: var(--font); font-weight: 400; font-size: 10.5px; margin-left: 8px; letter-spacing: 0.04em; }
.panel-body { padding: 18px 20px; }
.panel-body.is-flush { padding: 0; }
.panel-note { color: var(--faint); font-size: 11px; line-height: 1.8; }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 16px; }
.split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 11px; }
.nowrap { white-space: nowrap; }
.pos { color: var(--red); }
.neg { color: var(--jade); }
.is-up { color: var(--red); }
.is-down { color: var(--jade); }
.hairline { height: 1px; background: var(--line-soft); margin: 14px 0; }

/* 标签/印章 */
.badge, .stamp {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 2px 8px;
  font-size: 10px; letter-spacing: 0.04em;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel-3);
  white-space: nowrap;
}
.badge.is-jade, .stamp.is-jade, .badge.is-ok, .stamp.is-ok { color: var(--jade); border-color: rgba(90, 168, 138, 0.35); background: var(--jade-soft); }
.badge.is-amber, .stamp.is-amber, .badge.is-warn, .stamp.is-warn { color: var(--amber); border-color: rgba(217, 164, 65, 0.35); background: var(--amber-soft); }
.badge.is-red, .stamp.is-red, .badge.is-danger, .stamp.is-danger { color: var(--red); border-color: rgba(196, 85, 62, 0.4); background: var(--red-soft); }
.badge.is-indigo, .stamp.is-progress { color: var(--indigo); border-color: rgba(131, 147, 207, 0.35); background: var(--indigo-soft); }
.badge.is-brass { color: var(--brass-2); border-color: rgba(201, 162, 39, 0.35); background: var(--brass-soft); }
.stamp { border-radius: 6px; padding: 4px 9px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; }
.stamp.is-muted { color: var(--muted); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 8px; padding: 8px 14px; font-size: 12px; cursor: pointer;
  transition: 0.16s ease; white-space: nowrap;
}
.btn:hover { border-color: #3a4656; background: var(--panel-3); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(145deg, var(--brass-2), var(--brass)); border-color: transparent; color: #17130a; font-weight: 700; }
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(145deg, var(--brass-2), var(--brass)); }
.btn-jade { background: var(--jade); border-color: transparent; color: #07120e; font-weight: 700; }
.btn-danger { background: var(--red-soft); border-color: rgba(196, 85, 62, 0.45); color: #e8a294; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-block { width: 100%; }

/* 表单 */
.field { display: grid; gap: 6px; }
.field label { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.field label em { color: var(--red); font-style: normal; }
.field .hint { color: var(--faint); font-size: 10.5px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  border-radius: 7px; padding: 9px 11px; font-family: inherit; font-size: 13px; outline: none;
  transition: 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: rgba(201, 162, 39, 0.55); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.08); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; min-height: 74px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form-grid .field.is-full { grid-column: 1 / -1; }

/* 表格 */
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; font-weight: 500; color: var(--faint); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.012);
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.is-clickable { cursor: pointer; }
tbody tr.is-clickable:hover { background: rgba(201, 162, 39, 0.04); }
.cell-main { display: grid; gap: 3px; }
.cell-main b { font-weight: 500; }
.cell-main span { color: var(--faint); font-size: 10.5px; }
.table-empty { padding: 34px 20px; }

/* 阶段条 */
.stage-bar { display: flex; align-items: center; gap: 0; margin: 4px 0 6px; }
.stage-step { flex: 1; display: grid; justify-items: center; gap: 7px; position: relative; color: var(--faint); font-size: 10px; }
.stage-step::before {
  content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 1px;
  background: var(--line); z-index: 0;
}
.stage-step:first-child::before { display: none; }
.stage-num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-3); border: 1px solid var(--line); color: var(--faint);
  font-family: var(--mono); font-size: 10px; position: relative; z-index: 1;
}
.stage-step.is-done { color: var(--jade); }
.stage-step.is-done .stage-num { background: var(--jade-soft); border-color: rgba(90, 168, 138, 0.55); color: var(--jade); }
.stage-step.is-done::before { background: rgba(90, 168, 138, 0.45); }
.stage-step.is-current { color: var(--brass-2); }
.stage-step.is-current .stage-num { background: var(--brass-soft); border-color: var(--brass); color: var(--brass-2); box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.08); }

/* 成本卡 */
.cost-sheet { display: grid; gap: 0; }
.cost-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line-soft); align-items: baseline; }
.cost-row:last-child { border-bottom: 0; }
.cost-row .label { color: var(--muted); font-size: 12px; }
.cost-row .std { font-family: var(--mono); text-align: right; color: var(--muted); }
.cost-row .act { font-family: var(--mono); text-align: right; }
.cost-row.is-total { border-top: 1px solid var(--line); border-bottom: 0; padding-top: 14px; margin-top: 2px; }
.cost-row.is-total .label { color: var(--text); font-weight: 600; }
.cost-row.is-total .act, .cost-row.is-total .std { font-size: 16px; color: var(--text); }
.cost-head { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; padding-bottom: 8px; color: var(--faint); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; }
.cost-head span:not(:first-child) { text-align: right; }
.variance-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-family: var(--mono); }
.variance-pill.is-bad { color: var(--red); background: var(--red-soft); }
.variance-pill.is-ok { color: var(--jade); background: var(--jade-soft); }
.variance-pill.is-warn { color: var(--amber); background: var(--amber-soft); }

/* 得分环 */
.score-ring {
  --p: 0; --ring: var(--jade);
  width: 116px; height: 116px; border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--p) * 1%), rgba(255, 255, 255, 0.06) 0);
  display: grid; place-items: center; position: relative; flex: 0 0 auto;
}
.score-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line-soft); }
.score-ring b { position: relative; font-family: var(--mono); font-size: 30px; letter-spacing: -0.04em; }
.score-ring b small { font-size: 10px; color: var(--faint); margin-left: 2px; }

/* 稽核维度 */
.dim { display: grid; gap: 5px; margin-bottom: 11px; }
.dim:last-child { margin-bottom: 0; }
.dim-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.dim-top b { font-family: var(--mono); color: var(--text); font-weight: 500; }
.dim-bar { height: 5px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.dim-bar i { display: block; height: 100%; border-radius: 999px; background: var(--jade); }
.dim-bar i.is-warn { background: var(--amber); }
.dim-bar i.is-fail { background: var(--red); }

/* 检查项 */
.check-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 11px; padding: 12px 13px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--bg-2); margin-bottom: 8px; }
.check-row:last-child { margin-bottom: 0; }
.check-mark { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--panel-3); color: var(--muted); }
.check-row.is-pass .check-mark { background: var(--jade-soft); color: var(--jade); }
.check-row.is-warn .check-mark { background: var(--amber-soft); color: var(--amber); }
.check-row.is-fail .check-mark { background: var(--red-soft); color: var(--red); }
.check-title { font-size: 12px; display: flex; gap: 8px; align-items: center; }
.check-title .group-name { color: var(--faint); font-size: 10px; }
.check-detail { color: var(--muted); font-size: 11px; line-height: 1.7; margin-top: 4px; }
.check-suggest { color: var(--brass-2); font-size: 10.5px; margin-top: 4px; }
.check-status { font-size: 10px; color: var(--muted); white-space: nowrap; }
.check-row.is-pass .check-status { color: var(--jade); }
.check-row.is-warn .check-status { color: var(--amber); }
.check-row.is-fail .check-status { color: var(--red); }

/* 结账流水线 */
.pipeline { display: grid; gap: 10px; }
.stage-card { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 15px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--bg-2); }
.stage-card.is-done { border-color: rgba(90, 168, 138, 0.28); background: linear-gradient(90deg, var(--jade-soft), var(--bg-2) 55%); }
.stage-card.is-current { border-color: rgba(201, 162, 39, 0.4); background: linear-gradient(90deg, var(--brass-soft), var(--bg-2) 55%); }
.stage-card.is-blocked { border-color: rgba(196, 85, 62, 0.45); }
.stage-index { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--panel-3); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.stage-card.is-done .stage-index { background: var(--jade-soft); color: var(--jade); }
.stage-card.is-current .stage-index { background: var(--brass-soft); color: var(--brass-2); }
.stage-title { font-size: 13px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.stage-desc { color: var(--faint); font-size: 10.5px; line-height: 1.7; margin-top: 3px; }
.stage-meta { color: var(--faint); font-size: 10px; margin-top: 4px; }

/* 凭证 */
.journal { border: 1px solid var(--line-soft); border-radius: 9px; margin-bottom: 10px; overflow: hidden; }
.journal-head { display: flex; justify-content: space-between; padding: 9px 13px; background: var(--panel-2); font-size: 11px; color: var(--muted); }
.journal-head b { color: var(--text); font-weight: 500; }
.journal table { font-size: 11px; }
.journal td, .journal th { padding: 7px 13px; }
.journal .debit { color: var(--brass-2); }
.journal .credit { color: var(--jade); }

.total-row td { background: var(--panel-2); font-weight: 600; }
.strong { font-weight: 600; color: var(--text); }

/* 成本法选择 */.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.mode-card {
  text-align: left; cursor: pointer; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-2); padding: 16px 17px;
  display: grid; gap: 9px; transition: 0.16s ease;
}
.mode-card:hover:not(:disabled) { border-color: rgba(201, 162, 39, 0.45); background: var(--panel-2); }
.mode-card.is-active { border-color: rgba(201, 162, 39, 0.55); background: linear-gradient(145deg, var(--brass-soft), var(--bg-2)); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.05); }
.mode-card:disabled { cursor: default; }
.mode-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mode-name { font-family: var(--display); font-size: 16px; letter-spacing: 0.04em; }
.mode-desc { color: var(--muted); font-size: 11.5px; line-height: 1.8; }
.mode-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.mode-meta span { font-size: 9.5px; color: var(--faint); border: 1px solid var(--line-soft); border-radius: 999px; padding: 2px 8px; }

/* 趋势 */
.trend { display: flex; align-items: flex-end; gap: 13px; height: 180px; padding-top: 10px; }
.trend-col { flex: 1; display: grid; justify-items: center; gap: 6px; height: 100%; align-content: end; }
.trend-bars { display: flex; align-items: flex-end; gap: 3px; width: 100%; height: 132px; justify-content: center; }
.trend-bar { width: 12px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--brass-2), var(--brass)); min-height: 3px; align-self: flex-end; }
.trend-bar.is-std { background: linear-gradient(180deg, #3b4a5c, #2a3542); }
.trend-label { color: var(--faint); font-size: 9.5px; font-family: var(--mono); }

/* 构成条 */
.composition { display: grid; gap: 13px; }
.comp-bar { display: flex; height: 15px; border-radius: 999px; overflow: hidden; background: var(--panel-3); }
.comp-bar i { height: 100%; }
.comp-legend { display: grid; gap: 9px; }
.comp-item { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted); }
.comp-dot { width: 8px; height: 8px; border-radius: 2px; }
.comp-item b { margin-left: auto; font-family: var(--mono); color: var(--text); font-weight: 500; }

/* 时间线 */
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line-soft); }
.tl-item:last-child { border-bottom: 0; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-top: 5px; justify-self: center; }
.tl-item.is-key .tl-dot { background: var(--brass); box-shadow: 0 0 8px rgba(201, 162, 39, 0.5); }
.tl-title { font-size: 12px; }
.tl-meta { display: flex; gap: 10px; color: var(--faint); font-size: 10px; margin-top: 3px; }
.tl-detail { color: var(--muted); font-size: 10.5px; line-height: 1.7; margin-top: 3px; }

/* BOM 树 */
.tree { display: grid; gap: 0; }
.tree-node { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12px; }
.tree-node:last-child { border-bottom: 0; }
.tree-rail { color: var(--faint); font-family: var(--mono); font-size: 10px; }
.tree-name { display: grid; gap: 2px; }
.tree-name small { color: var(--faint); font-size: 10px; }
.tree-cost { font-family: var(--mono); color: var(--text); }
.tree-node.is-leaf .tree-rail { color: var(--brass); }

/* 附件 */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.att-card { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--bg-2); position: relative; }
.att-thumb { height: 84px; display: grid; place-items: center; background: var(--panel-2); color: var(--faint); font-size: 22px; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-body { padding: 8px 10px; }
.att-name { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-sub { display: flex; justify-content: space-between; color: var(--faint); font-size: 9.5px; margin-top: 4px; }
.att-remove { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; cursor: pointer; }

/* OEE */
.oee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 13px; }
.oee-card { border: 1px solid var(--line); border-radius: 11px; background: var(--bg-2); padding: 15px; display: grid; gap: 11px; }
.oee-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.oee-name { font-size: 13px; }
.oee-code { color: var(--faint); font-size: 10px; font-family: var(--mono); margin-top: 3px; }
.oee-value { font-family: var(--mono); font-size: 26px; }
.oee-value small { font-size: 10px; color: var(--faint); }
.oee-meter { height: 6px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.oee-meter i { display: block; height: 100%; background: var(--jade); }
.oee-meter i.is-warn { background: var(--amber); }
.oee-meter i.is-bad { background: var(--red); }
.oee-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.oee-split span { color: var(--faint); font-size: 9.5px; display: block; }
.oee-split b { font-family: var(--mono); font-size: 11.5px; font-weight: 500; }

/* 进度 */
.progress { height: 6px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), var(--brass-2)); }
.progress.is-jade i { background: linear-gradient(90deg, #3f7f68, var(--jade)); }

/* 提示条 */
.alert { border-radius: 9px; padding: 11px 13px; font-size: 11.5px; line-height: 1.8; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); }
.alert b { color: var(--text); }
.alert.is-info { border-color: rgba(131, 147, 207, 0.3); background: var(--indigo-soft); }
.alert.is-warn { border-color: rgba(217, 164, 65, 0.35); background: var(--amber-soft); color: #d9c08a; }
.alert.is-danger { border-color: rgba(196, 85, 62, 0.4); background: var(--red-soft); color: #dca396; }
.alert.is-ok { border-color: rgba(90, 168, 138, 0.35); background: var(--jade-soft); color: #a7cfc1; }

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 18px; overflow: auto; }
.tab { padding: 9px 14px; font-size: 12px; color: var(--muted); border: 0; background: transparent; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brass-2); border-bottom-color: var(--brass); }

/* 矩阵 */
.matrix { font-size: 11px; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.matrix .grant { color: var(--jade); }
.matrix .deny { color: #3a4654; }
.matrix td { padding: 8px 10px; }
.matrix th { padding: 8px 10px; }

/* 空态/加载 */
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text-2); font-weight: 500; margin-bottom: 6px; }
.empty div { font-size: 11.5px; line-height: 1.8; }
.loading { display: flex; align-items: center; gap: 10px; padding: 40px 0; justify-content: center; color: var(--muted); font-size: 12px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--panel-3); border-top-color: var(--brass); animation: spin 0.75s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 弹窗 */
dialog { border: 0; background: transparent; padding: 0; color: var(--text); max-width: min(560px, calc(100vw - 40px)); width: 100%; }
dialog::backdrop { background: rgba(4, 6, 9, 0.72); backdrop-filter: blur(3px); }
.dialog-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); overflow: hidden; }
.dialog-panel.is-wide { max-width: 860px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line-soft); }
.dialog-head h3 { margin: 0; font-size: 15px; font-family: var(--display); letter-spacing: 0.04em; }
.dialog-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.dialog-close { border: 0; background: var(--panel-2); color: var(--muted); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 15px; }
.dialog-body { padding: 18px 20px; max-height: 68vh; overflow: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 20px 18px; border-top: 1px solid var(--line-soft); }
.dialog-error { font-size: 11px; }

/* Toast */
.toast-stack { position: fixed; right: 22px; bottom: 26px; z-index: 9999; display: grid; gap: 9px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 2px solid var(--jade);
  border-radius: 9px; padding: 11px 15px; box-shadow: var(--shadow);
  font-size: 12px; max-width: 340px; animation: toastIn 0.2s ease;
}
.toast small { display: block; color: var(--faint); margin-top: 3px; }
.toast.is-error { border-left-color: var(--red); }
.toast.is-warn { border-left-color: var(--amber); }
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } }

/* 底部 */
.site-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 4px 12px; font-size: 9.5px; color: var(--faint);
  background: rgba(11, 14, 18, 0.86); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line-soft);
}
.site-foot a { color: var(--faint); }
.site-foot a:hover { color: var(--brass-2); }

/* 响应式 */
@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
  .login-screen { grid-template-columns: 1fr; }
  .login-side { border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 40px 34px; }
  .login-hero { margin: 34px 0 8px; }
  .login-main { max-height: none; padding: 34px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; overflow-x: auto; }
  .rail-brand { border-bottom: 0; padding: 0 14px 0 0; }
  .rail-brand h1 { font-size: 14px; }
  .rail-nav { flex-direction: row; margin: 0; }
  .nav-label, .rail-foot { display: none; }
  .nav-item { padding: 7px 9px; font-size: 12px; }
  .nav-index { display: none; }
  .topbar { padding: 0 18px; }
  .view { padding: 22px 18px 60px; }
  .split-even { grid-template-columns: 1fr; }
  .cost-row, .cost-head { grid-template-columns: 1fr 0.8fr 0.8fr; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-actions { width: 100%; }
  .stage-bar { overflow-x: auto; }
  .stage-step { min-width: 54px; }
  .login-side { display: none; }
  .login-main { padding: 24px 18px; }
  .site-foot { font-size: 8.5px; gap: 8px; }
}
