/* 平安国际 业务管理系统 —— 样式（原生 CSS，无框架）。颜色、间距、圆角统一用下面的变量 */
:root {
  --font: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --bg: #F4F5F7;
  --surface: #fff;
  --surface-2: #F8F9FB;
  --hover: #F2F5F9;
  --ink: #1B2430;
  --ink-2: #3E434A;
  --muted: #5A6270;
  --muted-2: #8A909A;
  --line: #E3E5E8;
  --line-soft: #EEF0F2;
  --input: #C9CDD3;
  --primary: #1C4C80;
  --primary-dark: #12355C;
  --primary-soft: #E6EEF8;
  --ok: #1F6B3A;
  --ok-soft: #E3F2E8;
  --warn: #8A4310;
  --warn-soft: #FBE9D9;
  --warn-bg: #FFF8F1;
  --warn-line: #E8C9A8;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --nav: #1B2430;
  --nav-on: #2F3B4C;
  --nav-text: #DDE1E7;
  --nav-muted: #AEB5BF;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-3: 0 12px 40px rgba(27, 36, 48, .25);
  --ring: 0 0 0 3px rgba(28, 76, 128, .2);
  --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); font-family: var(--font); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); } a:hover { color: var(--primary-dark); }
button, input, select, textarea { font-family: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: .2px; }
h2 { margin: 0; font-size: 18px; font-weight: 700; }
h3 { margin: 0; font-size: 16px; font-weight: 700; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* 启动 / 旧浏览器提示 */
.boot-msg { padding: 48px 16px; text-align: center; color: var(--muted); }
#old-browser-msg { display: none; margin: 24px; padding: 16px; border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn); border-radius: var(--r-md); }
.old-browser #old-browser-msg { display: block; }
.old-browser #root { display: none; }

/* ========== 框架：分组侧栏 + 顶栏 + 内容 ========== */
.app { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px 24px; z-index: 60; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand b { display: block; font-size: 16px; font-weight: 700; letter-spacing: .5px; color: var(--ink); }
.brand span { display: block; font-size: 12px; color: var(--muted-2); }
.logo { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.side-nav { display: flex; flex-direction: column; gap: 14px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-title { font-size: 12px; font-weight: 600; color: var(--muted-2); padding: 4px 10px; letter-spacing: .5px; }
.side-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink-2); font-size: 14px; text-align: left; cursor: pointer; transition: background .12s, color .12s; }
.side-item .ico { color: var(--muted-2); }
.side-item.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-item.on .ico { color: var(--primary); }
.side-item span:not(.badge) { flex: 1; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.badge[hidden] { display: none; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 28px; background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: saturate(1.5) blur(8px); backdrop-filter: saturate(1.5) blur(8px); }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .cur { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--line); }
.gsearch { position: relative; display: flex; align-items: center; width: min(320px, 34vw); }
.gsearch > .ico { position: absolute; left: 10px; color: var(--muted-2); pointer-events: none; }
.gsearch input { width: 100%; min-height: 36px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; color: var(--ink); }
.gsearch input:focus { background: #fff; border-color: var(--primary); box-shadow: var(--ring); }
.gsr { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-3); padding: 6px; max-height: 60vh; overflow-y: auto; z-index: 70; }
.gsr-title { font-size: 12px; color: var(--muted-2); padding: 6px 8px 2px; }
.gsr-empty { padding: 12px; color: var(--muted); font-size: 14px; }
.gsr button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 8px; border: 0; background: none; border-radius: var(--r-sm); text-align: left; cursor: pointer; font-size: 14px; color: var(--ink); }
.gsr button span { font-size: 12px; color: var(--muted); }
.gsr button:hover, .gsr button:focus-visible { background: var(--hover); }
.topbar select.ent { width: auto; min-height: 36px; font-size: 14px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink-2); cursor: pointer; }
.only-mobile { display: none; }

