* { box-sizing: border-box; margin: 0; padding: 0; }
:root { --blue:#1f5bd7; --blue-dark:#1747ad; --ink:#252b36; --sub:#7b8391; --line:#e5e9f0; --bg:#f2f4f8; }
body { font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); font-size: 14.5px; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

/* auth */
.auth-view { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1747ad 0%, #1f5bd7 45%, #6f9df5 100%); }
.auth-card { width: 380px; max-width: calc(100vw - 32px); background: #fff; border-radius: 14px; padding: 34px 32px 24px; box-shadow: 0 24px 70px rgba(9,32,80,.35); }
.a-logo { font-size: 24px; font-weight: 800; color: var(--blue); text-align: center; letter-spacing: 2px; }
.a-sub { font-size: 11px; color: var(--sub); text-align: center; letter-spacing: 1px; margin: 6px 0 16px; }
.a-org { background: #f0f4fd; border-radius: 8px; padding: 9px 12px; font-size: 13px; color: var(--sub); text-align: center; margin-bottom: 18px; }
.auth-card label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 12px; }
.auth-card input { width: 100%; margin-top: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; outline: none; font-size: 14px; color: var(--ink); }
.auth-card input:focus { border-color: var(--blue); }
.a-err { color: #e5484d; font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.a-btn { width: 100%; background: var(--blue); color: #fff; border-radius: 8px; padding: 12px 0; font-weight: 700; }
.a-btn:hover { background: var(--blue-dark); }
.a-foot { text-align: center; font-size: 12px; color: var(--sub); margin-top: 14px; }
.a-reg { text-align: center; margin-top: 10px; }
.a-link { color: var(--blue); font-size: 13px; text-decoration: underline; }

/* layout */
.app { display: flex; height: 100vh; height: 100dvh; }
.side { width: 220px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 12px; }
.side-brand { font-size: 19px; font-weight: 800; color: var(--blue); padding: 2px 10px 20px; letter-spacing: 1px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav button { text-align: left; padding: 11px 12px; border-radius: 9px; color: var(--ink); font-size: 14.5px; }
.side-nav button:hover { background: #f0f4fd; }
.side-nav button.on { background: var(--blue); color: #fff; font-weight: 600; }
.side-foot { display: flex; align-items: center; gap: 9px; border-top: 1px solid var(--line); padding: 12px 8px 2px; }
.me-ava { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.me-info { flex: 1; min-width: 0; }
.me-info div:first-child { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-dept { font-size: 11.5px; color: var(--sub); }
#btnLogout { color: var(--sub); padding: 5px 8px; border-radius: 7px; }
#btnLogout:hover { background: #f0f4fd; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); padding: 0 22px; height: 54px; flex: none; }
.tb-title { font-weight: 700; font-size: 15.5px; }
.tb-right { color: var(--sub); font-size: 12.5px; }
.view { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 16px 18px; }
.s-num { font-size: 26px; font-weight: 800; color: var(--blue); }
.s-label { font-size: 12.5px; color: var(--sub); margin-top: 3px; }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.panel { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 16px 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.panel-head h3 { font-size: 15px; }
.panel-head span { color: var(--sub); font-size: 12.5px; cursor: pointer; }
#chartCanvas { width: 100%; }
.notice-list { list-style: none; }
.notice-list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.notice-list li:last-child { border: 0; }
.n-tag { background: #eef3ff; color: var(--blue); font-size: 11px; border-radius: 4px; padding: 2px 7px; flex: none; }
.n-tag.red { background: #fdeaea; color: #d23c3c; }
.n-date { margin-left: auto; color: var(--sub); font-size: 12px; flex: none; }
.new-flow { margin-top: 16px; background: var(--blue); color: #fff; border-radius: 10px; padding: 12px 24px; font-weight: 700; }
.new-flow:hover { background: var(--blue-dark); }

/* flow center */
.flow-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.flow-list-panel, .flow-detail-panel { background: #fff; border-radius: 12px; border: 1px solid var(--line); min-height: 420px; }
.fl-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.new-mini { background: var(--blue); color: #fff; width: 26px; height: 26px; border-radius: 7px; font-size: 16px; line-height: 1; }
.flow-list { display: flex; flex-direction: column; padding: 8px; }
.flow-item { text-align: left; border-radius: 9px; padding: 10px 12px; margin-bottom: 2px; border: 1px solid transparent; }
.flow-item:hover { background: #f0f4fd; }
.flow-item.on { background: #eef3ff; border-color: #ccd9f5; }
.fi-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-meta { font-size: 12px; color: var(--sub); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.fi-dot { width: 7px; height: 7px; border-radius: 50%; background: #d5dae2; flex: none; }
.fi-dot.active { background: #2fa96c; }
.flow-empty { color: var(--sub); text-align: center; padding: 60px 20px; line-height: 2; }
.flow-detail { padding: 18px 20px; }
.fd-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.fd-title { font-size: 17px; font-weight: 800; }
.fd-meta { color: var(--sub); font-size: 12.5px; margin-top: 5px; }
.fd-stamp { border: 2px solid #d23c3c; color: #d23c3c; font-weight: 800; border-radius: 6px; padding: 3px 10px; transform: rotate(6deg); font-size: 13px; opacity: .85; flex: none; }

/* timeline */
.timeline { margin: 18px 0 8px; padding-left: 6px; }
.t-node { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.t-node::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: -2px; width: 2px; background: var(--line); }
.t-node:last-child::before { display: none; }
.t-dot { width: 28px; height: 28px; border-radius: 50%; background: #eef3ff; color: var(--blue); display: flex; align-items: center; justify-content: center; flex: none; font-size: 13px; z-index: 1; }
.t-body { flex: 1; min-width: 0; background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; position: relative; }
.t-node.audit .t-body { border-color: #d6e2ff; background: #f4f8ff; }
.t-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); }
.t-who { font-weight: 700; color: var(--ink); font-size: 13.5px; }
.t-text { margin-top: 6px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.t-stamp { position: absolute; right: 12px; top: 10px; border: 2px solid #2fa96c; color: #2fa96c; font-size: 11px; font-weight: 800; border-radius: 4px; padding: 1px 6px; transform: rotate(8deg); opacity: .8; }
.t-node .audit-typing { color: var(--sub); font-size: 13px; }

.fd-input { display: flex; gap: 10px; align-items: flex-end; margin-top: 8px; }
.fd-input textarea { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none; min-height: 62px; resize: vertical; font: inherit; }
.fd-input textarea:focus { border-color: var(--blue); }
.fd-input button { background: var(--blue); color: #fff; border-radius: 10px; padding: 11px 20px; font-weight: 700; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(20,30,50,.45); z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal { width: 430px; max-width: calc(100vw - 32px); background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(9,32,80,.3); max-height: 86vh; overflow-y: auto; }
.modal h3 { font-size: 17px; }
.m-sub { font-size: 13px; color: var(--sub); margin: 5px 0 16px; }
.m-label { font-size: 13px; color: var(--sub); margin: 12px 0 8px; }
.auditor-list { display: flex; flex-direction: column; gap: 8px; }
.auditor { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-align: left; }
.auditor:hover { border-color: var(--blue); }
.auditor.on { border-color: var(--blue); background: #f0f4fd; }
.a-ava { width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.a-info { flex: 1; min-width: 0; }
.a-name { font-weight: 700; font-size: 14px; }
.a-meta { font-size: 12px; color: var(--sub); }
.m-textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none; min-height: 90px; resize: vertical; font: inherit; }
.m-textarea:focus { border-color: var(--blue); }
.m-actions { display: flex; gap: 10px; margin-top: 16px; }
.m-actions button { flex: 1; padding: 11px 0; border-radius: 10px; font-weight: 700; }
.btn-cancel { background: #f0f2f6; color: var(--ink); }
.btn-ok { background: var(--blue); color: #fff; }

#toast { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%) translateY(14px); background: var(--ink); color: #fff; border-radius: 8px; padding: 10px 18px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2,1fr); } .dash-grid, .flow-wrap { grid-template-columns: 1fr; } .side { width: 64px; } .side-nav button { font-size: 12px; padding: 10px 6px; } .me-info { display: none; } }
