/* 手机优先，桌面限宽居中（720px），照小程序的卡片组 + 行式 cell 来排 */
:root {
  --bg: #f2f3f5;
  --card: #fff;
  --line: #ebedf0;
  --line2: #f4f5f7;
  --ink: #1a1a1a;
  --ink2: #8a8a8a;
  --ink3: #b5b8bd;
  --brand: #185fa5;
  --brand-soft: #e8f1fa;
  --ok: #0f6e56;
  --ok-soft: #e3f5ee;
  --warn: #993c1d;
  --danger: #c0392b;
  --tab: 50px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 14px);
}
body.has-foot { padding-bottom: calc(var(--tab) + 60px + env(safe-area-inset-bottom) + 14px); }
a { color: var(--brand); text-decoration: none; }

/* ---- 顶栏 ---- */
header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  background: var(--card); border-bottom: 1px solid var(--line);
}
header h1 {
  flex: 1; min-width: 0; margin: 0; text-align: center;
  font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
header .right { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink2); }
header .me { color: var(--ink3); }

main { max-width: 720px; margin: 0 auto; padding: 12px 12px 0; }

/* ---- 卡片组 ---- */
.panel { background: var(--card); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.panel.pad { padding: 12px; }
.sec-title { display: flex; align-items: baseline; gap: 8px; padding: 2px 4px 8px; font-size: 13px; color: var(--ink2); }
.sec-title .sp { flex: 1; }

/* ---- 行式 cell ---- */
.cell { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 14px; border-bottom: 1px solid var(--line2); }
.cell:last-child { border-bottom: 0; }
.cell > .lb { flex: 0 0 72px; color: var(--ink2); font-size: 14px; }
.cell > .vl { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.cell input, .cell select {
  flex: 1; min-width: 0; width: 100%; border: 0; padding: 6px 0;
  background: transparent; font: inherit; color: var(--ink);
}
.cell input:focus, .cell select:focus { outline: none; }
.val { color: var(--ink); word-break: break-all; }

/* ---- 搜索 / 分段 ---- */
.searchbar { margin-bottom: 10px; }
.searchbar input {
  width: 100%; height: 38px; padding: 0 14px; border: 0; border-radius: 19px;
  background: #fff; font: inherit; color: var(--ink);
}
.seg { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.seg button { flex: 1; height: 36px; border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand); color: #fff; }

/* ---- 横向 chips ---- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 16px;
  background: #fff; font: inherit; font-size: 13px; color: var(--ink2);
}
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.chip .n { margin-left: 5px; font-size: 12px; opacity: .7; }

/* ---- 输入 / 按钮 ---- */
input, select, textarea, button { font: inherit; }
textarea {
  width: 100%; min-height: 120px; padding: 10px; border: 0; border-radius: 10px;
  background: var(--line2); resize: vertical;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-soft); }
button {
  min-height: 36px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); cursor: pointer;
}
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.ghost { background: #fff; }
button.danger { color: var(--danger); }
button.sm { min-height: 28px; padding: 3px 10px; font-size: 12px; border-radius: 8px; }
button.block { display: block; width: 100%; min-height: 44px; }
button:disabled { opacity: .5; }
.btnrow { display: flex; gap: 8px; margin-top: 10px; }
.btnrow button { flex: 1; min-height: 42px; }

/* ---- 列表卡片 ---- */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border-radius: 12px; padding: 12px 14px; }
.card .top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card .name { font-size: 16px; font-weight: 600; }
.card .date { color: var(--ink2); font-size: 13px; }
.card .sp { flex: 1; }
.card .meta { color: var(--ink2); font-size: 13px; margin-top: 4px; }
.card .acts { display: flex; gap: 8px; margin-top: 10px; }
.card .acts button { flex: 1; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.tag.done { background: var(--ok-soft); color: var(--ok); }
.empty { color: var(--ink3); padding: 40px 0; text-align: center; font-size: 14px; }

/* ---- 明细卡（手机上表格没法看，一律卡片）---- */
.icard { background: var(--card); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.icard .itop { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line2); }
.icard .itop .sp { flex: 1; }
.icard .itop b { font-size: 14px; }
.igrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px; }
.fld { min-width: 0; }
.fld label { display: block; font-size: 12px; color: var(--ink2); margin-bottom: 3px; }
.fld input {
  width: 100%; min-height: 36px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.fld .val { min-height: 22px; font-size: 14px; word-break: break-all; }

/* ---- 底部固定操作条 ---- */
.footbar {
  position: fixed; left: 0; right: 0; z-index: 18;
  bottom: calc(var(--tab) + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); padding: 8px 12px;
}
.footbar .inner { max-width: 720px; margin: 0 auto; }

/* ---- 底部 tabbar ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 19;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .inner { display: flex; max-width: 720px; margin: 0 auto; }
.tabbar .tb {
  flex: 1; height: var(--tab); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--ink2);
}
.tabbar .tb.on { color: var(--brand); font-weight: 600; }

/* ---- 提示 ---- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 20px);
  background: rgba(26,26,26,.9); color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 13px; z-index: 99; max-width: 80%; text-align: center;
}
body.has-foot .toast { bottom: calc(var(--tab) + 60px + env(safe-area-inset-bottom) + 20px); }
.hint { color: var(--ink2); font-size: 13px; }
.warn { color: var(--warn); }
.pad12 { padding: 2px 4px 10px; }