/* 下拉菜单（<details>） */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px; max-width: calc(100vw - 16px); background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-3); padding: 6px; z-index: 80; display: flex; flex-direction: column; }
.menu-pop button, .menu-pop .menu-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: var(--r-sm); font-size: 14px; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; }
.menu-pop button:hover, .menu-pop .menu-link:hover { background: var(--hover); }
.umenu > summary { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--r-md); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.uname { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--ink); }
.uname small { font-weight: 400; color: var(--muted); font-size: 12px; }

#page { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 20px; max-width: 1440px; width: 100%; transition: opacity .15s; outline: none; }
#page[aria-busy="true"] { opacity: .55; pointer-events: none; }
body.busy { cursor: progress; }

/* 页头 */
.ph { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.ph-text { min-width: 0; flex: 1 1 360px; }
.ph h1 { font-size: 24px; font-weight: 700; line-height: 1.3; }
.ph-desc { margin: 6px 0 0; font-size: 14px; color: var(--muted); max-width: 820px; }
.ph-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ph-actions .inp { width: auto; }

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: -4px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab .badge { background: var(--line-soft); color: var(--ink-2); }
.tab-body { display: flex; flex-direction: column; gap: 20px; }

/* 案件摘要 */
.hero { display: flex; flex-direction: column; gap: 12px; }
.hero .back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-size: 13px; color: var(--muted); padding: 0; }
.hero-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.hero-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hero-title h1 { font-size: 26px; font-weight: 700; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 0; font-size: 14px; color: var(--muted); }
.hero-meta span { padding-right: 12px; margin-right: 12px; border-right: 1px solid var(--line); }
.hero-meta span:last-child { border-right: 0; }
.notice { padding: 10px 14px; border-radius: var(--r-md); font-size: 14px; background: var(--primary-soft); color: var(--primary-dark); }
.notice.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }

/* 工具条（搜索 / 筛选） */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.toolbar .sub { margin-left: auto; }
.toolbar select.inp { width: auto; }
.search-field { position: relative; display: flex; align-items: center; flex: 1 1 220px; max-width: 360px; }
.search-field .ico { position: absolute; left: 10px; color: var(--muted-2); pointer-events: none; }
.search-field input { width: 100%; min-height: 36px; padding: 0 12px 0 34px; border: 1px solid var(--input); border-radius: var(--r-md); font-size: 14px; background: #fff; color: var(--ink); }
.search-field input:focus { border-color: var(--primary); box-shadow: var(--ring); }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }

