/* ==========================================================
   app.css —— 公文管理平台界面样式（浅色 / 政务风）
   ========================================================== */

:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --panel-2: #faf9f6;
  --ink: #1b1c1f;
  --ink-2: #5b6068;
  --ink-3: #8d929a;
  --line: #e5e2db;
  --line-soft: #efece6;
  --red: #c1272d;
  --red-dark: #9d1d22;
  --red-soft: #fbeceb;
  --green: #1d7a4d;
  --green-soft: #e8f4ee;
  --amber: #b06a10;
  --amber-soft: #fcf1e0;
  --blue: #2f5fd0;
  --blue-soft: #eaeffb;
  --purple: #6a4f9e;
  --purple-soft: #f0ecf7;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(24, 20, 14, 0.05);
  --shadow-md: 0 6px 24px rgba(24, 20, 14, 0.09);
  --shadow-lg: 0 18px 60px rgba(24, 20, 14, 0.16);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
::selection { background: #f3d3d2; }

/* ---------------- 布局 ---------------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 236px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 15px; letter-spacing: 0.04em; }
.brand-text span { font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; }

.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.nav a svg { width: 17px; height: 17px; flex: none; opacity: 0.75; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.active { background: var(--red-soft); color: var(--red-dark); font-weight: 600; }
.nav a.active svg { opacity: 1; }
.nav a.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--red);
  border-radius: 0 3px 3px 0;
}

/* .nav a 自带 display:flex，会盖过浏览器默认的 [hidden]{display:none}；
   不显式声明 !important，非管理员的两个菜单会一直显示 */
.nav a[hidden] { display: none !important; }
.badge[hidden] { display: none !important; }

.badge {
  margin-left: auto;
  font-style: normal;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid var(--line-soft);
}

.role-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: var(--panel-2);
}

.role-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #efe7dc;
  color: #7a5a35;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  flex: none;
}

