/* 上门护理调度工作台 —— 移动优先。
   护士在电梯里、楼道里单手用手机操作，所以：按钮大、字大、层级浅。 */

:root {
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-soft: #ccfbf1;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #16232e;
  --muted: #64748b;
  --line: #e2e8f0;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 35, 46, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --line: #334155;
    --brand-soft: #134e4a;
    --danger-soft: #450a0a;
    --warn-soft: #451a03;
    --ok-soft: #052e16;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  padding-bottom: 72px; /* 给底部导航留位 */
}

a { color: var(--brand); text-decoration: none; }

/* ---------- 顶栏 ---------- */
header.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: #fff;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
header.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
header.topbar a { color: #fff; opacity: .9; font-size: 13px; }

/* ---------- 布局 ---------- */
.wrap { max-width: 900px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
.card h2 .sub { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }

/* ---------- 指标块 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; text-align: center;
}
.stat .num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent .num { color: var(--brand); }
.stat.danger .num { color: var(--danger); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; line-height: 1.7; white-space: nowrap;
  background: var(--line); color: var(--muted);
}
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; padding: 10px 16px; border-radius: 10px;
  background: var(--brand); color: #fff; border: 0; cursor: pointer;
  font-size: 15px; font-family: inherit; text-align: center;
}
.btn:active { background: var(--brand-dark); }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.grey { background: var(--line); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; font-size: 16px; /* 16px 防 iOS 自动放大 */
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); font-family: inherit;
}
textarea { min-height: 76px; resize: vertical; }
input[type="checkbox"] { width: auto; margin-right: 8px; transform: scale(1.3); }
.check { display: flex; align-items: flex-start; gap: 4px; margin: 10px 0; font-size: 14px; }
.check label { margin: 0; color: var(--text); font-size: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0 0 14px; }
legend { font-size: 13px; color: var(--muted); padding: 0 6px; }

/* ---------- 列表项 ---------- */
.item {
  display: block; padding: 12px 0; border-bottom: 1px solid var(--line);
  color: var(--text);
}
.item:last-child { border-bottom: 0; }
.item .title { font-weight: 600; font-size: 15px; }
.item .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- 时间轴（排班建议） ---------- */
.timeline { position: relative; padding-left: 62px; }
.tl-item { position: relative; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-time {
  position: absolute; left: -62px; top: 12px; width: 52px;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--brand-dark); text-align: right;
}
.tl-travel { font-size: 12px; color: var(--muted); margin-bottom: 2px; }

/* ---------- 提示条 ---------- */
.alert {
  padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px;
  font-size: 14px; border-left: 4px solid;
}
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert.info { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- 底部导航 ---------- */
nav.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabbar a {
  flex: 1; text-align: center; padding: 9px 2px 7px;
  font-size: 11px; color: var(--muted);
}
nav.tabbar a .ico { display: block; font-size: 19px; line-height: 1.25; }
nav.tabbar a.on { color: var(--brand); font-weight: 600; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 6px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 筛选标签 ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.chips a {
  white-space: nowrap; padding: 6px 13px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.chips a.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.thumb { width: 78px; height: 78px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* 凭证缩略图 + 右上角删除按钮 */
.shot-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.shot { position: relative; line-height: 0; }
.shot form { position: absolute; top: -6px; right: -6px; margin: 0; line-height: 1; }
/* 客户端的订单进展。最新一条加重，老的淡下去 —— 一眼看到"现在到哪了" */
.timeline-c { position: relative; padding-left: 18px; }
.timeline-c::before {
  content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line);
}
.tl-c-item { position: relative; padding: 8px 0; }
.tl-c-item::before {
  content: ""; position: absolute; left: -18px; top: 14px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line); border: 2px solid var(--card);
}
.tl-c-item.latest::before { background: var(--brand); }
.tl-c-item.latest .tl-c-msg { font-weight: 600; color: var(--text); }
.tl-c-time { font-size: 12px; color: var(--muted); }
.tl-c-msg { font-size: 15px; color: var(--muted); margin-top: 1px; }

.thumb-rejected { opacity: .45; filter: grayscale(1); }
.shot-tag {
  position: absolute; left: 0; bottom: 0; right: 0;
  font-size: 11px; line-height: 18px; text-align: center;
  border-radius: 0 0 8px 8px; color: #fff;
}
.shot-tag.danger { background: var(--danger); }
.shot-tag.ok { background: var(--ok); }
.shot-del {
  width: 24px; height: 24px; padding: 0;
  border: 2px solid var(--card); border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 15px; line-height: 20px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- 抢单：快超时的单要一眼看见 ---------- */
.card.urgent { border-left: 4px solid var(--warn); }

/* ---------- 客户端 ---------- */
/* 客户里有不少老人，字号和行距都放大一档 */
body.portal { font-size: 16px; }
body.portal .card h2 { font-size: 16px; }
body.portal .item .title { font-size: 16px; }
body.portal .meta { font-size: 14px; }
body.portal table { font-size: 15px; }

.stat-big { font-size: 22px; font-weight: 700; color: var(--brand); margin-bottom: 4px; }

a.stat { display: block; color: inherit; }

/* ---------- 评分星星 ---------- */
.rating { display: flex; justify-content: center; gap: 4px; margin: 8px 0; }
.rating label { margin: 0; cursor: pointer; }
.rating input { position: absolute; opacity: 0; width: 0; height: 0; }
.rating .star { font-size: 38px; line-height: 1; color: var(--line); transition: color .12s; }
.rating .star.on { color: #f59e0b; }

/* 自定义样式的文件选择。
   用 <label for> 让浏览器原生打开选择器，不走 JS 的 .click() ——
   微信内置浏览器(X5)和部分安卓 WebView 会拦掉对 hidden 元素的程序化点击，
   表现是点了完全没反应、也不报错。而客户基本都在微信里打开链接。
   同理不能用 display:none / hidden，那些在部分 WebView 里同样点不动。 */
.file-pick {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}
label.btn { display: inline-block; cursor: pointer; }
label.btn.block { display: block; }

details summary { cursor: pointer; padding: 6px 0; }
input[readonly] { background: var(--bg); }
pre { background: var(--bg); padding: 10px; border-radius: 8px; }
code { font-size: 13px; }
