/* 律政工作台网页版 · 样式
   桌面：左侧栏 + 内容区（内容限宽居中）；手机：顶栏 + 底部五栏 + 全宽内容。
   配色与 APP 商店版分层图标同源：深蓝 + 金。 */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --line: #dde3ec;
  --ink: #1c2733;
  --ink-2: #5b6b7d;
  --ink-3: #8d9cae;
  --brand: #1d3557;
  --brand-2: #2456a6;
  --gold: #c99612;
  --ok: #1e9e62;
  --warn: #d97706;
  --danger: #d43d2a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 35, 60, .05), 0 8px 24px rgba(20, 35, 60, .06);
  --nav-w: 232px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151c;
    --panel: #1a212c;
    --panel-2: #232c39;
    --line: #2e3949;
    --ink: #e8edf3;
    --ink-2: #a7b4c4;
    --ink-3: #71808f;
    --brand: #7fa8e0;
    --brand-2: #6f9fe8;
    --gold: #d9a521;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--ink); }

/* ---------- 布局 ---------- */
#app { display: flex; min-height: 100vh; }
#sidebar {
  width: var(--nav-w); flex: 0 0 var(--nav-w); position: sticky; top: 0; height: 100vh;
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 14px; z-index: 20;
}
#main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar { display: none; }
#content { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 26px 28px 60px; }
#tabbar { display: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; background: var(--brand); color: var(--gold);
  font-family: "Songti SC", "STSong", serif; font-weight: 700; font-size: 24px;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.brand-mark.small { width: 30px; height: 30px; font-size: 17px; border-radius: 9px; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .04em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); }
.brand-mini { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }

.side-search input, .top-search input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); outline: none;
}
.side-search input:focus, .top-search input:focus { border-color: var(--brand-2); background: var(--panel); }

#main-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--ink); font-size: 15px;
}
.nav-item:hover { background: var(--panel-2); }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.active .nav-ico { opacity: 1; }
.nav-ico { width: 20px; text-align: center; opacity: .75; font-size: 15px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

#sync-card { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; }
.sync-line { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; }
.sync-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; word-break: break-all; }
.sync-btn {
  margin-left: auto; border: 1px solid var(--line); background: var(--panel); color: var(--brand-2);
  border-radius: 8px; padding: 3px 9px; font-size: 12.5px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--ok); } .dot.err { background: var(--danger); }
.dot.busy { background: var(--warn); } .dot.off { background: var(--ink-3); }

