/* 钱眼 · 老板财务驾驶舱 —— 样式（375px 竖屏优先，浅色） */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1f2937;
  --ink-2: #6b7280;
  --ink-3: #9ca3af;
  --line: #e8ecf1;
  --green: #16a34a;
  --green-bg: #ecfdf3;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --brand: #0f4c81;
  --brand-2: #1668b3;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 42, 67, .08);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
  max-width: 768px; margin: 0 auto; min-height: 100%;
}
button { font-family: inherit; }

/* ---------- 登录 ---------- */
#login {
  position: fixed; inset: 0; z-index: 100; background: linear-gradient(160deg, #0f4c81 0%, #1668b3 55%, #2f86d6 100%);
  display: flex; flex-direction: column; justify-content: center; padding: 32px;
}
#login .logo { text-align: center; color: #fff; margin-bottom: 28px; }
#login .logo .t1 { font-size: 26px; font-weight: 700; letter-spacing: 2px; }
#login .logo .t2 { font-size: 13px; opacity: .85; margin-top: 6px; }
#login .box { background: #fff; border-radius: 16px; padding: 22px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
#login .box h3 { font-size: 16px; margin-bottom: 14px; }
#login input {
  width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px; font-size: 15px; margin-bottom: 12px; outline: none; background: #fafbfc;
}
#login input:focus { border-color: var(--brand-2); background: #fff; }
#login .btn-login {
  width: 100%; height: 44px; border: 0; border-radius: 10px; background: var(--brand);
  color: #fff; font-size: 16px; font-weight: 600;
}
#login .err { color: var(--red); font-size: 12px; min-height: 18px; margin: 2px 0 8px; }
#login .hint { margin-top: 14px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }

/* ---------- 顶栏 ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; padding: 10px 12px 12px;
}
#topbar .row1 { display: flex; align-items: center; justify-content: space-between; }
#topbar .app-title { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
#topbar .who { font-size: 12px; opacity: .85; }
#topbar .row2 { display: flex; gap: 8px; margin-top: 10px; }
#topbar select {
  flex: 1; height: 34px; border: 0; border-radius: 8px; padding: 0 8px;
  font-size: 14px; color: var(--ink); background: rgba(255,255,255,.95); outline: none;
}
.status-tag {
  align-self: center; font-size: 11px; padding: 3px 8px; border-radius: 20px; white-space: nowrap;
}
.st-published { background: var(--green-bg); color: var(--green); border: 1px solid #b7e4c7; }
.st-draft { background: var(--amber-bg); color: var(--amber); border: 1px solid #fde68a; }
.st-pending { background: var(--blue-bg); color: var(--blue); border: 1px solid #bfdbfe; }

/* ---------- 主体 ---------- */
#page { padding: 12px 12px 76px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px;
}
.card h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.card h3 .sub { font-size: 11px; color: var(--ink-3); font-weight: 400; }
.card h3 .lnk { font-size: 12px; color: var(--brand-2); font-weight: 400; }
.empty { text-align: center; color: var(--ink-3); padding: 28px 0; font-size: 13px; }
.empty .big { font-size: 30px; margin-bottom: 8px; }