/* 指标卡 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 14px; }
.kpis.compact { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 10px; }
button.kpi { text-align: left; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { margin-top: 6px; font-size: 26px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--muted); }
.kpis.compact .kpi { padding: 14px 16px; box-shadow: none; background: var(--surface-2); border-color: var(--line-soft); }
.kpis.compact .kpi-value { font-size: 18px; margin-top: 4px; }
.kpi-note { margin-top: 4px; font-size: 12px; color: var(--muted); }
.kpi.dark .kpi-label, .kpi.dark .kpi-note { color: var(--nav-muted); }

/* 区块 */
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-head .count { display: inline-block; margin-left: 4px; padding: 0 8px; border-radius: 10px; background: var(--line-soft); color: var(--muted); font-size: 12px; font-weight: 600; vertical-align: 2px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card-desc { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.card-foot { padding-top: 4px; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 20px 12px; }
.card.flush > .card-desc { padding: 0 20px 12px; margin: 0; }
.card.flush > .table-wrap { border: 0; border-radius: 0; border-top: 1px solid var(--line-soft); }
.card.flush > .empty-box { margin: 16px 20px 20px; }
.card.flush > .pager { padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.card.report h2 { font-size: 15px; }
.card.report .card-desc { flex: 1; margin: 0; }

/* 列表行 */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.list > .list-row:first-child { border-top: 0; padding-top: 4px; }
.list-row.clickable { cursor: pointer; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: var(--r-md); }
.list-main { min-width: 0; flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; }
.list-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.list-title.muted { color: var(--muted); font-weight: 500; }
.list-sub { font-size: 13px; color: var(--muted); }
.list-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
tr.clickable { cursor: pointer; }
dl.info { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 10px; }
dl.info > div { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 10px 12px; min-width: 0; }
dl.info > div.alert { background: var(--warn-bg); border-color: var(--warn-line); }
dl.info dt { font-size: 12px; color: var(--muted); }
dl.info dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.strong { font-weight: 700; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line-soft); display: flex; flex-direction: column; gap: 14px; }
.timeline li { position: relative; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); }
.tl-meta { font-size: 12px; color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.inline-form select { flex: 1 1 200px; width: auto; }
.empty-box { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-box p { margin: 0; }
details.collapse > summary { list-style: none; cursor: pointer; }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse:not([open]) { padding: 0; border: 0; background: none; box-shadow: none; }
details.collapse[open] > summary { margin-bottom: 8px; }
details.preview { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 8px 12px; margin-bottom: 6px; }
details.preview summary { cursor: pointer; font-size: 14px; }
details.preview pre { white-space: pre-wrap; font-size: 13px; margin: 8px 0 0; font-family: inherit; color: var(--ink-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); }

/* 流程节点 */
ol.steps { list-style: none; margin: 0; padding: 0; position: relative; }
ol.steps .step { position: relative; padding: 6px 0 14px; }
ol.steps .step:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 36px; bottom: 0; width: 2px; background: var(--line-soft); }
ol.steps .step.done:not(:last-child)::after { background: var(--ok); opacity: .35; }

.sub { font-size: 13px; color: var(--muted); }
.col { display: flex; flex-direction: column; gap: 20px; }
.col-24 { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row.end { align-items: flex-end; }
.row.g8 { gap: 8px; }
.row.acts { gap: 8px; justify-content: flex-end; flex-wrap: nowrap; }
.between { justify-content: space-between; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 20px; align-items: start; }
.grid-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; font-size: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px; }
.grid-reports { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }

/* 卡片 / 指标 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-1); min-width: 0; }
.card.tight { gap: 8px; }
.card.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.card h3 { margin-top: 4px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-1); min-width: 0; }
.kpi .v { font-size: 32px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .v.sm { font-size: 28px; }
.kpi .v.xs { font-size: 22px; }
.kpi.dark { background: var(--nav); color: #fff; border-color: var(--nav); }
.kpi.dark .sub { color: var(--nav-muted); }
.kpi.warn { background: var(--warn-bg); border-color: var(--warn-line); padding: 16px; }
.kpi.warn .sub { color: var(--warn); }
.kpi.pad16 { padding: 16px; }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); }

.line-item { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.line-item.p12 { padding: 12px 0; }
.line-item .stack { display: flex; flex-direction: column; min-width: 0; }
.tile { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 12px; min-width: 0; }
.tile.white { background: #fff; border-color: var(--line); }
.tile.alert { background: #fff; border-color: var(--warn-line); }
.tile .sub { font-size: 13px; }

/* 按钮 */
.btn { min-height: var(--tap); padding: 0 16px; border: 1px solid var(--input); border-radius: var(--r-md); background: #fff; color: var(--ink); font-size: 14px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; transition: background .15s, border-color .15s, color .15s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
a.btn { text-decoration: none; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.danger { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn.lg { padding: 0 20px; font-size: 15px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); border-color: currentColor transparent; border-top-color: #fff; border-bottom-color: #fff; animation: spin .8s linear infinite; }
.btn:not(.primary):not(.danger)[aria-busy="true"]::after { border-top-color: var(--muted); border-bottom-color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font-size: 13px; padding: 4px 0; text-decoration: underline; text-underline-offset: 2px; }

.pill { min-height: var(--tap); padding: 0 16px; border-radius: 999px; font-size: 14px; cursor: pointer; background: #fff; color: var(--ink); border: 1px solid var(--input); white-space: nowrap; }
.pill.on { background: var(--nav); color: #fff; border-color: var(--nav); font-weight: 700; }

/* 表单 */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); min-width: 0; }
.field input, .field select, .field textarea, select.inp, input.inp {
  min-height: var(--tap); padding: 0 12px; border: 1px solid var(--input); border-radius: var(--r-md); background: #fff; font-size: 15px; color: var(--ink); font-weight: 400; width: 100%; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.page-head select.inp, .row select.inp, .row input.inp { width: auto; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { border-color: var(--primary); box-shadow: var(--ring); }
.field input:disabled, .field select:disabled { background: var(--surface-2); color: var(--muted); }
.field textarea { min-height: 80px; padding: 8px 12px; resize: vertical; }
.field input[type=file] { padding-top: 9px; }
.field select, select.inp { -webkit-appearance: none; appearance: none; padding-right: 32px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235A6270' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center; }
/* iOS 日期时间框：空值时会塌成很窄，统一高度和对齐（日期 / 月份已改用系统自带面板，见 app.js Picker） */
.field input[type=datetime-local] {
  -webkit-appearance: none; appearance: none; display: block; line-height: 42px;
}
input::-webkit-date-and-time-value { text-align: left; }
select.inp.sm, input.inp.sm { min-height: 36px; font-size: 14px; padding: 0 8px; }
select.inp.sm { padding-right: 28px; background-position: right 8px center; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); min-height: var(--tap); }
.check input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }

/* 状态标签：固定高度 + 前置圆点 */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle;
  background: var(--line-soft); color: var(--ink-2); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; flex: none; }
.chip.green { background: var(--ok-soft); color: var(--ok); }
.chip.blue { background: var(--primary-soft); color: var(--primary); }
.chip.orange { background: var(--warn-soft); color: var(--warn); }
.chip.red { background: var(--danger-soft); color: var(--danger); }
.chip.black { background: var(--ink-2); color: #fff; }

/* 表格：可横向滚动，左右滚动有阴影提示 */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left / 24px 100% no-repeat local,
              linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right / 24px 100% no-repeat local,
              radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .12), transparent) left / 10px 100% no-repeat scroll,
              radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .12), transparent) right / 10px 100% no-repeat scroll; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); padding: 10px 10px; font-weight: 500; font-size: 13px; white-space: nowrap; background: var(--surface-2); border-bottom: 1px solid var(--line); }
