/* ============================================================
   钒洛管理系统 — 全局样式
   设计令牌（颜色/圆角/阴影等 CSS 变量）统一在 tokens.css 维护
   ============================================================ */
@import url("tokens.css?v=221");

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: var(--font); font-size: 15px; color: var(--text); background: var(--bg-warm); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   封面 / 欢迎页 — 星辰银河主题
   ============================================================ */
.welcome {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #03050f;
  color: #d0daf0;
}

/* 银河深空背景 */
.welcome__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% 35%, rgba(35,25,100,.4) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 25% 55%, rgba(20,50,140,.3) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 30%, rgba(70,25,140,.22) 0%, transparent 55%),
    radial-gradient(ellipse 35% 30% at 65% 75%, rgba(25,70,180,.15) 0%, transparent 50%),
    radial-gradient(ellipse 45% 35% at 10% 15%, rgba(30,120,100,.12) 0%, transparent 45%),
    radial-gradient(ellipse 50% 30% at 15% 25%, rgba(50,180,120,.08) 0%, transparent 50%);
}
.welcome__bg svg { display: none; }
.welcome__grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ══════════════════════════════════════════════════════════
   登录页 · 雄鹰日出全景版
   构图：题词居顶正中 → 品牌文案居左 → 登录卡停靠右下（海岸线空域）
   雄鹰（画面中右上方）完整可见，不被任何元素遮挡
   ══════════════════════════════════════════════════════════ */
.welcome--photo { background: #140d05; }
.welcome--photo .welcome__bg {
  position: absolute;
  inset: -2.5%;                    /* 预留 Ken Burns 缩放余量，避免露边 */
  z-index: 1;
  background: url("../img/login-bird.png?v=2") 60% 36% / cover no-repeat;
  filter: saturate(1.12) contrast(1.04);
  animation: bgDrift 36s ease-in-out infinite alternate;
  transform-origin: 62% 38%;       /* 以鹰为中心缓慢呼吸 */
}
.welcome--photo .welcome__draft {
  position: absolute;
  left: clamp(1.05rem, 2.2vw, 1.85rem);
  top: clamp(0.72rem, 1.8vh, 1.15rem);
  z-index: 5;
  margin: 0;
  pointer-events: none;
  white-space: nowrap;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: .04em;
  color: #fff8e8;
  text-shadow:
    0 0 10px rgba(255, 228, 160, .8),
    0 1px 2px rgba(40, 16, 0, .7);
}
@keyframes bgDrift {
  from { transform: scale(1); }
  to   { transform: scale(1.04); }
}

/* 三向柔性遮罩：左侧承托文案、底部承托页脚与登录卡、顶部承托题词；
   画面中央（雄鹰）保持通透明亮 */
.welcome__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(90deg,
      rgba(16,9,3,.72) 0%,
      rgba(16,9,3,.52) 20%,
      rgba(16,9,3,.24) 36%,
      rgba(16,9,3,.06) 48%,
      transparent 58%),
    linear-gradient(0deg,
      rgba(10,5,2,.66) 0%,
      rgba(10,5,2,.34) 12%,
      rgba(10,5,2,.08) 24%,
      transparent 34%),
    linear-gradient(180deg,
      rgba(14,8,2,.46) 0%,
      rgba(14,8,2,.16) 10%,
      transparent 20%);
}

/* ── 题词：居顶正中，如卷首题字 ── */
.welcome__motto {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  text-align: center;
  padding-top: clamp(1.1rem, 3.2vh, 2.2rem);
  animation: mottoReveal 1.4s ease-out;
}
@keyframes mottoReveal {
  0%   { opacity: 0; transform: translateY(-14px); }
  100% { opacity: 1; transform: translateY(0); }
}
.welcome__motto-main {
  margin: 0;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  font-weight: 500;
  letter-spacing: .5em;
  text-indent: .5em;            /* 抵消末字后的字距，保证视觉居中 */
  color: rgba(255,240,212,.95);
  text-shadow: 0 2px 14px rgba(30,12,0,.75), 0 1px 3px rgba(30,12,0,.6);
  white-space: nowrap;
}
.welcome__motto-divider {
  width: 168px;
  height: 1px;
  margin: 0;
  background: linear-gradient(90deg, transparent, rgba(255,208,130,.75), transparent);
}
.welcome__motto-sub {
  margin: 0;
  font-size: clamp(.72rem, 1vw, .82rem);
  font-weight: 400;
  letter-spacing: .62em;
  text-indent: .62em;
  color: rgba(255,226,180,.62);
  text-shadow: 0 1px 4px rgba(30,12,0,.7);
  white-space: nowrap;
}

/* ── 整页栅格：题词 / 舞台 / 页脚 ── */
.welcome__frame {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0 clamp(1.5rem, 4vw, 4rem) clamp(.9rem, 2vh, 1.4rem);
}

/* 舞台：左文案 + 右登录卡，中央留给雄鹰 */
.welcome__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(2rem, 6vw, 6rem);
  min-height: 0;
}

/* 更改密码等旧页仍使用的居中容器 */
.welcome__content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1.25rem;
  text-align: center;
}
.welcome__content .welcome__login-card { width: min(100%, 400px); text-align: left; }