/* KPI 卡 */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; position: relative; overflow: hidden;
}
.kpi .label { font-size: 12px; color: var(--ink-2); }
.kpi .num { font-size: 24px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .num .u { font-size: 11px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.kpi .mom { font-size: 11px; display: flex; align-items: center; gap: 4px; }
.up { color: var(--green); }
.down { color: var(--red); }
.flat { color: var(--ink-3); }
.kpi .spark { height: 30px; margin-top: 6px; }
.kpi .go { position: absolute; right: 10px; top: 10px; color: #d1d5db; font-size: 14px; }
.kpi.blue .num { color: var(--brand); }
.num-pos { color: var(--green); }
.num-neg { color: var(--red); }

/* 骨架屏 */
.skel { position: relative; overflow: hidden; background: #eef1f5; border-radius: 8px; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* 图表容器 */
.chart { width: 100%; }
.chart-h220 { height: 220px; }
.chart-h260 { height: 260px; }
.chart-h300 { height: 300px; }

/* 表格 */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 12px; white-space: nowrap; }
table.tbl th, table.tbl td {
  padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
table.tbl th { color: var(--ink-2); font-weight: 600; background: #f8fafc; position: sticky; top: 0; }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; }
table.tbl th:first-child { background: #f8fafc; z-index: 2; }
table.tbl tr.total td { font-weight: 700; border-top: 2px solid var(--ink); background: #fbfcfe; }
table.tbl tr.loss td { background: var(--red-bg); }
table.tbl tr.loss td:first-child { background: var(--red-bg); }
table.tbl td.neg { color: var(--red); }
table.tbl td.pos { color: var(--green); }
.tbl-note { font-size: 11px; color: var(--ink-3); margin-top: 6px; }

/* 录入矩阵输入框 */
input.ent {
  width: 66px; border: 0; border-bottom: 1px dashed #d1d5db; background: transparent;
  text-align: right; font-size: 12px; padding: 4px 2px; font-variant-numeric: tabular-nums;
  color: var(--ink); outline: none;
}
input.ent:focus { border-bottom-color: var(--brand-2); background: var(--blue-bg); }
input.entp:focus { outline: none; border-color: var(--brand-2) !important; }

/* 快捷入口 */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.quick .q {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  text-align: center; padding: 12px 4px; color: var(--ink); text-decoration: none;
}
.quick .q .ico { font-size: 20px; }
.quick .q .t { font-size: 12px; color: var(--ink-2); margin-top: 4px; }

/* 列表行 */
.row-list .row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.row-list .row:last-child { border-bottom: 0; }
.row-list .row .l { font-size: 13px; }
.row-list .row .l .s { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.row-list .row .r { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 备注框 */
.remark {
  background: var(--amber-bg); border: 1px solid #fde68a; color: #92400e;
  border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.6; margin-bottom: 12px;
}

/* 草稿提醒条 */
.draft-banner {
  background: var(--amber-bg); border: 1px dashed var(--amber); color: var(--amber);
  border-radius: 10px; padding: 8px 12px; font-size: 12px; margin-bottom: 12px;
}

/* 我的页 */
.me-user { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.me-user .avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.me-user .n { font-size: 16px; font-weight: 700; }
.me-user .r { font-size: 12px; color: var(--ink-2); }
.menu .mi {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 2px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.menu .mi:last-child { border-bottom: 0; }
.menu .mi .v { color: var(--ink-2); font-size: 13px; }
.menu .mi.arrow::after { content: "›"; color: #d1d5db; margin-left: 6px; font-size: 18px; }
.btn-outline {
  width: 100%; height: 42px; border: 1px solid var(--red); color: var(--red);
  border-radius: 10px; background: #fff; font-size: 15px; margin-top: 14px;
}
.koujing { font-size: 12px; color: var(--ink-2); line-height: 1.9; }
.koujing b { color: var(--ink); }

/* 部门 Tab */
.dept-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.dept-tabs .dt {
  flex-shrink: 0; padding: 7px 16px; border-radius: 20px; background: var(--card);
  border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow);
}
.dept-tabs .dt.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* 返回条 */
.backbar { display: flex; align-items: center; gap: 8px; padding: 2px 0 10px; font-size: 13px; }
.backbar a { color: var(--brand-2); text-decoration: none; }

/* 公司对比卡 */
.co-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv-row { background: #f8fafc; border-radius: 10px; padding: 10px 12px; }
.kv-row .lbl { font-size: 11px; color: var(--ink-2); margin-bottom: 4px; }
.kv-row .v { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-h280 { height: 280px; }
.co-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px;
  border: 1.5px solid transparent;
}
.co-card.on { border-color: var(--brand-2); }
.co-card .n { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.co-card .n .tag { font-size: 10px; background: var(--blue-bg); color: var(--blue); border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
.co-card .kv { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; color: var(--ink-2); }
.co-card .kv b { font-variant-numeric: tabular-nums; }

/* 底部 Tab */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 768px; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
#tabbar a {
  flex: 1; text-align: center; padding: 7px 0 8px; text-decoration: none;
  color: var(--ink-3); font-size: 10px;
}
#tabbar a .ico { font-size: 20px; display: block; }
#tabbar a.on { color: var(--brand); font-weight: 600; }

/* 长按浮层 */
#lptip {
  position: fixed; z-index: 90; background: rgba(17, 24, 39, .92); color: #fff;
  border-radius: 10px; padding: 10px 12px; font-size: 12px; max-width: 240px;
  display: none; line-height: 1.6; pointer-events: none;
}
#lptip b { font-size: 14px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(17, 24, 39, .9); color: #fff; padding: 9px 16px; border-radius: 20px;
  font-size: 13px; z-index: 95; display: none; max-width: 80%;
}

@media (min-width: 700px) {
  body { font-size: 15px; }
  .kpi .num { font-size: 28px; }
}
