* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --line: #e6ebf3;
  --text: #1f2733;
  --muted: #6b7686;
  --primary: #2563eb;
  --primary-d: #1e4fcf;
  --primary-grad: linear-gradient(135deg, #3b82f6, #2563eb);
  --green: #16a34a;
  --red: #dc2626;
  --soft: #eef3ff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .05);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .14);
  --radius: 14px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(37, 99, 235, .18); }
.hidden { display: none !important; }
button { cursor: pointer; font-family: inherit; }
/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #ccd4e2; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aeb9cc; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Login ---------- */
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #e8efff 0%, #f4f7fd 45%, #fdf2f6 100%); overflow: hidden; }
.login-wrap::before, .login-wrap::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.login-wrap::before { width: 420px; height: 420px; background: rgba(59, 130, 246, .16); top: -120px; left: -100px; }
.login-wrap::after { width: 380px; height: 380px; background: rgba(244, 114, 182, .14); bottom: -140px; right: -80px; }
.login-card { width: 356px; background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.8); border-radius: 18px; padding: 38px 32px 30px;
  box-shadow: var(--shadow-lg); text-align: center; position: relative; z-index: 1;
  border-top: 4px solid var(--primary); }
.login-card h1 { font-size: 20px; color: var(--primary); letter-spacing: .5px; }
.login-card .sub { color: var(--muted); margin: 8px 0 24px; font-size: 13px; letter-spacing: 1px; }
.login-card label { display: block; text-align: left; color: var(--muted); margin-bottom: 16px; font-size: 13px; }
.login-card input { width: 100%; margin-top: 6px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; background: #fbfcfe; transition: all .2s; }
.login-card input:focus { outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.login-card button { width: 100%; padding: 12px; background: var(--primary-grad); color: #fff; border: none;
  border-radius: 10px; font-size: 15px; font-weight: 600; letter-spacing: 4px; box-shadow: 0 6px 16px rgba(37,99,235,.28);
  transition: all .2s; }
.login-card button:hover { box-shadow: 0 8px 22px rgba(37,99,235,.38); transform: translateY(-1px); }
.login-card .err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.login-card .hint { color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; }
.sidebar { width: 212px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; box-shadow: 1px 0 8px rgba(16,24,40,.03); }
.brand { padding: 18px 16px 16px; font-size: 17px; font-weight: 700; color: var(--primary);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 9px; letter-spacing: .5px; }
.brand-ico { width: 22px; height: 22px; color: var(--primary); flex: none; }
.sidebar nav { flex: 1; padding: 12px 10px; overflow: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px 12px; margin-bottom: 3px; border: none; background: transparent; color: var(--text);
  border-radius: 9px; font-size: 14px; transition: all .15s; }
.nav-item svg { width: 17px; height: 17px; flex: none; color: var(--muted); }
.nav-item:hover { background: var(--soft); color: var(--primary); }
.nav-item:hover svg { color: var(--primary); }
.nav-item.active { background: var(--soft); color: var(--primary); font-weight: 600; }
.nav-item.active svg { color: var(--primary); }
.side-foot { padding: 14px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 62px; background: #fff; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; padding: 0 24px; }
.topbar h2 { font-size: 17px; padding-left: 12px; border-left: 3px solid var(--primary); line-height: 1.3; }
.top-right { display: flex; align-items: center; gap: 14px; }
/* 顶部业务切换（大选项） */
.biz-switch { display: flex; gap: 6px; background: #eef3ff; border: 1px solid #d5e1ff;
  border-radius: 12px; padding: 4px; }
.biz-switch button { border: none; background: transparent; padding: 8px 24px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: #4a5b8c; cursor: pointer; font-family: inherit;
  transition: all .15s; }
.biz-switch button:hover { color: var(--primary); }
.biz-switch button.active { background: linear-gradient(135deg, #3b6cff, #2b4bd9); color: #fff;
  box-shadow: 0 2px 8px rgba(43, 75, 217, .35); }
.month-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.month-label input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; }
.month-label input:focus { outline: none; border-color: var(--primary); }
.top-user { color: var(--muted); font-size: 13px; background: var(--soft); padding: 5px 12px; border-radius: 20px; }
.btn-ghost { background: transparent; border: 1px solid var(--line); padding: 7px 14px; border-radius: 8px; color: var(--muted); transition: all .15s; }
.btn-ghost:hover { color: var(--text); border-color: #c9d2e3; background: #f7f9fc; }
.view { flex: 1; overflow: auto; padding: 24px; }

/* ---------- Cards / tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
/* 搜索行（置顶独占一行） */
.search-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px;
  background: #f7f9fe; border: 1px dashed #d5e1ff; border-radius: 10px; padding: 10px 14px; }
.search-row input[type="text"] { flex: 1; min-width: 220px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; font-family: inherit; }
.search-row input[type="text"]:focus { outline: none; border-color: var(--primary); }
/* 搜索行内分组（日期筛选等）用竖线分隔 */
.search-row .toolbar-group { border-left: 1px solid #d9e2f5; padding-left: 12px; }
.search-row > .toolbar-group:first-child { border-left: none; padding-left: 0; }
/* 日期范围筛选 */
.date-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-range input[type="date"] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 13px; }
/* 列表分页条 */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; }
/* 工具栏功能分组（同类归一组，组间竖线分隔） */
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-group + .toolbar-group { border-left: 1px solid #d9e2f5; padding-left: 12px; }
.toolbar-group.ml-auto { margin-left: auto; }
.toolbar-group .btn.sm { box-shadow: none; }
/* 快捷录入条 */
.quick-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px;
  background: #f6f8fc; border: 1px dashed #c9d4e8; border-radius: 10px; padding: 10px 14px; }
/* 批量操作条 */
.batch-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px;
  background: #eef3ff; border: 1px solid #c9d8ff; border-radius: 10px; padding: 8px 14px; }
.batch-bar b { color: var(--primary); font-size: 14px; }
.batch-bar .btn.sm { box-shadow: none; }
.quick-bar input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #fff; }
.quick-bar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.month-input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px;
  background: #fff; color: var(--text); font-family: inherit; transition: all .15s; }
.month-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
/* 列设置弹窗 */
.col-settings { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; padding: 4px 2px; }
.col-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); padding: 5px 0; cursor: pointer; }
.col-item input { accent-color: var(--primary); }
.tabs { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; }
.tabs button { border: none; background: transparent; padding: 7px 16px; border-radius: 8px;
  color: var(--muted); font-size: 13px; transition: all .15s; }
.tabs button.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 4px rgba(16,24,40,.1); }

.table-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 数据看板：固定列宽，各列大致等宽，长数字省略 */
table.b-table { table-layout: fixed; }
.b-table th, .b-table td { overflow: hidden; text-overflow: ellipsis; }
.b-table th { white-space: normal; line-height: 1.3; }
/* 看板数字居中 */
.b-table td.num { text-align: center; padding-right: 0; }
th, td { padding: 11px 13px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f6f8fc; color: var(--muted); font-weight: 600; position: sticky; top: 0; z-index: 1; }
tbody tr:nth-child(even) { background: #fafbfe; }
tbody tr:hover { background: #eef3ff; }
tbody tr:last-child td { border-bottom: none; }
tfoot td { background: #e8effd; font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); }

/* 表格内联编辑输入框：占满单元格宽度，不溢出 */
.cell-edit { width: 100%; min-width: 0; padding: 4px 3px; border: 1px solid transparent; border-radius: 6px;
  font-size: 13px; text-align: center; background: transparent; color: inherit;
  font-variant-numeric: tabular-nums; box-sizing: border-box; }
.cell-edit:hover { border-color: var(--line); background: #fff; }
.cell-edit:focus { outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 2px rgba(56, 111, 255, .12); }
/* 下拉框/日期框/文本框同样占满 */
.cell-edit.cell-sel, .cell-edit[type="date"], .cell-edit[type="text"] { width: 100%; min-width: 0; }
/* 去掉数字输入框的上下箭头 */
.cell-edit::-webkit-inner-spin-button, .cell-edit::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cell-edit { -moz-appearance: textfield; appearance: textfield; }

.btn { background: var(--primary-grad); color: #fff; border: none; padding: 9px 16px; border-radius: 9px;
  font-size: 13px; font-weight: 600; box-shadow: 0 4px 12px rgba(37,99,235,.22); transition: all .15s; }
.btn:hover { box-shadow: 0 6px 18px rgba(37,99,235,.32); transform: translateY(-1px); }
.btn.sm { padding: 5px 11px; font-size: 12px; box-shadow: none; }
.btn.sm:hover { transform: none; }
.btn.sec { background: #fff; color: var(--primary); border: 1px solid #bfd0f5; box-shadow: none; font-weight: 500; }
.btn.sec:hover { background: var(--soft); box-shadow: none; transform: none; }
.btn.danger { background: #fff; color: var(--red); border: 1px solid #f3c2c2; box-shadow: none; font-weight: 500; }
.btn.danger:hover { background: #fff5f5; box-shadow: none; transform: none; }
.btn.add { background: #fff; color: var(--primary); border: 1px dashed var(--primary); padding: 4px 10px;
  border-radius: 8px; font-size: 12px; box-shadow: none; font-weight: 500; }
.btn.add:hover { background: var(--soft); box-shadow: none; transform: none; }

.empty { color: var(--muted); text-align: center; padding: 34px; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
/* 长文本列：固定宽度省略号，悬停 title 显示完整内容 */
.ellip { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 月度大视图（KPI 卡片 + 趋势图） ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: all .18s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-card::after { content: ''; position: absolute; right: -26px; top: -26px; width: 86px; height: 86px;
  border-radius: 50%; background: radial-gradient(circle, rgba(37,99,235,.08), transparent 70%); }
.kpi-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.kpi-ico { width: 30px; height: 30px; border-radius: 9px; flex: none; background-size: 16px 16px;
  background-position: center; background-repeat: no-repeat; }
.kpi-ico.yen { background-color: #eef3ff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctext x='12' y='17' font-size='14' font-weight='700' text-anchor='middle' fill='%232563eb'%3E¥%3C/text%3E%3C/svg%3E"); }
.kpi-ico.users { background-color: #e8f5ee; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='9' cy='8' r='3.2' fill='%2316a34a'/%3E%3Cpath d='M3 20c.9-3.4 3.3-5 6-5s5.1 1.6 6 5' fill='%2316a34a'/%3E%3Ccircle cx='17' cy='9' r='2.6' fill='%2387d1ab'/%3E%3Cpath d='M16.5 20c.5-2.4 2-3.9 4-4.6' stroke='%2387d1ab' stroke-width='1.8' fill='none'/%3E%3C/svg%3E"); }
.kpi-ico.check { background-color: #eef3ff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%232563eb' stroke-width='2'/%3E%3Cpath d='M8 12.5l2.6 2.6L16 9.5' fill='none' stroke='%232563eb' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.kpi-ico.hospital { background-color: #fdeef0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='4' width='16' height='16' rx='3' fill='none' stroke='%23dc2626' stroke-width='2'/%3E%3Cpath d='M12 8.5v7M8.5 12h7' stroke='%23dc2626' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.kpi-ico.cost { background-color: #fdf4e8; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='8' width='16' height='12' rx='2.5' fill='none' stroke='%23ea8c1e' stroke-width='2'/%3E%3Cpath d='M8 8V6a4 4 0 0 1 8 0v2' fill='none' stroke='%23ea8c1e' stroke-width='2'/%3E%3Ccircle cx='12' cy='14' r='2.2' fill='%23ea8c1e'/%3E%3C/svg%3E"); }
.kpi-ico.rate { background-color: #f3eefd; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 17l5-6 4 3 7-8' fill='none' stroke='%237c3aed' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14 6h6v6' fill='none' stroke='%237c3aed' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-num { font-size: 26px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #2563eb, #3b82f6); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; line-height: 1.15; }
.trend-card svg { width: 100%; height: auto; display: block; }
.trend-svg .axis { font-size: 11px; fill: #8a94a6; }

/* ---------- Forms ---------- */
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.field label .req { color: var(--red); margin-left: 2px; }
.field input, .field select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; background: #fbfcfe; transition: all .15s; }
.field input:focus, .field select:focus { outline: none; border-color: var(--primary);
  background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.field .with-add { display: flex; gap: 8px; }
.field .with-add select { flex: 1; }
.inline-add { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.inline-add input { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(20, 30, 50, .45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 50; animation: fadeIn .18s ease; }
.modal-card { width: 520px; max-width: 94vw; background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow-lg); animation: popIn .2s ease; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px;
  border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px; }
.modal-head .x { border: none; background: transparent; font-size: 22px; color: var(--muted);
  line-height: 1; border-radius: 6px; padding: 2px 8px; transition: all .15s; }
.modal-head .x:hover { background: var(--soft); color: var(--text); }
.modal-body { padding: 20px; max-height: 70vh; overflow: auto; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: #1f2733; color: #fff;
  padding: 11px 20px; border-radius: 10px; z-index: 100; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.22); animation: fadeIn .18s ease; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: var(--soft); border-radius: 12px; padding: 12px 16px; min-width: 120px; border: 1px solid #dbe6ff; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 19px; font-weight: 700; color: var(--primary); margin-top: 3px; }