/* ── 品牌文案（左，避开鹰的下翼） ── */
.welcome__hero {
  flex: 0 1 auto;
  max-width: min(46vw, 620px);
  align-self: center;
  transform: translateY(-4vh);    /* 略微上移，让出画面下方翼尖 */
  animation: heroFadeIn 1s ease-out .15s both;
}
@keyframes heroFadeIn {
  from { opacity: 0; transform: translate(-32px, -4vh); }
  to   { opacity: 1; transform: translate(0, -4vh); }
}
.welcome__tagline {
  margin: 0 0 .8rem;
  font-size: clamp(.66rem, .85vw, .74rem);
  font-weight: 600;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: rgba(255,198,112,.85);
  text-shadow: 0 1px 3px rgba(40,18,2,.65);
}
.welcome__title {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1.32;
  color: #fffaf2;
  text-shadow: 0 3px 18px rgba(15,6,0,.7), 0 1px 4px rgba(15,6,0,.55);
  /* 仅允许在 <wbr>（浙江）后断行，避免中文任意断字 */
  word-break: keep-all;
  overflow-wrap: normal;
}
.welcome__divider {
  width: 64px;
  height: 3px;
  margin: 1.15rem 0 1rem;
  background: linear-gradient(90deg, rgba(255,200,96,.95), rgba(232,142,42,.25));
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(255,180,80,.35);
}
.welcome__subtitle {
  margin: 0 0 .35rem;
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  font-weight: 600;
  letter-spacing: .22em;
  color: rgba(255,226,180,.98);
  text-shadow: 0 0 24px rgba(230,150,50,.35), 0 1px 4px rgba(35,15,2,.72);
}
.welcome__subtitle2 {
  margin: 0 0 1rem;
  font-size: clamp(.88rem, 1.25vw, 1rem);
  font-weight: 400;
  letter-spacing: .16em;
  color: rgba(255,236,210,.76);
  text-shadow: 0 1px 4px rgba(35,15,2,.62);
}
.welcome__desc {
  margin: 0;
  font-size: clamp(.8rem, 1vw, .9rem);
  line-height: 1.75;
  color: rgba(255,238,214,.68);
  font-weight: 400;
  text-shadow: 0 1px 3px rgba(20,8,0,.6);
}

/* ── 登录卡（右下停靠，落在海岸线空域，不压鹰翼） ── */
.welcome__login {
  flex: 0 0 auto;
  align-self: flex-end;
  margin-bottom: clamp(.5rem, 2.5vh, 2rem);
  animation: cardSlideUp .9s ease-out .3s both;
}
@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(34px); }
  to   { opacity: 1; transform: translateY(0); }
}
.welcome__login-card {
  position: relative;
  width: clamp(320px, 24vw, 360px);
  background: linear-gradient(168deg, rgba(26,15,6,.62) 0%, rgba(16,9,4,.7) 100%);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-radius: 18px;
  box-shadow:
    0 24px 64px rgba(0,0,0,.5),
    0 4px 16px rgba(0,0,0,.3),
    inset 0 1px 0 rgba(255,222,166,.14);
  padding: 1.4rem 1.6rem 1.2rem;
  overflow: hidden;
  border: 1px solid rgba(255,186,96,.24);
}
.welcome__login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(201,130,28,.85), rgba(240,172,50,.95), rgba(201,130,28,.85));
}
.welcome__card-kicker {
  margin: 0 0 .35rem;
  text-align: center;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(255,190,110,.55);
}
.welcome__card-title {
  margin: 0 0 1.1rem;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: rgba(255,255,255,.92);
}
.welcome__card-hello {
  margin: 0 0 1.5rem;
  text-align: center;
  font-size: 1rem;
  color: rgba(255,206,140,.85);
  font-weight: 500;
}

.welcome__login-form { display: flex; flex-direction: column; gap: .85rem; }
.welcome__label {
  display: block;
  margin-bottom: .35rem;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .12em;
  color: rgba(255,205,150,.6);
  text-transform: uppercase;
}
.welcome__field input {
  width: 100%;
  padding: .72rem .95rem;
  font-size: .92rem;
  font-family: inherit;
  color: #f4e7d4;
  border: 1px solid rgba(255,190,100,.22);
  border-radius: 8px;
  background: rgba(8,5,3,.75);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  box-sizing: border-box;
}
.welcome__field input:focus {
  border-color: rgba(255,190,100,.65);
  box-shadow: 0 0 0 2px rgba(255,170,70,.28);
  background: rgba(12,7,3,.92);
}
.welcome__field input::placeholder { color: rgba(220,190,150,.42); font-weight: 300; }
.welcome__field-hint {
  display: block;
  margin-top: .35rem;
  font-size: .68rem;
  color: rgba(255,200,150,.38);
  letter-spacing: .04em;
}
.welcome__field--readonly {
  background: rgba(255,180,90,.1) !important;
  color: rgba(255,220,170,.95) !important;
  font-weight: 600;
  cursor: default;
  border-color: rgba(255,190,100,.28) !important;
}

/* 登录/进入按钮 */
.welcome__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .9rem 2.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #3a1e02;
  background: linear-gradient(135deg, #c9821c 0%, #f0ac32 50%, #c9821c 100%);
  border: 1px solid rgba(255,200,110,.4);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(210,130,30,.28);
  text-decoration: none;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.welcome__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(240,160,50,.42);
  text-decoration: none;
  border-color: rgba(255,210,130,.65);
}
.welcome__cta--btn {
  width: 100%;
  margin-top: .25rem;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .25em;
}

.welcome__change-pwd {
  display: block;
  margin-top: .75rem;
  text-align: center;
  font-size: .78rem;
  letter-spacing: .05em;
  color: rgba(230,200,160,.45);
  transition: color .2s;
}
.welcome__change-pwd:hover { color: rgba(255,206,140,.9); text-decoration: none; }

