/* 智慧记进销存 · 移动优先，青绿（#00A2B5）顶栏 */
:root {
  --teal: #00a2b5; --teal-dark: #008a9c; --teal-light: #e6f6f8;
  --ink: #222; --muted: #888; --line: #e5e5e5; --bg: #f4f6f7;
  --card: #fff; --red: #d93025; --green: #1e8e3e; --amber: #e8710a;
  --blue: #1a73e8; --purple: #8e24aa; --pink: #d81b60;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; padding: 9px 10px; border: 1px solid #ccc; border-radius: 8px; width: 100%; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
a { color: var(--teal-dark); }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
.muted { color: var(--muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }

/* 顶栏 */
#topbar { background: var(--teal); color: #fff; display: flex; align-items: center; gap: 8px; padding: 8px 12px; position: sticky; top: 0; z-index: 50; flex-wrap: wrap; }
#topbar .logo { background: rgba(255,255,255,.16); border: none; color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 17px; font-weight: 700; }
#topbar .logo span { font-size: 14px; font-weight: 400; }
#topbar .shop { font-size: 13px; opacity: .9; }
#top-search { flex: 1; min-width: 140px; border: none; border-radius: 20px; padding: 7px 14px; }
#topbar .me { font-size: 13px; white-space: nowrap; }
#btn-logout { background: rgba(0,0,0,.18); border: none; color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 13px; }

#view { max-width: 1060px; margin: 0 auto; padding: 14px 12px 90px; }

/* KPI 卡片 */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 6px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--card); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.kpi .ic { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 21px; color: #fff; flex: none; }
.kpi .lb { font-size: 12px; color: var(--muted); }
.kpi .vl { font-size: 18px; font-weight: 700; }
.ic.blue { background: #2f80ed; } .ic.green { background: #27ae60; } .ic.orange { background: #f2994a; }
.ic.red { background: #eb5757; } .ic.purple { background: #9b51e0; } .ic.pink { background: #e84393; }

/* 功能导航 */
.nav-group { margin-top: 16px; }
.nav-group h2 { border-left: 4px solid var(--teal); padding-left: 8px; }
.nav-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 700px) { .nav-grid { grid-template-columns: repeat(8, 1fr); } }
.nav-item { background: var(--card); border: none; border-radius: 12px; padding: 12px 4px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.nav-item .ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; }
.nav-item:active { transform: scale(.97); }

/* 列表与表格 */
.card { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar input, .toolbar select { width: auto; flex: 1; min-width: 120px; }
.btn { display: inline-block; background: var(--teal); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--teal-dark); border: 1px solid var(--teal); }
.btn.danger { background: var(--red); }
.btn.ghost { background: #eee; color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
.rowlink { cursor: pointer; }
.rowlink:hover td { background: var(--teal-light); }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 20px; background: var(--teal-light); color: var(--teal-dark); }
.tag.red { background: #fdecea; color: var(--red); }
.tag.green { background: #e6f4ea; color: var(--green); }
.tag.amber { background: #fef3e2; color: var(--amber); }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field .req { color: var(--red); }
.line-row { display: grid; grid-template-columns: 1fr 74px 84px 96px 30px; gap: 6px; align-items: center; margin-bottom: 8px; }
.line-row input { padding: 7px 8px; }
.line-row .del { background: none; border: none; color: var(--red); font-size: 18px; padding: 0; }
.prod-pick { position: relative; }
.prod-pick .suggest { position: absolute; z-index: 20; left: 0; right: 0; background: #fff; border: 1px solid #ccc; border-radius: 8px; max-height: 240px; overflow-y: auto; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.prod-pick .suggest div { padding: 9px 10px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.prod-pick .suggest div:hover { background: var(--teal-light); }
.total-box { background: var(--teal-light); border-radius: 10px; padding: 12px 14px; margin: 10px 0; font-size: 15px; }
.total-box b { font-size: 19px; color: var(--teal-dark); }

/* 登录 */
.login-wrap { max-width: 380px; margin: 60px auto 0; }
.login-wrap .card { padding: 24px 20px; }
.login-wrap .logo-big { width: 64px; height: 64px; border-radius: 16px; background: var(--teal); color: #fff; font-size: 34px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.login-wrap h1 { text-align: center; }
.login-wrap .field { margin-bottom: 12px; }

/* 底部导航（手机） */
#bottomnav { display: none; }
@media (max-width: 700px) {
  #bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 50; }
  #bottomnav button { flex: 1; background: none; border: none; padding: 8px 0 10px; font-size: 12px; color: var(--muted); }
  #bottomnav button.on { color: var(--teal-dark); font-weight: 700; }
  #bottomnav .bi { font-size: 20px; display: block; }
}
#bottomnav { position: fixed; }

/* 提示条 */
#toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: rgba(0,0,0,.85); color: #fff; padding: 10px 18px; border-radius: 24px; z-index: 99; font-size: 14px; max-width: 90vw; text-align: center; }
.install-tip { background: #fff8e1; border: 1px solid #ffe082; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 12px 0; }

/* 报表条形图 */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 8px 0 0; }
.bars .bar { flex: 1; background: var(--teal); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .bar span { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.bar-labels { display: flex; gap: 3px; font-size: 10px; color: var(--muted); }
.bar-labels span { flex: 1; text-align: center; }

/* 打印：平时隐藏打印区，打印时只显示打印区 */
#print-root { display: none; }
@media print {
  body { background: #fff; }
  #app { display: none !important; }
  #print-root { display: block !important; color: #000; }
  .print-doc { max-width: 800px; margin: 0 auto; font-size: 14px; }
  .print-doc h1 { text-align: center; font-size: 20px; margin: 4px 0; }
  .print-doc .p-head { text-align: center; color: #444; font-size: 13px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
  .print-doc table { border-collapse: collapse; width: 100%; }
  .print-doc th, .print-doc td { border: 1px solid #000; padding: 5px 7px; font-size: 13px; }
  .print-doc .sign { display: flex; justify-content: space-between; margin-top: 22px; }
}
