/* =========================================================
   订单资料管理 · 设计系统
   ========================================================= */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-500: #6366f1;
  --brand-soft: #eef2ff;
  --violet: #8b5cf6;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --line: #e8ebf2;
  --line-strong: #d8dde8;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(17, 24, 39, .04), 0 1px 3px rgba(17, 24, 39, .06);
  --sh-2: 0 4px 12px rgba(17, 24, 39, .06), 0 2px 4px rgba(17, 24, 39, .04);
  --sh-3: 0 18px 45px rgba(17, 24, 39, .12), 0 4px 12px rgba(17, 24, 39, .06);
  --font: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d5dae6; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c1c8d8; background-clip: content-box; border: 3px solid transparent; }
::selection { background: #ddd6fe; }

/* ---------------- 启动遮罩 ---------------- */
.boot {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: linear-gradient(160deg, #f7f8fd 0%, #eef1fb 100%);
  transition: opacity .28s ease;
}
.boot.fade { opacity: 0; pointer-events: none; }
.boot-logo { animation: pulse 1.6s ease-in-out infinite; }
.boot-text { color: var(--muted); font-size: 13px; letter-spacing: .04em; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.92); opacity: .7; } }

/* =========================================================
   登录 / 注册
   ========================================================= */
.auth {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 28px; overflow: auto;
}
.auth-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(1100px 620px at 8% -10%, #e0e7ff 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #ede9fe 0%, transparent 55%),
    radial-gradient(700px 500px at 60% 110%, #e0f2fe 0%, transparent 60%),
    #f6f7fc;
}
.auth-wrap {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 400px 420px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(30, 41, 59, .14), 0 6px 18px rgba(30, 41, 59, .06);
  overflow: hidden;
  animation: rise .45s cubic-bezier(.22, 1, .36, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }

.auth-brand {
  position: relative;
  padding: 46px 38px;
  color: #fff;
  background: linear-gradient(155deg, #4f46e5 0%, #6d28d9 55%, #7c3aed 100%);
  display: flex; flex-direction: column; justify-content: center;
}
.auth-brand::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(320px 220px at 110% -10%, rgba(255, 255, 255, .22), transparent 70%),
    radial-gradient(260px 200px at -20% 110%, rgba(255, 255, 255, .16), transparent 70%);
  pointer-events: none;
}
.brand-mark {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  margin-bottom: 26px;
}
.auth-brand h1 { font-size: 25px; font-weight: 700; margin: 0 0 12px; letter-spacing: .01em; }
.brand-sub { margin: 0; font-size: 13.5px; line-height: 1.9; color: rgba(255, 255, 255, .82); }
.auth-card { padding: 44px 40px 36px; background: #fff; }
.auth-tabs {
  position: relative; display: flex; gap: 6px; margin-bottom: 26px;
  background: #f3f4f9; padding: 4px; border-radius: 12px; width: 100%;
}
.auth-tab {
  flex: 1; position: relative; z-index: 1; border: 0; background: transparent; cursor: pointer;
  padding: 9px 0; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-radius: 9px; transition: color .18s ease;
}
.auth-tab.active { color: var(--brand-600); }
.auth-tab-ink {
  position: absolute; top: 4px; left: 4px; height: calc(100% - 8px); width: calc(50% - 7px);
  background: #fff; border-radius: 9px; box-shadow: var(--sh-1);
  transition: transform .26s cubic-bezier(.22, 1, .36, 1);
}
.auth-tab-ink.right { transform: translateX(calc(100% + 6px)); }

.auth-form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.input {
  width: 100%; height: 44px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: #fbfcfe; outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.input::placeholder { color: var(--muted-2); }
.input:hover { border-color: #c7cddb; }
.input:focus { background: #fff; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(99, 102, 241, .14); }
/* 下拉框去掉系统默认外观，统一成设计系统样式 */
select.input {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select.input::-ms-expand { display: none; }
select.input option { color: var(--ink); background: #fff; }

/* 分段选择器（替代系统下拉/单选） */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.seg-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: #fbfcfe; color: var(--ink-2); font-size: 13.5px; font-weight: 600;
  text-align: left; cursor: pointer; transition: all .16s;
}
.seg-item span { font-size: 11.5px; font-weight: 500; color: var(--muted-2); }
.seg-item:hover { border-color: #c7cddb; background: #fff; }
.seg-item.on {
  border-color: var(--brand-500); background: var(--brand-soft); color: var(--brand-700);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}
.seg-item.on span { color: var(--brand-600); }
.input-affix { position: relative; }
.input-affix .input { padding-right: 58px; }
.affix-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 32px; padding: 0 10px; border: 0; background: transparent; color: var(--muted);
  font-size: 12.5px; cursor: pointer; border-radius: 8px;
}
.affix-btn:hover { color: var(--brand-600); background: var(--brand-soft); }
.auth-hint { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.auth-hint a { font-weight: 600; }

/* =========================================================
   按钮
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background .16s, color .16s, border-color .16s, box-shadow .16s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand));
  color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .24);
}
.btn-primary:hover { background: linear-gradient(135deg, #5b52ea, var(--brand-600)); box-shadow: 0 8px 20px rgba(79, 70, 229, .3); }
.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover { background: #f7f8fc; border-color: #c8cedb; color: var(--ink); }
.btn-soft { background: var(--brand-soft); color: var(--brand-600); }
.btn-soft:hover { background: #e5e9ff; }
.btn-danger { background: var(--danger-soft); color: #b91c1c; border-color: #fee2e2; }
.btn-danger:hover { background: #fee2e2; }
.btn-danger-solid { background: linear-gradient(135deg, #f87171, #ef4444); color: #fff; box-shadow: 0 6px 16px rgba(239, 68, 68, .24); }
.btn-danger-solid:hover { filter: brightness(.96); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 46px; font-size: 14.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 9px; }
.btn-link {
  background: none; border: 0; color: var(--brand); font-weight: 600; font-size: 12.5px;
  padding: 0 4px; height: 26px; cursor: pointer; border-radius: 6px;
}
.btn-link:hover { background: var(--brand-soft); }
.btn-link.danger { color: #dc2626; }
.btn-link.danger:hover { background: var(--danger-soft); }

/* =========================================================
   主界面框架
   ========================================================= */
#view-app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 60px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
.brand-mini { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.sync-chip {
  display: flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  background: #f0fdf4; color: #047857; border: 1px solid #d1fae5;
  font-size: 12px; font-weight: 600;
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(16, 185, 129, .16); }
.sync-chip.busy { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.sync-chip.busy .sync-dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); animation: blink 1s infinite; }
.sync-chip.off { background: #f3f4f6; color: #4b5563; border-color: var(--line); }
.sync-chip.off .sync-dot { background: #9ca3af; box-shadow: none; }
@keyframes blink { 50% { opacity: .35; } }

.user-chip {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 4px;
  border-radius: 999px; background: #f6f7fb; border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-500), var(--violet));
  color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase;
}

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 316px 1fr; }

/* ---------------- 侧栏 ---------------- */
.sidebar {
  min-height: 0; display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--line);
}
.sidebar-top { padding: 16px 16px 12px; display: grid; gap: 10px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.search-input {
  width: 100%; height: 38px; padding: 0 12px 0 34px;
  border: 1px solid var(--line); border-radius: 10px; background: #f8f9fc; outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.search-input:focus { background: #fff; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.order-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 10px; }
.order-item {
  position: relative;
  display: grid; gap: 5px;
  padding: 11px 12px; margin-bottom: 4px;
  border-radius: var(--r-md); cursor: pointer;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s, box-shadow .14s;
}
.order-item:hover { background: #f7f8fc; }
.order-item.active {
  background: linear-gradient(180deg, #f4f3ff, #eef2ff);
  border-color: #ddd6fe; box-shadow: inset 3px 0 0 var(--brand);
}
.order-item-title {
  font-weight: 600; font-size: 13.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.order-item-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.cat-dots { display: flex; gap: 3px; }
.cat-dot { width: 6px; height: 6px; border-radius: 2px; background: #e5e7eb; }
.cat-dot.on { background: var(--brand-500); }
.sidebar-foot {
  flex: none; padding: 10px 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); background: #fcfcfe;
}

/* ---------------- 右侧内容 ---------------- */
.content { min-height: 0; overflow-y: auto; padding: 22px 26px 34px; }

.empty-state {
  height: 100%; min-height: 420px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; color: var(--muted);
}
.empty-state h3 { margin: 8px 0 0; font-size: 17px; color: var(--ink-2); }
.empty-state p { margin: 0 0 8px; font-size: 13px; }
.empty-art { opacity: .95; }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.detail-title { display: grid; gap: 6px; min-width: 0; }
.detail-title h2 {
  margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62vw;
}
.detail-sub { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.detail-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.doc-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); display: flex; flex-direction: column; min-height: 210px;
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.doc-card:hover { box-shadow: var(--sh-2); }
.doc-card.dragover { border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(99, 102, 241, .12); background: #fbfbff; }
.doc-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.doc-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-600);
}
.doc-icon.c-invoice { background: #eef2ff; color: #4f46e5; }
.doc-icon.c-contract { background: #ecfdf5; color: #059669; }
.doc-icon.c-acceptance { background: #fff7ed; color: #ea580c; }
.doc-icon.c-delivery { background: #eff6ff; color: #2563eb; }
.doc-name { font-weight: 700; font-size: 14px; }
.doc-count { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.doc-head .btn { margin-left: auto; }
.doc-body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fdfdfe; transition: border-color .14s, background .14s;
}
.file-row:hover { background: #f9fafd; border-color: #dfe4ee; }
.file-ext {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 800; letter-spacing: -.02em;
  background: #eef1f7; color: #64748b; text-transform: uppercase;
}
.file-ext.pdf { background: #fee2e2; color: #dc2626; }
.file-ext.img { background: #e0f2fe; color: #0284c7; }
.file-ext.doc, .file-ext.docx { background: #e0e7ff; color: #4338ca; }
.file-ext.xls, .file-ext.xlsx { background: #dcfce7; color: #15803d; }
.file-meta { min-width: 0; flex: 1; display: grid; gap: 2px; }
.file-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 11px; color: var(--muted); }
.file-ops { display: flex; align-items: center; gap: 2px; flex: none; }

.doc-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 12px; border: 1px dashed var(--line-strong); border-radius: 12px;
  color: var(--muted-2); font-size: 12.5px; cursor: pointer; transition: border-color .16s, color .16s, background .16s;
}
.doc-empty:hover { border-color: #b9c0d4; color: var(--muted); background: #fafbff; }

.upload-progress { height: 4px; border-radius: 4px; background: #eef1f7; overflow: hidden; margin-top: 6px; }
.upload-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-500), var(--violet)); transition: width .2s; }

/* =========================================================
   弹窗 / 提示
   ========================================================= */
.modal-root { position: fixed; inset: 0; z-index: 1000; display: none; }
.modal-root.show { display: block; }
.modal-mask {
  position: absolute; inset: 0; background: rgba(17, 24, 39, .38);
  backdrop-filter: blur(3px); animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative; z-index: 1;
  width: min(440px, calc(100vw - 40px));
  margin: 12vh auto 0;
  background: #fff; border-radius: 18px; box-shadow: var(--sh-3);
  border: 1px solid rgba(255, 255, 255, .8);
  animation: modalIn .22s cubic-bezier(.22, 1, .36, 1);
  overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 20px 22px 0; display: flex; align-items: center; gap: 10px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 12px 22px 4px; color: var(--ink-2); font-size: 13.5px; line-height: 1.7; }
.modal-body .input { height: 42px; }
.modal-foot { padding: 16px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-icon {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-600);
}
.modal-icon.warn { background: #fff7ed; color: #ea580c; }
.modal-icon.danger { background: var(--danger-soft); color: #dc2626; }

.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 2000; display: grid; gap: 8px; pointer-events: none; }
.toast {
  min-width: 220px; max-width: 520px;
  padding: 11px 16px; border-radius: 12px;
  background: #111827; color: #fff; font-size: 13px; font-weight: 500;
  box-shadow: 0 12px 30px rgba(17, 24, 39, .22);
  display: flex; align-items: center; gap: 9px;
  animation: toastIn .22s cubic-bezier(.22, 1, .36, 1);
}
.toast.err { background: #b91c1c; }
.toast.ok { background: #065f46; }
.toast.hide { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* 被踢下线遮罩 */
.kick-mask {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px);
}
.kick-card {
  width: min(400px, 100%); background: #fff; border-radius: 18px; padding: 28px;
  text-align: center; box-shadow: var(--sh-3); animation: modalIn .24s cubic-bezier(.22, 1, .36, 1);
}
.kick-card h3 { margin: 14px 0 8px; font-size: 17px; }
.kick-card p { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }

@media (max-width: 1180px) {
  .doc-grid { grid-template-columns: 1fr; }
  .detail-title h2 { max-width: 50vw; }
}
@media (max-width: 980px) {
  .auth-wrap { grid-template-columns: 1fr; width: min(440px, 100%); }
  .auth-brand { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* =========================================================
   v2.0 分类 / 备注 / 预览弹窗
   ========================================================= */
.btn-new-folder { height: 36px; font-size: 13px; color: var(--ink-2); }

/* ---------- 侧栏：分类分组 ---------- */
.folder-group { margin-bottom: 6px; }
.folder-head {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 8px; border-radius: 9px;
  cursor: pointer; user-select: none;
  color: var(--ink-2); font-size: 12.5px; font-weight: 700;
  transition: background .14s, color .14s;
}
.folder-head:hover { background: #f5f6fb; }
.folder-head.drop-hot { background: #eef2ff; box-shadow: inset 0 0 0 1.5px #a5b4fc; }
.folder-head.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
.folder-head.dragging { opacity: .5; }
.folder-caret { width: 12px; font-size: 10px; color: var(--muted-2); flex: none; }
.folder-ico { display: flex; color: #8b93a8; flex: none; }
.folder-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder-count {
  flex: none; min-width: 20px; height: 18px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; background: #eef0f6; color: var(--muted);
  font-size: 10.5px; font-weight: 700;
}
.root-head { color: var(--muted); font-weight: 600; padding-left: 12px; }
.root-head .folder-count { background: #f3f4f8; }
.folder-body { padding: 2px 0 4px; }
.folder-group.collapsed .folder-body { display: none; }
.folder-empty {
  margin: 2px 6px 4px; padding: 12px 10px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: 10px;
  color: var(--muted-2); font-size: 11.5px;
}
.folder-body.drop-hot { background: #f7f8ff; border-radius: 10px; }
.drop-tail { height: 6px; }
.drop-tail.drop-hot { background: var(--brand-soft); border-radius: 4px; }
.side-empty { padding: 26px 12px; text-align: center; color: var(--muted); font-size: 12.5px; }

.order-item.dragging { opacity: .45; }
.order-item.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
.order-item.drop-after { box-shadow: inset 0 -2px 0 var(--brand); }

/* ---------- 分类右键菜单 ---------- */
.ctx-menu {
  position: fixed; z-index: 2500; min-width: 168px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--sh-3); animation: modalIn .12s ease;
}
.ctx-title {
  padding: 6px 10px 8px; font-size: 11.5px; color: var(--muted-2); font-weight: 600;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ctx-menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent;
  font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.ctx-menu button:hover { background: #f5f6fb; }
.ctx-menu button.danger { color: #dc2626; }
.ctx-menu button.danger:hover { background: var(--danger-soft); }

/* ---------- 详情：其他附件 / 备注 ---------- */
.doc-icon.c-other { background: #f5f3ff; color: #7c3aed; }
.doc-icon.c-note { background: #fff7ed; color: #ea580c; }
.doc-tip { padding: 0 16px 2px; font-size: 11px; color: var(--muted-2); }
.note-card .doc-head { padding-bottom: 8px; }
.note-body { display: flex; }
.note-input {
  width: 100%; min-height: 132px; flex: 1; resize: vertical;
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fbfcfe; font-size: 13px; line-height: 1.7; outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.note-input:focus { background: #fff; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }

.tag-local {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 6px; background: #fff7ed; color: #c2410c;
  font-size: 10px; font-weight: 700; vertical-align: 1px;
}

.modal-hint { margin-top: 8px; font-size: 11.5px; color: var(--muted-2); }

/* =========================================================
   二级弹窗：真实预览
   ========================================================= */
.pv-root { position: fixed; inset: 0; z-index: 4000; }
.pv-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px); }
.pv {
  position: relative; z-index: 1;
  width: min(1080px, calc(100vw - 48px)); height: min(88vh, 900px);
  margin: 3vh auto 0; display: flex; flex-direction: column;
  background: #f3f4f8; border-radius: 16px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .32);
  animation: modalIn .2s cubic-bezier(.22, 1, .36, 1);
}
.pv-head {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line);
}
.pv-name {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pv-ops { display: flex; gap: 8px; flex: none; }
.pv-stage { flex: 1; overflow: auto; padding: 18px; }
.pv-loading { padding: 60px 0; text-align: center; color: var(--muted); font-size: 13px; }
.pv-pages { display: grid; gap: 14px; justify-items: center; }
.pv-page {
  background: #fff; box-shadow: var(--sh-2); border-radius: 4px; max-width: 100%;
}
.pv-more { color: var(--muted); font-size: 12px; padding: 10px 0 20px; }
.pv-imgwrap { display: flex; justify-content: center; }
.pv-imgwrap img { max-width: 100%; border-radius: 6px; box-shadow: var(--sh-2); background: #fff; }
.pv-doc {
  background: #fff; border-radius: 8px; padding: 42px 54px; width: 100%; max-width: none;
  min-height: 70vh; margin: 0 auto;
  box-shadow: var(--sh-2); font-size: 14px; line-height: 1.85; color: #1f2937;
}
.pv-doc h1 { font-size: 22px; margin: 18px 0 12px; }
.pv-doc h2 { font-size: 18px; margin: 16px 0 10px; }
.pv-doc h3 { font-size: 16px; margin: 14px 0 8px; }
.pv-doc p { margin: 0 0 10px; }
.pv-doc table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.pv-doc td, .pv-doc th { border: 1px solid #d1d5db; padding: 6px 9px; font-size: 13px; }
.pv-doc img { max-width: 100%; }
.pv-text {
  background: #fff; border-radius: 8px; padding: 26px 30px; margin: 0 auto; max-width: 860px;
  box-shadow: var(--sh-2); font-family: Consolas, "Courier New", monospace;
  font-size: 13px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
}
.pv-sheets { background: #fff; border-radius: 8px; box-shadow: var(--sh-2); overflow: hidden; }
.pv-tabs { display: flex; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.pv-tab {
  border: 1px solid var(--line); border-bottom: none; border-radius: 8px 8px 0 0;
  background: #f7f8fc; color: var(--muted); padding: 6px 12px; font-size: 12.5px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.pv-tab.on { background: #fff; color: var(--brand-600); }
.pv-sheet { overflow: auto; max-height: calc(88vh - 160px); }
.pv-sheet table { border-collapse: collapse; font-size: 12.5px; }
.pv-sheet td, .pv-sheet th {
  border: 1px solid #e5e7eb; padding: 4px 8px; white-space: nowrap; min-width: 44px;
}
.pv-sheet tr:first-child td, .pv-sheet th { background: #f8fafc; font-weight: 600; }
.pv-error {
  max-width: 520px; margin: 60px auto; background: #fff; border-radius: 14px;
  padding: 28px; text-align: center; box-shadow: var(--sh-2); color: var(--ink-2);
}
.pv-error b { display: block; font-size: 15px; margin-bottom: 8px; }
.pv-error p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0 0 16px; }

/* 打印：只打印预览内容 */
@media print {
  @page { margin: 10mm; }
  body { background: #fff !important; }
  body > *:not(.pv-root) { display: none !important; }
  .pv-root { position: static !important; display: block !important; }
  .pv-mask, .pv-head, .pv-more { display: none !important; }
  .pv {
    width: auto !important; height: auto !important; margin: 0 !important;
    box-shadow: none !important; border-radius: 0 !important; background: #fff !important;
    overflow: visible !important; display: block !important;
  }
  .pv-stage { overflow: visible !important; padding: 0 !important; }
  .pv-pages { display: block !important; }
  /* 关键：只在「下一页之前」分页。以前写 page-break-after:always，
     最后一页后面也会再分一页，于是单页发票打印出来变成两张。 */
  .pv-page, .pv-stage canvas {
    box-shadow: none !important; border-radius: 0 !important;
    /* canvas 自带内联 width/height（按屏幕像素），必须压到纸宽，否则纵向溢出再分一页 */
    width: 100% !important; height: auto !important;
    max-width: 100% !important;
    margin: 0 auto !important; display: block;
    break-inside: avoid; page-break-inside: avoid;
  }
  .pv-page + .pv-page { break-before: page; page-break-before: always; }
  .pv-imgwrap { display: block !important; text-align: center; }
  .pv-imgwrap img {
    box-shadow: none !important; border-radius: 0 !important;
    max-width: 100% !important; page-break-after: avoid; break-after: avoid;
  }
  .pv-doc, .pv-text, .pv-sheets {
    box-shadow: none !important; max-width: none !important; width: auto !important;
    min-height: 0 !important; padding: 0 !important;
  }
  .pv-sheet { max-height: none !important; overflow: visible !important; }
}