table.t td { padding: 10px 10px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
table.t tbody tr:first-child td { border-top: 0; }
table.t td.b { font-weight: 500; }
table.t .r { text-align: right; font-variant-numeric: tabular-nums; }
table.t td.strong { font-weight: 700; }
.sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 流程节点 */
.dot { flex: none; width: 28px; height: 28px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 1px solid var(--input); background: #fff; color: var(--muted); }
.dot.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.dot.now { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.dot.stuck { background: var(--warn); border-color: var(--warn); color: #fff; }
.dot.plain { color: var(--ink-2); }
.step { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.step .body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.step .name.now { font-weight: 700; }
.step .name.done { color: var(--ink-2); }
.step .name.todo { color: var(--muted); }

/* 空状态 / 日志 */
.empty { color: var(--muted); font-size: 14px; }
.card > .empty:only-child, .card > h2 + .empty, .card > .row + .empty { padding: 16px; text-align: center; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--r-md); }
.empty.inline { padding: 8px 0; text-align: left; background: none; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; }
.log { font-size: 13px; color: var(--muted); padding: 6px 0; border-top: 1px solid var(--line-soft); }
.log b { color: var(--ink); font-weight: 500; }
.scroll-60 { max-height: 60vh; overflow: auto; }
.scroll-40 { max-height: 40vh; overflow: auto; }

/* 对话框：标题和按钮固定，中间内容滚动 */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: hidden; box-shadow: var(--shadow-3); color: var(--ink); }
dialog::backdrop { background: rgba(27, 36, 48, .45); }
dialog[open] { display: flex; flex-direction: column; }
dialog form { padding: 0; display: flex; flex-direction: column; min-height: 0; max-height: inherit; flex: 1; }
dialog form > h2 { padding: 20px 24px 12px; flex: none; }
dialog .dlg-body { padding: 4px 24px 16px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 16px; min-height: 0; flex: 1; }
dialog .actions { display: flex; gap: 12px; justify-content: flex-end; flex: none; padding: 12px 24px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); background: #fff; }
/* 不支持 <dialog> 的浏览器（app.js 里的兜底）：固定定位 + 遮罩 */
dialog.fallback { position: fixed; z-index: 900; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; }
dialog.fallback:not([open]) { display: none; }
body.dlg-open::after { content: ""; position: fixed; inset: 0; background: rgba(27, 36, 48, .45); z-index: 800; }
body.dlg-open { overflow: hidden; }

#toast { position: fixed; left: 50%; bottom: 32px; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--nav); color: #fff; padding: 12px 20px; border-radius: var(--r-md); font-size: 14px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 1000; max-width: calc(100vw - 32px); box-shadow: var(--shadow-3); }
#toast.show { opacity: 1; }
#toast.err { background: var(--warn); }

/* 登录页 */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #E3ECF7, transparent), var(--bg); }
.login { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 8px 32px rgba(16, 24, 40, .08); }
.login .brand b { display: block; font-size: 24px; letter-spacing: 1px; color: var(--primary-dark); }
/* 公司标志：登录页用横版全称，侧栏用地球图标 */
.brand-full { flex-direction: column; align-items: center; gap: 6px; padding: 0 0 4px; }
.brand-full img { display: block; width: min(300px, 100%); height: auto; }
.brand-full .sub { font-size: 13px; color: var(--muted-2); letter-spacing: 2px; }
.logo-mark { flex: none; width: 40px; height: 37px; }

/* 有鼠标的设备才有悬停效果（避免手机点击后悬停样式“粘住”） */
@media (hover: hover) {
  .btn:hover:not(:disabled) { border-color: var(--muted); }
  .btn.primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
  .side-item:hover:not(.on) { background: var(--hover); color: var(--ink); }
  .tab:hover:not(.on) { color: var(--ink); }
  button.kpi:hover { border-color: var(--primary); box-shadow: var(--ring); }
  tr.clickable:hover td, .list-row.clickable:hover { background: var(--hover); }
  .umenu > summary:hover { background: var(--hover); }
  .pill:hover:not(.on) { border-color: var(--muted); }
  table.t tbody tr:hover td { background: var(--hover); }
  .link-btn:hover { color: var(--primary-dark); }
}

/* 平板 / 手机：导航变成顶部横向滚动条 */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .uname { display: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-3); padding-top: max(16px, env(safe-area-inset-top)); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(27, 36, 48, .4); z-index: 55; }
  body.nav-open { overflow: hidden; }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); gap: 8px; }
  .gsearch { width: auto; flex: 1 1 140px; }
  .crumbs { display: none; }
  #page { padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); gap: 16px; }
}
@media (max-width: 760px) {
  h1 { font-size: 22px; }
  .field input, .field select, .field textarea, .inp, .inp.sm { font-size: 16px; } /* 小于 16px 时 iOS 聚焦会自动放大页面 */
  .btn { white-space: normal; max-width: 100%; text-align: center; line-height: 1.3; padding-top: 6px; padding-bottom: 6px; }
  .btn.sm { min-height: 40px; }
  .card, .kpi { padding: 16px; }
  .kpi .v { font-size: 26px; } .kpi .v.sm { font-size: 24px; } .kpi .v.xs { font-size: 20px; }
  .pills-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .pills-scroll::-webkit-scrollbar { display: none; }
  .pill { flex: none; }
  .link-btn { padding: 10px 2px; }
  .gsearch input, .search-field input { font-size: 16px; }
  .ph h1 { font-size: 21px; }
  .hero-title h1 { font-size: 22px; }
  .hero-meta span { padding-right: 8px; margin-right: 8px; }
  .toolbar { padding: 12px; }
  .toolbar .sub { margin-left: 0; }
  .search-field { max-width: none; }
  .card.flush > .card-head { padding: 14px 16px 10px; }
  .card.flush > .card-desc { padding: 0 16px 10px; }
  .topbar select.ent { max-width: 92px; }
  /* 表格首列固定，横向滑动时始终能看到是哪一行 */
  table.t th:first-child, table.t td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--line-soft); }
  table.t th:first-child { background: var(--surface-2); }
  .scroll-60, .scroll-40 { max-height: none; }
}
/* 手机：对话框从底部弹出、按钮占满一行 */
@media (max-width: 560px) {
  dialog:not(.fallback) { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92vh; max-height: 92dvh; }
  dialog.fallback { width: calc(100vw - 16px); }
  dialog form > h2 { padding: 16px 16px 8px; font-size: 17px; }
  dialog .dlg-body { padding: 4px 16px 16px; }
  dialog .actions { padding-left: 16px; padding-right: 16px; flex-direction: column-reverse; gap: 8px; }
  dialog .actions .btn { width: 100%; }
  .login { padding: 24px; }
  .row.acts { flex-wrap: wrap; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
}
@media print {
  .side, .topbar, .no-print, #toast { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  main { padding: 0; }
  .card, .kpi { box-shadow: none; }
}

/* 表格：单元格默认不换行（列多时横向滚动），长文字列用 .wrap */
table.t td { white-space: nowrap; }
table.t td.wrap { white-space: normal; min-width: 200px; max-width: 380px; }
.card h2 { font-size: 16px; }
.card > .row.between:first-child { margin-bottom: 2px; }
@media (max-width: 760px) {
  .kpis, .kpis.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 20px; }
  .kpis.compact .kpi-value { font-size: 16px; }
  .ph-actions { width: 100%; }
  .topbar .uname, .topbar .umenu > summary > .ico { display: none; }
}
.brand .logo { display: inline-flex; font-size: 16px; color: #fff; }

/* ========== 语言切换 ========== */
.login-wrap { position: relative; }
.login-lang { position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px; }
.login-lang select { width: auto; }
.menu-lang { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px 0 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.menu-pop .menu-lang button { justify-content: center; padding: 7px 6px; font-size: 13px; }
.menu-pop .menu-lang button.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ========== 阿拉伯语：从右到左 ========== */
:root[lang="ar"] { --font: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", system-ui, sans-serif; }
:root[lang="ar"] body { line-height: 1.6; }
[dir="rtl"] .side { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .side-item, [dir="rtl"] .gsr button, [dir="rtl"] .menu-pop button, [dir="rtl"] .menu-pop .menu-link, [dir="rtl"] button.kpi { text-align: right; }
[dir="rtl"] .nav-item .badge { margin-left: 0; }
[dir="rtl"] .gsearch > .ico, [dir="rtl"] .search-field .ico { left: auto; right: 10px; }
[dir="rtl"] .gsearch input, [dir="rtl"] .search-field input { padding: 0 34px 0 12px; }
[dir="rtl"] .menu-pop, [dir="rtl"] .menu-pop.right { right: auto; left: 0; }
[dir="rtl"] .login-lang { right: auto; left: 16px; }
[dir="rtl"] table.t th { text-align: right; }
[dir="rtl"] table.t .r { text-align: left; }
[dir="rtl"] .toolbar .sub { margin-left: 0; margin-right: auto; }
[dir="rtl"] .card-head .count { margin-left: 0; margin-right: 4px; }
[dir="rtl"] .hero-meta span { padding-right: 0; margin-right: 0; border-right: 0; padding-left: 12px; margin-left: 12px; border-left: 1px solid var(--line); }
[dir="rtl"] .hero-meta span:last-child { border-left: 0; }
[dir="rtl"] .hero .back .ico { transform: scaleX(-1); }
[dir="rtl"] .timeline { padding: 0 14px 0 0; border-left: 0; border-right: 2px solid var(--line-soft); }
[dir="rtl"] .timeline li::before { left: auto; right: -20px; }
[dir="rtl"] ol.steps .step:not(:last-child)::after { left: auto; right: 13px; }
[dir="rtl"] .list-row.clickable { margin: 0 -10px; }
[dir="rtl"] .card.warn, [dir="rtl"] .notice { text-align: right; }
[dir="rtl"] dialog .actions { justify-content: flex-start; }
[dir="rtl"] .field select, [dir="rtl"] select.inp { padding-right: 12px; padding-left: 32px; background-position: left 12px center; }
[dir="rtl"] select.inp.sm { padding-right: 8px; padding-left: 28px; background-position: left 8px center; }
@media (max-width: 900px) {
  [dir="rtl"] .side { left: auto; right: 0; transform: translateX(100%); }
  [dir="rtl"] body.nav-open .side, body.nav-open[dir="rtl"] .side { transform: none; }
}
@media (max-width: 760px) {
  [dir="rtl"] table.t th:first-child, [dir="rtl"] table.t td:first-child { left: auto; right: 0; box-shadow: -1px 0 0 var(--line-soft); }
}

/* 日期 / 月份选择面板（替代浏览器自带日历，跟随界面语言） */
input[data-date], input[data-month] { cursor: pointer; padding-inline-end: 36px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235A6270' stroke-width='1.5'%3E%3Crect x='2' y='3' width='12' height='11' rx='1.5'/%3E%3Cpath d='M2 7h12M5 1.5v3M11 1.5v3'/%3E%3C/svg%3E") no-repeat right 12px center; }
input.inp.sm[data-month] { width: 130px; background-position: right 8px center; padding-inline-end: 30px; }
[dir="rtl"] input[data-date], [dir="rtl"] input[data-month] { background-position: left 12px center; }
[dir="rtl"] input.inp.sm[data-month] { background-position: left 8px center; }
.picker-pop { position: fixed; z-index: 1000; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3); padding: 12px; width: 280px; max-width: calc(100vw - 16px); font-size: 14px; color: var(--ink); }
.picker-pop .pk-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.picker-pop .pk-head b { flex: 1; text-align: center; font-size: 15px; }
.picker-pop .pk-head select { flex: 1; min-width: 0; }
.picker-pop .pk-head .icon-btn { width: 32px; height: 32px; min-height: 32px; font-size: 18px; line-height: 1; flex: none; }
[dir="rtl"] .picker-pop .pk-head .icon-btn { transform: scaleX(-1); }
.picker-pop .pk-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.picker-pop .pk-week, .picker-pop .pk-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.picker-pop .pk-week span { font-size: 12px; color: var(--muted); padding: 4px 0; }
.picker-pop .pk-months button, .picker-pop .pk-days button { border: 0; background: none; border-radius: var(--r-md); color: var(--ink);
  font: inherit; cursor: pointer; padding: 0; height: 36px; }
.picker-pop .pk-months button { height: 40px; }
.picker-pop .pk-months button:hover, .picker-pop .pk-days button:hover { background: var(--hover); }
.picker-pop button.today { box-shadow: inset 0 0 0 1px var(--primary); color: var(--primary); }
.picker-pop button.on, .picker-pop button.on:hover { background: var(--primary); color: #fff; }
.picker-pop .pk-days button:disabled { color: var(--muted-2); cursor: default; background: none; opacity: .5; }
.picker-pop button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.picker-pop .pk-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.picker-pop .pk-foot:has(> :only-child) { justify-content: flex-end; }

/* 手机上菜单项太长时换行，不撑出屏幕 */
@media (max-width: 600px) { .menu-pop button, .menu-pop .menu-link { white-space: normal; } }
