/* 百应订单管理系统 · 全局样式（移动优先，浅色卡片风，语义用色） */
:root {
  --primary: #185fa5;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: rgba(0,0,0,.10);
  --text: #22262b;
  --muted: #6b7280;
  --ok: #0f6e56;   --ok-bg: #e1f5ee;
  --warn: #854f0b; --warn-bg: #faeeda;
  --info: #185fa5; --info-bg: #e6f1fb;
  --err: #a32d2d;  --err-bg: #fcebeb;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--primary); text-decoration: none; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--text); }
.brand img { height: 26px; width: auto; }
.brand .logo-fallback {
  width: 26px; height: 26px; border-radius: 7px; background: var(--primary);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 13px;
}
.nav a.on, .nav a:hover { background: var(--info-bg); color: var(--primary); }
.user { margin-left: auto; font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }

main { max-width: 1080px; margin: 0 auto; padding: 16px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 0 28px; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
/* 财务总览 6 指标：固定 2 行 × 3 列，窄屏降为单列 */
.grid.fin6 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .grid.fin6 { grid-template-columns: 1fr; } }

/* 指标卡 */
.metric { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.metric .m-label { font-size: 12px; color: var(--muted); }
.metric .m-value { font-size: 24px; font-weight: 600; margin-top: 2px; }
.metric .m-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.m-ok { color: var(--ok); } .m-warn { color: var(--warn); } .m-err { color: var(--err); }

/* 指标卡彩色顶边（语义配色，便于快速区分） */
.metric.acc-blue   { border-top: 3px solid #185fa5; }
.metric.acc-green  { border-top: 3px solid #0f9d6e; }
.metric.acc-teal   { border-top: 3px solid #0e8a8a; }
.metric.acc-orange { border-top: 3px solid #e8890c; }
.metric.acc-red    { border-top: 3px solid #c0392b; }
.metric.acc-purple { border-top: 3px solid #7d3ac1; }
.metric.acc-gray   { border-top: 3px solid #8a94a6; }

/* 工作台指标数字可点击跳转明细 */
.metric .m-value.m-link { color: inherit; text-decoration: none; cursor: pointer;
  display: inline-block; }
.metric .m-value.m-link:hover { text-decoration: underline;
  filter: brightness(0.85); }

/* 状态徽章 */
.badge { display: inline-block; font-size: 12px; border-radius: 6px; padding: 1px 8px; white-space: nowrap; }
.b-gray { background: #eef0f2; color: #5f6368; }
.b-ok   { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-red    { background: var(--err-bg); color: var(--err); }
.b-purple { background: #efe7fa; color: #6a35ad; }

/* 筛选栏：PC 一行排开，手机自动换行 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar .f { margin-bottom: 0; }
.quick-links { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* 类型统计色点 */
.type-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* ── 工作台自定义布局（12 列栅格，模块可拖拽/隐藏/调宽窄） ── */
.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.dash-module { grid-column: span 12; min-width: 0; }
.dash-module .card { margin-bottom: 0; height: 100%; }
@media (min-width: 720px) {
  .dash-module[data-size="s"] { grid-column: span 4; }
  .dash-module[data-size="m"] { grid-column: span 6; }
  .dash-module[data-size="l"] { grid-column: span 12; }
}
.dash-module.mod-hidden { display: none; }
.dash-module.dragging { opacity: .45; }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mod-tools { display: none; align-items: center; gap: 4px; flex-shrink: 0; }
.mod-grip { cursor: grab; color: var(--muted); font-size: 15px; padding: 0 4px; user-select: none; }
.mod-bar { display: none; justify-content: flex-end; }
body.layout-editing .mod-bar { display: flex; margin-bottom: 8px; }
body.layout-editing .dash-module { outline: 2px dashed color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 4px; border-radius: 4px; cursor: grab; }
body.layout-editing .dash-module .mod-tools { display: inline-flex; }
body.layout-editing .dash-module.mod-hidden { display: block; opacity: .45; }
body.layout-editing .dash-module .card { min-height: 50px; }

/* 表格（手机端横向滚动） */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
.tbl tr:hover td { background: var(--bg); }

/* 表单 */
label.f { display: block; margin-bottom: 10px; }
label.f span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=color], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: var(--card); color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent); border-color: var(--primary); }

/* 按钮 */
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--card);
  color: var(--text); border-radius: 8px; padding: 8px 14px; font: inherit; font-size: 13px;
  cursor: pointer; text-align: center;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); background: var(--primary); }
.btn.danger { color: var(--err); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.block { display: block; width: 100%; }

/* 提示条 */
.flash { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }

/* 柱状图 */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; text-align: center; }
.bars .bar i { display: block; background: var(--info-bg); border-radius: 4px 4px 0 0; }
.bars .bar.today i { background: var(--primary); }
.bars .bar b { font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 4px; }

/* 占比条 */
.dist { margin-bottom: 10px; font-size: 12px; }
.dist .d-top { display: flex; justify-content: space-between; margin-bottom: 3px; }
.dist .d-bar { height: 6px; background: var(--bg); border-radius: 3px; }
.dist .d-bar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 100%; max-width: 360px; }
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo img { height: 48px; }

/* 粘贴解析框 */
.paste-box textarea { min-height: 70px; }
.paste-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* 录单页客户检索联想 */
.cust-search { position: relative; }
.cust-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.10); max-height: 260px; overflow-y: auto;
}
.cust-item { padding: 9px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--line); }
.cust-item:last-child { border-bottom: none; }
.cust-item:hover { background: var(--info-bg); }
.cust-item .ci-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.cust-item.ci-none { cursor: default; color: var(--muted); }
.cust-item.ci-none:hover { background: none; }
.cust-item.ci-add { color: var(--primary); }
#newCustBox { border-style: dashed; }

/* 工单卡片列表（手机端友好） */
.order-item { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; color: var(--text); }
.order-item:hover { border-color: var(--primary); }
.order-item .o-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 8px; }
.order-item .o-no { font-weight: 600; font-size: 13px; }
.order-item .o-sub { font-size: 12px; color: var(--muted); }
.order-item .o-money { font-size: 13px; }

.section-title { font-size: 13px; color: var(--muted); margin: 18px 0 8px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: inline; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 12px; margin: 0 6px 6px 0; cursor: pointer; }
.chip input { display: none; }
.chip.checked { background: var(--info-bg); border-color: var(--primary); color: var(--primary); }
/* 用 button 做可点标签时抹掉按钮默认外观（解决方案快捷标签） */
button.sol-chip { background: transparent; color: inherit; font: inherit;
                  -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button.sol-chip.checked { background: var(--info-bg); }
.tag-list { font-size: 12px; color: var(--muted); }
.tag-list span { margin-right: 10px; }
.log-line { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.log-line b { color: var(--text); font-weight: 500; }

@media (min-width: 720px) {
  main { padding: 20px; }
  .tbl td { white-space: nowrap; }
}