.role-meta { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.role-meta strong { font-size: 12.5px; }
.role-meta span { font-size: 11px; color: var(--ink-3); }

.role-select {
  width: 100%;
  margin-top: 8px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  padding: 0 8px;
  outline: none;
  cursor: pointer;
}

.role-select:focus { border-color: var(--red); }
.role-tip { margin: 7px 0 0; font-size: 11px; color: var(--ink-3); text-align: center; }

/* ---------------- 主区域 ---------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.crumb-root { color: var(--ink-3); }
.crumb-sep { color: #c9c5bd; }
#crumbNow { color: var(--ink); font-weight: 600; }

.top-actions { display: flex; align-items: center; gap: 14px; }
.today { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* 云端同步状态指示点 */
.cloud-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #c9c5bc;
  display: inline-block;
  flex: none;
  cursor: help;
  transition: background 0.3s, box-shadow 0.3s;
}
.cloud-dot.on {
  background: var(--green, #2e9e5b);
  box-shadow: 0 0 0 3px rgba(46, 158, 91, 0.15);
}
.cloud-dot.off { background: #d9a441; box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.15); }

.view {
  padding: 24px 26px 60px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ---------------- 通用元素 ---------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.page-head p { margin: 5px 0 0; font-size: 12.5px; color: var(--ink-3); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.card-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head h2::before {
  content: "";
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--red);
  display: inline-block;
}

.card-body { padding: 18px; }
.card-body.tight { padding: 14px 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { border-color: #d3cfc7; background: var(--panel-2); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 1px 2px rgba(193, 39, 45, 0.24);
}
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }

.btn-ghost { background: transparent; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }

.btn-text {
  border: none;
  background: none;
  color: var(--red);
  padding: 0 4px;
  height: 26px;
  font-size: 12.5px;
  cursor: pointer;
}
.btn-text:hover { text-decoration: underline; }
.btn-text.muted { color: var(--ink-2); }
.btn-text.danger { color: #c0392b; }

/* ---------------- 员工账号 ---------------- */
.session-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; margin-top: 10px; }
.session-btns .btn { padding-left: 4px; padding-right: 4px; font-size: 12px; }

/* 文号样式预设 */
.tpl-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tpl-preset {
  text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 9px; padding: 10px 12px; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column; gap: 4px;
}
.tpl-preset:hover { border-color: var(--red); }
.tpl-preset.on { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft); }
.tpl-preset strong { font-size: 12.5px; color: var(--ink); }
.tpl-preset em { font-style: normal; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.user-cell { display: flex; align-items: center; gap: 9px; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--red-soft); color: var(--red);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 650; flex: none;
}
.user-self {
  font-style: normal; font-size: 10px; color: var(--red);
  background: var(--red-soft); border-radius: 4px; padding: 1px 5px; margin-left: 2px;
}
.u-on { font-size: 12px; color: var(--green); }
.u-off { font-size: 12px; color: var(--ink-3); }

/* ==========================================================
/* ==========================================================
   登录页 —— 版式对齐「运营管理系统」登录页
   中央圆角大卡片：左品牌展示区（墨红 + 金 / 圆环 + 光晕 + 水印字）
                 右表单区（米白底 + 顶部渐变条白卡）
   ========================================================== */
@keyframes loginFade { from { opacity: 0; } to { opacity: 1; } }

.show-login.overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
  background:
    radial-gradient(1100px 620px at 6% -14%, #f0e7d6 0%, transparent 58%),
    radial-gradient(900px 520px at 102% 110%, #f3ecdd 0%, transparent 52%),
    #f7f5f0;
  backdrop-filter: none;
  animation: loginFade .3s ease-out;
  overflow: auto;
}

/* ---------- 中央大卡片 ---------- */
.show-login .login-card {
  width: min(980px, 100%);
  min-height: 640px;
  display: grid;
  grid-template-columns: 435px 1fr;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: 0 32px 80px -24px rgba(40, 28, 24, .28), 0 2px 8px rgba(40, 28, 24, .05);
}

/* ---------- 左：品牌展示区 ---------- */
.show-login .login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 38px 40px 24px;
  color: #f5ece4;
  background:
    radial-gradient(120% 90% at 78% 16%, rgba(205, 71, 62, .42), transparent 62%),
    linear-gradient(147deg, #24161a 0%, #4a1a20 42%, #7d2228 80%, #93262c 100%);
}
.lb-ring { position: absolute; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .16); pointer-events: none; }
.lb-ring.r1 { width: 300px; height: 300px; right: -70px; top: -46px; }
.lb-ring.r2 { width: 208px; height: 208px; right: -24px; top: 0; border-color: rgba(255, 255, 255, .11); }
.lb-ring.r3 { width: 430px; height: 430px; left: -170px; bottom: -200px; border-color: rgba(255, 255, 255, .07); }
.lb-glow {
  position: absolute; width: 420px; height: 420px; right: -130px; top: -150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 189, 133, .30) 0%, transparent 65%);
  filter: blur(8px); pointer-events: none;
}
.lb-mark {
  position: absolute; right: -40px; bottom: -92px;
  font: 900 320px/1 "Songti SC", "STSong", "SimSun", serif;
  color: rgba(255, 255, 255, .07); pointer-events: none; user-select: none;
}
.lb-head, .show-login .login-hero-top { position: relative; z-index: 1; }
.show-login .login-logo {
  width: 40px; height: 40px; padding: 5px; flex: none;
  border-radius: 11px; background: #fff;
  box-shadow: 0 8px 18px -6px rgba(0, 0, 0, .4);
}
.show-login .login-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.show-login .login-hero-top { display: flex; align-items: center; gap: 12px; }
.show-login .login-hero-org strong { display: block; font-size: 16px; letter-spacing: .08em; font-weight: 650; color: #fff; }
.show-login .login-hero-org span { display: block; font-size: 10px; letter-spacing: .15em; color: rgba(245, 236, 228, .72); margin-top: 4px; }
.lb-main { position: relative; z-index: 1; margin: auto 0; padding: 42px 0 34px; }
.lb-main h1 {
  margin: 0; font-size: 30px; line-height: 1.52; color: #fff;
  font-weight: 700; letter-spacing: 1.5px;
  text-shadow: 0 10px 34px rgba(0, 0, 0, .22);
}
.lb-foot {
  position: relative; z-index: 1; margin-top: auto; padding-top: 14px;
  font-size: 11px; color: rgba(230, 214, 200, .5); letter-spacing: .3px;
}

/* ---------- 右：表单区 ---------- */
.show-login .login-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 56px 22px;
  background: linear-gradient(180deg, #faf8f4 0%, #f4efe7 100%);
}
.show-login .login-box {
  width: 100%; max-width: 400px; margin: 0 auto;
  position: relative; overflow: hidden;
  background: #fff; border-radius: 18px; padding: 26px 30px 24px;
  border: 1px solid #eae3d6;
  box-shadow: 0 24px 56px -24px rgba(40, 28, 24, .18), 0 2px 8px rgba(40, 28, 24, .04);
}
.login-box-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #d0363a 0%, #b9232a 55%, #8e1f24 100%);
}
.show-login .login-title {
  margin: 0 0 20px; text-align: center;
  font-size: 24px; line-height: 1.3; color: var(--ink); font-weight: 700; letter-spacing: -.4px;
}
.login-notice {
  background: #fcf3e4; color: #a5670e; border: 1px solid #f2e1c2;
  font-size: 12px; padding: 9px 12px; border-radius: 9px; margin-bottom: 16px;
}
.show-login .login-field { margin-bottom: 15px; }
.show-login .login-field > label {
  display: block; font-size: 12.5px; color: var(--ink-2);
  margin-bottom: 7px; font-weight: 550; letter-spacing: .04em;
}
.show-login .login-input-wrap { position: relative; }
.show-login .login-input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: #a9a49b; pointer-events: none;
}
.show-login .login-input-wrap .input {
  height: 46px; padding-left: 41px; border-radius: 11px; font-size: 14px;
  background: #fcfbf8; border-color: #e2dbcd;
}
.show-login .login-input-wrap .input:focus {
  background: #fff; border-color: var(--red); box-shadow: 0 0 0 4px rgba(193, 39, 45, .09);
}
.show-login .login-input-wrap:focus-within .login-input-icon { color: var(--red); }
.login-err { min-height: 20px; font-size: 12px; color: #c0392b; margin: 2px 0 8px; }
.show-login .login-btn {
  position: relative; width: 100%; height: 47px; border-radius: 11px;
  font-size: 15px; font-weight: 600; letter-spacing: 4px; text-indent: 4px;
  border-color: transparent;
  background: linear-gradient(93deg, #b9232a 0%, #d0363a 100%);
  box-shadow: 0 12px 26px -10px rgba(185, 35, 42, .55);
  transition: filter .15s, box-shadow .15s, background .15s;
}
.show-login .login-btn:hover:not(:disabled) {
  background: linear-gradient(93deg, #a01f25 0%, #c23035 100%);
  box-shadow: 0 14px 30px -10px rgba(185, 35, 42, .65);
}
.show-login .login-btn:disabled { opacity: .7; }
.show-login .login-btn .btn-arrow {
  position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
  display: flex; color: #fff; opacity: .95; letter-spacing: 0; text-indent: 0;
}
.login-secure {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 20px; font-size: 11px; color: var(--ink-3); letter-spacing: .04em;
}
.login-secure svg { width: 12px; height: 12px; }

/* ---------- 自适应 ---------- */
@media (max-width: 900px) {
  .show-login.overlay { padding: 20px; }
  .show-login .login-card { grid-template-columns: 1fr; width: min(480px, 100%); min-height: 0; }
  .show-login .login-brand { display: none; }
  .show-login .login-left { padding: 28px 22px 18px; }
}
@media (max-height: 720px) {
  .show-login.overlay { align-items: flex-start; padding-top: 20px; padding-bottom: 20px; }
  .show-login .login-card { min-height: 0; }
  .lb-main { padding: 22px 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .show-login.overlay { animation: none; }
}

.btn-danger { color: #b02318; border-color: #f0d6d3; background: #fff7f6; }

/* 状态标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.tag.draft { background: #f1f0ed; color: #6d7076; }
.tag.review { background: var(--amber-soft); color: var(--amber); }
.tag.sign { background: var(--blue-soft); color: var(--blue); }
.tag.issued { background: var(--green-soft); color: var(--green); }
.tag.archived { background: var(--purple-soft); color: var(--purple); }

.tag-plain {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
}

/* 表格 */
.table-wrap { overflow-x: auto; }

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.tbl th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-3);
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

table.tbl tbody tr:hover { background: #fcfbf8; }
table.tbl tbody tr:last-child td { border-bottom: none; }

td.num { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
td .doc-title-cell {
  font-weight: 500;
  color: var(--ink);
  display: block;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
td .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; display: block; }
.row-actions { display: flex; gap: 2px; flex-wrap: wrap; }

/* 空状态 */
.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty .empty-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #c2bdb3;
}
.empty p { margin: 0 0 12px; font-size: 13px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }

.field { margin-bottom: 14px; }
.field > label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.field > label .req { color: var(--red); }
.field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  padding: 0 11px;
  height: 38px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.textarea {
  height: auto;
  padding: 10px 11px;
  line-height: 1.75;
  resize: vertical;
  min-height: 120px;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(193, 39, 45, 0.08);
}

.input[readonly] { background: var(--panel-2); color: var(--ink-2); }
.input::placeholder, .textarea::placeholder { color: #b4b0a8; }

.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; }

.autonum {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--red-soft);
  border: 1px solid #f2dbda;
}
.autonum .num {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--red-dark);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.autonum .tip { margin-left: auto; font-size: 11px; color: #a8605f; }

/* 发文字号输入 */
.num-input {
  font-family: var(--mono);
  letter-spacing: 0.02em;
  color: var(--red-dark);
  font-weight: 600;
}
.hint.warn { color: #a8605f; }

/* 预览中可点击修改的区域（仅拟稿页） */
.preview-editable .rh-org,
.preview-editable .rh-no,
.preview-editable .doc-org,
.preview-editable .doc-no,
.preview-editable .corp-cn,
.preview-editable .corp-no,
.preview-editable .sign-org {
  cursor: text;
  border-radius: 2px;
  transition: background 0.15s, box-shadow 0.15s;
}
.preview-editable .rh-org:hover,
.preview-editable .rh-no:hover,
.preview-editable .doc-org:hover,
.preview-editable .doc-no:hover,
.preview-editable .corp-cn:hover,
.preview-editable .corp-no:hover,
.preview-editable .sign-org:hover {
  background: rgba(193, 39, 45, 0.07);
  box-shadow: 0 0 0 3px rgba(193, 39, 45, 0.07);
}

/* 文件上传 */
.upload-box {
  border: 1px dashed #d8d4cb;
  border-radius: 9px;
  background: var(--panel-2);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.upload-box:hover { border-color: var(--red); background: #fdf8f7; }
.upload-box p { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.upload-box span { font-size: 11.5px; color: var(--ink-3); }

.file-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12.5px;
  background: #fff;
}
.file-item .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fsize { color: var(--ink-3); font-size: 11.5px; }

/* 统计卡 */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat .k { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.stat.accent .v { color: var(--red); }

/* 筛选栏 */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.filters .f { display: flex; flex-direction: column; gap: 5px; }
.filters .f > span { font-size: 11.5px; color: var(--ink-3); }
.filters .input, .filters .select { height: 34px; font-size: 12.5px; }
.filters .w-sm { width: 118px; }
.filters .w-md { width: 150px; }
.filters .w-lg { width: 220px; }
.filters .spacer { flex: 1; }

/* ---------------- 拟稿工作台 ---------------- */
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(420px, 0.98fr);
  gap: 18px;
  align-items: start;
}

.preview-col { position: sticky; top: 82px; }

.preview-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eceae5;
  background-image: radial-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1px);
  background-size: 14px 14px;
  padding: 18px;
  overflow: hidden;
}

.preview-wrap { overflow: hidden; position: relative; }
.preview-wrap .paper { transition: transform 0.12s ease-out; }

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.preview-bar .pb-title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.preview-bar .pb-title .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.seg {
  display: inline-flex;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  border: none;
  background: none;
  font-size: 12px;
  color: var(--ink-2);
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel-2);
  border-radius: 0 0 var(--radius) var(--radius);
  position: sticky;
  bottom: 0;
  z-index: 5;
}
.form-actions .spacer { flex: 1; }
.form-actions .save-tip { font-size: 11.5px; color: var(--ink-3); }

/* ---------------- 详情页 ---------------- */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(330px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.meta-list { display: grid; grid-template-columns: 84px 1fr; gap: 9px 12px; font-size: 12.5px; }
.meta-list dt { color: var(--ink-3); }
.meta-list dd { margin: 0; color: var(--ink); word-break: break-all; }

.action-stack { display: flex; flex-direction: column; gap: 8px; }
.action-stack .btn { width: 100%; }
.action-row { display: flex; gap: 8px; }
.action-row .btn { flex: 1; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 1px solid var(--line);
  margin-left: 4px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #c9c5bd;
}
.timeline li.done::before { border-color: var(--red); background: var(--red); }
.timeline .tl-title { font-size: 12.5px; font-weight: 600; }
.timeline .tl-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.share-box {
  border: 1px dashed #d9d5cc;
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink-2);
  word-break: break-all;
  font-family: var(--mono);
  line-height: 1.55;
}

/* ---------------- 设置 ---------------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px dashed var(--line-soft); }
.setting-row:last-child { border-bottom: none; }
.setting-row .sr-main { flex: 1; }
.setting-row .sr-main strong { font-size: 13px; font-weight: 600; display: block; }
.setting-row .sr-main p { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.55; }

.switch { position: relative; width: 38px; height: 22px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: #d8d4cc; border-radius: 22px; transition: 0.18s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.18s; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--red); }
.switch input:checked + .slider::before { transform: translateX(16px); }

.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--red); }
.range-row .val { width: 52px; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

/* 公章上传区 */
.seal-pick { display: grid; gap: 9px; }

.seal-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 15px 14px;
  text-align: center;
  border: 1.5px dashed #d8d4cb;
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  transition: all 0.15s;
}
.seal-drop:hover, .seal-drop.over { border-color: var(--red); background: #fdf8f7; }
.seal-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sd-ico {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--red-soft); color: var(--red);
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700; margin-bottom: 2px;
}
.sd-main { font-size: 13px; font-weight: 600; color: var(--ink); }
.sd-sub { font-size: 11.5px; color: var(--ink-3); }

.seal-cur {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #fff;
}
.sc-thumb {
  width: 40px; height: 40px; flex: none;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  display: grid; place-items: center;
  overflow: hidden; background: #fff;
}
.sc-thumb img { width: 100%; height: 100%; object-fit: contain; }
.sc-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-txt strong { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.sc-txt em { font-size: 11px; color: var(--ink-3); font-style: normal; }
.sc-ph { font-size: 12px; color: var(--ink-3); }

/* label 包裹的文件输入（原生触发选文件） */
.btn { position: relative; }
.btn input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.seal-preview {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfaf7;
  padding: 10px;
  margin-top: 10px;
  overflow: hidden;
}

.code-line {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink-2);
  word-break: break-all;
}

/* ---------------- 弹层 ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-root.open { pointer-events: auto; }
/* 弹层本体必须显式恢复点击：pointer-events 会被继承，否则真实鼠标点击全部穿透 */
.overlay { pointer-events: auto; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 20, 14, 0.34);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade 0.16s ease-out;
}

.modal {
  width: min(520px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.modal.wide { width: min(760px, 100%); }
.modal-head { padding: 18px 20px 0; }
.modal-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.modal-head p { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.modal-body { padding: 16px 20px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  background: var(--panel-2);
  border-radius: 0 0 14px 14px;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------------- 提示 ---------------- */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: #23241f;
  color: #fff;
  font-size: 12.5px;
  padding: 9px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.2s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 460px;
}
.toast.err { background: #a3211b; }
.toast.ok { background: #1d5c3d; }

@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- 版式风格选择 ---------------- */
.style-opts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.style-opt {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.style-opt:hover { border-color: #cfcac1; }
.style-opt.on { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.so-thumb {
  width: 52px;
  height: 66px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  padding: 7px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(24, 20, 14, 0.06);
}

.so-thumb i { display: block; height: 6px; border-radius: 1px; background: #d9d5cc; }
.so-thumb b { display: block; height: 2.5px; border-radius: 1px; background: #e6e2da; }
.so-thumb .l1 { width: 62%; }
.so-thumb .l2 { width: 100%; margin-top: 4px; }
.so-thumb .l3 { width: 84%; }
.so-thumb.rh i { width: 100%; height: 7px; background: #cf2b27; }
.so-thumb.rh b.l2 { width: 100%; height: 1.5px; background: #cf2b27; opacity: 0.55; }
.so-thumb.gov i { width: 100%; height: 9px; background: #c1272d; }
.so-thumb.gov b.l2 { height: 1.5px; background: #c1272d; opacity: 0.55; }

.so-txt strong { font-size: 13px; font-weight: 600; display: block; }
.so-txt em { font-style: normal; font-size: 11.5px; color: var(--ink-3); display: block; margin-top: 3px; line-height: 1.5; }

.color-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.color-row input[type="color"] {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}
.color-row .code-line { padding: 5px 8px; font-size: 11.5px; }
.swatches { display: flex; gap: 5px; margin-left: auto; }
.swatches i {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: transform 0.12s;
}
.swatches i:hover { transform: translateY(-1px); }

.logo-row { display: flex; align-items: center; gap: 8px; }
.logo-thumb {
  width: 44px;
  height: 44px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  font-size: 10.5px;
  color: var(--ink-3);
  overflow: hidden;
  flex: none;
}
.logo-thumb img { width: 100%; height: 100%; object-fit: contain; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .workbench, .detail-grid, .settings-grid { grid-template-columns: 1fr; }
  .preview-col { position: static; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .view { padding: 16px 14px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
}

/* ---------------- 归档台账 · 按公司分档 ---------------- */
.ledger-corp { border-top: 1px solid var(--line-soft); }
.filters + .ledger-corp { border-top: none; }
.ledger-corp-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px; background: var(--panel-2);
  border-bottom: 1px solid var(--line-soft);
}
.ledger-corp-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(150deg, #cf2f34, #a31c21); color: #fff;
  display: grid; place-items: center; font-family: "Songti SC", serif;
  font-size: 13px; font-weight: 700;
}
.ledger-corp-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ledger-corp-name strong { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.ledger-corp-name span { font-size: 11.5px; color: var(--ink-3); }
.ledger-corp-meta { margin-left: auto; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.ledger-corp-empty { padding: 20px 18px; text-align: center; font-size: 12.5px; color: var(--ink-3); }
/* 启动时从云端拉取权威数据的占位提示（本机无业务副本，必须等 RPC 返回再渲染） */
.boot-loading { padding: 64px 20px; text-align: center; font-size: 13px; color: var(--ink-3); letter-spacing: .3px; }

/* ---------- 系统设置防误改锁定：进入页面默认全灰，点「解锁编辑」后才可修改 ---------- */
.settings-locked input:disabled,
.settings-locked select:disabled,
.settings-locked button:disabled,
.settings-locked .style-opt,
.settings-locked .tpl-preset,
.settings-locked .seal-drop,
.settings-locked .seal-cur { opacity: .5; cursor: not-allowed; }
.settings-locked .switch input:disabled + .slider { opacity: .5; cursor: not-allowed; }
.settings-locked .range-row input[type="range"]:disabled { opacity: .5; }
.settings-locked .card-head::after { content: '已锁定'; margin-left: auto; font-size: 11px; color: var(--ink-3); letter-spacing: .12em; }
.settings-locked .style-opt { pointer-events: none; }
.settings-locked .tpl-preset { pointer-events: none; }
.settings-locked .seal-drop { pointer-events: none; }

/* hidden 属性对 flex/grid 元素同样生效（UA 默认会被作者 display 覆盖） */
.input-row[hidden], .hint[hidden], label[hidden] { display: none !important; }

/* ---------- 编制附件：与「备注（附件名）」同一行右侧的勾选框 ---------- */
.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.att-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 400;
  letter-spacing: 0;
  cursor: pointer;
  user-select: none;
}
.att-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--red);
  cursor: pointer;
}
#attEditorBox { margin-top: 10px; }
#attEditorBox[hidden] { display: none !important; }

/* ---------- 编制附件：多附件列表（每个附件名对应一段独立内容） ---------- */
.att-list { display: flex; flex-direction: column; gap: 10px; }

.att-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px 12px 12px;
}

.att-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.att-no {
  flex: none;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--red-dark);
  background: var(--red-soft);
  border: 1px solid #f0d5d4;
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}

.att-item-head .att-name { flex: 1; min-width: 0; }
.att-item-head .btn-text { flex: none; }
.att-text { min-height: 130px; background: #fff; }

.att-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px 14px;
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
}

.att-tools {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.att-tools .btn { flex: none; }
.att-tools .hint { flex: 1; min-width: 220px; margin: 4px 0 0; }
