:root {
  --bg: #f4f6fb; --panel: #fff; --ink: #1c2333; --sub: #6b7280;
  --primary: #2563eb; --primary-d: #1d4ed8; --ok: #059669; --warn: #d97706;
  --danger: #dc2626; --line: #e5e9f2;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
header { background: linear-gradient(120deg, #1e3a8a, #2563eb 60%, #3b82f6); color: #fff; padding: 18px 28px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.brand { display: flex; gap: 14px; align-items: center; }
.logo { font-size: 34px; }
header h1 { font-size: 21px; letter-spacing: 1px; }
header p { font-size: 12px; opacity: .85; margin-top: 2px; }
.header-right .pill { background: rgba(255,255,255,.18); padding: 5px 13px; border-radius: 999px; font-size: 12px; margin-left: 8px; }
nav { background: #fff; padding: 6px 24px; display: flex; flex-wrap: wrap; gap: 2px 4px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; width: 100%; }
.tab { flex: 0 1 auto; max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; border: none; background: none; padding: 10px 12px; font-size: 14px; cursor: pointer; color: var(--sub); border-bottom: 3px solid transparent; }
.tab:hover { background: #f4f7ff; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -4px; border-radius: 6px; }
@media (max-width: 980px), (max-height: 700px) {
  nav { position: static; }
}
@media (max-width: 640px) {
  header { flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
  .brand { min-width: 0; }
  .header-right { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .header-right .pill { margin-left: 0; }
  nav { padding-inline: 12px; }
}
main { padding: 22px 24px 60px; max-width: 1400px; margin: 0 auto; }
.tabpane { display: none; }
.tabpane.active { display: block; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(20,40,90,.07); border: 1px solid var(--line); }
.card .num { font-size: 26px; font-weight: 700; color: var(--primary); margin: 4px 0; }
.card .lbl { color: var(--sub); font-size: 12px; }
.card .foot { font-size: 11px; color: var(--ok); }
.two-col { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border-radius: 12px; padding: 16px 18px; border: 1px solid var(--line); margin-bottom: 16px; }
.panel h3 { font-size: 15px; margin-bottom: 12px; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar label { color: var(--sub); font-size: 13px; }
select, input[type="month"], input[type="text"], input[type="number"], input[type="password"] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; margin-left: 5px; }
.btn { padding: 8px 15px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-d); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.mini { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.hint { color: var(--sub); font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--sub); font-weight: 600; padding: 9px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
tr:hover td { background: #f8faff; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.tag.blue { background: #e0ecff; color: #1d4ed8; }
.tag.green { background: #d9f2e6; color: #047857; }
.tag.orange { background: #fdf0dc; color: #b45309; }
.tag.red { background: #fde2e2; color: #b91c1c; }
.tag.gray { background: #eef1f6; color: #64748b; }
.tag.purple { background: #ede4ff; color: #6d28d9; }
.money { font-variant-numeric: tabular-nums; text-align: right; }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.empty { color: var(--sub); text-align: center; padding: 30px; }
.bar-wrap { background: #eef1f6; border-radius: 999px; height: 10px; overflow: hidden; margin: 8px 0 4px; }
.bar { height: 100%; background: linear-gradient(90deg, #2563eb, #22c55e); border-radius: 999px; }
.kv { display: flex; justify-content: space-between; padding: 7px 2px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv b { font-variant-numeric: tabular-nums; }
#toast { position: fixed; right: 24px; bottom: 24px; background: #111827; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 13px; opacity: 0; transition: opacity .25s, transform .25s; transform: translateY(10px); pointer-events: none; max-width: 380px; }
#toast.show { opacity: .95; transform: translateY(0); }
.hidden { display: none !important; }
.legend { font-size: 12px; color: var(--sub); margin-top: 10px; line-height: 1.8; }

.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 14px; padding: 22px 24px; width: min(420px, 100%); box-shadow: 0 20px 50px rgba(15,23,42,.25); }
.modal-card h3 { font-size: 16px; margin-bottom: 6px; }
.pw-field { display: block; color: var(--sub); font-size: 13px; margin-bottom: 12px; }
.pw-field input { display: block; width: 100%; margin: 6px 0 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* 客户智能口子：主路径 + 更多 */
.cus-smart { min-width: 260px; max-width: 340px; }
.cus-smart-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.cus-smart-chips .tag { font-size: 11px; padding: 1px 7px; }
.cus-smart-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cus-smart-actions .btn { padding: 3px 8px; font-size: 12px; }
.cus-smart-actions .btn:disabled { opacity: .55; cursor: not-allowed; }
.cus-name-cell b { font-size: 13px; }
.cus-more { position: relative; display: inline-block; }
.cus-more-menu {
  display: none; position: absolute; right: 0; top: 100%; z-index: 40;
  min-width: 148px; margin-top: 2px; padding: 4px 0;
  background: #fff; border: 1px solid var(--border, #ddd); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.cus-more-menu.open { display: block; }
.cus-more-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 7px 12px; font-size: 12px; cursor: pointer; color: inherit;
}
.cus-more-menu button:hover { background: var(--hover, #f3f6fb); }
.cus-more-menu button:disabled { opacity: .45; cursor: not-allowed; }

/* 会计办公按任务分区，窄屏逐项排列，避免字段延伸至屏幕外。 */
.office-workbench { min-width: 0; }
.office-task-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,220px),1fr)); gap: 12px; margin: 14px 0; }
.office-task { background: #f5f8ff; border: 1px solid #dbe4f4; border-radius: 10px; padding: 16px; text-align: left; cursor: pointer; color: inherit; }
.office-task b,.office-task span { display: block; }
.office-task span { margin-top: 6px; font-size: 12px; color: var(--sub); }
.office-task:hover,.office-task:focus-visible { border-color: #4169d1; background: #eef3ff; }
.office-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 14px 0; }
.office-form-grid label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.office-form-grid input,.office-form-grid select,.office-form-grid textarea { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.office-form-grid textarea { min-height: 88px; resize: vertical; }
.office-wide { grid-column: 1 / -1; }
.office-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.office-workbench [hidden] { display: none !important; }
.office-workbench pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 400px; overflow: auto; }
.office-workbench summary { cursor: pointer; margin: 12px 0; }
.office-job { padding: 12px 0; border-bottom: 1px solid var(--border,#ddd); }
@media(max-width:640px) { .office-form-grid { grid-template-columns: minmax(0,1fr); } }
