:root {
  color-scheme: light;
  --navy: #102547;
  --navy-deep: #0c1d39;
  --text: #15243d;
  --muted: #62728a;
  --border: #e2e9f3;
  --page: #f3f6fb;
  --white: #fff;
  --orange: #e65c13;
  --accent: #ff781f;
  --shadow: 0 4px 18px #20355309;
  font: 15px/1.55 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
a { color: #1c59bd; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #5699ff; outline-offset: 3px; }
button:disabled { opacity: .55; cursor: wait; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 29px; letter-spacing: -.035em; line-height: 1.28; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
small { font-size: 12px; }
.app { display: grid; min-height: 100dvh; grid-template-columns: 226px minmax(0, 1fr); }
.sidebar { position: sticky; inset-block-start: 0; height: 100dvh; background: linear-gradient(155deg,#16345e 0%,var(--navy) 48%,var(--navy-deep) 100%); color: #d5e0f2; display: flex; flex-direction: column; padding: 25px 15px 16px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 26px; color: white; }
.brand strong { display: block; font-size: 17px; font-weight: 730; letter-spacing: .02em; }
.brand small { display: block; margin-top: 1px; color: #aebfe0; }
.mark, .avatar, .icon { display: inline-grid; place-items: center; flex: 0 0 auto; }
.mark { height: 41px; width: 41px; border-radius: 12px; color: white; font-size: 21px; background: linear-gradient(150deg,#ff9a4e,#f25f0c); box-shadow: 0 4px 10px #e7692666; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { border: 0; background: none; display: flex; align-items: center; gap: 12px; color: inherit; text-align: left; border-radius: 9px; min-height: 43px; width: 100%; padding: 0 12px; white-space: nowrap; }
.nav-item .icon { width: 22px; font-size: 17px; }
.sidebar .nav-item:hover { background: #ffffff12; }
.sidebar .nav-item.active { color: white; font-weight: 680; background: linear-gradient(105deg,#fa6e1b,#ff8a2e); box-shadow: 0 5px 16px #0a1c3840; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #ffffff23; padding: 15px 8px 4px; display: flex; align-items: center; gap: 9px; font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #52d69c; }
.workspace { min-width: 0; }
.topbar { height: 67px; position: sticky; top: 0; z-index: 4; background: #fff; border-bottom: 1px solid var(--border); padding: 0 30px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar-right { display: flex; gap: 11px; align-items: center; }
.crumb { color: #76849a; font-size: 13px; }
.crumb strong { color: #26364e; margin-left: 7px; }
.tenant { border: 1px solid var(--border); border-radius: 9px; background: #f8fafd; min-height: 37px; padding: 0 10px; max-width: 145px; color: #324460; }
.avatar { width: 35px; height: 35px; border: 0; border-radius: 50%; background: #eaf1ff; color: #2457a0; font-size: 13px; font-weight: 700; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; color: #40536f; background: #f4f7fc; border: 1px solid #e7edf7; border-radius: 11px; font-size: 18px; }
.icon-button:hover { background: #eaf1ff; }
.notice-icon { position: relative; }
.notice-icon .dot { width: 7px; height: 7px; position: absolute; top: 5px; right: 6px; background: #f45c18; }
main { max-width: 1500px; margin: 0 auto; padding: 26px 30px 32px; min-width: 0; }
.loading { padding: 25px; color: var(--muted); }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 22px; }
.subtle { color: var(--muted); }
.title-row p { margin-top: 7px; }
.today { white-space: nowrap; color: #68768b; font-size: 13px; background: #fff; border: 1px solid var(--border); padding: 7px 11px; border-radius: 9px; }
.stats { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 13px; margin-bottom: 20px; }
.stat, .panel { background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left; }
.stat:hover, .action:hover, .list-button:hover { border-color: #b6c7e4; background: #f9fbff; }
.stat .icon, .task-icon { width: 39px; height: 39px; border-radius: 11px; font-size: 19px; }
.stat span.label { display: block; font-size: 12px; color: #5a6a81; white-space: nowrap; }
.stat strong { font-size: 24px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat small { margin-left: 3px; color: #67778c; }
.blue { background: #eaf3ff; color: #2277e5; }
.green { background: #e7f8ee; color: #198653; }
.orange { background: #fff0e2; color: #df6216; }
.purple { background: #f3ecff; color: #784acd; }
.red { background: #ffedf0; color: #d74e61; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(252px, 290px); align-items: start; gap: 17px; }
.panel { min-width: 0; overflow: hidden; }
.panel-head { min-height: 61px; padding: 13px 17px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #edf1f7; }
.panel-head > div { display: flex; align-items: center; gap: 9px; }
.panel-head button.link { white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 3px 9px; font-size: 12px; white-space: nowrap; background: #edf3fc; color: #31598b; }
.status.green { background: #e7f8ee; color: #167345; }
.status.orange { background: #fff0e2; color: #a84b10; }
.status .dot { width: 6px; height: 6px; }
.chat { display: flex; flex-direction: column; }
.chat-log { min-height: 309px; max-height: 420px; overflow: auto; overscroll-behavior: contain; padding: 18px; display: flex; flex-direction: column; gap: 15px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg > div:last-child { min-width: 0; max-width: min(100%, 620px); }
.bot { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(155deg,#437cff,#2261cc); box-shadow: 0 3px 8px #2754af2e; position: relative; flex: 0 0 auto; }
.bot::after { content: "••"; position: absolute; inset: 8px 6px; color: #bce9ff; font: 700 14px/16px system-ui; letter-spacing: 3px; text-indent: 3px; border-radius: 5px; background: #102747; }
.meta { color: #74839a; font-size: 11px; margin: 1px 0 4px; }
.bubble { background: #f0f5ff; border: 1px solid #e4ecfc; border-radius: 2px 12px 12px 12px; padding: 9px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { justify-content: flex-end; }
.user .bubble { background: #fff0e3; border-color: #ffe6d0; border-radius: 12px 2px 12px 12px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 17px; }
.action { border: 1px solid #e4ebf6; border-radius: 9px; padding: 7px 10px; background: #fff; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; text-align: left; }
.action .icon { color: var(--orange); }
.composer { display: flex; padding: 11px 12px; gap: 7px; border-top: 1px solid #ecf0f6; align-items: end; }
.composer textarea { flex: 1; min-width: 0; padding: 10px; height: 44px; max-height: 100px; resize: none; border-radius: 10px; background: #f7f9fd; border: 1px solid #e2eaf6; color: var(--text); }
.composer .icon-button { height: 44px; }
.primary, .secondary, .link { display: inline-flex; justify-content: center; align-items: center; border-radius: 9px; min-height: 39px; padding: 7px 13px; text-decoration: none; font-weight: 650; }
.primary { color: white; border: 1px solid transparent; background: linear-gradient(120deg,#e86418,#d95009); }
.primary:hover { background: #c9480a; }
.secondary { background: #fff; border: 1px solid #dbe5f2; color: #344e72; }
.secondary:hover { background: #f0f5ff; }
.link { color: #245eae; border: 0; background: none; padding: 3px 2px; font-size: 12px; }
.send { width: 44px; height: 44px; padding: 0; font-size: 21px; }
.side-stack { display: grid; gap: 15px; }
.side-list { padding: 5px 13px 11px; }
.list-button { display: flex; gap: 9px; align-items: center; background: none; border: 1px solid transparent; border-bottom: 1px solid #edf1f7; border-radius: 7px; width: 100%; min-height: 52px; text-align: left; padding: 7px 3px; }
.list-button:last-child { border-bottom-color: transparent; }
.list-button > span:nth-child(2) { flex: 1; min-width: 0; }
.list-button strong, .list-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-button strong { font-size: 13px; }
.list-button small { color: var(--muted); margin-top: 2px; }
.chevron { color: #8899b5; }
.task-icon { width: 32px; height: 32px; font-size: 16px; }
.card { border-radius: 11px; border: 1px solid #dfe8f7; background: #fff; margin-top: 7px; padding: 12px; min-width: 230px; }
.card h3 { margin-bottom: 6px; }
.card .flow { margin: 10px 0 3px; }
.card-data { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 3px 12px; font-size: 13px; margin: 7px 0; }
.card-data dt { color: var(--muted); }
.card-data dd { margin: 0; overflow-wrap: anywhere; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.recent { margin-top: 19px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th, td { padding: 11px 15px; border-bottom: 1px solid #edf1f7; }
th { color: #556882; background: #f7f9fc; font-size: 12px; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); padding: 17px; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 15px; }
.filters input, .filters select, .form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-height: 42px; color: var(--text); background: #fff; border: 1px solid #dce5f1; border-radius: 8px; padding: 8px 10px; }
.filters input, .filters select { width: auto; }
.module-cards { display: grid; gap: 12px; }
.info { padding: 16px; }
.info p { margin-top: 4px; overflow-wrap: anywhere; }
.flow { padding: 0; margin: 15px 0; list-style: none; }
.flow li { border-left: 2px solid #dce6f5; margin-left: 7px; padding: 0 0 12px 17px; position: relative; color: #657690; }
.flow li:before { content: ""; position: absolute; width: 11px; height: 11px; border: 2px solid #c4d2e6; border-radius: 50%; background: #fff; top: 6px; left: -6.5px; }
.flow li.done::before { border-color: #159560; background: #159560; }
.flow li.current::before { border-color: #2368df; background: #2368df; }
.flow li:last-child { border-left-color: transparent; padding-bottom: 0; }
.flow time { margin-left: 7px; font-size: 12px; color: #687a94; }
.money { color: #b94b10; font-variant-numeric: tabular-nums; }
dialog { width: min(560px, calc(100% - 28px)); max-height: 88dvh; border: 1px solid #dce6f4; border-radius: 16px; padding: 0; color: var(--text); box-shadow: 0 15px 60px #1025472c; }
dialog::backdrop { background: #0d22496b; }
.modal-content { padding: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: grid; gap: 4px; color: #455871; font-size: 13px; }
.form-grid .wide { grid-column: 1/-1; }
.form-grid textarea { resize: vertical; }
.toast { position: fixed; bottom: 22px; right: 22px; z-index: 6; max-width: min(410px,calc(100% - 44px)); padding: 12px 17px; border-radius: 10px; background: #132748; color: #fff; box-shadow: 0 5px 18px #13274838; }
.role-home { max-width: 750px; margin: auto; }
.driver-banner { background: linear-gradient(125deg,#2168d2,#144796); color: #fff; border-color: #2469c9; }
.driver-banner p { color: #e1ecff; }
.proof-image { width: 100%; max-height: 55dvh; object-fit: contain; }
.mobile-nav { display: none; }
@media(max-width:1150px) {
  .app { grid-template-columns: 188px minmax(0,1fr); }
  main, .topbar { padding-left: 19px; padding-right: 19px; }
  .stat { gap: 8px; padding: 10px; }
  .stat .icon { width: 32px; height: 32px; }
  .dashboard { grid-template-columns: minmax(0,1fr) 245px; }
}
@media(max-width:900px) {
  .dashboard { grid-template-columns: minmax(0,1fr); }
  .side-stack { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .app { grid-template-columns: 155px minmax(0,1fr); }
  .sidebar { padding-left: 9px; padding-right: 9px; }
  .brand { gap: 7px; padding-left: 3px; }
  .brand strong { font-size: 15px; }
}
@media(max-width:690px) {
  :root { font-size: 16px; }
  .app { display: block; }
  .sidebar { display: none; }
  .topbar { height: 57px; padding: 0 12px; }
  .crumb { font-size: 0; }
  .crumb strong { font-size: 14px; margin: 0; }
  .topbar-right { gap: 5px; }
  .tenant { max-width: 111px; font-size: 12px; }
  main { padding: 16px 12px calc(78px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .stat { min-width: 115px; }
  .stats { display: flex; overflow: auto; gap: 8px; padding-bottom: 3px; }
  .side-stack { grid-template-columns: minmax(0,1fr); }
  .title-row p { font-size: 13px; }
  .today { font-size: 11px; }
  .mobile-nav { position: fixed; bottom: 0; inset-inline: 0; display: flex; justify-content: space-around; z-index: 5; background: #fff; border-top: 1px solid #e3ebf6; padding: 3px 5px calc(3px + env(safe-area-inset-bottom)); }
  .mobile-nav .nav-item { max-width: 92px; flex-direction: column; justify-content: center; gap: 0; font-size: 11px; color: #50627b; padding: 2px 4px; }
  .mobile-nav .active { color: #b94509; background: #fff3e8; }
  .mobile-nav .icon { font-size: 16px; height: 19px; }
  .action, .secondary, .primary { min-height: 44px; }
  .toast { bottom: calc(61px + env(safe-area-inset-bottom)); }
  .chat-log { padding: 12px; }
  .quick-actions { padding-inline: 12px; }
  .app[data-role=owner][data-page=workbench] .role-home { margin: -16px -12px 0; }
  .app[data-role=owner][data-page=workbench] .chat { border-radius: 0; border: 0; height: calc(var(--visual-height, 100dvh) - 108px - env(safe-area-inset-bottom)); }
  .app[data-role=owner][data-page=workbench] .chat-log { min-height: 0; max-height: unset; flex: 1; }
  .app[data-role=owner][data-page=workbench] .panel-head { display: none; }
  body.keyboard .app[data-role=owner][data-page=workbench] .chat { height: calc(var(--visual-height, 100dvh) - 57px); }
  body.keyboard .app[data-role=owner] .mobile-nav, body.keyboard .app[data-role=owner] .quick-actions { display: none; }
}
@media(max-width:360px) {
  .form-grid { grid-template-columns: 1fr; }
  .composer { padding-inline: 6px; gap: 4px; }
  .composer .icon-button { width: 33px; }
}
@media print {
  body { background: #fff; }
  .sidebar,.topbar,.mobile-nav, .toast { display: none !important; }
  dialog[open] { position: static; width: 100%; max-height: none; border: 0; box-shadow: none; }
  body:has(dialog[open]) .app { display: none; }
  dialog::backdrop, dialog .buttons, dialog .icon-button { display: none; }
}
