/* H5 专用样式：只为手机设计，不引用 PC 版任何样式。
   原则：单列、拇指可达（主操作固定在底部）、触控区 ≥44px、字号 ≥15px（输入框 16px 防 iOS 放大）。 */
:root {
  --bg: #f2f4f7; --card: #fff; --fg: #1d2733; --sub: #5f6b7a; --hint: #718091; --line: #e8ebf0;
  --brand: #0f3b57; --primary: #1769c2; --primary-press: #11559f;
  --review: #e08a00; --seal: #7a4fd6; --back: #e0453a; --draft: #2f7fe0; --todo: #9aa4b1; --done: #1f9a68;
  --radius: 14px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-padding-bottom: calc(140px + var(--safe-b)); }
html, body { margin: 0; background: #e7edf2; color: var(--fg); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
#app { min-height: 100vh; min-height: 100dvh; max-width: 560px; margin: 0 auto; background: var(--bg); box-shadow: 0 0 0 1px #dce4ea; }
a { color: var(--primary); text-decoration: none; }
button { font: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(23, 105, 194, .38); outline-offset: 2px; }
.boot { padding: 40vh 0 0; text-align: center; color: var(--hint); }

/* ---------- 顶栏 ---------- */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 6px 16px; background: var(--brand); color: #fff; }
.bar h1 { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar .back { display: grid; place-items: center; min-width: 44px; min-height: 44px; margin-left: -10px; color: #fff; font-size: 26px; line-height: 1; }
.bar .link { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 44px; min-height: 44px; margin: 0; padding: 8px 4px; border: 0; background: none; color: #b9cfdd; font: inherit; font-size: 14px; line-height: 1.5; white-space: nowrap; }

/* ---------- 列表页头部 ---------- */
.hello { padding: 14px 16px 6px; background: var(--brand); color: #dbe7ef; }
.hello b { display: block; color: #fff; font-size: 22px; font-weight: 600; margin: 2px 0 4px; }
.hello .stat { display: flex; gap: 18px; padding: 10px 0 8px; font-size: 13px; }
.hello .stat span b { display: inline; font-size: 20px; margin-right: 3px; }
.hello .stat .red b { color: #ff8f86; }

/* 项目过滤：横向滑动的分段标签，吸顶 */
.seg { position: sticky; top: 52px; z-index: 9; display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; background: var(--bg); scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a { display: inline-flex; align-items: center; min-height: 44px; flex: none; max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 14px; border-radius: 999px; background: #fff; color: var(--sub); font-size: 14px; box-shadow: 0 0 0 1px var(--line) inset; }
.seg a.on { background: var(--brand); color: #fff; box-shadow: none; }
.seg a i { font-style: normal; margin-left: 5px; opacity: .7; font-size: 12px; }

.list { padding: 0 12px calc(24px + var(--safe-b)); }
.group { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 4px 8px; color: var(--sub); font-size: 13px; font-weight: 600; }
.group span:last-child { font-weight: 400; color: var(--hint); }

/* 任务卡片：左侧色条区分类型 */
.task { position: relative; display: block; margin: 0 0 10px; padding: 12px 14px 12px 18px; border-radius: var(--radius); background: var(--card); color: var(--fg); overflow: hidden; box-shadow: 0 1px 2px rgba(16, 32, 48, .04); }
.task::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--todo); }
.task.k-review::before { background: var(--review); } .task.k-seal::before { background: var(--seal); }
.task.k-back::before { background: var(--back); } .task.k-draft::before { background: var(--draft); }
.task:active { background: #f6f8fb; }
.task:focus-visible { outline: 3px solid rgba(23, 105, 194, .28); outline-offset: 2px; }
.task .top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task .name { display: block; margin: 6px 0 4px; font-size: 16px; font-weight: 600; line-height: 1.4; }
.task .meta { display: flex; justify-content: space-between; gap: 8px; color: var(--hint); font-size: 12px; }
.task .meta .late { color: var(--back); font-weight: 600; }
.no { color: var(--hint); font-size: 12px; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 12px; line-height: 18px; font-weight: 600; color: #fff; background: var(--todo); }
.tag.review { background: var(--review); } .tag.seal { background: var(--seal); } .tag.back { background: var(--back); }
.tag.draft { background: var(--draft); } .tag.done { background: var(--done); } .tag.todo { background: #eef1f4; color: var(--sub); }
.tag.late { background: #fde8e6; color: var(--back); }
.tag.line { background: none; color: var(--sub); box-shadow: 0 0 0 1px var(--line) inset; font-weight: 500; }

.more { display: block; margin: 6px 0; padding: 12px; text-align: center; color: var(--primary); font-size: 14px; }
.empty { padding: 72px 24px; text-align: center; color: var(--hint); }
.empty .big { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: #e3f4ec; color: var(--done); font-size: 30px; }

/* ---------- 办理页 ---------- */
.doc { padding: 12px 12px calc(140px + var(--safe-b)); }
.doc details[open] { scroll-margin-bottom: calc(140px + var(--safe-b)); }
.doc-no-action { padding-bottom: calc(24px + var(--safe-b)); }
.card { margin: 0 0 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--card); }
.card h2 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; font-size: 15px; }
.card h2 small { color: var(--hint); font-weight: 400; font-size: 13px; }
.head .name { margin: 4px 0 8px; font-size: 19px; font-weight: 600; line-height: 1.4; }
.kv { display: grid; grid-template-columns: 4.5em 1fr; gap: 6px 10px; margin: 12px 0 0; font-size: 14px; }
.kv dt { color: var(--hint); } .kv dd { margin: 0; }
.kv .late { color: var(--back); font-weight: 600; }
.next { display: flex; gap: 10px; align-items: flex-start; margin: 14px -16px -14px; padding: 12px 16px; border-radius: 0 0 var(--radius) var(--radius); background: #f3f7fc; font-size: 14px; color: var(--sub); }
.next::before { content: "→"; color: var(--primary); font-weight: 700; }
.next.me { background: #fff6e6; color: #7a4a00; } .next.me::before { color: var(--review); }
.next.bad { background: #fdeeed; color: #9b2c24; } .next.bad::before { color: var(--back); }

label.f { display: block; margin: 0 0 14px; color: var(--sub); font-size: 13px; }
label.f em { color: var(--back); font-style: normal; margin-left: 2px; }
.f input, .f select, .f textarea, textarea.op { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid #d9dee5; border-radius: 10px; background: #fff; color: var(--fg); font: inherit; font-size: 16px; -webkit-appearance: none; appearance: none; }
.f input:focus, .f select:focus, .f textarea:focus, textarea.op:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 105, 194, .12); }
.f input:disabled, .f textarea:disabled, .f select:disabled { background: #f6f7f9; color: var(--sub); }
label.sw { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: 0 0 8px; font-size: 15px; }
label.sw input { width: 22px; height: 22px; accent-color: var(--primary); }
.sec { margin: 18px 0 10px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--fg); font-size: 14px; font-weight: 600; }
.sec:first-child { margin-top: 0; padding-top: 0; border: 0; }
/* 表格字段在手机上改成“一行一张小卡片” */
.rowcard { position: relative; margin: 0 0 10px; padding: 10px 12px 2px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.rowcard .idx { margin: 0 0 6px; color: var(--hint); font-size: 12px; }
.rowcard .del { position: absolute; right: 2px; top: 2px; min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--hint); font-size: 13px; padding: 6px; }
.addrow { width: 100%; min-height: 46px; margin: 0 0 14px; border: 1px dashed #c7cfda; border-radius: 10px; background: #fff; color: var(--primary); }
.note { margin: 0 0 12px; color: var(--hint); font-size: 13px; }
.upload-limit { margin: 8px 0 0; }

.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 10px; min-height: 48px; border-bottom: 1px solid var(--line); font-size: 14px; }
.files li:last-child { border: 0; }
.files a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files small { color: var(--hint); }
.files button { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--hint); padding: 8px 4px; }
.pick { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; margin-top: 10px; border: 1px dashed #c7cfda; border-radius: 10px; color: var(--primary); font-size: 15px; }
.pick input { display: none; }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.steps li:last-child { border: 0; }
.steps .op { display: block; color: var(--hint); font-size: 13px; }

.slot { width: 100%; min-height: 50px; margin: 0 0 10px; border: 0; border-radius: 12px; background: var(--seal); color: #fff; font-size: 16px; font-weight: 600; }
.slot:active { filter: brightness(.92); }
.slot small { display: block; font-weight: 400; font-size: 12px; opacity: .85; }
.mock { margin: 0 0 12px; color: var(--hint); font-size: 12px; }
details > summary { list-style: none; padding: 8px 0; color: var(--sub); font-size: 14px; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: " ›"; color: var(--hint); }
details[open] > summary::after { content: " ⌄"; }

/* 底部操作栏：拇指区，固定 */
.actionbar { position: fixed; left: 50%; right: auto; bottom: 0; width: min(100%, 560px); transform: translateX(-50%); z-index: 20; display: flex; gap: 10px; padding: 10px 12px calc(10px + var(--safe-b)); background: rgba(255, 255, 255, .96); box-shadow: 0 -1px 0 var(--line), 0 -6px 16px rgba(16, 32, 48, .05); backdrop-filter: blur(8px); }
.btn { flex: 1; min-height: 48px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--primary); color: #fff; font-size: 16px; font-weight: 600; }
.btn:active { background: var(--primary-press); }
.btn.plain { flex: 0 0 34%; background: #eef2f6; color: var(--fg); }
.btn.danger { flex: 0 0 34%; background: #fdeeed; color: var(--back); }
.btn.full { width: 100%; }
button:disabled { opacity: .5; }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; min-height: 100dvh; padding: calc(env(safe-area-inset-top, 0px) + 56px) 24px 40px; background: linear-gradient(180deg, var(--brand) 0, var(--brand) 220px, var(--bg) 220px); }
.login .logo { color: #fff; }
.login .logo b { display: block; font-size: 26px; font-weight: 700; letter-spacing: 1px; }
.login .logo span { color: #a9c2d3; font-size: 14px; }
.login form { margin-top: 36px; padding: 22px 18px 8px; border-radius: 18px; background: #fff; box-shadow: 0 8px 24px rgba(16, 32, 48, .08); }
.login .btn { width: 100%; margin: 6px 0 14px; }
.login .tip { color: var(--hint); font-size: 12px; text-align: center; margin: 18px 0 0; }

/* ---------- 提示 ---------- */
#toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); z-index: 50; max-width: 86vw; padding: 10px 16px; border-radius: 10px; background: rgba(20, 28, 38, .9); color: #fff; font-size: 14px; text-align: center; transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.on { opacity: 1; }
#toast.err { background: rgba(176, 40, 30, .94); }

html.gj-modal-open{overflow:hidden}
.gj-dialog{box-sizing:border-box;position:fixed;inset:0;width:calc(100% - 32px);max-width:420px;max-height:calc(100dvh - 48px);margin:auto;padding:28px;border:1px solid #dce5ec;border-radius:18px;background:#fff;color:#1d3547;box-shadow:0 24px 80px #09273d40;font:15px/1.65 -apple-system,BlinkMacSystemFont,"Microsoft YaHei",sans-serif;overflow:auto;overscroll-behavior:contain;text-align:left}
.gj-dialog::backdrop{background:rgba(12,32,49,.48);backdrop-filter:blur(3px)}
.gj-dialog-icon{display:grid;place-items:center;width:40px;height:40px;border-radius:12px;background:#edf5fc;color:var(--primary,var(--accent,#146c94));font-size:23px;font-weight:700;margin-bottom:16px}
.gj-dialog.gj-dialog-danger .gj-dialog-icon{background:#fff0ee;color:#c23944}
.gj-dialog h2{display:block;margin:0 0 10px;padding:0;color:#17354c;font-size:20px;line-height:1.4;font-weight:650}
.gj-dialog h2::before{display:none}
.gj-dialog p{margin:0 0 26px;color:#5b7080;font-size:15px;line-height:1.75;white-space:pre-wrap;overflow-wrap:anywhere}
.gj-dialog-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.gj-dialog .gj-dialog-actions button{box-sizing:border-box;display:flex;align-items:center;justify-content:center;min-width:0;min-height:46px;margin:0;padding:10px 16px;border:1px solid transparent;border-radius:10px;font:inherit;font-weight:600;cursor:pointer;transform:none;white-space:normal;overflow-wrap:anywhere}
.gj-dialog .gj-dialog-cancel{background:#f3f6f8;border-color:#dce5ec;color:#526b7d}
.gj-dialog .gj-dialog-accept{background:var(--primary,var(--accent,#146c94));color:#fff}
.gj-dialog.gj-dialog-danger .gj-dialog-accept{background:#c23944}
.gj-dialog button:hover{filter:brightness(.96);transform:none}
.gj-dialog button:focus-visible{outline:3px solid #6da6ca;outline-offset:3px}
.gj-toast{position:fixed;z-index:1000;left:50%;bottom:calc(28px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);box-sizing:border-box;width:max-content;max-width:calc(100% - 32px);padding:12px 18px;border-radius:12px;background:#17354c;color:#fff;box-shadow:0 8px 30px #09273d30;white-space:pre-wrap;overflow-wrap:anywhere;font:14px/1.6 -apple-system,BlinkMacSystemFont,"Microsoft YaHei",sans-serif}
.gj-toast[hidden]{display:none}
@media(max-width:480px){.gj-dialog{padding:24px;border-radius:16px}.gj-dialog h2{font-size:19px}}
@media print{.gj-dialog,.gj-toast{display:none!important}}
