:root {
  --brand: #1355d8;
  --brand-dark: #0d3ea8;
  --brand-soft: #eaf1ff;
  --ok: #12a150;
  --ok-soft: #e8f8ef;
  --warn: #d97706;
  --warn-soft: #fef6e7;
  --danger: #d92d20;
  --danger-soft: #fdecea;
  --ink: #17202e;
  --ink-2: #4a5568;
  --ink-3: #7b8794;
  --line: #e3e8ef;
  --line-strong: #cdd5e0;
  --bg: #f5f7fa;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 18px;
  height: 58px; padding: 0 20px; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; flex-shrink: 0; }
.logo {
  width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #1355d8, #3b82f6);
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 11px; color: var(--ink-3); }
.crumbs { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow: hidden; }
.crumbs .crumb { color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.crumbs .crumb:hover { color: var(--brand); }
.crumbs .crumb.cur { color: var(--ink); font-weight: 600; cursor: default; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.crumbs .sep { color: var(--line-strong); }
.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.datapath { font-size: 11px; color: var(--ink-3); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app { max-width: 1240px; margin: 0 auto; padding: 20px 20px 80px; }

/* 通用 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-head h3 { margin: 0; font-size: 14px; }
.card-head .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink); cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { color: var(--danger); border-color: #f3c2be; }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn.lg { padding: 11px 22px; font-size: 15px; border-radius: 9px; }

input[type=text], input[type=number], input[type=date], input[type=email], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(19,85,216,.12); }
label.field { display: block; }
label.field > span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
/* 窄窗口收敛：顶栏保持 62px 单行（sticky 工具栏依赖这个偏移），
   改为隐藏数据路径 + 截断面包屑 + 收紧按钮内边距，避免整页横向溢出 */
@media (max-width: 1180px) {
  .datapath { display: none; }
  .top-actions { flex-shrink: 1; min-width: 0; }
  .top-actions .btn { padding-left: 9px; padding-right: 9px; }
  .crumbs .crumb.cur { max-width: 30vw; }
  .sticky-toolbar { flex-wrap: wrap; row-gap: 6px; }
}
@media (max-width: 900px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .crumbs .crumb.cur { max-width: 22vw; }
  .top-actions .btn { padding-left: 7px; padding-right: 7px; font-size: 12px; }
  .card-head { flex-wrap: wrap; gap: 6px; }
}
/* 手机宽度：顶栏允许换行（此时 sticky 工具栏改为静态定位，避免偏移错乱） */
@media (max-width: 640px) {
  .topbar { height: auto; min-height: 58px; flex-wrap: wrap; padding: 8px 12px; row-gap: 8px; gap: 10px; }
  .brand-text span { display: none; }
  .crumbs { flex: 1 1 100%; order: 3; }
  .crumbs .crumb:not(.cur) { display: none; }
  .crumbs .cur { max-width: 46vw; }
  .top-actions { flex: 1 1 auto; order: 2; justify-content: flex-end; flex-wrap: wrap; row-gap: 6px; }
  .user-chip { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sticky-toolbar { position: static; flex-wrap: wrap; row-gap: 6px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .modal-box { max-width: 96vw; }
}

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 9px 16px; cursor: pointer; border: 1px solid transparent; border-bottom: none;
  border-radius: 8px 8px 0 0; color: var(--ink-2); margin-bottom: -1px; background: transparent;
}
.tab:hover { color: var(--brand); background: var(--brand-soft); }
.tab.on { background: #fff; border-color: var(--line); border-bottom-color: #fff; color: var(--brand); font-weight: 600; }

/* 徽标 */
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 20px; font-size: 11px; line-height: 18px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.tag.brand { background: var(--brand-soft); color: var(--brand); border-color: #c7dbff; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: #b7e6cb; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: #f6dcae; }
.tag.danger { background: var(--danger-soft); color: var(--danger); border-color: #f5c8c4; }

/* 首页 */
.hero {
  background: linear-gradient(135deg, #0e3f9e 0%, #1355d8 55%, #2f7cf6 100%);
  color: #fff; border-radius: 14px; padding: 34px 32px; margin-bottom: 22px;
}
.hero h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: 1px; }
.hero p { margin: 0; opacity: .9; max-width: 760px; }
.hero .steps { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.hero .step { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: 9px; padding: 10px 14px; font-size: 12.5px; }
.hero .step b { display: block; font-size: 15px; margin-bottom: 2px; }

.ent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.ent-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; transition: all .15s; box-shadow: var(--shadow); }
.ent-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.ent-card h3 { margin: 0 0 6px; font-size: 15px; }
.ent-card .meta { font-size: 12px; color: var(--ink-3); }
.ent-card .stat { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }

/* 资料项 */
.item-list { display: flex; flex-direction: column; }
.item {
  display: flex; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); align-items: flex-start;
}
.item:last-child { border-bottom: none; }
.item.off { opacity: .55; }
.item .item-main { flex: 1; min-width: 0; }
.item .item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.item .item-hint { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.item .item-files { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.file-chip { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; font-size: 12.5px; }
.file-chip .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip a { color: var(--brand); text-decoration: none; }
.item .item-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

details.evidence { margin-top: 6px; font-size: 12px; color: var(--ink-2); }
details.evidence summary { cursor: pointer; color: var(--brand); }
details.evidence ul { margin: 6px 0 0; padding-left: 18px; }
details.evidence li { margin-bottom: 3px; }

/* 进度条 */
.progress { height: 8px; background: var(--line); border-radius: 5px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #1355d8, #4f9bff); transition: width .3s; }

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px 8px; text-align: center; vertical-align: middle; }
table.data th { background: #f7f9fc; font-weight: 600; font-size: 12px; color: var(--ink-2); position: sticky; top: 0; }
table.data th:last-child, table.data td:last-child { border-right: none; }
table.data tbody tr:hover { background: #fafbfd; }
table.data input { padding: 4px 6px; font-size: 12.5px; border-radius: 5px; border-color: transparent; background: transparent; }
table.data input:hover { border-color: var(--line-strong); background: #fff; }
table.data input:focus { background: #fff; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-del { color: var(--danger); cursor: pointer; user-select: none; font-size: 13px; }

/* 汇总 */
.total-box { display: flex; gap: 24px; align-items: baseline; flex-wrap: wrap; background: var(--brand-soft); border: 1px solid #c7dbff; border-radius: 10px; padding: 16px 20px; }
.total-box .amount { font-size: 28px; font-weight: 700; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.total-box .upper { font-size: 14px; color: var(--brand-dark); }

/* 上传区 */
.drop {
  border: 2px dashed var(--line-strong); border-radius: 10px; padding: 22px; text-align: center;
  color: var(--ink-3); cursor: pointer; transition: all .15s; background: #fbfcfe;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.drop b { color: var(--ink); }

/* 列表 */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.alert { border-radius: 8px; padding: 10px 14px; font-size: 13px; border: 1px solid; }
.alert.info { background: var(--brand-soft); border-color: #c7dbff; color: var(--brand-dark); }
.alert.warn { background: var(--warn-soft); border-color: #f6dcae; color: #92400e; }
.alert.ok { background: var(--ok-soft); border-color: #b7e6cb; color: #0b6b36; }
.alert.danger { background: var(--danger-soft); border-color: #f5c8c4; color: #93231a; }

/* 空状态 */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .5; }

/* 提示 */
.toast {
  position: fixed; left: 50%; top: 108px; transform: translateX(-50%);
  background: #17202e; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 13.5px; max-width: 70vw;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* 加载 */
.loading { position: fixed; inset: 0; background: rgba(255,255,255,.72); z-index: 150; display: flex; align-items: center; justify-content: center; gap: 12px; flex-direction: column; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 180; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 12px; max-width: 640px; width: 100%; max-height: 86vh; overflow: auto; padding: 22px 24px; box-shadow: 0 20px 48px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 14px; font-size: 16px; }

/* 报告 */
.report-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.report-row:last-child { border-bottom: none; }
.report-row .rname { flex: 1; }
.report-row .rnote { color: var(--ink-3); font-size: 12px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.sticky-toolbar { position: sticky; top: 62px; z-index: 25; background: #fff; border-radius: var(--radius); }
.flash { animation: flashRing 1.8s ease-out; }
@keyframes flashRing {
  0% { box-shadow: 0 0 0 4px rgba(19, 85, 216, .45); }
  60% { box-shadow: 0 0 0 4px rgba(19, 85, 216, .28); }
  100% { box-shadow: var(--shadow); }
}
.flash > .card-head, .flash.row { background: #eaf1ff; }
.parts-block.flash { border-radius: 8px; }
.anchor-hint { font-size: 12px; color: var(--ink-3); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 6px 14px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--brand); color: #fff; }

.ph-table td { vertical-align: top; }
.code { background: #f3f6fb; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: #0d3ea8; }

.grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head > div { text-align: center; font-size: 12px; color: var(--ink-3); padding: 4px 0; font-weight: 600; }
.cal-cell { min-height: 74px; border: 1px solid var(--line); border-radius: 7px; padding: 4px 5px; background: #fff; overflow: hidden; }
.cal-cell.empty { border: none; background: transparent; }
.cal-cell.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-cell.urgent { background: var(--warn-soft); border-color: #f6dcae; }
.cal-cell.overdue { background: var(--danger-soft); border-color: #f5c8c4; }
.cal-day { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
.cal-ev { font-size: 10.5px; line-height: 1.4; background: var(--brand-soft); color: var(--brand-dark); border-radius: 4px; padding: 1px 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 10px; color: var(--ink-3); }

.footer-note { text-align: center; color: var(--ink-3); font-size: 12px; padding: 26px 0 0; }

/* 登录 / 初始化 */
.auth-mask {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #0e3f9e 0%, #1355d8 55%, #2f7cf6 100%);
}
.auth-card { background: #fff; border-radius: 14px; padding: 28px 30px; width: 100%; max-width: 430px; box-shadow: 0 22px 55px rgba(0, 0, 0, .3); }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.auth-brand .logo { width: 38px; height: 38px; font-size: 18px; }
.auth-brand strong { display: block; font-size: 17px; }
.auth-brand span { font-size: 12px; color: var(--ink-3); }
.auth-card .btn.lg { width: 100%; justify-content: center; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
table.users td, table.users th { text-align: left; }
table.users td { padding: 8px 10px; }

/* ---------------- 首页（登录前的展示页） ---------------- */
.landing { display: flex; min-height: 100vh; background: linear-gradient(135deg,#eef4ff 0%,#f7faff 55%,#eaf0fb 100%); }
.landing-main { flex: 1; padding: 44px 48px; max-width: 880px; }
.landing-hero { margin-bottom: 26px; }
.landing-hero .logo.lg { width: 54px; height: 54px; border-radius: 14px; font-size: 26px; margin-bottom: 14px; }
.landing-hero h1 { margin: 0 0 4px; font-size: 34px; letter-spacing: 1px; color: var(--ink); }
.landing-hero .slogan { color: var(--brand); font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.landing-hero .lead { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.85; max-width: 720px; }
.adv-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.adv { display: flex; gap: 11px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; box-shadow: 0 1px 2px rgba(16,32,64,.04); }
.adv-i { font-size: 20px; line-height: 1.2; flex-shrink: 0; }
.adv b { display: block; font-size: 13.5px; color: var(--ink); margin-bottom: 3px; }
.adv p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--ink-3); }
.landing-contact { margin-top: 22px; display: grid; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.landing-contact > div { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.landing-contact span { color: var(--ink-3); min-width: 68px; flex-shrink: 0; }
.landing-contact b { color: var(--ink); font-weight: 600; }
.landing-contact .wx { color: #0f9d58; font-size: 16px; letter-spacing: .5px; }
.landing-contact i { color: var(--ink-3); font-style: normal; font-size: 12px; }
.landing-side { width: 400px; flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 40px 44px 40px 0; }
.landing-side .auth-card { width: 100%; }
.side-note { font-size: 12px; line-height: 1.8; color: var(--ink-3); background: rgba(255,255,255,.7); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px 14px; }
@media (max-width: 1080px) {
  .landing { flex-direction: column; }
  .landing-main { max-width: none; padding: 28px 22px 8px; }
  .landing-side { width: auto; padding: 18px 22px 32px; }
  .landing-hero h1 { font-size: 27px; }
}
@media (max-width: 640px) {
  .adv-grid { grid-template-columns: 1fr; }
  .landing-main { padding: 20px 14px 6px; }
  .landing-side { padding: 14px 14px 26px; }
}

/* 首页是全屏布局，去掉登录遮罩的暗色背景与居中约束 */
.auth-mask:has(.landing) { background: linear-gradient(135deg,#eef4ff 0%,#f7faff 55%,#eaf0fb 100%); align-items: stretch; justify-content: flex-start; padding: 0; overflow-y: auto; }