/* ---------- 页面通用 ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; margin: 0; }
.page-head .spacer { flex: 1; }
.crumb { font-size: 13px; color: var(--ink-2); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.empty { text-align: center; color: var(--ink-3); padding: 42px 10px; font-size: 14.5px; }
.muted { color: var(--ink-2); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.danger-text { color: var(--danger); } .warn-text { color: var(--warn); } .ok-text { color: var(--ok); }
.mono { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); border-radius: 10px; padding: 8px 16px; font-size: 14.5px;
}
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; font-weight: 600; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.danger { color: var(--danger); border-color: #ecc5bf; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; }

.chip {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  background: var(--panel-2); color: var(--ink-2); font-size: 12.5px; white-space: nowrap;
}
.chip.blue { background: #e3ecfa; color: var(--brand-2); }
.chip.gold { background: #f7ecd2; color: #8a6408; }
.chip.red { background: #fbe7e3; color: var(--danger); }
.chip.green { background: #e2f4ea; color: var(--ok); }
@media (prefers-color-scheme: dark) {
  .chip.blue { background: #22354f; } .chip.gold { background: #40360f; color: var(--gold); }
  .chip.red { background: #452520; } .chip.green { background: #17382a; }
}

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type="search"], .toolbar input[type="text"] {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); min-width: 200px;
}
.seg { display: inline-flex; background: var(--panel-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 13px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); }
.seg button.active { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 16px; display: block; color: var(--ink);
}
a.row-card:hover { border-color: var(--brand-2); }
.row-top { display: flex; align-items: baseline; gap: 10px; }
.row-title { font-weight: 600; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-right { margin-left: auto; text-align: right; flex: 0 0 auto; }
.row-sub { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.row-tags { margin-top: 7px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 13px; max-width: 760px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-2); }
.field textarea { min-height: 96px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.frow.c3 { grid-template-columns: 1fr 1fr 1fr; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.check-line input { width: 17px; height: 17px; accent-color: var(--brand-2); }
.form-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0; }
fieldset legend { font-weight: 700; font-size: 14.5px; padding: 0 6px; }
fieldset + fieldset { margin-top: 4px; }
.multi-check { display: flex; gap: 8px; flex-wrap: wrap; }
.multi-check button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 13px; font-size: 13.5px;
}
.multi-check button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 详情 ---------- */
.kv { display: grid; grid-template-columns: 108px 1fr; row-gap: 9px; column-gap: 14px; font-size: 14.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; word-break: break-word; }
.section-title { font-size: 16px; font-weight: 700; margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
.progress-line { display: flex; gap: 0; flex-wrap: wrap; margin: 6px 0; }
.progress-line .step {
  padding: 5px 12px; font-size: 13px; background: var(--panel-2); color: var(--ink-2);
  border: 1px solid var(--line); margin: 0 -1px 6px 0;
}
.progress-line .step:first-child { border-radius: 9px 0 0 9px; }
.progress-line .step:last-child { border-radius: 0 9px 9px 0; }
.progress-line .step.sel { background: #e3ecfa; color: var(--brand-2); font-weight: 600; }
.progress-line .step.now { background: var(--brand); color: #fff; font-weight: 600; }

/* ---------- 表格/统计 ---------- */
table.stat { width: 100%; border-collapse: collapse; font-size: 14px; }
table.stat th, table.stat td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.stat td.num, table.stat th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 13.5px; }
.bar-row .bar-name { width: 92px; flex: 0 0 auto; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { flex: 1; background: var(--panel-2); height: 10px; border-radius: 5px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: var(--brand-2); border-radius: 5px; }
.bar-row .bar-val { width: 110px; text-align: right; flex: 0 0 auto; }
.big-num { font-size: 26px; font-weight: 700; }
.stat-label { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 工具 ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tool-tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 14px; text-align: center; color: var(--ink); display: block;
}
.tool-tile:hover { border-color: var(--brand-2); }
.tool-tile .t-ico { font-size: 26px; }
.tool-tile .t-name { font-weight: 600; margin-top: 7px; }
.tool-tile .t-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.result-box { background: var(--panel-2); border-radius: 12px; padding: 14px 16px; }
.disclaimer { font-size: 12.5px; color: var(--warn); margin-top: 12px; }

/* ---------- 文书预览 ---------- */
.doc-viewer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.doc-viewer .dv-head { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc-viewer iframe { width: 100%; height: 72vh; border: 0; display: block; }
.doc-viewer .dv-body { max-height: 72vh; overflow: auto; padding: 8px; }
.doc-viewer img.preview { max-width: 100%; display: block; margin: 0 auto; }
.docx-wrap { background: #ececec; padding: 18px 8px; }
@media (prefers-color-scheme: dark) { .docx-wrap { background: #2a2f38; } }

/* ---------- 弹窗/抽屉 ---------- */
.modal-mask, .sheet-mask {
  position: fixed; inset: 0; background: rgba(10, 18, 30, .45); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  background: var(--panel); border-radius: 16px; max-width: 560px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 20px 22px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 12px; font-size: 17px; }
.sheet-mask { align-items: flex-end; padding: 0; }
.sheet {
  background: var(--panel); width: 100%; border-radius: 18px 18px 0 0; padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet-item { display: flex; gap: 12px; align-items: center; padding: 13px 8px; color: var(--ink); font-size: 16px; border-bottom: 1px solid var(--line); }
.sheet-cancel { margin-top: 10px; border: 0; background: var(--panel-2); border-radius: 12px; padding: 12px; font-size: 15.5px; }

#lw-toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(16px);
  background: rgba(20, 30, 45, .92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 88vw; text-align: center;
}
#lw-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .cal-dow { text-align: center; font-size: 12px; color: var(--ink-3); padding: 4px 0; }
.cal-cell {
  min-height: 74px; border: 1px solid var(--line); border-radius: 10px; padding: 5px 6px;
  background: var(--panel); font-size: 12.5px; overflow: hidden;
}
.cal-cell.dim { opacity: .38; }
.cal-cell.today { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.cal-cell .cal-d { font-weight: 600; font-size: 13px; }
.cal-ev { display: block; border-radius: 5px; padding: 1px 5px; margin-top: 3px; font-size: 11.5px;
  background: #e3ecfa; color: var(--brand-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.hearing { background: #f7ecd2; color: #8a6408; }
.cal-ev.overdue { background: #fbe7e3; color: var(--danger); }
.cal-ev.done { opacity: .45; text-decoration: line-through; }

/* ---------- 手机端 ---------- */
@media (max-width: 860px) {
  #sidebar { display: none; }
  #topbar {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
  }
  .top-search { flex: 1; }
  #content { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  #tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 7px 0 6px; font-size: 11.5px; color: var(--ink-2); background: none; border: 0;
  }
  .tab-item.active { color: var(--brand-2); font-weight: 700; }
  .tab-ico { font-size: 19px; line-height: 1.15; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .frow, .frow.c3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 92px 1fr; }
  .cal-cell { min-height: 56px; }
  .page-title { font-size: 20px; }
  #lw-toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
