:root {
  --ink: #16222b; --ink2: #46555f; --ink3: #7d8b93; --line: #e4ebef; --bg: #f4f7f9;
  --brand: #0b6ba8; --brand-d: #075483; --teal: #0f9b8c; --amber: #d98a17; --red: #d1435a; --green: #17a56f;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
.boot { padding: 60px; text-align: center; color: var(--ink3); }
a { color: var(--brand); }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(140deg, #075483, #0b6ba8 45%, #0f9b8c); }
.login { width: 360px; background: #fff; border-radius: 16px; padding: 30px 28px; box-shadow: 0 20px 50px rgba(3,34,52,.3); }
.login h1 { font-size: 19px; margin: 0 0 4px; }
.login p { font-size: 12px; color: var(--ink3); margin: 0 0 20px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; color: var(--ink2); margin-bottom: 5px; }
input, textarea, select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--ink); background: #fbfdfe; }
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--brand); background: #fff; }
textarea { min-height: 74px; resize: vertical; line-height: 1.7; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: 0; border-radius: 9px; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brand-d); }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.btn.ghost { background: #eef3f6; color: var(--ink2); }
.btn.ghost:hover { background: #e2ebf0; }
.btn.teal { background: var(--teal); }
.btn.danger { background: #fdf0f2; color: var(--red); }
.btn.sm { padding: 5px 11px; font-size: 12px; font-weight: 500; }
.warnbox { margin-top: 14px; padding: 10px 12px; border-radius: 9px; background: #fdf6e8; color: #8a6a20; font-size: 12px; line-height: 1.7; }

/* 布局 */
.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }
.side { background: #0d2b3c; color: #cfe0e7; padding: 18px 0; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { padding: 0 18px 16px; border-bottom: 1px solid #17415a; margin-bottom: 12px; }
.brand b { color: #fff; font-size: 15px; display: block; }
.brand span { font-size: 11px; color: #7fa5b8; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 10px 18px; color: #b6d0dc; text-decoration: none; font-size: 13px; border-left: 3px solid transparent; }
.nav a:hover { background: #12374d; color: #fff; }
.nav a.on { background: #12455f; color: #fff; border-left-color: var(--teal); font-weight: 600; }
.nav i { font-style: normal; width: 18px; text-align: center; opacity: .85; }
.nav .badge { margin-left: auto; background: var(--amber); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 8px; }
.side-foot { padding: 14px 18px; font-size: 11px; color: #6f94a7; border-top: 1px solid #17415a; margin-top: 14px; }
.main { padding: 0 0 60px; }

.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 13px 24px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 5; }
.topbar h2 { font-size: 16px; margin: 0; }
.crumb { font-size: 12px; color: var(--ink3); }
.ver { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; }
.ver .tag { background: #eef5fa; color: var(--brand-d); padding: 3px 9px; border-radius: 8px; font-family: ui-monospace, Consolas, monospace; }
.ver .dirty { background: #fdf3e3; color: #b5730f; padding: 3px 9px; border-radius: 8px; }
.wrap { padding: 22px 24px; max-width: 1280px; }

/* 卡片与表格 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 13px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 15px 16px; }
.kpi b { display: block; font-size: 25px; color: var(--brand); font-family: ui-monospace, Consolas, monospace; }
.kpi span { font-size: 12px; color: var(--ink3); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 17px 18px; margin-bottom: 16px; }
.panel h3 { font-size: 14px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.panel h3 .sub { font-size: 11px; color: var(--ink3); font-weight: 400; }
.panel h3 .r { margin-left: auto; display: flex; gap: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--ink3); font-weight: 600; font-size: 12px; padding: 8px 9px; border-bottom: 1px solid var(--line); background: #f8fbfc; }
td { padding: 9px; border-bottom: 1px solid #f0f4f6; vertical-align: top; }
tr:hover td { background: #fafcfd; }
td.mono, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 9px; background: #eef5fa; color: var(--brand-d); white-space: nowrap; }
.pill.now { background: #e6f6ee; color: var(--green); }
.pill.ob { background: #fcecf0; color: var(--red); }
.pill.note { background: #fdf3e3; color: #b5730f; }
.pill.gray { background: #f0f3f5; color: var(--ink3); }
.row-act { display: flex; gap: 6px; }
.filters { display: flex; gap: 9px; margin-bottom: 13px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 150px; }
.empty { padding: 34px; text-align: center; color: var(--ink3); font-size: 13px; }

/* 编辑器 */
.edit { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr); gap: 18px; align-items: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 11px; color: var(--ink3); margin-top: 4px; line-height: 1.6; }
.rep { border: 1px dashed var(--line); border-radius: 10px; padding: 11px; margin-bottom: 9px; background: #fcfdfe; }
.rep .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; color: var(--ink3); }
.rep .hd .x { margin-left: auto; cursor: pointer; color: var(--red); font-size: 12px; }
.rep .g { display: grid; grid-template-columns: 1.1fr 1.3fr .9fr 1.2fr; gap: 7px; }
.sticky-actions { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 18px; display: flex; gap: 9px; align-items: center; margin: 0 -18px -17px; border-radius: 0 0 13px 13px; }
.sticky-actions .r { margin-left: auto; display: flex; gap: 9px; }

/* 手机预览 */
.preview { position: sticky; top: 78px; }
.phone { width: 100%; max-width: 330px; margin: 0 auto; background: #0b1319; border-radius: 32px; padding: 8px; }
.pw { background: #f3f6f8; border-radius: 26px; overflow: hidden; height: 560px; overflow-y: auto; }
.pw .hero { padding: 26px 14px 14px; background: linear-gradient(158deg, var(--brand), #0a86b8 55%, var(--teal)); color: #fff; }
.pw .hero .t { font-size: 16px; font-weight: 700; line-height: 1.4; }
.pw .hero .a { font-size: 10.5px; opacity: .85; margin-top: 6px; }
.pw .b { padding: 10px; }
.pw .c { background: #fff; border-radius: 12px; padding: 11px; margin-bottom: 9px; box-shadow: 0 2px 8px rgba(11,62,92,.05); }
.pw .c h4 { font-size: 12px; margin: 0 0 8px; display: flex; gap: 6px; align-items: center; }
.pw .c h4 em { font-style: normal; width: 3px; height: 12px; background: var(--brand); border-radius: 2px; }
.pw .c p, .pw .c li { font-size: 11px; color: var(--ink2); line-height: 1.7; margin: 0 0 5px; }
.pw .c ul { padding-left: 16px; margin: 0; }
.pw .std { background: #f6fafc; border: 1px solid #e8f1f6; border-radius: 9px; padding: 8px; margin-bottom: 6px; }
.pw .std b { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--brand-d); display: block; }
.pw .std span { font-size: 10.5px; color: var(--ink2); }
.pw .fp { background: #fff6e8; border-left: 3px solid var(--amber); padding: 8px; border-radius: 0 8px 8px 0; font-size: 10.5px; color: #6b4c1d; line-height: 1.6; }
.pw .fx { background: #10262f; color: #7fe3c8; font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; padding: 9px; border-radius: 8px; line-height: 1.7; }

/* 发布流 */
.flow { display: flex; gap: 0; margin: 4px 0 18px; }
.flow div { flex: 1; background: #fff; border: 1px solid var(--line); padding: 12px 14px; font-size: 12px; color: var(--ink2); position: relative; }
.flow div:first-child { border-radius: 11px 0 0 11px; }
.flow div:last-child { border-radius: 0 11px 11px 0; }
.flow b { display: block; font-size: 13px; color: var(--ink); margin-bottom: 3px; }
.flow .n { position: absolute; right: 10px; top: 10px; font-size: 11px; color: #fff; background: var(--brand); width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 11px 0 11px 20px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.timeline li.cur::before { background: var(--teal); border-color: var(--teal); }
.timeline b { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.timeline .m { font-size: 11.5px; color: var(--ink3); margin-top: 2px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px); background: #12303f; color: #fff; padding: 11px 18px; border-radius: 11px; font-size: 13px; opacity: 0; pointer-events: none; transition: .22s; z-index: 99; max-width: 70vw; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #a3243a; }
.kv { display: grid; grid-template-columns: 132px 1fr; gap: 7px 12px; font-size: 13px; }
.kv .k { color: var(--ink3); }
pre.json { background: #0f2530; color: #b8e6d8; padding: 13px; border-radius: 10px; font-size: 11.5px; overflow: auto; max-height: 320px; line-height: 1.6; }
code.inline { background: #eef3f6; padding: 1px 6px; border-radius: 5px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }

/* 人员账号 / 现场记录 / 计算表 */
.tiny { font-size: 11px; color: var(--ink3); line-height: 1.5; }
.tiny a { font-size: 11px; }
.hide-row { display: none; }
.pw-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pw-inline input { max-width: 320px; }
.pw-inline select { max-width: 420px; flex: 1; min-width: 200px; }
.checking { font-size: 11px; color: var(--ink3); }
details.raw summary { cursor: pointer; font-size: 11px; color: var(--ink3); }
details.raw[open] summary { color: var(--brand); }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.65; min-height: 460px; }
.chk { border-radius: 9px; padding: 10px 12px; font-size: 12px; line-height: 1.7; margin-top: 10px; }
.chk ul { margin: 6px 0 0 18px; padding: 0; }
.chk li { margin-bottom: 3px; font-family: ui-monospace, Consolas, monospace; }
.chk.ok { background: #e6f6ee; color: #0e7a52; }
.chk.warn { background: #fdf6e8; color: #8a6a20; }
.chk.bad { background: #fcecf0; color: #a3243a; }
@media (max-width: 1080px) { .edit { grid-template-columns: 1fr; } .preview { position: static; } }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .side { height: auto; position: static; } .nav { display: flex; flex-wrap: wrap; } }

/* 可视化编辑器 */
.vis-section { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; margin-bottom: 14px; background: #fafbfc; }
.vis-section h4 { font-size: 13px; margin: 0 0 10px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.vis-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 5px 0; border-bottom: 1px dashed #eef1f4; }
.vis-row:last-child { border-bottom: none; }
.vis-row input, .vis-row select { padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; }
.vis-group { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; margin-bottom: 10px; }
.vis-group .form-grid { margin-bottom: 8px; }
.vg-cols { margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--brand); }
