:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  --navy: #10213f;
  --navy-hover: #1b3157;
  --accent: #1769e0;
  --accent-hover: #1258bd;
  --accent-soft: #eaf2ff;
  --green: #16845b;
  --green-soft: #e8f6ef;
  --red: #c83b4b;
  --red-soft: #fdecef;
  --amber: #916600;
  --amber-soft: #fff5db;
  --ink: #17233a;
  --muted: #66758c;
  --line: #dce3ed;
  --line-strong: #c5d0df;
  --surface: #ffffff;
  --surface-subtle: #f7f9fc;
  --canvas: #f1f4f8;
  --panel-radius: 12px;
  --control-radius: 7px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid rgb(23 105 224 / .28); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* 登录 */
.login-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr); background: var(--surface); }
.login-brand { min-height: 100dvh; padding: clamp(44px, 7vw, 108px); display: flex; flex-direction: column; justify-content: space-between; background: var(--navy); color: #f7f9fd; }
.login-brand-copy { margin: auto 0; }
.brand-mark { margin: 0 0 20px; color: #9eb8e0; font-size: 12px; font-weight: 800; letter-spacing: .17em; }
.login-brand h1 { max-width: 760px; margin: 0; font-size: clamp(42px, 5vw, 72px); line-height: 1.08; letter-spacing: -.04em; }
.login-brand-copy > p:last-child { max-width: 560px; margin: 26px 0 0; color: #c5d2e7; font-size: 18px; line-height: 1.7; }
.login-proof { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 56px 0 0; border-top: 1px solid rgb(255 255 255 / .16); }
.login-proof div { padding: 20px 20px 0 0; }
.login-proof dt { color: #9eb0cc; font-size: 12px; }
.login-proof dd { margin: 7px 0 0; font-size: 18px; font-weight: 700; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(100%, 430px); }
.login-card h2 { margin: 0; font-size: 32px; letter-spacing: -.025em; }
.login-card > .muted { margin: 9px 0 0; }
.section-kicker { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.stack-form { display: grid; gap: 18px; margin-top: 30px; }
label { display: grid; gap: 8px; color: #31415b; font-size: 14px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); padding: 10px 12px; transition: border-color .14s ease, box-shadow .14s ease; }
input:hover, select:hover, textarea:hover { border-color: #91a2b9; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(23 105 224 / .11); outline: none; }
textarea { resize: vertical; line-height: 1.55; }
.form-error { min-height: 20px; margin: 0; color: var(--red); font-size: 13px; }

/* 应用外壳 */
.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; z-index: 30; height: 100dvh; display: flex; flex-direction: column; background: var(--navy); color: #eaf0fa; }
.sidebar-brand { height: 78px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid rgb(255 255 255 / .1); }
.brand-symbol { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: #ffffff; font-size: 13px; font-weight: 800; }
.sidebar-brand div { display: grid; gap: 2px; }
.sidebar-brand strong { font-size: 16px; }
.sidebar-brand span:last-child { color: #9eb0cc; font-size: 11px; }
.side-nav { flex: 1; overflow-y: auto; padding: 17px 12px; }
.nav-group-label { margin: 18px 10px 7px; color: #8499b9; font-size: 11px; font-weight: 700; }
.nav-group-label:first-child { margin-top: 0; }
.nav-item { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 0; border-radius: 7px; background: transparent; padding: 0 12px; color: #cbd6e7; text-align: left; font-weight: 650; }
.nav-item:hover { background: var(--navy-hover); color: #ffffff; }
.nav-item.active { background: #244573; color: #ffffff; }
.nav-badge { min-width: 22px; height: 20px; display: inline-grid; place-items: center; border-radius: 10px; background: rgb(255 255 255 / .13); padding: 0 6px; font-size: 11px; }
.sidebar-footer { padding: 14px 14px 18px; border-top: 1px solid rgb(255 255 255 / .1); }
.agent-state { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; padding: 9px 10px; color: #d2dced; }
.agent-state > span { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #e5a72d; }
.agent-state div { display: grid; gap: 2px; }
.agent-state strong { font-size: 12px; }
.agent-state small { color: #91a4c1; font-size: 10px; }
.sidebar-user { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; border-top: 1px solid rgb(255 255 255 / .1); padding: 14px 6px 0; }
.user-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #d9e7fa; color: #23476f; font-weight: 800; }
.user-box { min-width: 0; display: grid; gap: 2px; }
.user-box strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-box span { color: #91a4c1; font-size: 10px; }
.logout-button { border: 0; background: transparent; color: #9eb0cc; padding: 6px; font-size: 11px; }
.logout-button:hover { color: #ffffff; }
.sidebar-backdrop { display: none; }
.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 78px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / .96); padding: 13px clamp(20px, 2.6vw, 40px); }
.page-heading { min-width: 0; }
.page-heading h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.page-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.topbar-meta { margin-left: auto; color: var(--muted); font-size: 11px; }
.menu-button { display: none; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--surface); padding: 8px 10px; color: var(--ink); }
.page-container { width: min(100%, 1660px); margin: 0 auto; }
.page-section { padding: 28px clamp(20px, 2.6vw, 40px) 48px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.section-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.section-heading .muted { margin: 5px 0 0; font-size: 13px; }

/* 控件 */
.primary-button, .secondary-button, .text-button, .danger-button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--control-radius); padding: 8px 14px; font-weight: 700; white-space: nowrap; }
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: #ffffff; }
.primary-button:hover { background: var(--accent-hover); }
.secondary-button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: var(--accent); color: var(--accent); }
.text-button { border: 0; background: transparent; color: var(--accent); }
.danger-button { border: 1px solid #efb2b9; background: var(--surface); color: var(--red); }
.primary-button:active, .secondary-button:active, .text-button:active, .danger-button:active { transform: translateY(1px); }
.full-button { width: 100%; }

/* 我的工作 */
.workbench-page { max-width: 1440px; margin: 0 auto; }
.workbench-summary { min-height: 92px; display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: center; gap: 28px; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); padding: 18px 22px; }
.workbench-summary > div { display: flex; align-items: baseline; gap: 14px; }
.workbench-summary span { color: var(--muted); font-weight: 700; }
.workbench-summary strong { color: var(--accent); font-size: 35px; line-height: 1; }
.workbench-summary p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* 看板 */
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); }
.summary-card { position: relative; min-height: 104px; border: 0; border-right: 1px solid var(--line); background: var(--surface); padding: 18px 20px; text-align: left; color: inherit; }
.summary-card:last-child { border-right: 0; }
.summary-card:hover { background: var(--surface-subtle); }
.summary-card.active { box-shadow: inset 0 -3px 0 var(--accent); }
.summary-card.danger { background: #fffafb; }
.summary-label { display: block; color: #5f6c81; font-size: 12px; font-weight: 700; }
.summary-value { display: block; margin-top: 10px; font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.summary-action { position: absolute; right: 18px; bottom: 15px; color: #8a96a8; font-size: 10px; }
.summary-card.success .summary-value { color: var(--green); }
.summary-card.primary .summary-value { color: var(--accent); }
.summary-card.danger .summary-value { color: var(--red); }
.models-heading { margin-top: 30px; }
.model-tools { display: flex; align-items: center; gap: 8px; }
.model-tools select { min-width: 142px; }
.model-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); }
.model-card { min-width: 0; min-height: 135px; padding: 17px 18px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; color: var(--ink); }
.model-card:nth-child(4n) { border-right: 0; }
.model-card:hover { background: var(--surface-subtle); }
.model-card.active { box-shadow: inset 0 0 0 2px var(--accent); background: #fbfdff; }
.model-title { display: flex; align-items: start; justify-content: space-between; gap: 9px; }
.model-title strong { min-width: 0; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.model-title > span { flex: none; color: var(--muted); font-size: 11px; }
.model-rate { display: block; margin-top: 14px; color: var(--green); font-size: 24px; font-weight: 800; line-height: 1; }
.model-sub { display: flex; justify-content: space-between; gap: 10px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.ec-progress-track { position: relative; display: block; width: 100%; block-size: 8px; min-block-size: 8px; max-block-size: 8px; margin-top: 9px; overflow: hidden; border-radius: 4px; background: #e8edf4; contain: layout paint; }
.ec-progress-track::before { position: absolute; inset: 0 auto 0 0; width: var(--ec-progress, 0%); content: ""; border-radius: inherit; background: var(--green); }
.model-owner { display: block; margin-top: 10px; overflow: hidden; color: #607087; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.model-card.zero { opacity: .66; }

/* 任务列表 */
.task-panel { margin-top: 25px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); }
.task-toolbar { min-height: 70px; padding: 15px 18px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.task-toolbar h2 { margin: 0; font-size: 17px; }
.task-toolbar p { margin: 4px 0 0; font-size: 11px; }
.filters { display: grid; grid-template-columns: minmax(210px, 1.5fr) minmax(130px, .8fr) minmax(160px, 1fr); gap: 8px; width: min(100%, 640px); }
.compact-filters { grid-template-columns: minmax(250px, 1.5fr) minmax(145px, .8fr); max-width: 510px; }
.task-list { min-height: 150px; }
.task-row { border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row.overdue { background: #fffafb; }
.task-row summary { padding: 15px 18px; display: grid; grid-template-columns: minmax(260px, 2fr) minmax(140px, 1fr) minmax(110px, .75fr) minmax(110px, .75fr) auto; gap: 16px; align-items: center; cursor: pointer; list-style: none; }
.task-row summary::-webkit-details-marker { display: none; }
.task-row summary:hover { background: var(--surface-subtle); }
.task-id { display: block; font-size: 14px; }
.task-title { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.task-category { display: inline-flex; margin-top: 7px; border-radius: 999px; background: var(--accent-soft); padding: 3px 8px; color: #315f9f; font-size: 10px; font-weight: 700; }
.cell-label { display: block; color: #8a96a8; font-size: 10px; }
.cell-value { display: block; margin-top: 3px; font-size: 12px; font-weight: 650; }
.status { display: inline-flex; margin-top: 3px; border-radius: 12px; padding: 3px 8px; background: #edf1f6; color: #526074; font-size: 11px; font-weight: 700; }
.status.completed { background: var(--green-soft); color: var(--green); }
.status.emailFailed, .status.overdue, .status.returned { background: var(--red-soft); color: var(--red); }
.status.emailPending { background: var(--amber-soft); color: var(--amber); }
.expand-label { color: var(--accent); font-size: 12px; font-weight: 700; }
.task-detail { padding: 16px 18px 18px; display: grid; grid-template-columns: 1fr auto; gap: 22px; background: var(--surface-subtle); }
.mini-progress { max-width: 470px; }
.mini-progress p { margin: 8px 0 0; font-size: 11px; }
.task-actions { display: flex; align-items: center; gap: 8px; }
.empty-state { padding: 44px 22px; text-align: center; color: var(--muted); }
.empty-state p { margin: 7px 0 0; }
.skeleton { min-height: 104px; background: linear-gradient(90deg, #e9eef5 25%, #f6f8fb 50%, #e9eef5 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* 表单 */
.form-page { max-width: 1080px; margin: 0 auto; }
.create-form { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); padding: 24px; }
.wide { grid-column: 1 / -1; }
.workflow-category-summary { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: -8px; border: 1px solid #cbdcf5; border-radius: var(--control-radius); background: #f7faff; padding: 14px 16px; }
.workflow-category-summary > div { min-width: 0; display: grid; gap: 4px; }
.workflow-category-summary strong { font-size: 13px; }
.workflow-category-summary span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.workflow-category-summary dl { display: flex; flex: none; gap: 26px; margin: 0; }
.workflow-category-summary dl div { display: grid; gap: 3px; }
.workflow-category-summary dt { color: var(--muted); font-size: 9px; }
.workflow-category-summary dd { margin: 0; font-size: 11px; font-weight: 750; }
.workflow-category-summary.warning { align-items: start; flex-direction: column; gap: 4px; border-color: #ead8a5; background: var(--amber-soft); color: #72520b; }
fieldset { margin: 0; border: 1px solid var(--line); border-radius: var(--control-radius); padding: 17px; }
legend { padding: 0 6px; color: #31415b; font-weight: 700; }
.model-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.model-check { display: flex; align-items: center; gap: 8px; min-width: 0; border: 1px solid var(--line); border-radius: var(--control-radius); padding: 8px 9px; font-weight: 500; }
.model-check:hover { border-color: #aebfe0; }
.model-check input { width: 16px; margin: 0; }
.model-check span { min-width: 0; overflow-wrap: anywhere; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* 后台管理 */
.settings-page { max-width: 1440px; margin: 0 auto; }
.admin-status-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); }
.admin-status-strip div { min-height: 76px; display: grid; align-content: center; gap: 5px; border-right: 1px solid var(--line); padding: 14px 18px; }
.admin-status-strip div:last-child { border-right: 0; }
.admin-status-strip span { color: var(--muted); font-size: 11px; }
.admin-status-strip strong { font-size: 15px; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; margin-top: 20px; align-items: start; }
.settings-panel, .system-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); }
.panel-heading { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-heading h3 { margin: 0; font-size: 17px; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.config-list button { width: 100%; min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); padding: 14px 20px; color: inherit; text-align: left; }
.config-list button:last-child { border-bottom: 0; }
.config-list button:hover { background: var(--surface-subtle); }
.config-list button > span:first-child { display: grid; gap: 4px; }
.config-list strong { font-size: 14px; }
.config-list small { color: var(--muted); font-size: 11px; }
.config-list button > span:last-child { color: var(--accent); font-size: 12px; font-weight: 700; }
.health-list { margin: 0; padding: 8px 20px 18px; }
.health-list div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.health-list dt, .health-list dd { font-size: 12px; }
.health-list dd { margin: 0; color: var(--muted); font-weight: 700; }
.health-list .health-ok { color: var(--green); }
.health-list .health-warn { color: var(--amber); }
.system-panel > .full-button { width: calc(100% - 40px); margin: 0 20px 20px; }

/* 管理编辑器 */
.setting-dialog { width: min(1420px, calc(100vw - 28px)); max-width: none; max-height: calc(100dvh - 28px); padding: 0; border: 0; border-radius: var(--panel-radius); color: var(--ink); box-shadow: 0 30px 90px rgb(12 28 56 / .28); }
.setting-dialog::backdrop { background: rgb(14 27 52 / .48); }
.setting-dialog form { min-height: min(760px, calc(100dvh - 28px)); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.setting-dialog-head { min-height: 92px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding: 18px 22px; }
.setting-dialog-head > div > span { color: var(--accent); font-size: 10px; font-weight: 800; }
.setting-dialog-head h2 { margin: 3px 0 0; font-size: 21px; }
.setting-dialog-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.setting-dialog-body { min-height: 0; overflow: auto; background: var(--surface-subtle); padding: 20px 22px; }
.setting-dialog-footer { min-height: 68px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); background: var(--surface); padding: 13px 22px; }
.setting-dialog-footer .form-error { margin-right: auto; }
.admin-editor-toolbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 10px; }
.admin-editor-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.admin-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); }
.admin-table { width: 100%; min-width: 920px; border-collapse: collapse; }
.admin-table th { position: sticky; top: 0; z-index: 1; background: #eef2f7; color: #526178; padding: 11px 10px; text-align: left; font-size: 11px; }
.admin-table td { border-top: 1px solid var(--line); padding: 9px 10px; vertical-align: middle; font-size: 12px; }
.admin-table td input, .admin-table td select { min-width: 112px; padding: 7px 8px; font-size: 12px; }
.admin-table td input + input { margin-top: 6px; }
.admin-table .wide-input { min-width: 340px; }
.admin-table .check-cell { width: 62px; text-align: center; }
.admin-table .check-cell input { min-width: 0; width: 17px; height: 17px; }
.table-action { border: 0; background: transparent; padding: 6px; color: var(--accent); font-weight: 700; }
.table-action:disabled { cursor: not-allowed; opacity: .4; }
.danger-text { color: var(--red); }
.order-cell { min-width: 126px; white-space: nowrap; }
.order-cell strong { display: inline-block; min-width: 24px; }
.order-cell button { width: 29px; height: 29px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.order-cell button + button { border-left: 0; }
.settings-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); padding: 22px; }
.settings-form-grid label small { color: var(--muted); font-weight: 400; }
.toggle-field { min-height: 44px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: var(--control-radius); padding: 8px 12px; }
.toggle-field input { width: 18px; height: 18px; }
.config-list button > span:last-child b { color: var(--ink); }

/* 人员、部门与流程分类编辑器 */
.manager-panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.manager-panel-title > div { display: grid; gap: 2px; }
.manager-panel-title span { color: var(--muted); font-size: 9px; font-weight: 750; }
.manager-panel-title strong { font-size: 15px; }
.manager-panel-title > span { min-width: 25px; height: 22px; display: grid; place-items: center; border-radius: 11px; background: #e9eef5; color: #526178; }
.people-manager { min-height: 590px; display: grid; grid-template-columns: 210px minmax(360px, 1fr) 330px; gap: 14px; align-items: start; }
.department-panel, .people-list-panel, .person-editor-panel, .workflow-category-panel, .workflow-builder { border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); }
.department-panel { padding: 16px; }
.department-list { display: grid; gap: 5px; }
.department-item { width: 100%; min-height: 39px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid transparent; border-radius: var(--control-radius); background: transparent; padding: 8px 10px; color: var(--ink); text-align: left; }
.department-item:hover { background: var(--surface-subtle); }
.department-item.active { border-color: #b9d0f2; background: var(--accent-soft); color: #164f9e; }
.department-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.department-item small { flex: none; color: var(--muted); font-size: 9px; }
.department-editor { display: grid; gap: 12px; margin-top: 15px; border-top: 1px solid var(--line); padding-top: 15px; }
.department-editor label, .department-create label { font-size: 11px; }
.department-editor input, .department-create input { padding: 8px 9px; font-size: 11px; }
.department-create { display: grid; gap: 7px; margin-top: 15px; border-top: 1px solid var(--line); padding-top: 15px; }
.department-create > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.department-create .secondary-button { min-height: 34px; padding: 6px 9px; font-size: 10px; }
.people-list-panel { min-width: 0; padding: 14px; }
.people-toolbar { display: grid; grid-template-columns: minmax(180px, 1fr) 112px auto auto; align-items: center; gap: 8px; margin-bottom: 12px; }
.people-toolbar input, .people-toolbar select { padding: 8px 10px; font-size: 11px; }
.people-toolbar > span { min-width: 42px; color: var(--muted); font-size: 10px; text-align: center; }
.people-toolbar .primary-button { min-height: 36px; padding: 7px 11px; font-size: 11px; }
.people-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.person-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.person-card:hover { border-color: #a9bfdf; }
.person-card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.person-card > button { width: 100%; min-height: 116px; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; border: 0; background: transparent; padding: 13px; color: var(--ink); text-align: left; }
.person-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #dfeafa; color: #24578e; font-size: 12px; font-weight: 800; }
.person-copy { min-width: 0; display: grid; align-content: start; gap: 3px; padding-right: 31px; }
.person-copy strong, .person-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-copy strong { font-size: 12px; }
.person-copy small { color: var(--muted); font-size: 9px; }
.permission-chip { grid-column: 1 / -1; justify-self: start; border-radius: 999px; background: #edf1f6; padding: 3px 7px; color: #55647a; font-size: 9px; font-weight: 700; }
.person-state { position: absolute; top: 10px; right: 10px; color: var(--green); font-size: 9px; font-weight: 800; }
.person-state.disabled { color: var(--red); }
.people-card-grid > .empty-state { grid-column: 1 / -1; }
.person-editor-panel { position: sticky; top: 0; min-width: 0; padding: 17px; }
.person-editor-panel.empty { min-height: 170px; display: grid; align-content: center; text-align: center; color: var(--muted); }
.person-editor-panel.empty strong { color: var(--ink); }
.person-editor-panel.empty p { margin: 7px 0 0; font-size: 11px; line-height: 1.5; }
.person-editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.person-editor-heading > div { display: grid; gap: 2px; }
.person-editor-heading > div > span { color: var(--accent); font-size: 9px; font-weight: 800; }
.person-editor-heading h3 { margin: 0; font-size: 17px; }
.person-form { display: grid; gap: 12px; }
.person-form label { font-size: 11px; }
.person-form input, .person-form select { padding: 8px 9px; font-size: 11px; }
.person-form .toggle-field { min-height: 40px; }
.person-editor-actions { display: flex; justify-content: flex-end; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.person-editor-actions .danger-button { min-height: 34px; font-size: 10px; }
.workflow-manager { min-height: 590px; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.workflow-category-panel { padding: 16px; }
.workflow-category-list { display: grid; gap: 7px; margin-bottom: 12px; }
.workflow-category-item { width: 100%; min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); padding: 10px; color: var(--ink); text-align: left; }
.workflow-category-item:hover { border-color: #a9bfdf; }
.workflow-category-item.active { border-color: var(--accent); background: #f8fbff; box-shadow: inset 3px 0 0 var(--accent); }
.workflow-category-item > span:first-child { min-width: 0; display: grid; gap: 4px; }
.workflow-category-item strong, .workflow-category-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workflow-category-item strong { font-size: 12px; }
.workflow-category-item small { color: var(--muted); font-size: 9px; }
.workflow-category-item > span:last-child { flex: none; display: grid; justify-items: end; gap: 3px; color: var(--muted); font-size: 9px; }
.workflow-category-item b { color: var(--ink); }
.workflow-category-item em { color: var(--green); font-style: normal; font-weight: 800; }
.workflow-category-item em.off { color: var(--muted); }
.workflow-category-panel > p { margin: 12px 2px 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.workflow-builder { min-width: 0; overflow: visible; }
.workflow-category-form { border-bottom: 1px solid var(--line); padding: 17px 18px; }
.workflow-category-heading, .workflow-builder-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.workflow-category-heading > div:first-child { display: grid; gap: 3px; }
.workflow-category-heading > div:first-child > span { color: var(--accent); font-size: 9px; font-weight: 800; }
.workflow-category-heading h3, .workflow-builder-head h3 { margin: 0; font-size: 16px; }
.workflow-category-heading > div:last-child { display: flex; align-items: center; gap: 8px; }
.category-enabled { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: var(--control-radius); padding: 7px 9px; font-size: 10px; }
.category-enabled input { width: 16px; height: 16px; margin: 0; }
.workflow-category-heading .danger-button { min-height: 34px; padding: 6px 10px; font-size: 10px; }
.workflow-category-fields { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(260px, 1.4fr); gap: 12px; margin-top: 14px; }
.workflow-category-fields label { font-size: 11px; }
.workflow-category-fields input { padding: 8px 9px; font-size: 11px; }
.workflow-builder-head { padding: 16px 18px 12px; }
.workflow-builder-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.workflow-builder-head .primary-button { min-height: 34px; font-size: 10px; }
.workflow-node-list { display: grid; gap: 10px; padding: 0 18px 18px; }
.workflow-node-card { overflow: visible; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-subtle); }
.workflow-node-card > header { min-height: 47px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 9px 12px; }
.workflow-node-card > header > div:first-child { display: flex; align-items: baseline; gap: 9px; }
.workflow-node-card > header span { color: var(--accent); font-size: 9px; font-weight: 800; }
.workflow-node-card > header strong { font-size: 12px; }
.node-order-actions { display: flex; align-items: center; }
.node-order-actions button { min-width: 30px; height: 29px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 10px; font-weight: 700; }
.node-order-actions button + button { border-left: 0; }
.node-order-actions button:first-child { border-radius: 5px 0 0 5px; }
.node-order-actions button:last-child { min-width: 46px; border-radius: 0 5px 5px 0; }
.node-order-actions button:disabled { cursor: not-allowed; opacity: .38; }
.node-order-actions .danger-text { color: var(--red); }
.workflow-node-fields { display: grid; grid-template-columns: minmax(160px, .85fr) minmax(280px, 1.5fr) 100px 122px; gap: 12px; align-items: end; padding: 12px; }
.workflow-node-fields label, .workflow-field { min-width: 0; font-size: 10px; }
.workflow-field { display: grid; gap: 8px; color: #31415b; font-weight: 650; }
.workflow-node-fields input { padding: 8px 9px; font-size: 11px; }
.workflow-node-fields .toggle-field { min-height: 36px; }
.assignee-combobox { position: relative; min-width: 0; }
.assignee-combobox > input { padding-right: 34px; }
.combobox-toggle { position: absolute; top: 1px; right: 1px; width: 32px; height: 32px; border: 0; border-left: 1px solid var(--line); border-radius: 0 6px 6px 0; background: var(--surface); color: var(--muted); }
.assignee-menu { position: absolute; top: calc(100% + 5px); left: 0; z-index: 20; width: max(100%, 330px); max-height: 260px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); padding: 6px; box-shadow: 0 12px 34px rgb(12 28 56 / .18); }
.assignee-group > span { display: block; padding: 6px 7px 3px; color: var(--muted); font-size: 8px; font-weight: 800; }
.assignee-group button { width: 100%; display: grid; gap: 2px; border: 0; border-radius: 5px; background: transparent; padding: 7px 8px; color: var(--ink); text-align: left; }
.assignee-group button:hover, .assignee-group button.active { background: var(--accent-soft); }
.assignee-group button strong { font-size: 10px; }
.assignee-group button small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.combobox-empty { padding: 18px 10px; color: var(--muted); font-size: 10px; text-align: center; }

/* 邮件 */
.mail-notice { margin-bottom: 15px; border-left: 4px solid #d9a32a; border-radius: var(--control-radius); background: #fff8e8; padding: 12px 15px; color: #6e5313; font-size: 12px; }
.mail-table { overflow: auto; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); }
.mail-row { min-width: 900px; padding: 14px 17px; display: grid; grid-template-columns: 110px minmax(210px, 1.5fr) minmax(210px, 1fr) 150px 120px; gap: 15px; align-items: center; border-bottom: 1px solid var(--line); }
.mail-row:last-child { border-bottom: 0; }
.mail-row.header { background: var(--surface-subtle); color: var(--muted); font-size: 11px; font-weight: 800; }
.mail-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code { font-family: "Cascadia Mono", Consolas, monospace; }

/* 详情抽屉 */
.detail-dialog { width: min(1180px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: var(--panel-radius); color: var(--ink); box-shadow: 0 30px 90px rgb(12 28 56 / .28); }
.detail-dialog::backdrop { background: rgb(14 27 52 / .48); }
.dialog-head { min-height: 91px; padding: 20px 24px; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.detail-id { display: block; margin-bottom: 3px; color: var(--accent); font-size: 11px; font-weight: 800; }
.dialog-head h2 { margin: 0; font-size: 21px; }
.dialog-head p { margin: 5px 0 0; font-size: 12px; }
.dialog-close { width: 36px; height: 36px; flex: none; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font-size: 19px; }
.dialog-body { padding: 0; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; }
.detail-main { min-width: 0; max-height: calc(100dvh - 124px); overflow-y: auto; padding: 22px 24px 30px; }
.detail-side { border-left: 1px solid var(--line); background: var(--surface-subtle); padding: 22px; }
.detail-section + .detail-section, .timeline + .detail-section { margin-top: 27px; }
.detail-section h3, .timeline h3, .action-box h3 { margin: 0 0 12px; font-size: 15px; }
.file-field small { margin-top: 7px; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.45; }
.file-field input[type="file"] { padding: 8px; background: var(--surface); }
.file-field input[type="file"]::file-selector-button { margin-right: 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-subtle); color: var(--ink); padding: 7px 11px; font: inherit; font-weight: 700; cursor: pointer; }
.filled-content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface-subtle); margin-bottom: 18px; overflow: hidden; }
.filled-content-grid div { min-width: 0; padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.filled-content-grid div:nth-child(2n) { border-right: 0; }
.filled-content-grid div:nth-last-child(-n+2) { border-bottom: 0; }
.filled-content-grid span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.filled-content-grid strong { display: block; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.content-block { border-left: 3px solid #cbd8e9; padding: 2px 0 2px 14px; }
.content-block + .content-block { margin-top: 16px; }
.content-block strong { color: var(--muted); font-size: 11px; }
.content-block p { margin: 5px 0 0; line-height: 1.65; overflow-wrap: anywhere; }
.detail-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.detail-section-heading > span { color: var(--muted); font-size: 10px; }
.image-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.image-card { min-width: 0; display: grid; grid-template-rows: 152px auto; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); overflow: hidden; text-decoration: none; }
.image-card:hover { border-color: #9bb8e8; }
.image-card img { width: 100%; height: 152px; display: block; object-fit: contain; background: #eef2f7; }
.image-card span { min-width: 0; padding: 9px 11px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-list { border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); overflow: hidden; }
.attachment-row { min-height: 53px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.attachment-row:last-child { border-bottom: 0; }
.attachment-row > div { min-width: 0; }
.attachment-row strong, .attachment-row span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-row strong { font-size: 11px; }
.attachment-row span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.attachment-empty { border: 1px dashed #c8d3e2; border-radius: var(--control-radius); background: var(--surface-subtle); padding: 20px; color: var(--muted); font-size: 11px; text-align: center; }
.attachment-empty + .attachment-list { margin-top: 10px; }
.attachment-upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: end; margin-top: 12px; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface-subtle); padding: 13px; }
.attachment-upload label { grid-column: 1 / -1; font-size: 11px; font-weight: 750; }
.attachment-upload input[type="file"] { min-width: 0; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); padding: 7px; font-size: 10px; }
.attachment-upload small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; line-height: 1.5; }
.timeline { margin-top: 27px; }
.timeline-track { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 8px; }
.timeline-node { min-width: 92px; flex: 1 0 92px; border-top: 3px solid #d6dce6; padding-top: 7px; color: #778398; font-size: 10px; }
.timeline-node.done { border-color: var(--green); color: var(--green); }
.timeline-node.current { border-color: var(--accent); color: var(--accent); font-weight: 800; }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-list li { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(200px, 1.4fr) 150px; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.history-list li:last-child { border-bottom: 0; }
.history-list li > div { display: grid; gap: 2px; }
.history-list li span, .history-list time { color: var(--muted); font-size: 10px; }
.history-list p { margin: 0; font-size: 12px; line-height: 1.5; }
.history-list time { text-align: right; }
.detail-facts { margin: 0; }
.detail-facts div { padding: 0 0 13px; }
.detail-facts dt { color: var(--muted); font-size: 10px; }
.detail-facts dd { margin: 4px 0 0; font-size: 13px; font-weight: 650; }
.action-box { margin: 8px 0 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.action-box textarea { margin: 8px 0 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(420px, calc(100vw - 44px)); border-radius: var(--control-radius); background: var(--navy); color: #ffffff; padding: 12px 16px; box-shadow: 0 12px 34px rgb(12 28 56 / .24); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1280px) {
  .model-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .model-card:nth-child(4n) { border-right: 1px solid var(--line); }
  .model-card:nth-child(3n) { border-right: 0; }
  .model-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .people-manager { grid-template-columns: 190px minmax(330px, 1fr) 290px; }
  .people-card-grid { grid-template-columns: 1fr; }
  .workflow-node-fields { grid-template-columns: minmax(160px, 1fr) minmax(260px, 1.5fr) 90px; }
  .workflow-node-fields .toggle-field { grid-column: auto; }
}

@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: 248px; transition: transform .16s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; display: block; border: 0; background: rgb(8 19 38 / .48); }
  .menu-button { display: inline-flex; }
  .summary-grid, .admin-status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-card:nth-child(2) { border-right: 0; }
  .summary-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .admin-status-strip div:nth-child(2) { border-right: 0; }
  .admin-status-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .settings-layout, .detail-layout { grid-template-columns: 1fr; }
  .people-manager { grid-template-columns: 190px minmax(0, 1fr); }
  .person-editor-panel { position: static; grid-column: 1 / -1; }
  .person-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-manager { grid-template-columns: 220px minmax(0, 1fr); }
  .workflow-node-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-node-fields .toggle-field { grid-column: auto; }
  .detail-side { border-top: 1px solid var(--line); border-left: 0; }
  .detail-main { max-height: none; }
  .task-toolbar { align-items: stretch; flex-direction: column; }
  .filters { width: 100%; }
  .task-row summary { grid-template-columns: 1.5fr 1fr 1fr auto; }
  .task-row summary > div:nth-child(4) { display: none; }
}

@media (max-width: 720px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; padding: 42px 24px; }
  .login-brand h1 { font-size: 38px; }
  .login-proof { margin-top: 32px; }
  .login-panel { padding: 34px 24px; }
  .topbar { align-items: flex-start; }
  .topbar-meta { display: none; }
  .page-section { padding: 22px 15px 38px; }
  .section-heading { align-items: flex-start; }
  .summary-grid, .admin-status-strip, .model-grid { grid-template-columns: 1fr; }
  .summary-card, .summary-card:nth-child(2), .model-card, .model-card:nth-child(3n), .model-card:nth-child(4n), .admin-status-strip div, .admin-status-strip div:nth-child(2) { border-right: 0; }
  .summary-card, .model-card, .admin-status-strip div { border-bottom: 1px solid var(--line); }
  .summary-card:last-child, .model-card:last-child, .admin-status-strip div:last-child { border-bottom: 0; }
  .model-grid:not(.expanded) .model-card:nth-child(n+6) { display: none; }
  .model-tools { align-items: stretch; flex-direction: column; }
  .filters, .compact-filters { grid-template-columns: 1fr; }
  .workbench-summary { grid-template-columns: 1fr; }
  .task-row summary { grid-template-columns: 1fr auto; gap: 9px; }
  .task-row summary > div:nth-child(2), .task-row summary > div:nth-child(3), .task-row summary > div:nth-child(4) { display: none; }
  .task-detail { grid-template-columns: 1fr; }
  .task-actions { flex-wrap: wrap; }
  .create-form { grid-template-columns: 1fr; padding: 18px; }
  .wide { grid-column: auto; }
  .workflow-category-summary { align-items: flex-start; flex-direction: column; gap: 12px; }
  .workflow-category-summary dl { width: 100%; justify-content: space-between; gap: 12px; }
  .model-options { grid-template-columns: 1fr 1fr; }
  .settings-form-grid { grid-template-columns: 1fr; padding: 16px; }
  .settings-form-grid .wide { grid-column: auto; }
  .setting-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  .setting-dialog form { min-height: calc(100dvh - 12px); }
  .setting-dialog-body { padding: 14px; }
  .setting-dialog-footer { padding: 11px 14px; }
  .admin-editor-toolbar { align-items: flex-start; flex-direction: column; }
  .people-manager, .workflow-manager { grid-template-columns: 1fr; }
  .person-editor-panel { grid-column: auto; }
  .people-toolbar { grid-template-columns: 1fr 112px; }
  .people-toolbar > span { text-align: left; }
  .people-card-grid { grid-template-columns: 1fr; }
  .person-form { grid-template-columns: 1fr; }
  .workflow-category-fields, .workflow-node-fields { grid-template-columns: 1fr; }
  .workflow-category-heading { align-items: flex-start; flex-direction: column; }
  .workflow-category-heading > div:last-child { width: 100%; justify-content: space-between; }
  .assignee-menu { width: 100%; }
  .history-list li { grid-template-columns: 1fr; }
  .history-list time { text-align: left; }
  .filled-content-grid, .image-gallery { grid-template-columns: 1fr; }
  .filled-content-grid div, .filled-content-grid div:nth-child(2n), .filled-content-grid div:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .filled-content-grid div:last-child { border-bottom: 0; }
  .attachment-upload { grid-template-columns: 1fr; }
  .attachment-upload label, .attachment-upload small { grid-column: auto; }
  .detail-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
}

@media (min-width: 721px) {
  .model-grid:not(.expanded) .model-card:nth-child(n+9) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
