:root {
  --brand: #2c67c3;
  --brand-600: #24589f;
  --brand-50: #eef4fc;
  --brand-100: #d8e6f8;
  --green: #2bb848;
  --green-50: #eaf7ed;
  --ink: #17202c;
  --ink-2: #46536a;
  --ink-3: #7a879c;
  --line: #e3e8ef;
  --line-2: #eef1f6;
  --bg: #f4f6f9;
  --card: #ffffff;
  --danger: #d64545;
  --warn: #c88114;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 32, 44, .04), 0 8px 24px rgba(23, 32, 44, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3dae4; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }

.boot { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.boot-logo { width: 46px; height: 46px; border-radius: 12px; background: var(--brand); color: #fff; font-size: 24px; font-weight: 500; display: flex; align-items: center; justify-content: center; }
.boot-txt { color: var(--ink-3); font-size: 13px; }

/* 登录 */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-left { background: linear-gradient(150deg, #2c67c3 0%, #1d4c99 100%); color: #fff; padding: 56px 56px 40px; display: flex; flex-direction: column; justify-content: space-between; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .mark { width: 40px; height: 40px; border-radius: 11px; background: #fff; color: var(--brand); font-weight: 500; font-size: 20px; display: flex; align-items: center; justify-content: center; }
.login-brand b { font-size: 17px; font-weight: 500; letter-spacing: .5px; }
.login-hero h1 { font-size: 30px; font-weight: 500; line-height: 1.45; margin: 0 0 16px; }
.login-hero p { color: rgba(255,255,255,.78); line-height: 1.9; margin: 0 0 26px; font-size: 14px; max-width: 420px; }
.login-points { display: grid; gap: 12px; }
.login-points div { display: flex; gap: 10px; align-items: flex-start; color: rgba(255,255,255,.9); font-size: 13px; line-height: 1.7; }
.login-points i { width: 6px; height: 6px; border-radius: 50%; background: #79e08f; margin-top: 8px; flex: none; }
.login-foot { color: rgba(255,255,255,.55); font-size: 12px; }
.login-right { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.login-card { width: 100%; max-width: 340px; }
.login-card h2 { font-size: 20px; font-weight: 500; margin: 0 0 6px; }
.login-card .sub { color: var(--ink-3); font-size: 13px; margin: 0 0 28px; }
.login-card label { display: block; font-size: 12.5px; color: var(--ink-2); margin: 0 0 6px; }
.login-card input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; margin-bottom: 16px; background: #fbfcfe; transition: border-color .15s, box-shadow .15s; }
.login-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); background: #fff; }
.login-card .btn { width: 100%; height: 42px; margin-top: 4px; }
.login-tip { margin-top: 18px; padding: 10px 12px; border-radius: 8px; background: var(--brand-50); color: var(--brand-600); font-size: 12px; line-height: 1.7; }
.login-err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin: -6px 0 6px; }

/* 框架 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 216px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; }
.side-brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 500; }
.side-brand b { font-size: 15px; font-weight: 500; display: block; line-height: 1.3; }
.side-brand em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.menu { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.menu-group { font-size: 11px; color: var(--ink-3); padding: 14px 10px 6px; letter-spacing: .5px; }
.menu a { display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); font-size: 13.5px; margin-bottom: 2px; }
.menu a:hover { background: #f6f8fb; color: var(--ink); }
.menu a.on { background: var(--brand-50); color: var(--brand); font-weight: 500; }
.menu a .ico { width: 16px; height: 16px; flex: none; opacity: .8; }
.menu a.on .ico { opacity: 1; }
.menu a .num { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; font-style: normal; }
.menu a .ext { margin-left: auto; font-style: normal; font-size: 12px; color: var(--ink-3); opacity: .7; }
.userbox { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 9px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-100); color: var(--brand-600); display: flex; align-items: center; justify-content: center; font-size: 13px; flex: none; }
.userbox .u { flex: 1; min-width: 0; }
.userbox .u b { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .u em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.iconbtn { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 7px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-2); padding: 0; }
.iconbtn:hover { border-color: var(--brand); color: var(--brand); }
.iconbtn svg { width: 15px; height: 15px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 15px; font-weight: 500; margin: 0; }
.topbar .date { color: var(--ink-3); font-size: 12px; }
.topbar .grow { flex: 1; }
.search { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; min-width: 240px; }
.search svg { width: 14px; height: 14px; color: var(--ink-3); }
.search input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; width: 100%; font-size: 13px; }
.search kbd { font-family: inherit; font-size: 10.5px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }
.bell { position: relative; }
.bell .dot { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; }
.content { padding: 20px 22px 40px; flex: 1; }
.hamburger { display: none; }

/* 抽屉遮罩、手机入口、底部导航：默认都不占位，窄屏才启用 */
.side-mask { display: none; }
.side-phone { display: flex; align-items: center; gap: 9px; margin: 0 10px 10px; padding: 9px 11px; border-radius: 8px;
  background: #f2f7fd; color: var(--brand); font-size: 13px; }
.side-phone span { flex: 1; }
.side-phone em { font-style: normal; font-size: 12px; opacity: .7; }
.side-phone:hover { background: var(--brand-100); }
.tabbar { display: none; }
.scroll-tip { display: none; }
.map-frame { display: block; width: 100%; height: calc(100vh - 172px); min-height: 520px; border: 0; background: var(--bg); }

/* 通用 */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { font-size: 20px; font-weight: 500; margin: 0; }
.page-head .sub { color: var(--ink-3); font-size: 12.5px; }
.page-head .right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.card-h b { font-size: 14px; font-weight: 500; }
.card-h .sub { color: var(--ink-3); font-size: 12px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 14px; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.btn { height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: #cfd8e4; color: var(--ink); background: #fbfcfe; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); padding: 0 8px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn.danger { color: var(--danger); border-color: #f2d3d3; background: #fdf6f6; }
.btn.danger:hover { background: #fbeaea; border-color: #eab5b5; color: var(--danger); }
.btn-link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-size: 13px; }
.btn-link.danger { color: var(--danger); }

input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; background: #fff; font-size: 13px; width: 100%;
}
/* 表单里省略 type 的 input 也要铺满；只作用于弹窗，不动顶栏搜索框与登录框 */
.modal-b input:not([type]) {
  height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px;
  background: #fff; font-size: 13px; width: 100%;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
label.fl { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.field { margin-bottom: 12px; }
.hint { font-size: 12px; color: var(--ink-3); line-height: 1.7; margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.pill { height: 28px; padding: 0 11px; border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 12.5px; cursor: pointer; }
.pill.on { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand); font-weight: 500; }

/* 首页右上角快捷录入框：复用订单表单，视觉上比普通按钮更醒目 */
.quick-add { position: relative; display: inline-flex; align-items: center; gap: 9px; flex: none; height: 44px;
  padding: 0 12px 0 9px; border: 1px solid var(--brand); border-radius: 12px; color: #fff; text-align: left;
  background: linear-gradient(135deg, var(--brand), #1d4f9e); box-shadow: 0 5px 15px rgba(44, 103, 195, .24);
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, filter .15s ease; }
.quick-add:hover { transform: translateY(-2px); box-shadow: 0 9px 22px rgba(44, 103, 195, .32); filter: brightness(1.05); }
.quick-add:active { transform: translateY(0); }
.quick-add:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.quick-add .qa-mark { width: 30px; height: 30px; border-radius: 9px; background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center; flex: none; }
.quick-add .qa-txt { display: block; line-height: 1.2; }
.quick-add .qa-txt b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.quick-add .qa-txt em { display: block; font-style: normal; font-size: 10.5px; opacity: .82; white-space: nowrap; }
.quick-add .qa-plus { margin-left: 4px; font-size: 20px; font-weight: 300; line-height: 1; opacity: .9; }
.quick-add::after { content: ''; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 3px #fff; animation: qa-pulse 2.4s ease-in-out infinite; }
@keyframes qa-pulse {
  0%, 100% { box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(43, 184, 72, .45); }
  50% { box-shadow: 0 0 0 3px #fff, 0 0 0 8px rgba(43, 184, 72, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .quick-add { transition: none; }
  .quick-add::after { animation: none; }
}

.badge { display: inline-block; height: 22px; line-height: 22px; padding: 0 8px; border-radius: 5px; font-size: 12px; white-space: nowrap; vertical-align: middle; flex: none; }
.b-blue { background: var(--brand-50); color: var(--brand-600); }
.b-green { background: var(--green-50); color: #1d7f32; }
.b-amber { background: #fdf3e3; color: var(--warn); }
.b-gold { background: #f3ead0; color: #8a6410; font-weight: 600; }
.b-gray { background: #f2f4f7; color: var(--ink-3); }
.b-red { background: #fbecec; color: var(--danger); }
.b-purple { background: #f2eefc; color: #6a4bb0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbfcfe; white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; vertical-align: middle; }
tbody tr:hover { background: #fafbfd; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.muted { color: var(--ink-3); }
.danger-text { color: var(--danger); }
.warn-text { color: var(--warn); }
.green-text { color: #1d7f32; }
.nowrap { white-space: nowrap; }
.sub-no { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); font-weight: 500; margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }

.kpi { padding: 16px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.kpi .lab { font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.kpi .val { font-size: 26px; font-weight: 500; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.kpi .foot { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.kpi.brand { background: linear-gradient(135deg, #2c67c3, #24589f); border: 0; color: #fff; }
.kpi.brand .lab, .kpi.brand .foot { color: rgba(255,255,255,.75); }

.bar { height: 8px; border-radius: 4px; background: #eef1f6; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { height: 38px; padding: 0 14px; border: 0; background: none; color: var(--ink-2); font-size: 13.5px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(20, 28, 40, .35); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto; z-index: 60; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 24px 60px rgba(16, 24, 36, .22); animation: pop .12s ease-out; }
.modal.wide { max-width: 800px; }
@keyframes pop { from { transform: translateY(-6px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-h { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.modal-h b { font-size: 15px; font-weight: 500; }
.modal-h .x { margin-left: auto; cursor: pointer; color: var(--ink-3); border: 0; background: none; font-size: 20px; line-height: 1; padding: 0 4px; }
.modal-b { padding: 18px; max-height: 66vh; overflow-y: auto; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }

.toast-box { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #232c3a; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; max-width: 76vw; line-height: 1.6; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: drop .16s ease-out; white-space: pre-wrap; }
.toast.err { background: #b93a3a; }
.toast.ok { background: #1d7f32; }
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } }

/* 详情 */
.detail-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.detail-head h2 { margin: 0 0 6px; font-size: 20px; font-weight: 500; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); }
.timeline { display: grid; gap: 0; }
.tl-item { display: flex; gap: 12px; padding: 0 0 16px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--brand); background: #fff; margin-top: 4px; flex: none; z-index: 1; }
.tl-body { flex: 1; }
.tl-body p { margin: 0 0 4px; line-height: 1.7; }
.tl-meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }

.noti-pop { position: absolute; right: 0; top: 44px; width: 330px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(16,24,36,.14); z-index: 50; }
.noti-pop h4 { margin: 0; padding: 12px 14px; font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--line-2); }
.noti-pop .nl { max-height: 320px; overflow-y: auto; }
.noti-pop a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink); font-size: 13px; }
.noti-pop a:hover { background: #fafbfd; }
.noti-pop a i { font-style: normal; font-size: 11.5px; color: var(--ink-3); display: block; margin-top: 3px; }

.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.right { text-align: right; }

@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .18s; box-shadow: 0 0 40px rgba(0,0,0,.16); }
  .sidebar.open { transform: none; }
  .side-mask.open { display: block; position: fixed; inset: 0; background: rgba(20, 28, 40, .42); z-index: 29; }
  body.drawer-open { overflow: hidden; }
  .hamburger { display: flex; }
  .content { padding: 14px 14px 30px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar .date { display: none; }
  .topbar h1 { font-size: 14px; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .search { min-width: 0; flex: 1; }
  .search kbd { display: none; }
  .page-head h2 { font-size: 18px; }
  .page-head .sub { width: 100%; }
  .kpi .val { font-size: 22px; }
  .g3, .g4, .g2 { grid-template-columns: 1fr; }
  .grid.g4 { grid-template-columns: 1fr 1fr; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 84px 1fr; }
  .modal { max-width: 100%; }
  .modal-b { max-height: 72vh; }
  .noti-pop { width: min(330px, 86vw); }
}

/* 手机（≤640px）：底部导航 + 抽屉，表格横滚，弹窗改成底部抽屉式 */
@media (max-width: 640px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(23, 32, 44, .05);
  }
  .tabbar a, .tabbar button {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; border: 0; background: none; color: var(--ink-3); font-size: 10.5px; padding: 0; cursor: pointer;
  }
  .tabbar a.on { color: var(--brand); font-weight: 600; }
  .tabbar .ico { width: 19px; height: 19px; }

  .content { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .topbar { height: 52px; padding: 0 12px; gap: 8px; }
  .topbar .search { display: none; }
  .topbar h1 { max-width: none; font-size: 15px; }
  .sidebar { width: min(84vw, 300px); }

  .page-head { gap: 8px; }
  .page-head h2 { font-size: 17px; }
  .page-head .right { width: 100%; margin-left: 0; }
  /* 手机上快捷录入置顶独占一行，别被时间筛选挤成半截 */
  .page-head .right .quick-add { flex: 1 1 100%; order: -1; justify-content: center; height: 48px; padding: 0 16px; }
  .page-head .right .quick-add .qa-txt em { font-size: 11px; }
  .page-head .right .btn, .card-h .right .btn { flex: 1; justify-content: center; }
  .card-h { padding: 12px; flex-wrap: wrap; }
  .card-b { padding: 12px; }

  .grid.g3, .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .lab { font-size: 11.5px; }
  .kpi .val { font-size: 20px; }
  .kpi .foot { font-size: 11px; }

  /* 表格列多时横向滑动；宽表自然撑开，窄表仍铺满 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table { width: max-content; min-width: 100%; }
  .table-wrap th, .table-wrap td { white-space: nowrap; padding: 9px 10px; }
  .table-wrap th { font-size: 11.5px; }
  .table-wrap td { font-size: 12.5px; }
  .table-wrap .btn.sm { height: 32px; }
  .scroll-tip { display: block; font-size: 11px; color: var(--ink-3); padding: 0 2px 6px; }

  .mask { padding: 0; align-items: flex-end; overflow: hidden; }
  .modal, .modal.wide { width: 100%; max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0;
    display: flex; flex-direction: column; }
  .modal-h { padding: 14px 16px; flex: none; }
  .modal-b { max-height: none; min-height: 0; flex: 1; overflow-y: auto; padding: 14px 16px; }
  .modal-f { flex: none; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; justify-content: center; height: 44px; }

  /* iOS Safari 输入框字号 <16px 会自动放大整页，这里统一放大触控尺寸 */
  input:not([type]), input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
    font-size: 16px; height: 44px;
  }
  .modal-b input:not([type]) { height: 44px; }
  textarea { height: auto; min-height: 88px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  .pill { height: 32px; }
  .tabs { overflow-x: auto; }
  .tabs button { flex: none; }
  .row2, .row3, .split { grid-template-columns: 1fr; }
  .login-right { padding: 8vh 20px 24px; align-items: flex-start; }
  .login-card input { height: 46px; font-size: 16px; }
  .login-card .btn { height: 46px; }
  .toast-box { top: 10px; }
  .noti-pop { width: min(330px, calc(100vw - 24px)); }
  .kv { grid-template-columns: 76px 1fr; }
  .map-frame { height: calc(100vh - 210px); min-height: 360px; }
}

/* ===== 录入订单弹窗：客户信息 / 业务记录 / 样品发出 / 可选明细 ===== */
.of-sec { position: relative; margin-bottom: 14px; padding: 14px 16px 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.of-sec:last-child { margin-bottom: 0; }
.of-sec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.of-sec-h b { font-size: 14px; font-weight: 600; }
.of-n { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: none; border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; }
.of-sub { margin-left: auto; color: var(--ink-3); font-size: 11.5px; font-weight: 400; }
.of-sec .field { margin-bottom: 10px; }
.of-sec .hint { margin-top: 2px; margin-bottom: 6px; }
.of-dup { margin: -2px 0 10px; padding: 8px 10px; border-radius: 7px; background: #fff7e8; color: #9a6208; font-size: 12.5px; line-height: 1.5; }
.of-dup[hidden], #o-sample-body[hidden] { display: none !important; }
.of-static { height: 36px; line-height: 34px; padding: 0 10px; border: 1px dashed var(--line); border-radius: 7px; background: var(--bg); color: var(--ink-2); font-size: 13px; }
.of-switch { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 12.5px; color: var(--ink-2); }
.of-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.of-switch i { position: relative; width: 34px; height: 19px; border-radius: 10px; background: #cfd6e0; transition: background .15s; flex: none; }
.of-switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.of-switch input:checked + i { background: var(--green); }
.of-switch input:checked + i::after { transform: translateX(15px); }
.of-switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
.of-sec .ro, .of-sec select:disabled { background: var(--bg); color: var(--ink-2); opacity: 1; cursor: default; }
.of-items { padding-bottom: 12px; }
.of-items > summary { cursor: pointer; list-style: none; }
.of-items > summary::-webkit-details-marker { display: none; }
.of-items[open] .of-arrow { transform: rotate(180deg); }
.of-arrow { margin-left: 6px; color: var(--ink-3); font-size: 13px; transition: transform .15s; }
.of-items-body { padding-top: 2px; }
@media (max-width: 640px) {
  .of-sec { padding: 12px 12px 2px; margin-bottom: 10px; }
  .of-sec-h { margin-bottom: 10px; }
  .of-sub { font-size: 11px; }
  .of-static { height: 44px; line-height: 42px; font-size: 16px; }
  .of-switch span { font-size: 13px; }
  .of-switch i { width: 40px; height: 22px; }
  .of-switch i::after { width: 18px; height: 18px; }
  .of-switch input:checked + i::after { transform: translateX(18px); }
}

/* ---------- 登录品牌选择 & 侧栏品牌条（2026-11-19） ---------- */
.brand-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.brand-chips .bchip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid #d8dfe9;
  background: #fff; color: #4a5568; font-size: 13.5px; cursor: pointer;
  transition: all .15s; line-height: 1;
}
.brand-chips .bchip:hover { border-color: #2c68c2; color: #2c68c2; }
.brand-chips .bchip.on {
  background: #2c68c2; border-color: #2c68c2; color: #fff; font-weight: 600;
  box-shadow: 0 2px 8px rgba(44, 104, 194, .28);
}
.brand-bar { padding: 4px 14px 10px; }
.brand-bar .badge { font-size: 12px; padding: 4px 10px; }
.brand-bar select {
  width: 100%; padding: 6px 8px; border: 1px solid #d8dfe9; border-radius: 8px;
  font-size: 12.5px; color: #17457e; background: #fff;
}
.brand-bar select:focus { outline: none; border-color: #2c68c2; }