/* 封面 flash 提示 */
.welcome__flash {
  margin-bottom: .85rem;
  padding: .55rem .8rem;
  font-size: .82rem;
  border-radius: 6px;
  text-align: center;
}
.welcome__flash--error   { background: rgba(185,28,28,.12); color: #ff8a8a; border: 1px solid rgba(255,100,100,.2); }
.welcome__flash--success { background: rgba(22,101,52,.12); color: #6ee7a0; border: 1px solid rgba(110,231,160,.2); }
.welcome__flash--warning { background: rgba(146,64,14,.12); color: #fbbf24; border: 1px solid rgba(251,191,36,.2); }
.welcome__flash--info    { background: rgba(30,64,175,.12); color: #93c5fd; border: 1px solid rgba(147,197,253,.2); }

/* 底部品牌 + 版权（横贯全宽，细线收边） */
.welcome__footer {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: clamp(.65rem, 1.6vh, 1.1rem);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(255,190,100,.18);
  animation: footerFade 1.2s ease-out .45s both;
}
@keyframes footerFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.welcome__brand {
  position: static;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.welcome__logo-mark {
  position: relative;
  width: 36px; height: 36px;
  flex-shrink: 0;
}
.welcome__logo-sq {
  position: absolute;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,190,100,.45);
  background: rgba(255,190,100,.06);
}
.welcome__logo-sq--1 { left: 0; top: 6px; transform: rotate(-12deg); }
.welcome__logo-sq--2 { left: 8px; top: 3px; transform: rotate(8deg); opacity: .7; }
.welcome__logo-sq--3 { left: 14px; top: 9px; transform: rotate(-4deg); opacity: .5; }
.welcome__logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.welcome__finelok {
  font-size: 1.15rem;
  font-weight: 700;
  color: rgba(255,250,240,.85);
  letter-spacing: .02em;
  text-shadow: 0 1px 3px rgba(20,8,0,.6);
}
.welcome__finelok sup { font-size: .5em; font-weight: 600; }
.welcome__tag-en {
  font-size: .62rem;
  color: rgba(255,200,130,.65);
  letter-spacing: .05em;
  margin-top: 1px;
  text-shadow: 0 1px 2px rgba(20,8,0,.55);
}

/* 底部版权 */
.welcome__copy {
  position: static;
  margin: 0;
  font-size: .68rem;
  color: rgba(255,222,182,.6);
  letter-spacing: .04em;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(20,8,0,.55);
}

@media (prefers-reduced-motion: reduce) {
  .welcome--photo .welcome__bg,
  .welcome__motto,
  .welcome__hero,
  .welcome__footer,
  .welcome__login {
    animation: none !important;
  }
  .welcome__hero { transform: translateY(-4vh); }
}

/* ── 欢迎页移动端适配：纵向堆叠，鹰移入上半屏 ── */
@media (max-width: 800px) {
  .welcome--photo .welcome__bg {
    background-position: 62% 22%;
    animation: none;
  }
  .welcome--photo .welcome__draft {
    left: 1rem;
    right: auto;
    top: 0.62rem;
    bottom: auto;
    transform: none;
    letter-spacing: .04em;
    font-size: 1.28rem;
  }
  .welcome__overlay {
    background:
      linear-gradient(180deg,
        rgba(14,8,3,.5) 0%,
        rgba(14,8,3,.18) 18%,
        rgba(14,8,3,.2) 42%,
        rgba(14,8,3,.72) 68%,
        rgba(14,8,3,.9) 100%);
  }
  .welcome__frame { padding: 0 1.25rem 1.25rem; }
  .welcome__motto { padding-top: 1.1rem; gap: .45rem; }
  .welcome__motto-main { font-size: .95rem; letter-spacing: .34em; text-indent: .34em; }
  .welcome__motto-sub { font-size: .68rem; letter-spacing: .4em; text-indent: .4em; }
  .welcome__motto-divider { width: 120px; }
  .welcome__stage {
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 1.25rem;
    padding-top: 34vh;             /* 上半屏让给雄鹰 */
  }
  .welcome__hero {
    max-width: 100%;
    width: 100%;
    align-self: center;
    transform: none;
    text-align: center;
  }
  @keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .welcome__title { font-size: 1.35rem; }
  .welcome__divider { margin: .9rem auto .8rem; }
  .welcome__subtitle2 { margin-bottom: .6rem; }
  .welcome__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .welcome__login {
    align-self: center;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
  }
  .welcome__login-card { width: min(100%, 420px); }
  .welcome__footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .35rem;
  }
  .welcome__brand { flex-direction: column; gap: .3rem; }
  .welcome__copy { white-space: normal; }
  .welcome__logo-text { align-items: center; }
}

/* 中等宽度桌面：收窄文案列，防止与鹰翼相触 */
@media (min-width: 801px) and (max-width: 1180px) {
  .welcome__hero { max-width: 40vw; }
  .welcome__login-card { width: clamp(300px, 27vw, 340px); }
  .welcome--photo .welcome__bg { background-position: 57% 36%; }
}

/* 桌面矮屏（≤860px 高）：压缩纵向留白，保证登录卡与页脚完整可见 */
@media (min-width: 801px) and (max-height: 860px) {
  .welcome__motto { padding-top: .9rem; gap: .4rem; }
  .welcome__tagline { margin-bottom: .55rem; }
  .welcome__title { font-size: clamp(1.5rem, 2.5vw, 2.05rem); line-height: 1.3; }
  .welcome__divider { margin: .85rem 0 .75rem; }
  .welcome__subtitle2 { margin-bottom: .65rem; }
  .welcome__desc { line-height: 1.6; }
  .welcome__hero { transform: translateY(-2vh); }
  .welcome__login { margin-bottom: .5rem; }
  .welcome__login-card { padding: 1.15rem 1.4rem 1rem; }
  .welcome__card-title { margin-bottom: .85rem; }
  .welcome__login-form { gap: .7rem; }
  .welcome__field input { padding: .62rem .9rem; }
  .welcome__change-pwd { margin-top: .55rem; }
  .welcome__footer { padding-top: .55rem; }
  .welcome__logo-mark { width: 28px; height: 28px; }
}

/* ============================================================
   主页面布局
   ============================================================ */
.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-warm);
}

/* 顶栏 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 1.25rem;
  background: var(--header-grad);
  border-bottom: 1px solid var(--header-border);
}
.header__left {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.header__grid-icon {
  display: inline-block;
  width: 18px; height: 18px;
  background:
    linear-gradient(to right, var(--brown) 33%, transparent 33% 67%, var(--brown) 67%),
    linear-gradient(to bottom, var(--brown) 33%, transparent 33% 67%, var(--brown) 67%);
  background-size: 6px 6px;
  opacity: .85;
}
.header__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--header-title);
  text-decoration: none;
  letter-spacing: .06em;
}
.header__title:hover { color: var(--blue); text-decoration: none; }
.header__right {
  display: flex;
  align-items: center;
  gap: .85rem;
}
.header__status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  color: var(--text-muted);
}
.header__user {
  font-size: .85rem;
  color: var(--text-muted);
}
.header__logout {
  font-size: .82rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: .25rem .5rem;
  border: 1px solid rgba(139,105,20,.2);
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.header__logout:hover {
  background: rgba(139,105,20,.08);
  text-decoration: none;
}
.header__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(46,125,50,.2);
}

/* 部门导航标签栏 */
.tabs {
  background: #ebe4d8;
  border-bottom: 1px solid rgba(139,105,20,.12);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs__inner {
  display: flex;
  flex-wrap: nowrap;
  gap: .25rem;
  padding: .35rem .75rem;
  min-height: 48px;
  align-items: center;
}
.tabs__item {
  flex: 0 0 auto;
  padding: .45rem .9rem;
  font-size: .88rem;
  color: #4a4338;
  text-decoration: none;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tabs__item:hover {
  background: rgba(255,255,255,.55);
  color: var(--blue);
  text-decoration: none;
}
.tabs__item--active {
  background: linear-gradient(180deg, #ffd8a8 0%, #f0b878 100%);
  color: #3d2910;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}

/* 部门功能横向顶栏（部门名 + 子功能 Tab） */
.dept-topbar {
  background: linear-gradient(180deg, #f5efe4 0%, #ebe4d8 100%);
  border-bottom: 1px solid rgba(139,105,20,.15);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.dept-topbar__inner {
  display: flex;
  align-items: stretch;
  min-height: 46px;
  max-width: 100%;
}
.dept-topbar__dept {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 1rem 0 1.1rem;
  background: linear-gradient(135deg, #c9a227 0%, #a67c00 100%);
  border-right: 1px solid rgba(61,41,16,.2);
  position: sticky;
  left: 0;
  z-index: 2;
}
.dept-topbar__name {
  font-size: .92rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: .02em;
  text-shadow: 0 1px 1px rgba(0,0,0,.15);
}
.dept-topbar__tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .15rem;
  padding: .35rem .75rem;
  min-width: 0;
}
.dept-topbar__tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .4rem .75rem;
  font-size: .84rem;
  color: #4a4338;
  text-decoration: none;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.dept-topbar__tab:hover {
  background: rgba(255,255,255,.6);
  color: var(--blue);
  text-decoration: none;
}
.dept-topbar__tab--active {
  background: linear-gradient(180deg, #ffd8a8 0%, #f0b878 100%);
  color: #3d2910;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.dept-topbar__tab--sub {
  font-size: .8rem;
  padding: .32rem .6rem;
}
.dept-topbar__ico {
  font-size: .95em;
  line-height: 1;
}
.dept-topbar__grp {
  flex: 0 0 auto;
  font-size: .72rem;
  font-weight: 700;
  color: #8b6914;
  padding: .2rem .45rem;
  margin-left: .35rem;
  border-left: 2px solid rgba(139,105,20,.25);
  white-space: nowrap;
  user-select: none;
}

/* 主体（侧边栏 + 内容） */
.body { flex: 1; display: flex; min-height: 0; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #5c4330 0%, #4a3628 100%);
  color: #f0e8dc;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0,0,0,.15);
}
.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem .75rem;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .06em;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__body {
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar__body > .sidebar__nav:first-of-type {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.sidebar__nav--bottom {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: .35rem;
}
.sidebar__comm-label {
  padding: .45rem .75rem .25rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: #a89880;
  text-transform: uppercase;
}
.comm-nav .sidebar__link {
  position: relative;
}
.comm-badge {
  margin-left: auto;
  min-width: 1.15rem;
  padding: 0 6px;
  border-radius: 10px;
  background: #c45c26;
  color: #fff;
  font-size: 11px;
  line-height: 1.45;
  font-weight: 700;
  text-align: center;
}
.comm-badge[hidden] { display: none !important; }

/* 统一模块切换器分隔线 */
.sidebar__switch-divider {
  height: 1px;
  margin: .4rem .6rem .25rem;
  background: rgba(255,255,255,.12);
}
.sidebar__group--switch .sidebar__group-title:hover { color: var(--text-primary); }

/* 侧边栏菜单 */
.sidebar__nav { display: flex; flex-direction: column; padding: .5rem 0; }
.sidebar__link {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .65rem .75rem;
  font-size: .85rem;
  color: #d4c8b8;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.sidebar__link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}
.sidebar__link--active {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: var(--bronze);
  font-weight: 600;
}
.sidebar__icon { font-size: 1rem; flex-shrink: 0; width: 1.2em; text-align: center; }

/* 内容区 */
.content {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem 2rem;
  overflow: auto;
}

/* ============================================================
   部门总览
   ============================================================ */
.overview__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.overview__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #3d3428;
}
.overview__sub {
  margin: .35rem 0 0;
  font-size: .9rem;
  color: var(--text-muted);
}
.overview__hint {
  margin: 0;
  font-size: .82rem;
  color: var(--text-muted);
  max-width: 16rem;
  text-align: right;
  line-height: 1.45;
}

/* 统计卡片 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.stat-card__num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.1;
}
.stat-card__status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--success);
}
.stat-card__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--success);
}
.stat-card__label {
  font-size: .85rem;
  color: var(--text-muted);
}

/* 部门卡片网格 */
.section-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #3d3428;
}
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .85rem;
}
.dept-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
  padding: 1rem .75rem;
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.dept-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26,92,171,.12);
  text-decoration: none;
}
.dept-card__avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,.15);
}
.dept-card__name {
  font-size: .82rem;
  text-align: center;
  line-height: 1.35;
  color: #3d3428;
}

/* ============================================================
   部门详情（占位）
   ============================================================ */
.dept-page { max-width: 720px; }
.dept-page__crumb {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.dept-page__crumb a { color: var(--blue); }
.dept-page__sep { margin: 0 .35rem; opacity: .6; }
.dept-page__title {
  margin: 0 0 .5rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: #3d3428;
}
.dept-page__desc {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.dept-page__box {
  padding: 1.5rem;
  background: var(--card);
  border: 1px dashed rgba(26,92,171,.25);
  border-radius: var(--radius-lg);
  line-height: 1.7;
}
.dept-page__box code {
  font-size: .9em;
  padding: .1em .35em;
  background: rgba(26,92,171,.08);
  border-radius: 4px;
}
.dept-page__empty { padding: 2rem 0; color: var(--text-muted); }

/* ============================================================
   Flash 消息
   ============================================================ */
.flash-area { margin-bottom: 1rem; }
.flash {
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  line-height: 1.5;
  margin-bottom: .5rem;
}
.flash--success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.flash--error   { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
.flash--info    { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.flash--warning { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }

/* ============================================================
   管理页 — 表格
   ============================================================ */
.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.admin-header h1 { margin: 0; font-size: 1.35rem; color: #3d3428; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid #d5cfc6;
}
.data-table th,
.data-table td {
  padding: .7rem .85rem;
  text-align: left;
  font-size: .88rem;
  border: 1px solid #d5cfc6;
}
.data-table th {
  background: #f5efe6;
  font-weight: 600;
  color: #5c4a2a;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.data-table tr:last-child td { }
.data-table tr:hover td { background: rgba(26,92,171,.03); }
.data-table--compact th,
.data-table--compact td {
  padding: .45rem .55rem;
  font-size: .78rem;
  white-space: nowrap;
}
.td-ellipsis {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .actions { white-space: nowrap; }
.data-table .actions a,
.data-table .actions button {
  font-size: .82rem;
  margin-right: .5rem;
}


/* Excel 式表头列筛（零部件入库台账等） */
.xls-th {
  white-space: nowrap;
  position: relative;
}
.xls-th__label {
  margin-right: 2px;
}
.xls-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: #8b6914;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}
.xls-filter-btn:hover,
.xls-th--active .xls-filter-btn {
  background: #fff3cd;
  border-color: rgba(139,105,20,.35);
  color: #5c4500;
}
.xls-th--active .xls-filter-btn {
  background: #1a5cab;
  border-color: #1a5cab;
  color: #fff;
}
.xls-filter-panel {
  position: fixed;
  z-index: 1200;
  width: 260px;
  max-height: min(420px, 70vh);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  padding: 8px;
  box-sizing: border-box;
  font-size: 12px;
}
.xls-filter-panel[hidden] { display: none !important; }
.xls-filter-panel__search { margin-bottom: 6px; }
.xls-filter-panel__input {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid rgba(139,105,20,.35);
  border-radius: 3px;
  outline: none;
}
.xls-filter-panel__input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(26,92,171,.12);
}
.xls-filter-panel__all {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0 6px;
  border-bottom: 1px solid var(--border, #e5e0d5);
  font-weight: 600;
  cursor: pointer;
}
.xls-filter-panel__list {
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 80px;
  max-height: 260px;
  padding: 4px 6px 4px 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  pointer-events: auto;
  scrollbar-gutter: stable;
}
.xls-filter-panel {
  pointer-events: auto;
}
.xls-filter-panel__item {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 3px 8px 3px 2px;
  cursor: pointer;
  word-break: break-all;
  pointer-events: auto;
}
.xls-filter-panel__item:hover { background: #f7f5f0; }
.xls-filter-panel__empty {
  color: var(--text-muted, #888);
  padding: 12px 4px;
  text-align: center;
}
.xls-filter-panel__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border, #e5e0d5);
}

/* ============================================================
   管理页 — 表单
   ============================================================ */
.admin-form {
  max-width: 560px;
  background: var(--card);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.admin-form[style*="max-width:900px"] { max-width: 900px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0 1rem;
}
.form-grid .form-group { margin-bottom: .75rem; }
.td-actions {
  display: inline-flex;
  gap: .15rem;
  white-space: nowrap;
  flex-wrap: nowrap;
  align-items: center;
}
.td-actions > form {
  display: inline-flex;
  margin: 0;
}
/* 操作列按钮：压过 .btn / .btn--danger 较大 padding，尽量一行横排 */
.td-actions .btn {
  padding: .1rem .28rem;
  font-size: .78rem;
  line-height: 1.25;
  border-radius: 3px;
  flex-shrink: 0;
}
.btn--xs {
  padding: .2rem .45rem;
  font-size: .72rem;
  border-radius: 3px;
}
.btn--edit {
  background: rgba(26,92,171,.08);
  color: var(--blue);
  border: 1px solid rgba(26,92,171,.18);
}
.btn--edit:hover { background: rgba(26,92,171,.16); }
.flash-area { margin-bottom: .75rem; }
.flash {
  padding: .55rem 1rem;
  margin-bottom: .4rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  animation: flashIn .3s ease;
}
.flash--success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.flash--error   { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: .35rem;
  font-size: .88rem;
  font-weight: 600;
  color: #3d3428;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: .55rem .7rem;
  font-size: .9rem;
  font-family: inherit;
  border: 1px solid rgba(139,105,20,.25);
  border-radius: var(--radius-sm);
  background: #fffefb;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,92,171,.12);
}
.form-hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* 工号自动识别姓名提示 */
.emp-name-hint {
  display: inline-block;
  min-width: 3em;
  font-size: .85rem;
  font-weight: 600;
  color: var(--blue);
}

/* 工艺步骤标签 */
.step-tag {
  display: inline-block;
  padding: .15rem .45rem;
  margin: .1rem .15rem;
  font-size: .75rem;
  background: rgba(26,92,171,.08);
  color: var(--blue);
  border-radius: 4px;
  border: 1px solid rgba(26,92,171,.12);
  white-space: nowrap;
}

/* 备份文件列表 */
.backup-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.backup-list__item {
  padding: .4rem 0;
  font-size: .85rem;
  color: var(--text);
  border-bottom: 1px dashed var(--border);
}
.backup-list__item:last-child { border-bottom: none; }

/* 导入引导 */
.import-guide { line-height: 1.7; }
.import-guide h3 { margin: 0 0 .5rem; font-size: 1rem; color: #3d3428; }
.import-guide ol { margin: 0 0 .75rem; padding-left: 1.5rem; font-size: .9rem; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 1.15rem;
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, transform .1s;
}
.btn:hover { text-decoration: none; }
.btn--primary {
  background: var(--blue);
  color: #fff;
}
.btn--primary:hover { background: var(--blue-light); }
.btn--success {
  background: var(--success);
  color: #fff;
}
.btn--success:hover { background: #388e3c; }
.btn--danger {
  background: #d32f2f;
  color: #fff;
  padding: .35rem .75rem;
  font-size: .8rem;
}
.btn--danger:hover { background: #c62828; }
.btn--outline {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
}
.btn--outline:hover { background: rgba(26,92,171,.06); }
.btn--sm { padding: .3rem .65rem; font-size: .8rem; }

/* 筛选栏 */
.badge {
  display: inline-block;
  padding: .12rem .5rem;
  border-radius: 10px;
  font-size: .74rem;
  line-height: 1.5;
  background: #eef0f2;
  color: #555;
  white-space: nowrap;
}
.badge--success { background: #e3f6e8; color: #1f7a3d; }
.badge--warning { background: #fff3da; color: #9a6a00; }
.badge--danger  { background: #fde4e4; color: #b3261e; }
.barcode-svg { display: inline-block; max-width: 100%; height: auto; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1rem;
  font-size: .88rem;
}
.filter-bar select {
  padding: .4rem .65rem;
  font-size: .85rem;
  font-family: inherit;
  border: 1px solid rgba(139,105,20,.25);
  border-radius: var(--radius-sm);
  background: #fffefb;
}
.search-inline {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.search-inline__input {
  padding: .4rem .65rem;
  font-size: .85rem;
  font-family: inherit;
  border: 1px solid rgba(139,105,20,.25);
  border-radius: var(--radius-sm);
  background: #fffefb;
  width: 160px;
  outline: none;
}
.search-inline__input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,92,171,.12);
}

.ledger-top-search {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  max-width: 100%;
}
.ledger-top-search .search-inline__input {
  width: 108px;
}
.ledger-top-search .search-inline__input--wide {
  width: 220px;
}
.ledger-top-search .search-inline__input--date {
  width: 132px;
}
.ledger-top-search__sep {
  color: var(--text-muted, #888);
  font-size: .8rem;
}

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  margin-top: 1.25rem;
}
.pagination__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: .35rem .65rem;
  font-size: .82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--blue);
  text-decoration: none;
  transition: background .12s;
}
.pagination__link:hover { background: rgba(26,92,171,.06); text-decoration: none; }
.pagination__link--active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.pagination__link--disabled {
  color: var(--text-muted);
  opacity: .5;
  pointer-events: none;
}
.pagination__ellipsis { color: var(--text-muted); font-size: .82rem; padding: 0 .25rem; }

/* ============================================================
   错误页面
   ============================================================ */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: var(--bg-warm);
}
.error-page__code {
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 700;
  color: var(--blue);
  margin: 0 0 .5rem;
  line-height: 1;
}
.error-page__msg {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
}

/* ============================================================
   登录页
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, #f5f8fc 0%, var(--bg-warm) 100%);
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  padding: 2rem 1.75rem;
}
.login-card__title {
  margin: 0 0 .25rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--blue);
  text-align: center;
}
.login-card__sub {
  margin: 0 0 1.5rem;
  font-size: .88rem;
  color: var(--text-muted);
  text-align: center;
}
.login-form .form-group { margin-bottom: 1rem; }
.login-form .form-group label {
  display: block;
  margin-bottom: .35rem;
  font-size: .88rem;
  font-weight: 600;
  color: #3d3428;
}
.login-form .form-group input {
  width: 100%;
  padding: .6rem .75rem;
  font-size: .9rem;
  font-family: inherit;
  border: 1px solid rgba(139,105,20,.25);
  border-radius: var(--radius-sm);
  background: #fffefb;
  outline: none;
}
.login-form .form-group input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,92,171,.12);
}

/* ============================================================
   汉堡菜单按钮
   ============================================================ */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #5c4a2a;
  border-radius: 1px;
  transition: transform .2s;
}

/* 侧边栏遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 90;
}
.sidebar-overlay--visible { display: block; }

/* 表格横向滚动容器 */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 宽表固定视口：外层约一屏高，内部双轴滚动；表头 sticky；操作列 sticky 右 */
.table-scroll--viewport {
  max-height: calc(100vh - 240px);
  min-height: 220px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border: 1px solid #d5cfc6;
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow);
}
.table-scroll--viewport .data-table {
  width: max-content;
  min-width: 100%;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  border-collapse: separate;
  border-spacing: 0;
}
.table-scroll--viewport .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f5efe6;
  box-shadow: inset 0 -1px 0 #d5cfc6;
}
.table-scroll--viewport .data-table th.col-sticky-right,
.table-scroll--viewport .data-table td.col-sticky-right {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--card, #fff);
  box-shadow: -6px 0 10px -6px rgba(60, 40, 10, .18);
}
.table-scroll--viewport .data-table thead th.col-sticky-right {
  z-index: 4;
  background: #f5efe6;
}
.table-scroll--viewport .data-table tbody tr:hover > td.col-sticky-right {
  background: #f4f7fb;
}
.table-scroll--viewport .data-table tbody tr[data-locked] > td.col-sticky-right {
  background: #f0f7f0;
}
.table-scroll--viewport .data-table tbody tr[data-locked]:hover > td.col-sticky-right {
  background: #e6f0e6;
}
/* 左侧钉列：序号 + 单号（可叠多层 left；--1 的 left 由 JS 按序号列实测宽写入，下列为回退） */
.table-scroll--viewport .data-table th.col-sticky-left,
.table-scroll--viewport .data-table td.col-sticky-left {
  position: sticky;
  background: #fff;
  background-clip: padding-box;
}
/* 越靠左 z 越高，避免横滚时被盖住；表头再高于表体与普通 sticky 表头(z=3) */
.table-scroll--viewport .data-table td.col-sticky-left--0 { z-index: 2; }
.table-scroll--viewport .data-table td.col-sticky-left--1 { z-index: 1; }
.table-scroll--viewport .data-table thead th.col-sticky-left--0 {
  z-index: 6;
  background: #f5efe6;
}
.table-scroll--viewport .data-table thead th.col-sticky-left--1 {
  z-index: 5;
  background: #f5efe6;
}
/* 序号列锁宽，与 --1 的 left 回退一致；JS 会按 offsetWidth 重写 left */
.table-scroll--viewport .data-table .col-sticky-left--0 {
  left: 0;
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  box-sizing: border-box;
}
.table-scroll--viewport .data-table .col-sticky-left--1 {
  left: 64px;
  min-width: 130px;
  box-sizing: border-box;
}
/* 最右一块左钉列才投阴影，避免多层叠影 */
.table-scroll--viewport .data-table th.col-sticky-left--edge,
.table-scroll--viewport .data-table td.col-sticky-left--edge {
  box-shadow: 6px 0 10px -6px rgba(60, 40, 10, .18);
}
.table-scroll--viewport .data-table tbody tr:hover > td.col-sticky-left {
  background: #f4f7fb;
}
.table-scroll--viewport .data-table tbody tr[data-locked] > td.col-sticky-left {
  background: #f0f7f0;
}
.table-scroll--viewport .data-table tbody tr[data-locked]:hover > td.col-sticky-left {
  background: #e6f0e6;
}
/* xls-th 自带 position:relative；钉列必须保持 sticky（勿被 col-resize 等写回 relative） */
.table-scroll--viewport .data-table thead th.xls-th.col-sticky-left,
.table-scroll--viewport .data-table thead th.col-sticky-left,
.table-scroll--viewport .data-table thead th.col-sticky-right,
.table-scroll--viewport .data-table td.col-sticky-left,
.table-scroll--viewport .data-table td.col-sticky-right {
  position: sticky !important;
}




/* ============================================================
   行内编辑（双击）
   ============================================================ */
td[data-field] { cursor: default; }
td[data-field]:hover { background: rgba(26,92,171,.04); }
.ie-input {
  width: 100%;
  min-width: 50px;
  padding: .2rem .35rem;
  font-size: inherit;
  font-family: inherit;
  border: 1.5px solid var(--blue);
  border-radius: 3px;
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(26,92,171,.15);
}
.ie-saving { opacity: .5; }

.th-step,
.td-step {
  min-width: 52px;
  max-width: 80px;
  text-align: center;
  font-size: .82rem;
  padding: 4px 5px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-step .ie-input { width: 100%; min-width: 44px; font-size: .82rem; padding: 2px 3px; }

/* 列宽拖拽手柄 */
.col-resize-grip {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
}
.col-resize-grip:hover,
.col-resize-grip:active {
  background: rgba(26,92,171,.35);
}

/* 行高拖拽手柄 */
.row-resize-grip {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 7px;
  cursor: row-resize;
  z-index: 10;
}
.row-resize-grip:hover,
.row-resize-grip:active {
  background: rgba(26,92,171,.35);
}
table.data-table tbody tr {
  height: auto;
}
table.data-table tbody td {
  vertical-align: middle;
  overflow: visible;
}

table.data-table thead th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ie-ok {
  animation: ieFlashOk .5s ease;
}
.ie-err {
  animation: ieFlashErr .5s ease;
}
@keyframes ieFlashOk {
  0%   { background: rgba(46,125,50,.18); }
  100% { background: transparent; }
}
@keyframes ieFlashErr {
  0%   { background: rgba(211,47,47,.18); }
  100% { background: transparent; }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
  .hamburger { display: flex; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar--open { transform: translateX(0); }

  .admin-form { max-width: 100%; }

  .data-table { min-width: 600px; }

  .filter-bar { flex-direction: column; align-items: flex-start; }

  .admin-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .welcome__footer { flex-direction: column; align-items: center; }
  .stats { grid-template-columns: 1fr; }
  .dept-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ============================================================
   实际生产数量列 — 密码解锁隐藏
   ============================================================ */
.aq-hidden {
  display: none !important;
}
.aq-unlock {
  user-select: none;
}

/* ============================================================
   流程卡打印预览
   ============================================================ */
.print-card-wrapper {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0;
}
.print-card {
  width: 780px;
  background: #fff;
  border: 2px solid #222;
  padding: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 13px;
  color: #111;
}
.pc-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 10px 16px 6px;
  border-bottom: 2px solid #222;
}
.pc-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 12px;
}
.pc-brand {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  font-style: italic;
  color: #333;
}
.pc-header-table {
  width: 100%;
  border-collapse: collapse;
}
.pc-header-table td {
  border: 1px solid #222;
  padding: 5px 8px;
  line-height: 1.5;
}
.pc-header-table .pc-label {
  background: #f5f5f0;
  font-weight: 600;
  white-space: nowrap;
  width: 70px;
  text-align: center;
}
.pc-header-table .pc-value {
  min-width: 60px;
}
.pc-detail-table {
  width: 100%;
  border-collapse: collapse;
}
.pc-detail-table th,
.pc-detail-table td {
  border: 1px solid #222;
  padding: 4px 6px;
  text-align: center;
  line-height: 1.6;
  height: 28px;
}
.pc-detail-table thead th {
  background: #f5f5f0;
  font-weight: 600;
  font-size: 13px;
}
.pc-detail-table tbody td:nth-child(2) {
  text-align: left;
  padding-left: 8px;
}

/* ---- 打印样式 ---- */
@media print {
  .no-print, .header, .sidebar, .hamburger,
  .tabs, .dept-topbar, .filter-bar, .admin-header { display: none !important; }
  body { background: #fff; margin: 0; }
  .layout { display: block; }
  .main { padding: 0; margin: 0; }
  .print-card-wrapper { padding: 0; }
  .print-card {
    width: 100%;
    border-width: 1.5pt;
    page-break-inside: avoid;
  }
  .pc-header-table td { border-width: 0.8pt; }
  .pc-detail-table th,
  .pc-detail-table td { border-width: 0.8pt; }
}

/* ============================================================
   系统门户（工作台）— 模块磁贴启动台
   ============================================================ */
.portal { max-width: 1200px; margin: 0 auto; }

.portal__hero {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1.2rem;
  padding: 1.6rem 1.8rem;
  margin-bottom: 1.8rem;
  background: linear-gradient(135deg, #1a5cab 0%, #2568c4 55%, #2a6b8b 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  color: #fff;
}
.portal__title { margin: 0; font-size: 1.7rem; font-weight: 700; letter-spacing: .5px; }
.portal__sub { margin: .4rem 0 0; font-size: .95rem; opacity: .85; }

.portal__stats { display: flex; gap: 1.6rem; }
.portal__stat { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.portal__stat-num { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.portal__stat-num--ok { color: #7CFFB0; }
.portal__stat-label { font-size: .78rem; opacity: .8; margin-top: .2rem; }

.portal__section { margin-bottom: 2rem; }
.portal__section-title {
  font-size: 1.05rem; font-weight: 600; color: var(--text);
  margin: 0 0 1rem; padding-left: .6rem;
  border-left: 3px solid var(--blue);
}

.portal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.1rem;
}
.portal__grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .9rem;
}

.app-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: .6rem; padding: 1.4rem 1rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.app-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(26, 92, 171, 0.18);
  border-color: rgba(26, 92, 171, 0.35);
  text-decoration: none;
}
.app-tile__icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700;
}
.app-tile__icon--mini { width: 44px; height: 44px; font-size: 1rem; border-radius: 12px; }
.app-tile__name { font-size: .98rem; font-weight: 600; }
.app-tile__desc { font-size: .78rem; color: var(--text-muted); line-height: 1.35; }

.app-tile--mini { padding: 1rem .8rem; gap: .5rem; }

@media (max-width: 640px) {
  .portal__hero { flex-direction: column; align-items: flex-start; }
  .portal__stats { gap: 1.1rem; }
  .portal__grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
