/* 码管家 · 手机端
 *
 * 手机优先，大字号、大按钮 —— 用的人是药房/卫生院的，不是年轻人。
 * 单文件、无构建步骤（服务器上就一台小机器，不折腾前端工具链）。
 */

:root {
  --brand: #0f766e;          /* 医疗感的青绿，安静、可信 */
  --brand-dark: #115e59;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --ok: #15803d;
  --ok-bg: #f0fdf4;
  --ink: #1f2937;
  --ink-soft: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6f7;
  --card: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--brand); color: #fff;
  padding: 14px 16px calc(14px + env(safe-area-inset-top)) 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex; align-items: baseline; gap: 10px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.topbar .tenant { font-size: 13px; opacity: .85; margin-left: auto; }

/* ---------- 内容 ---------- */
.wrap { padding: 14px 14px calc(84px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.card h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.card .hint { color: var(--ink-soft); font-size: 13px; margin: 6px 0 0; }

/* ---------- 数字块 ---------- */
/*
 * ⚠️ 版式目标：**首页一屏放得下，不用上下滑**。
 *    手机可用高度大概 550~650px（去掉顶栏和底栏），所以：
 *      · 数字用三列横排，不占两行
 *      · 卡片间距压到 10px
 *      · "系统在做什么"这类明细挪到「记录」页，首页只放最要紧的
 */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats.three { grid-template-columns: 1fr 1fr 1fr; }
.stat { background: var(--card); border-radius: var(--radius); padding: 12px;
        box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.15; }
.stat .k { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.stat.wide { grid-column: 1 / -1; }
/* 三列的窄块：数字小一点、标题换行也不挤 */
.stats.three .stat { padding: 12px 6px; text-align: center; }
.stats.three .stat .n { font-size: 23px; }
.stats.three .stat .k { font-size: 12px; line-height: 1.25; margin-top: 4px; }

/* 并排的两个按钮 */
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { margin-top: 0; }

/* 首页用的紧凑提示条 */
.note.compact { padding: 9px 12px; font-size: 13px; margin-bottom: 10px; }

/* 首页顶部那块（只有授权告警时才出现，占位置要小） */
.card.tight { padding: 12px 14px; margin-bottom: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  display: block; width: 100%; padding: 15px 16px;
  font-size: 17px; font-weight: 600; text-align: center; text-decoration: none;
  border: 0; border-radius: var(--radius); cursor: pointer;
  background: var(--brand); color: #fff;
}
.btn:active { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.plain { background: #eef2f3; color: var(--ink); }
.btn[disabled] { opacity: .5; }
.btn + .btn { margin-top: 10px; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 14px; color: var(--ink-soft); margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=tel], input[type=number], select {
  width: 100%; padding: 13px 14px; font-size: 17px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }

/* ---------- 提示条 ---------- */
.note { border-radius: var(--radius); padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.danger { background: var(--danger-bg); color: var(--danger); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note strong { font-weight: 600; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; padding: 9px 4px 7px; text-align: center; text-decoration: none;
  color: var(--ink-soft); font-size: 11px;
}
.tabbar a .ico { display: block; font-size: 19px; line-height: 1.3; }
.tabbar a.on { color: var(--brand); font-weight: 600; }

/* ---------- 列表 ---------- */
.list { margin: 0; padding: 0; list-style: none; }
.list li { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list li:last-child { border-bottom: 0; }
.list .sub { color: var(--ink-soft); font-size: 12px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 999px;
       background: #eef2f3; color: var(--ink-soft); }
.tag.high { background: var(--danger-bg); color: var(--danger); }
.tag.low  { background: var(--warn-bg); color: var(--warn); }
.tag.ok   { background: var(--ok-bg); color: var(--ok); }

.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.empty { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 18px 0; }
